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
|
|---|---|---|---|---|---|
Technical Articles
Regression Problem using Apple`s Machine Learning framework
Introduction
In this blog post, we will solve a regression problem using Apple`s machine learning framework called as Create ML. Like every field, machine learning also has various levels of abstraction. It basically depends on which level, one is required to work at. For seasoned iOS developers, Apple provides task based approaches to enable machine learning flavour in their apps. The task based level in my view is the highest of the abstraction levels. It means one does not to be an expert in machine learning to do routine machine learning tasks in an iOS app.
Apple provides two state of the art methodologies – Create ML and Turi Create. Using Transfer Learning approach, we can build an accurate custom model with a small dataset. The base models for both of these have been trained on humongous data. For Create ML, everything happens in Xcode by using Swift language. Turi Create uses Python and we have to make use of environments such as Jupyter notebook etc. to train the model and then convert to coreml format to use with in the app. Also to note that Create ML requires MacOS where as Turi Create is cross platform.
Create ML is basically a subset of Turi Create. For this tutorial, we will restrict ourselves only to Create ML. Everything will be done in Swift language.
Problem Statement
In this blog post, we want to find out the compressive strength of concrete which is one of the good indicators of the quality of the concrete. The measure of unit of compressive strength is Mega Pascal. On a side note, I would also like to mention that one should not get confused between cement and concrete. Cement is in the powder form and concrete is mixture of cement, coarse aggregates and water in a liquid like form. This can be a nice use case as we know that concrete is a vital material in civil engineering and also acts as one of the widely used construction material.
Pre-requisites
You will require a MacOS with Xcode installed in it.
Data Source
We will be making use of UC Irvine Machine Learning Repository – Concrete Compressive Strength Dataset of UCI
The dataset has 1030 rows and 9 columns. The last column “csMPa” is the target variable which we want to predict.
Dataset
Getting Started
First download the data which is in the form of csv from the above mentioned UCI repository and keep it in a folder.
Open the Xcode and then go to File -> New -> Playground
Create Playground file
Select Blank and MacOS and then click on Next
Select Blank and MacOS
Give the playground file some name
Give name to Playground file
Import these two frameworks
import CreateML import Foundation
Read the csv file you have already downloaded. Give the appropriate path.
Create ML has a special data structure called as MLDataTable that we use to represent tabular data. For ones who are familiar with Python`s Pandas can think of MLDataTable in the same way. However, MLDataTable is not that much flexible as Pandas.
let dataFile = URL(fileURLWithPath: "/YourPath/Dataset/Concrete_Data_Yeh 2.csv") let data = try MLDataTable(contentsOf: dataFile) print(data.size)
Run the code at this moment and it should show you the no of rows and columns in the dataset in console
(rows: 1030, columns: 9)
Split the data into train and test
let (trainData, testData) = data.randomSplit(by:0.8, seed: 0)
Lets train the model now. When we create MLRegressor, it inspects our data and automatically chooses a specific regressor. The supported regressors are linear, decision tree, boosted tree and random forest.
let model = try MLRegressor(trainingData: trainData,targetColumn: "csMPa")
Run the code so far and you should see the following output in console
Console output
You can observe that as the number of iterations increase, the root-mean-square error and max error decrease.
Also you can print out the metrics as follows :
print("Training Metrics\n", model.trainingMetrics) print("Validation Metrics\n", model.validationMetrics)
Now lets save the trained model to any local directory of your wish. Make sure you give the path as appropriate. you will see a model that got created in the folder path you gave above
Model saved to local directory
The complete code so far in the playground file should look as follows
import CreateML import Foundation let dataFile = URL(fileURLWithPath: "YourPath/Concrete_Data_Yeh 2.csv") let data = try MLDataTable(contentsOf: dataFile) print(data.size) let (trainData, testData) = data.randomSplit(by:0.8, seed: 0) let model = try MLRegressor(trainingData: trainData,targetColumn: "csMPa") print("Training Metrics\n", model.trainingMetrics) print("Validation Metrics\n", model.validationMetrics) lets create a Xcode project and add the above trained model in it.
Click on File -> New -> Project -> Single View App -> Next -> Give a name
Now add your trained ML model into your newly created Xcode project.
To do so click on File -> Add files
Add .mlmodel file
Make sure it matches to below screenshot while adding the model.
Copy .mlmodel
Now click on the .mlmodel file and then click on the icon shown.
.mlmodel
This will land you to the following page where you could see the auto generated Swift file to interact with our trained model
Auto generated Swift file for .mlmodel
Now go to your ViewController.swift and replace the existing code with the following code. CompressiveStrength is the name that I gave to my ml model. It will be different for you based on what name you give to it.
import UIKit import CoreML class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let mlModel = CompressiveStrength() let prediction = try?mlModel.prediction(cement: 540, slag: 0, flyash: 0, water: 162, superplasticizer: 2.5, coarseaggregate: 1040, fineaggregate: 676, age: 28) print("Compressive strength is: " + "\(String(describing: prediction!.csMPa))") } }
When you run the code, you will get the Compressive strength as follows
Compressive strength is: 67.05448651313782
Conclusion
If we compare it with the ground truth, we will observe that we are quite close. We trained the model on a very limited data which can be one crucial scope of improvement. The common saying in the machine learning world is more the quality training data you have, more better the output prediction you will get.
The big advantage here is that the trained model resides within your app and there is no Internet dependency required to do the inference. You can go ahead and build an UI around this.
Very useful blog for developers who want to explore different possibilities with core ml.
Thanks Jay!
|
https://blogs.sap.com/2020/10/13/regression-problem-using-apples-machine-learning-framework/
|
CC-MAIN-2021-49
|
refinedweb
| 1,106
| 64.41
|
Details
- Type:
Sub-task
- Status:
Open
- Priority:
Major
- Resolution: Unresolved
- Affects Version/s: 1.1-beta-1
- Fix Version/s: None
- Component/s: class generator
- Labels:None
- Environment:Windows XP - Java 1.6.0 - Groovy 1.1-beta-1
- Number of attachments :
Description
class Test {
private text
private def getText()
private void setText( text ){ this.text = text * 10 }
}
using the previous class with the following script
x = new Test()
x.text = "z"
println x.text
give the result: "ZZZZZZZZZZ"
Issue Links
- relates to
GROOVY-1063 No access protection for private static fields
GROOVY-1591 Private Fields Are Accessible From Other Classes
Activity
It should be noted it is just the private methods and not private fields that are exposed.)
This is even more insidious and serious than I thought..
But the 'value' field of java.lang.String is final.
And the above code changes the content of a final field, ain't it?
Java has the same problems with private members and inner classes, but the difference is that Java resolves the name at compile time, while inside the closure we resolve the name at runtime. Because of this Java can provide an access method that will be used by the inner class only. We can provide such a method too, but only for the closure? Only in what cases? The case is just not as trivial as it seems. Jim... I just don't get why changing private to package access will solve anything. I told you that on the mailing list already.
Victor... true the field is final and it should not have been changed. But that is a different issue. Don't mix multiple cases in the same issue, that leads to confusion and makes the tracking problematic. Not respecting final here is a bug
Jochen, you are right. Sorry. Just tried to find an existing bug now, but didn't succeed. I therefore created
GROOVY-2774.
Perhaps GROOVY-1628 or
GROOVY-1475 are caused by the same root cause. But I am not sure. And I think it is quite critical, that an immutable class' contract is violated).
Jim... why don't you explain what we get from compiling "private" as "package private"? As it is atm, the class is at last correct from a Java view.:
def s = "12" def chars = s.value s.value = "ABCD" assert !chars.is(s.value) assert s == "AB" s.count=3 assert s == "ABC" s.offset = 1 assert s == "BCD" def s2 = "0123" s = s2.substring(0,2) assert s.value.is(s2.value) s2.value = "ABCD" assert s2 == "ABCD" assert s == "01".
It is interesting to look at Jira stats. Top (9 votes) and equal 2nd (8 votes) issues:
9 Bug GROOVY-1875 private fields and private methods are not private 8 Improvement GROOVY-1591 Private Fields Are Accessible From Other Classes 8 Bug GROOVY-1063 No access protection for private static fields
Jim.... you quoted my question, yet you don't answer it. Why is this? And I don't see your easy fix. Ok, let us assume we make private fields in Groovy classes package private, then why does this not violate the Java class model? You can still access the fields, nothing has changed. What could be done then is to avoid access to private fields in general, which would solve the access problem for String for example..
The Java-Groovy Privacy Manifesto.
Then let me say a few things to some of the points...;} } }
javac will produce bytecode looking like:
- it is a breaking change for closures (a property access becomes a method call outside the MOP)
- package private fields are visible in subclasses in the same package, and will possibly produce name conflicts with already existing fields in both Java and Groovy classes
- package private for fields is an not intended relaxation of the visibility
- a correct and 1-time breaking change is preferred over a temporary solution that will break things as well
- testing private members from Groovy is handy
I realize there are many places to apply a solution, some with more ramifications than others. Coming from a user of Groovy's point of view (not knowing the internals), it seems one place of exposure of this information that should be hidden with little or no detrimental ramifications is what is exposed via foo.properties. Even if the methods / data is still actually accessible, it is better than the current state which is complete exposure. So I am proposing a first step, a baby step (but not the last step) towards eventual resolution to this issue. Perhaps there are other baby steps beyond this have ramifications either. I understand that in the short term we don't want to break things.
As far as I understand the code, to really solve this issue, you would have to differentiate between property access from "inside a class" (and a closure is inside the class where it is defined) and access from outside a class. Interestingly the getProperty-method in MetaClassImpl has a parameter "fromInsideClass" that is never used and in the comments for this parameter there is only a "??"..
true, there is a "fromInside" on MetaClass. I added that a long while ago. But later I did see that this does not solve the issue at all. In a class if you have "this.foo", then it is compiled as direct field access if the field exists. If you do only "foo", then due to the implicit "this", it is compiled in the same way as "this.foo". That means that in current Groovy (1.0, 1.5.x, 1.6) the MetaClass method won't be used for this and a direct field access, like Java would do that is done instead. We can do this for classes, because classes have a clear context when it comes to the meaning of the implicit "this". Much later than adding this parameter we decided on two things, first the direct access to the field in classes and second the mutable name resolving for closures. That all opens a bug question for when then implicit this means "this" as in a class or the delegate.. not to forget that there is the problem that a closure should ask the owner for the field, not the class directly in the nested case. And now it comes down to the MOP. If we don't do a direct field access, then we need to go through the MOP. And that unfortunately means to do a property based access, because the current MOP does not have a special case for fields only. We also have the convention, that "this.foo" becomes a property access if there is no field foo. As a conclusion every field/property access becomes a MOP based property access inside a closure, because we don't know the real meaning of the "implicit this" until runtime.
Fix Version/s: None?
it is now a subtask of GROOVY-3010, which is scheduled for 2.0. GROOVY-3010 is a task and has several sub tasks, to collect the issues which are more or less the same.
It seems that groovy++ has resolved the issue. Maybe Alex Tkachman can give a hand to port the code.
A serious ramification of this is that "text" is considered a javaBean property and so it can be found in x.properties
. I'm using grails and partially because of this problem I've found that grails will end up calling my private getters because it thinks it's a javabean property when I really don't think it should.
|
http://jira.codehaus.org/browse/GROOVY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
|
CC-MAIN-2013-20
|
refinedweb
| 1,270
| 73.07
|
I am working through my first Ruby on Rails App!
I have followed along with ruby's getting started tutorial and created a blog.
I am trying to implement a way to track when articles are viewed so I created a second table/model/controller that I'd like to insert the current date every time an article is viewed (show).
I'm not really sure how to implement this though... my initial though was in the article controller under the show def I would do something like
@view = View.new(view_params)
@view.Save!
You didn't mention what columns you had in your new model, but I'm assuming it's just the default timestamps and a field for the article ID.
So, within the 'show' action for the articles, you could do something like this. Your action names and such may differ, but the principle is the same.
def show @article = Article.find(params[:id]) View.create(article_id:@article.id) end
I can't think of any reason why you'd need to store the view itself in an instance variable, or any variable for that matter.
|
https://codedump.io/share/0MnXEezB7rk3/1/track-dates-of-viewed-article
|
CC-MAIN-2017-39
|
refinedweb
| 189
| 71.24
|
Hi,
I have requirement to write a jython script to connect multiple weblogic servers and generate some reports.
I am importing wlstModule(import wlstModule as wl) in the scirpts.
I would need multiple users to be able to run the script from a webpage in parallel.The website is based on java.
1. My initial thoughts were to create a new thread for each user request. But since the global variable cmo is shared between the jython threads,i believe it wouldn't work.
2. My second option is to create a new process for each user.This way each process would have its own independent global namespace.
Even though this should work,it dosen't look the cleanest way to do.
Does someone have any better idea?
|
https://community.oracle.com/message/11278509
|
CC-MAIN-2017-47
|
refinedweb
| 128
| 76.11
|
In the past I've separated my MVC solutions into separate projects. Domain, WebUI, Persistence, etc.
Is there any reason for that if I'm just writing for myself and I'm the only programmer?
Why not just contain everything in one project using the standard MVC folder layout?
Well, it comes down to preference. If you sure you do not need it, you do not have to do it. But I tend keep it in layers. So that in the future, if for some reason, I decide to to a mobile version of my site for example, I can just include my persistance and domain project references and would not have to copy paste all the code.
Only hard and fast rule is separating the core logic / peristance stuff from the UI layer. You never know when you need to make a command line interface to your web project's data.
It is a good point. I'm making a mobile web app and I suppose I can eventually make a native app in the future. I probably never will but at least the option is there.
I find that separating the concerns into projects of their own an aide to my own thinking processes. It helps me conceptualize and visualize a layers actual responsibilities. In your case, there is a third option. Simply branch the Models namespace into Models/Domain, Models/Persistence, and Models/Presentation. Later, if you decide to pull these out into their own projects, name them MyProject.Models.Domain, MyProject.Models.Persistence and MyProject.Models.Presentation and they'll continue to work with their given namespaces, as long as you add cross project references.
=)
Sometimes people only see the black and white solutions, overlooking the grey, when grey is the color being sought.
Sounds good!
Gray is the new blackandwhite.
If you are 100% sure that it will remain your internal project, and it will remain small, and there are not expected many changes in future, then it will be faster to develop all this in one project. But if you are not sure, then dividing into layers will take you some more time now, but save very much time in future, when you want to make some significant changes.
By the way, you can divide your application into layers within one project too - just have different classes for Domain, UI, DataAccess etc, and put them to different folders so that to differ them easier.
One thing I'd like to point out as a feather in the hat for separation is the ease of maintenance and deployability. It is far easier to deploy a smaller, single file named FooBarApp.Persistence.Impl.dll and have the user drop it in their bin folder than it is to redeploy an entire solution.
|
https://www.sitepoint.com/community/t/separating-projects/8870
|
CC-MAIN-2016-30
|
refinedweb
| 466
| 63.7
|
You can find here also some precompiled version, you can use them, when you want.
This tutorial uses the LUA 5.1 version.
The next step is setting up an external CS project within your enviroment. Don't forget to set up your project as a dynamic link library, and the neccessary CS and LUA libs and include director, . The concrete steps depending from your IDE and operating system. ( This is a so called "professional" tutorial. Professional tutorials are not just for C++ masters , but I assume, you can set up this project without any external help.)
Crystal Space uses the iScript interface to communicate with scripting languages, so we have to implement this interface to integrate LUA. So we include some CS headers:
#include <ivaria/script.h>
#include <iutil/eventh.h>
#include <iutil/comp.h>
#include <csutil/csinput.h>
#include <iutil/string.h>
Then we introduce a new namespace to avoid name conflicts, in Crystal Space way:
CS_PLUGIN_NAMESPACE_BEGIN(cslua) {
This macro creates for us a new cslua namespace.
Now we can to start
Please report site bugs at the Bugtracker
|
http://www.crystalspace3d.org/mediawiki/index.php?title=Luaplugin_tutorial&diff=2426&oldid=2425
|
CC-MAIN-2015-11
|
refinedweb
| 181
| 60.11
|
Sorry to not responding to the name discussion earlier. But it's christmas, so there're a lot of family issues. To the name in general: I don't really care about the name. I started using debsigs-ng, but Overfiend (maintainer of debsigs) asked me to change the name because dpkg-sig is not a fork off debsigs. After that, there was a discussion on IRC which brought dpkg-{sig,sign,experimental-sign}, dpst or `makepasswd` as result. After that discussion, I re-titled my ITP to dpkg-sig (and Cc'ed d-d on this), and all I got were two supporting answers, so I decided that there is no problem with uploading. The package sits now on ftp-master in the NEW-queue. * Martin Michlmayr (tbm@cyrius.com) [031228 14:55]: > * Javier Fernández-Sanguino Peña <jfs@computer.org> [2003-12-28 14:14]: > > 'apt-cache search --names-only "^apt-" |grep -v howto'. We don't > > have any policy on name space collision AFAIK, do we? > Not having a policy doesn't mean that everything is allowed. And the > dpkg maintainers have made it clear in the past that the dpkg > namespace is theirs. Definitly. However, I remember a IRC-session where doogie was also there (but I don't log IRC normally, so I can't re-read that session) and where there was talk about the name, and I got no "No", "please not" or similar. I remember also a discussion with doogie about "make it in an extra package or as part of dpkg (source package)?" where I got something like: Show usable code in an extra package, and if it works (and is actually used), it's possible to move that to dpkg later on. So, for me the situation is this: - If the dpkg-maintainers ask me to change name I'll of course do this. - I'll try to move the code to src:dpkg if dpkg-sig is really used (which I assume and hope); otherwise, we won't need an unused package in the archive. I hope this is ok. Cheers, Andi -- PGP 1024/89FB5CE5 DC F1 85 6D A6 45 9C 0F 3B BE F1 D0 C5 D1 D9 0C
|
https://lists.debian.org/debian-devel/2003/12/msg02090.html
|
CC-MAIN-2015-40
|
refinedweb
| 371
| 71.55
|
Setup Tasks
Before you can use the SAP components in a production, you must perform several setup activities. This chapter discusses them:
Setting up the Java Gateway
Installing the SAP JCo Files
Generating proxy classes for SAP JCo
Testing the SAP connection
To access SAP, it is necessary to provide a username and password. This means that you must also create production credentials that contain an SAP username and password. For information on creating credentials, see Configuring Productions.
Setting Up the Java Gateway
For information on setting up the Java Gateway, see “Prerequisites” in Using the Java Gateway in Productions.
Installing the SAP JCo Jar File
Obtain, from SAP, the SAP Java Connector 3.x, as appropriate for your operating system. Generally, this is provided as a compressed file. Uncompress it and place the contents in a convenient location. The directory should contain the following items:
examples subdirectory
javadoc subdirectory
Readme.txt file
sapjco3.dll file
sapjco3.jar file
sapjcomanifest.mf file
Generating Proxy Classes for SAP JCo
To communicate with SAP JCo, your interoperability-enabled namespace must contain proxy classes that represent SAP JCo. To generate these classes, do the following:
Start the Java Gateway.
The easiest way to do this is as follows:
Create a simple production that contains only one business host: EnsLib.JavaGateway.Service.
Configure the settings for this business host so that it can find the Java Gateway. For information, see “Using the Java Gateway in a Production” in Using the Java Gateway in Productions.
Start the production, which starts the Java Gateway.
For other ways to start the Java Gateway, see Using the Java Gateway in Productions.
In the Terminal, change to your interoperability-enabled namespace and use the ImportSAP() method of EnsLib.SAP.BootStrap, as follows:
do ##class(EnsLib.SAP.BootStrap).ImportSAP(pFullPathToSAPJarFile,pPort,pAddress)Copy code to clipboard
Where:
pFullPathToSAPJarFile is the full path to the SAP Jar file.
pPort is the port used by the Java Gateway.
pAddress is the IP address used by the Java Gateway.
Testing the SAP Connection
To test the SAP connection, do the following in the Terminal (or in code):
Create an instance of EnsLib.SAP.Utils.
Set the following properties of that instance. These are string properties unless otherwise noted.
SAPClient — SAP Client e.g 000.
SAPUser — Username that has access to the SAP server.
SAPPassword — Password for the user.
SAPLanguage
SAPHost— Host name or IP address of the SAP server.
SAPSystemNumber — SAP SystemNumber e.g 00.
JavaGatewayAddress — IP address or name of the machine where the JVM to be used by the Java Gateway server is located.
JavaGatewayPort — Port used by the Java Gateway.
SAPTransactionAutoCommit — Specifies whether to execute the BAPI "BAPI_TRANSACTION_COMMIT" after a successful BAPI/RFC-call. This property is %Boolean.
Call the PingSAP() method of your instance. This method connects to SAP and performs a dynamic invocation of the STFC_CONNECTION function. It returns a %Status.
|
https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.UI.Page.cls?KEY=ESAP_SETUP
|
CC-MAIN-2021-10
|
refinedweb
| 483
| 51.34
|
ARDBCRollbackTransaction
Description
This function rolls back the changes of one or more previous ARDBC calls to the external data source. The plug-in server calls this function when one or more actions that read or modify the external data source result in a failed operation or an error. After the plug-in server issues this function, the BMC Remedy AR System server begins the next transaction.
Important
If you do not define this function and the plug-in server receives a roll back transaction request, the BMC Remedy AR System server does not process the request and does not return an error.
Synopsis
#include "ardbc.h" int ARDBCRollbackTrans.
|
https://docs.bmc.com/docs/ars91/en/ardbcrollbacktransaction-609071561.html
|
CC-MAIN-2020-45
|
refinedweb
| 108
| 53.92
|
15.7. Analyzing a nonlinear differential system — Lotka-Volterra (predator-prey) equations
Here, we will conduct a brief analytical study of a famous nonlinear differential system: the Lotka-Volterra equations, also known as predator-prey equations. These equations are first-order differential equations that describe the evolution of two interacting populations (for example, sharks and sardines), where the predators eat the prey. This example illustrates how to obtain exact expressions and results about fixed points and their stability with SymPy.
Getting ready
For this recipe, knowing the basics of linear and nonlinear systems of differential equations is recommended.
How to do it...
1. Let's create some symbols:
from sympy import * init_printing(pretty_print=True) var('x y') var('a b c d', positive=True)
2. The variables \(x\) and \(y\) represent the populations of the prey and predators, respectively. The parameters \(a\), \(b\), \(c\), and \(d\) are strictly positive parameters (described more precisely in the How it works... section of this recipe). The equations are:
f = x * (a - b * y) g = -y * (c - d * x)
3. Let's find the fixed points of the system (solving \(f(x,y) = g(x,y) = 0\)). We call them \((x_0, y_0)\) and \((x_1, y_1)\):
solve([f, g], (x, y))
(x0, y0), (x1, y1) = _
4. Let's write the 2D vector with the two equations:
M = Matrix((f, g)) M
5. Now, we can compute the Jacobian of the system, as a function of \((x, y)\):
J = M.jacobian((x, y)) J
6. Let's study the stability of the first fixed point by looking at the eigenvalues of the Jacobian at this point. The first fixed point corresponds to extinct populations:
M0 = J.subs(x, x0).subs(y, y0) M0
M0.eigenvals()
The parameters \(a\) and \(c\) are strictly positive, so the eigenvalues are real and of opposite signs, and this fixed point is a saddle point. As this point is unstable, the extinction of both populations is unlikely in this model.
7. Let's consider the second fixed point now:
M1 = J.subs(x, x1).subs(y, y1) M1
M1.eigenvals()
The eigenvalues are purely imaginary: thus, this fixed point is not hyperbolic. Therefore, we cannot draw conclusions from this linear analysis about the qualitative behavior of the system around this fixed point. However, we could show with other methods that oscillations occur around this point.
How it works...
The Lotka-Volterra equations model the growth of the predator and prey populations, taking into account their interactions. In the first equation, the \(ax\) term represents the exponential growth of the prey, and \(-bxy\) represents death by predators. Similarly, in the second equation, \(-yc\) represents the natural death of the predators, and \(dxy\) represents their growth as they eat more and more prey.
To find the equilibrium points of the system, we need to find the values \(x\), \(y\) such that \(dx/dt = dy/dt = 0\), that is, \(f(x, y) = g(x, y) = 0\), so that the variables do not evolve anymore. Here, we were able to obtain analytical values for these equilibrium points with the
solve() function.
To analyze their stability, we need to perform a linear analysis of the nonlinear equations, by taking the Jacobian matrix at these equilibrium points. This matrix represents the linearized system, and its eigenvalues tell us about the stability of the system near the equilibrium point. The Hartman–Grobman theorem states that the behavior of the original system qualitatively matches the behavior of the linearized system around an equilibrium point if this point is hyperbolic (meaning that no eigenvalues of the matrix have a real part equal to 0). Here, the first equilibrium point is hyperbolic as \(a, c > 0\), but the second is not.
Here, we were able to compute symbolic expressions for the Jacobian matrix and its eigenvalues at the equilibrium points.
There's more...
Even when a differential system is not solvable analytically (as is the case here), a mathematical analysis can still give us qualitative information about the behavior of the system's solutions. A purely numerical analysis is not always relevant when we are interested in qualitative results, as numerical errors and approximations can lead to wrong conclusions about the system's behavior.
Here are a few references:
- Matrix documentation in SymPy, available at
- Dynamical systems on Wikipedia, at
- Equilibrium points on Scholarpedia, at
- Bifurcation theory on Wikipedia, at
- Chaos theory on Wikipedia, at
- Further reading on dynamical systems, at
- Lectures on ordinary differential equations on Awesome Math, at
|
https://ipython-books.github.io/157-analyzing-a-nonlinear-differential-system-lotka-volterra-predator-prey-equations/
|
CC-MAIN-2019-09
|
refinedweb
| 750
| 53.1
|
So, I'm learning Java after learning the basics of Python, and im stucked at Constructors. Here's a small program that im doing to understand it.
package random;
import java.util.Scanner;
public class program {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
Cube x = new Cube();
Cube y = new Cube(20,20,20);
System.out.println(x.cubeVolume());
System.out.println(y.cubeVolume());
}
}
And then the Cube Class
package random;
public class Cube {
int lenght,widht,height;
public int cubeVolume()
{
return (lenght*widht*height);
}
Cube()
{
lenght = 10;
widht = 20;
height = 30;
}
Cube(int l, int w, int h){
lenght = l;
widht = w;
height = h;
}
}
But my problem is to undestand why does my y Cube gets the 20,20,20 and does not change to 10,20,30... Why does it chooses Cube(int l, int w, int h) and not the Cube()? What makes the x Cube go to Cube() and y Cube to Cube(int l, int w, int h)?
basically constructor initializes the global variables of the object.
construct() ---> non-parametrized constructor construct(parameter) ---> parametrized constructor
example of parametrized constructor:
cube(int l,int w,int h) { length=l; width=w; height=h; }
here u had defined two constructors with same class name, which is called constructor overloading(multiple constructors with different parameters)
1st one:
cube() { lenght = 10; widht = 20; height = 30; }
2nd one:
cube(int l, int w, int h) { lenght = l; widht = w; height = h; }
So here u had defined two constructors to initializes the global variables of object. Now, as hope you know that only one constructor works at a time to initialize the object and you have to call that constructor during object creation.
here you had created two objects:
1st object: Cube x = new Cube(no argument passed); //no argument passed
In above line constructor cube had been called which initializes the global variable length, widht, height with values 10,20,30. Now, here we did not pass any argument to the constructor so constructor with no parameter had called, which is cube()
2nd object: Cube y = new Cube(20,20,20);
here constructor cube(int l,int w,int h) had been called because here we had defined three parameter -->int l, int w,int h and while calling the constructor we passed three argument -->20,20,20 so parameter matched with argument and the parametrized constructor had called.
so here two object exists, object x has values length=10,widht=20,heigth=30. And other object y with values length=20,width=20,heigth=20;
It will look for the constructor that matches the constructor you are calling.
x cube is constructed with zero arguments, and so the no-arg constructor will be selected.
y cube is constructed with three arguments, and so the three-arg constructor will be selected.
It would help to show the output from your program, which helps in debugging.
width, length and length are spelled using : 'th', not 'ht'. This will not affect how your program compiles or runs, but will help others read your code.
In direct answer to your question, you have two overloaded constructors:
Cube(); Cube(int length, int width, int height);
The constructor will be picked by the compiler based on the arguments that you supply. Only one constructor is used (and if you do not supply a constructor, a default Cube() {} is created by the compiler, along with a default super() constructor, and so on).
|
http://m.dlxedu.com/m/askdetail/3/bce01320c51840b270957e02f26fb08d.html
|
CC-MAIN-2018-30
|
refinedweb
| 581
| 56.08
|
Once the file has been opened for reading using fopen( ), as we have seen, the file’s contents are brought into buffer (partly or wholly) and a pointer is set up that points to the first character in the buffer. This pointer is one of the elements of the structure to which fp is pointing.
To read the file’s contents from memory there exists a function called fgetc( ). This has been used in our program as,
ch = fgetc ( fp ) ;
fgetc( ) reads the character from the current pointer position, advances the pointer position so that it now points to the next character, and returns the character that is read, which we collected in the variable ch. Note that once the file has been opened, we no longer refer to the file by its name, but through the file pointer fp.
We have used the function fgetc( ) within an indefinite while loop. There has to be a way to break out of this while. When shall we break out… the moment we reach the end of file. But what is end of file? A special character, whose ASCII value is 26, signifies end of file. This character is inserted beyond the last character in the file, when it is created.
While reading from the file, when fgetc( ) encounters this special character, instead of returning the character that it has read, it returns the macro EOF. The EOF macro has been defined in the file “stdio.h”. In place of the function fgetc( ) we could have as well used the macro getc( ) with the same effect.
In our program we go on reading each character from the file till end of file is not met. As each character is read we display it on the screen. Once out of the loop, we close the file.
Example
#include <stdio.h> #include <stdlib.h> // for exit() function int main() { FILE *fs; char ch; fs = fopen("file1.txt", "r"); if (fs == NULL) { puts("Cannot open source file"); exit(1); } while (1) { ch = fgetc(fs); if (ch == EOF) break; else printf("%c",ch); } getchar(); return 0; }
|
https://www.loopandbreak.com/reading-files-in-c/
|
CC-MAIN-2021-25
|
refinedweb
| 350
| 80.51
|
GETSID(3P) POSIX Programmer's Manual GETSID(3P)
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
getsid — get the process group ID of a session leader
#include <unistd.h> pid_t getsid(pid_t pid);. The following sections are informative.
None.
None.
None.
None.
exec(1p), fork(3p), getpid(3p), getpgid(3p), setpgid(3p), sets GETSID(3P)
Pages that refer to this page: unistd.h(0p), getpgid(3p), setpgrp(3p), setsid(3p)
|
https://www.man7.org/linux/man-pages/man3/getsid.3p.html
|
CC-MAIN-2022-27
|
refinedweb
| 101
| 50.84
|
How do I convert a NumPy array to a Python List (for example
[[1,2,3],[4,5,6]] ), and do it reasonably fast?
import numpy as np >>> np.array([[1,2,3],[4,5,6]]).tolist() [[1, 2, 3], [4, 5, 6]]
Note that this converts the values from whatever numpy type they may have (e.g. np.int32 or np.float32) to the "nearest compatible Python type" (in a list). If you want to preserve the numpy data types, you could call list() on your array instead, and you'll end up with a list of numpy scalars. (Thanks to Mr_and_Mrs_D for pointing that out in a comment.)
The numpy .tolist method produces nested arrays if the numpy array shape is 2D.
if flat lists are desired, the method below works.
import numpy as np from itertools import chain a = [1,2,3,4,5,6,7,8,9] print type(a), len(a), a npa = np.asarray(a) print type(npa), npa.shape, "\n", npa npa = npa.reshape((3, 3)) print type(npa), npa.shape, "\n", npa a = list(chain.from_iterable(npa)) print type(a), len(a), a`
|
https://pythonpedia.com/en/knowledge-base/1966207/converting-numpy-array-into-python-list-structure-
|
CC-MAIN-2020-29
|
refinedweb
| 191
| 86.6
|
Opened 6 years ago
Closed 6 years ago
#14197 closed (invalid)
.update() doesn't work on model_to_dict(model_instance)
Description
The following doesn't work:
from django.forms import model_to_dict dict = model_to_dict(model_instance).update({'a':1})
whereas this does:
from django.forms import model_to_dict dict = model_to_dict(model_instance) dict.update({'a':1})
Change History (1)
comment:1 Changed 6 years ago by lukeplant
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to invalid
- Status changed from new to closed
Note: See TracTickets for help on using tickets.
"doesn't work" isn't helpful, since we don't know what you expect to happen. I expect the first one to do something different from the second, i.e. the first will end up with dict == None, since the update method of dict instances returns None. And that is what happens. This is Python behaviour, and nothing to do with the Django function model_to_dict.
|
https://code.djangoproject.com/ticket/14197
|
CC-MAIN-2016-30
|
refinedweb
| 154
| 58.89
|
:confused: I really don't know where to began with this assignment. I have to calculae the average of a series of test scores where the lowest score in the series is dropped.
1. GetVaules should ask for fiv test scores and store them in variables.
2. Findlowest should determine which of the five scores is the lowest, and return that vaule.
3. CalcAverage should calculate and display the average of the four highest scores. Not accepting scores greaten that 100 or less than 0. In put Five test scores.
I did 2 out of 3, I don't know how to calcavg. Hopefully I did the first 2 right. PLEASE HELP. Here is my code::
P.s. Remeber I am a BEGINNER!!!
#include <iostream.h>
void main ()
{
"function protype";
void Getvalues (double scores);
int findlowest();
int calcaverage();
}
void Getvalues()
{
int score 1, score 2, score 3, score 4, score 5;
cout<<"Please enter five test scores."<<end1;
cin>>score 1>> score 2>> score 3>> score 4>> score 5;
}
int findlowest ()
{
if (score 1, score 2, score 3, score 4, score 5 > = 100)
lowestscore = < 0;
|
https://cboard.cprogramming.com/cplusplus-programming/17081-i-am-lost-please-help-printable-thread.html
|
CC-MAIN-2017-04
|
refinedweb
| 185
| 82.95
|
The QTabletEvent class contains parameters that describe a Tablet event. More...
#include <qevent.h>
Inherits QEvent.
List of all member functions.
Tablet Events are generated from a Wacom© tablet. Most of the time you will want to deal with events from the tablet as if they were events from a mouse, for example retrieving the position with x(), y(), pos(), globalX(), globalY() and globalPos(). In some situations you may wish to retrieve the extra information provided by the tablet device driver, for example, you might want to adjust color brightness based on pressure. QTabletEvent allows you to get the pressure(), the xTilt() and yTilt(), as well as the type of device being used with device() (see TabletDevice).
A tablet event contains a special accept flag that indicates whether the receiver wants the event. You should call QTabletEvent::accept() if you handle the tablet event; otherwise it will be sent to the parent widget.
The QWidget::setEnabled() function can be used to enable or disable mouse and keyboard events for a widget.
The event handler QWidget::tabletEvent() receives all three types of tablet events. Qt will first send a tabletEvent and then, if it is not accepted, it will send a mouse event. This allows applications that don't utilize tablets to use a tablet like a mouse while also enabling those who want to use both tablets and mouses differently.
See also Event Classes.
This enum defines what type of device is generating the event.
On Irix, globalPos will contain the high-resolution coordinates received from the tablet device driver, instead of from the windowing system.
See also pos(), globalPos(), device(), pressure(), xTilt(), and yTilt().
Constructs a tablet event object. The position when the event occurred is is given in pos and globalPos. device contains the device type, pressure contains the pressure exerted on the device, xTilt and yTilt contain the device's degrees of tilt from the X and Y axis respectively. The uId contains an event id.
On Irix, globalPos will contain the high-resolution coordinates received from the tablet device driver, instead of from the windowing system.
See also pos(), globalPos(), device(), pressure(), xTilt(), and yTilt().
Sets the accept flag of the tablet event object.
Setting the accept flag indicates that the receiver of the event wants the tablet event. Unwanted tablet events are sent to the parent widget.
The accept flag is set by default.
See also ignore().
Returns the type of device that generated the event. Useful if you want one end of the pen to do something different than the other.
See also TabletDevice.().
Returns the global x-position of the mouse pointer at the time of the event.
See also globalY() and globalPos().
Returns the global y-position of the mouse pointer at the time of the event.
See also globalX() and globalPos().
Clears the accept flag parameter of the tablet event object.
Clearing the accept flag indicates that the event receiver does not want the tablet event. Unwanted tablet events are sent to the parent widget.
The accept flag is set by default.
See also accept().
Returns TRUE if the receiver of the event handles the tablet event; otherwise returns FALSE.
Returns the position of the device, relative to the widget that received the event.
If you move widgets around in response to mouse events, use globalPos() instead of this function.
See also x(), y(), and globalPos().
Returns the pressure that is exerted on the device. This number is a value from 0 (no pressure) to 255 (maximum pressure). The pressure is always scaled to be within this range no matter how many pressure levels the underlying hardware supports.
Returns a unique ID for the current device. It is possible to generate a unique ID for any Wacom© device. This makes it possible to differentiate between multiple devices being used at the same time on the tablet. The first member contains a value for the type, the second member contains a physical ID obtained from the device. Each combination of these values is unique. Note: for different platforms, the first value is different due to different driver implementations.
Returns the x-position of the device, relative to the widget that received the event.
See also y() and pos().
Returns the difference from the perpendicular in the X Axis. Positive values are towards the tablet's physical right. The angle is in the range -60 to +60 degrees.
See also yTilt().
Returns the y-position of the device, relative to the widget that received the event.
See also x() and pos().
Returns the difference from the perpendicular in the Y Axis. Positive values are towards the bottom of the tablet. The angle is within the range -60 to +60 degrees.
See also xTilt().
This file is part of the Qt toolkit. Copyright © 1995-2005 Trolltech. All Rights Reserved.
|
https://doc.qt.io/archives/3.3/qtabletevent.html
|
CC-MAIN-2019-26
|
refinedweb
| 805
| 68.16
|
Hi all,
Quilt 0.43 has been released ten days ago (sorry for being slow). A
number of improvements may be of interest to kernel developers so I am
announcing it here on LKML.
Quilt 0.43 can be downloaded from here:
Bug fixes:
Deleting the top patch works again,
patch delimiter ("---") is no more eaten on refresh.
Compatibility:
Huge efforts have been put into improving compatibility with many
platforms. The git specific patch format extensions are better
supported too.
New features:
The mail command has been completely reworked,
delete -r physically removes the deleted patch,
delete --backup makes a backup copy of the deleted patch,
annotate -P annotates a previous version of the file,
import can preserve or merge comments when updating a patch,
push detects reversed patches,
diffstat options can be specified,
patch delimiter ("---") is automatically inserted before diffstat.
|
http://lkml.iu.edu/hypermail/linux/kernel/0602.1/1998.html
|
CC-MAIN-2021-43
|
refinedweb
| 141
| 51.28
|
Ste(); } } } }
16 thoughts on “Macro to quickly fix the To/From Room parameter for doors”
[…] experience might at least improve the situation for him. I wrote to Harry and a day or so later we’ve got this to consider. […]
[…] experience might at least improve the situation for him. I wrote to Harry and a day or so later we’ve got this to consider. […]
Great idea for a tool! We started a project in our firm to determine what add-ins (Revit, Autocad, Rhino/GH, ect) we could develop that would help with user productivity. This idea did not come up yet but I see it’s value.
Thanks,
Dan
[…]… […]
Hi Harry, I tried to copy/paste this code and I got this error when I “Build” the macro, any idea what is happening?
Error 1 The best overloaded method match for ‘Autodesk.Revit.DB.Document.GetElement(Autodesk.Revit.DB.Reference)’ has some invalid arguments C:\ProgramData\Autodesk\Revit\Macros\2012\Architecture\VstaMacros\AppHookup\TagDoorToRM\Source\TagDoorToRM\ThisApplication.cs 56 32 TagDoorToRM
Error 2 Argument ‘1’: cannot convert from ‘Autodesk.Revit.DB.ElementId’ to ‘Autodesk.Revit.DB.Reference’ C:\ProgramData\Autodesk\Revit\Macros\2012\Architecture\VstaMacros\AppHookup\TagDoorToRM\Source\TagDoorToRM\ThisApplication.cs 56 47 TagDoorToRM
Hi Jeff,
Are you working in Revit 2012? If so, this post might help.
Ah ok thanks Harry, I think I missed your 03/06 posting. Thanks again!!!
Hi’ Harry,
When I try to build your solution, I get these errors:
‘RoomTag’ does not contain a definition for ‘Room’ and no extension method ‘Room’ accepting a first argument of type ‘RoomTag’ could be found (are you missing a using directive or an assembly reference?)
‘RoomTag’ is inaccessible due to its protection level
The as operator must be used with a reference type or nullable type (‘RoomTag’ is a non-nullable value type)
The type or namespace name ‘Room’ could not be found (are you missing a using directive or an assembly reference?)
I’ve put using Autodesk.Revit.UI.Selection; in my code as you explained in earlier post – but still no luck.
I’ve tried to change the Target Framework as someone metioned on stackoverflow.com – but still no luck.
I’m in Revit 2013.
Any help would be much appreciated.
Thanks!
/Martin
Hi Martin,
The RoomTag class is in the Autodesk.Revit.DB.Architecture namespace. In general, I’d suggest adding all the “using” statements mentioned in this post, though for this specific issue you just need “using Autodesk.Revit.DB.Architecture;”
Harry
Hi’ Harry,
Thanks for your quick reply.
It worked!
Thanks.
/Martin
Hi Harry,
Is there a way to make Revit recognize rooms through a link? What i mean is that when I have all of the rooms in one revit model the from/to parameter works just fine. However, when I try to extract information from doors that are in linked models (no rooms are located in linked models) I am getting nothing. Is it possible to make doors recognize their relationships to rooms in linked models?
Konrad
Which elements are in which file? Are the doors in the link & rooms in the host file? Or vice versa?
Host file contains rooms. Linked file contains doors. I would like to know if there is a way to make those doors display To/From room properties of rooms from host file. Right now when I am queering door information through a link I am getting that the parameter to/from room is null/none. Ideas? Thank you!
FamilyInstance.FromRoom and FamilyInstance.ToRoom are read-only, so you won’t be able to use the API to set their values. If it was helpful to put this data into some other parameter, it could be possible to do some geometry investigation to figure this out.
The only way I found is to ‘Bind the link’ (select the link and press ‘Bind Link’ in the menu).
From that point all rooms are set op correctly on the elements (doors, windows, …)
Only drawback, this is not a great solution because ofcourse you lose all the advantages of using a link as it is converted to a group.
Harry,
Also, on the topic of From/To Room parameter I have made a post earlier this week. You or your readers might find it useful:
Konrad
|
https://boostyourbim.wordpress.com/2013/02/10/macro-to-quickly-fix-the-tofrom-room-parameter-for-doors/
|
CC-MAIN-2015-14
|
refinedweb
| 721
| 64.91
|
In my earlier experience my Flask apps were pretty simple and everything worked just as it has been created from the scratch. I loved it, but then the inevitable thing has happened: my application got really slow and I HAD to do something about it. In this post I’ll tell my story about looking for the bottleneck of my Flask app, solving the problem and will share some amazing tools I used for it.
So I have a Flask application and a MySQL database which contains a lot of one-to-many super-nested objects. And by saying ‘super-nested’ I’m not hyperbolising: an object of total 3000 table rows from five different tables is a common case. At the beginning everything was fine, but at some point processing the request started to take 3-5 or even 10 seconds! Oh.My.God. This was something I didn’t want to be happening, so I started to think what might cause the problem.
At first, I naively went through my code base and tried to determine the area of possible bottleneck. The answer seemed to be obvious: I’m using the marshmallow library to serialise and validate data before inserting and after selecting it from the database. This is it, right? Googling “marshmallow + slow” returned a few articles that confirmed my suspicions: it’s the library. One of the articles I found was by some guys from Lyft, that said: “We’re using marshmallow and it’s so slow, so we created toasted-marshmallow which is 15x times faster”. Amazing!- I thought. This is what I need. At that point my requests took an average of three seconds. So I updated my code to using toasted marshmallow and prepared myself a red stripe and scissors. Sent a request… bam. Six seconds. That was impressive.
I got pretty upset because I thought I have to rewrite half of my app’s logic. And then a colleague asked me if I tried using a profiler? Yes, at this point I have to admit I didn’t know profilers existed. I’m happy I do know now, though!
What is a code profiler? Long story short, it’s a tool for dynamic code analysis that helps to detect performance problems, also known as bottlenecks of your program. The profiler gathers information on various metrics of how your program works, and based on this information you can identify where to move on with code optimisation.
There are a lot of profiling tools for Python code, and most of them are built-in — like profile or cProfile. Since I’m speaking about Flask application, let’s see what the world has especially for it. There is a beautiful lib called flask-profiler, which has a web interface with some cool features such as route or date filters. But Flask also has a built-in in werkzeug's profiler. It looked awesomely easy in use, so it was the first — and the last — one I tried.
To use the built-in profiler you’ll need to add only two lines of code to your project:
from werkzeug.middleware.profiler import ProfilerMiddleware app = ProfilerMiddleware(app)
You can also configure it, for example, specify the profile_dir or set restrictions for the stats you want to see.
After adding the two lines before the Flask
app.run() function and executing the program, overview result on each request will be displayed in the stdout.
Sometimes this short result can give you an idea on what’s slowing your program down. But usually it’s interesting to see thee detailed analysis, which is put into the chosen profile directory as *.prof files.
There are a few tools to visualise the profile dumps. Some of them providing a full GUI for navigatig within your profiling results ( RunSnakeRun), some of them represent the analysis result as a Graph (gprof2dot).
I stopped on snakeviz, which is a browser based visualizer.
It is easy installed using
pip install snakeviz, and then simply run with snakeviz profile_dir. The result looks something like this, and you can dive in to each of the visual parts to see its more close detalization, which is in my opinion is super cool and handy.
After analysing the visual representation of the profiling results, it turned out that most of my performance problems were coming from service-database interaction. When I knew exactly which lines of code took inexcusably lot of time to execute, I was able to solve my problems whether by rewriting the queries, or improving the code itself. Improving code performance via enhancement of database interaction is a topic for a whole new article, so I will probably write about my experience with it later.
To sum up: of course, automatic profilers are not perfect and they won’t 100% show you the mistakes in your code. Sometimes it’s simply ‘staring at your code’ method that actually works really good. But at least with the help of profilers you can detect the weak area which in most cases is more than enough.
Thank you for reading and I hope it was somehow useful. :)
Discussion (8)
I don't undertand where should I use the code
app = ProfilerMiddleware(app)
I'm using app factory pattern.
Can you help? :)
you can use it at the place where you initially create your Flask app:
Hey, this didn't work. But this (inside my
create_appfunction) did:
Thanks, I probably had the same problem ("Attribute Record no defined for ProfilerMiddleWare") or something like that, but this def works. I use Ubuntu 20.04 with python 3.8.10
Really insightful article here, I'm a flask developer and I havent used profilers neither did I know what they were thanks for writing this.
thank you Paul!
really useful
Thanks for your good article .
thank you!
|
https://dev.to/yellalena/profiling-flask-application-to-improve-performance-4970
|
CC-MAIN-2022-21
|
refinedweb
| 975
| 63.09
|
>>>>> "Mikael" == Mikael Djurfeldt <address@hidden> writes: Mikael> The guile-1.6 release will be a real pain for many Mikael> application developers. [...] My first thought: "But surely this is what our deprecation mechanism is for! Why isn't that enough?" One of your points is that some changes in the API have not been properly put through our existing deprecation policy -- I agree completely that those omissions should be identified and fixed. But what else? Analyzing a little further, I think that your argument breaks down into two points: (1) perhaps the recent deprecation period has not been long enough (2) perhaps the deprecation mechanism does not in fact help in the most common scenarios of transitioning between releases. And I think you're right about (2). Here's why... The scenarios that application writers have to worry about when considering different Guile versions are as follows. (1) An application is distributed as source and should be compilable against whichever version of Guile is installed on the user's computer. (2) An application is distributed pre-built but dynamically linked, and so should link against whichever version of Guile is installed on the user's computer. (3) An application is distributed pre-built and statically linked, so it is convenient for the application writer if the application code is partly protected from changes in the API of the Guile installed on the writer's computer. I think our current deprecation mechanism only really helps with (3), which is the least common scenario in these packaged and dynamically linked days. (2), the most common scenario, I don't totally understand, but I think it is addressed as much as is possible by libtool and the version/revision/age system. Isn't it a problem, though, that we don't differentiate between the names of shared Guile libraries that are configured with and without threads, or with and without SCM_DEBUG_DEPRECATED? Surely any ./configure level switch should result in a differently named library, or else how is an application to know what the library that it tries to link with actually contains? (1), which is still more common than (3), is the scenario that could be helped by autoconf macros and a compat.h header file, and which isn't addressed (AFAICS) by the current deprecation mechanism. But I'm not sure that it is necessary to provide configure.in tests for individual changes. Wouldn't a simpler mechanism like the _GNU_SOURCE one used in libc suffice? For example, an application written using the 1.4 API would always say #define _GUILE_SOURCE_1.4 #include <libguile.h> and then the libguile.h header in, say, version 1.6, could consist of ... normal 1.6 header decls ... typedef ... scm_t_bits; #ifdef _GUILE_SOURCE_1.4 ... 1.4 compatibility decls ... typedef scm_t_bits scm_bits_t; #endif Would that be any simpler? (Probably this is an old debate, but I'm not familiar with the outcome.) Regards, Neil
|
https://lists.gnu.org/archive/html/guile-user/2001-10/msg00027.html
|
CC-MAIN-2021-17
|
refinedweb
| 486
| 56.96
|
sub process_feed {
my ($line) = @_;
my @lines;
my $last_received = "";
while (1) {
if ($line =~/^{(.*?)}(.*)/) {
push @lines, $1;
$line = $2;
} else {
$last_received = $line;
}
}
print "sending back @lines, $last_received\n";
return (@lines, $last_received);
}
my (@lines, $leftover) = process_feed("{hi1}{hi2}{hi3");
print "got lines: @lines\n";
print "got last_recevied, $leftover\n";
sending back hi1 hi2, {hi3
got lines: hi1 hi2 {hi3
got last_recevied,
sending back hi1 hi2, {hi3
got lines: hi1 hi2
got last_recevied, {hi3
$last_recevied
@lines
A function returns a flat list. If array is assigned to first, the whole list goes into that array. So in
my (@lines, $leftover) = process_feed("{hi1}{hi2}{hi3");
the
@lines gets everything the sub returned.
Solutions
Return a reference to an array, so assign to two scalars
sub process_feed { # ... return \@lines, $last_received; } my ($rlines, $leftover) = process_feed("{hi1}{hi2}{hi3"); print "got lines: @$rlines\n";
I would recommend this approach, in general.
Since
$last_received is always returned, swap the order in the return and assignment
sub process_feed { # ... return $last_received, @lines; } my ($leftover, @lines) = process_feed("{hi1}{hi2}{hi3");
Since the assignment is to the scalar first, only one value from the return is assigned to it and then others go into next variables, here the array
@lines which takes all remaining return.
|
https://codedump.io/share/qsQW1lYPwM2i/1/perl-subroutine-returning-array-and-str-but-they-are-getting-merged
|
CC-MAIN-2016-44
|
refinedweb
| 203
| 64.64
|
Start out trying to look like Iron Man, end up thinking a bit about your humanity, have a lot of fun in the process. This project is meant to produce and interesting and unexpected effect from a source that we take for granted, our heart. On a base level this is an Arduino powered jacket that turns your heartbeat into a pulsing ring of light.
Origins
In the beginning I mostly wanted to create something wearable that resembled the arc reactor used by Iron Man, but to add a twist with an unusual input. The heart sensor was the second in a list that ranged from temperature, to sound, and many more.
Material List
- Arduino Uno - Compact microcontroller produced by Arduino, it will allow us to interpret the signals sent by the sensor information here
- Zip Front Hoodie - Cheap or not really depends on what you want aesthetically, but be aware that you will be cutting holes in it, sewing things on to it and generally being rough on the garment
- Pulse Sensor - The sensor I used is specifically made by the guys at pulsesensor.com. The package they send includes the sensor, the velcro strip and discs, sensor covers and a couple other pieces. Their website also includes their custom Arduino library and code that you will need later on.
- (20) Jumper Wires - Make sure you have both male to male, and male to female cables, as both are necessary Information here
- 5.5 x 2.1 mm Battery Connector Cable and 9V battery - This cable provides power to your arduino via a 9 volt battery, and is also super cheap on amazon and other online electronics retailers. information here
- Adafruit 16 Neo Pixel Ring - This ring utilizes 16 individually programmable NeoPixel LED lights, and is available from a Adafruit specifically, but can be found on Amazon for a higher price information here
- Sewing Needle and Thread - Thread that matches the color of your chosen hoodie would be best
- Breadboard - A small electronics platform for testing circuitry without needing to solder anything Information here
- (2) Single LED's - Very cheap single LED's are needed for testing sensors and Arduino output before actual construction begins. Information here
- Soldering Iron and solder - A very small amount of soldering is necessary in this project
Step 1: Pulse Sensor Preparation and Testing
Once you have all your materials put together the first step is to test all our major components.
The pulse sensor is the first, to go to the "Getting Started" tutorial on pulsesensor.com Click here
The link has a basic tutorial in how to prepare the sensor, including casing wires with glue and connections to the arduino itself. The sensor has 3 wires, power (red) , ground (black) and an output (purple) that connect to the 5V, GND, and A0 pins respectively on the Analog side of the Arduino Uno. If your Arduino is plugged in, then the sensor itself should light up bright green.
Be sure to double check your connection before plugging the Arduino in to make sure it doesn't damage the sensor! Its unlikely but possible!
Now that we are sure the sensor works, time to test the code. Navigate back to the tutorial linked above and click on the GitHub image to download the PulseSensor libraries for Arduino. Follow the tutorial for instructions on how to install the libraries correctly based on your computers operating system.
Once you have it installed and the Arduino IDE running, open the
PulseSensorAmped_Arduino_1dot2.ino sketch. Verify and Upload this sketch to your arduino and don your pulse sensor and watch for the L light to start blinking along with your heart beat. You can also connect an single LED between pin 13 and the GND pin on the digital side, which should begin blinking along with your pulse.
If these pieces are working as described above, Congrats! Your pulse sensor is working properly, and your first piece of code is uploaded and ready to go!
Step 2: NeoPixel Testing and Preperation
Now that the pulse sensor is working, its time to test your NeoPixel ring as well. This section will be a bit shorter and simpler.
First things first, head over to this site and download the Adafruit NeoPixel libraries for your Arduino Click Here
Download, and unzip as you did with the previous libraries. After that, rename the folder to 'Adafruit_NeoPixel' before dropping it into libraries. If you do not you will have trouble with verifying and uploading your code!
Now, open your Arduino IDE and open the simple sketch from the examples folder in the NeoPixel library.
Disconnect everything from your Arduino if you haven't already, then verify and upload the simple sketch.
Now with the code out of the way, take three of your male to male jumpers and connect two of them to the 5V and GND pins on the Analog side of the arduino. Connect the 3rd one to pin 6 on the digital side. Now connect the 5V jumper to the Power 5V DC hole on the NeoPixel ring. Do the same with GND to Power Signal Ground, and Data Input to pin 6, at this point your ring should light up bright green! If you reset your arduino, the ring will light up one LED at a time bright green.
It may flicker and change color sometimes, but that is only because of the unstable connection between the jumper ends and the contact point on the ring. At this point we are just testing to make sure the ring works.
If you see bright green Pixels, Congrats! Its time to move on to the good stuff!
Step 3: Coding Time!
Alright, now its time to prepare our code. We need to incorporate parts of both of our sketches so that the Arduino will process the input from the heartbeat sensor as well as controlling the NeoPixel ring.
The pulse sensor code will be our base and we will add code from the "simple" sketch we used for the arduino. We need to cut the major portions of the simple sketch out and paste them in their respective places inside the pulse senor code. See Below
// 6 //. }
void loop() { //,150,0)); // Moderately bright green color.pixels.show(); // This sends the updated pixel color to the hardware. delay(delayval); // Delay for a period of time (in milliseconds) } }
What we need to do is cut out each of the individual parts of this code, specifically the variable declarations on top, as well as the void setup, and void loop portions. Open both this and the Pulse Sensor sketch in seperate windows and transfer each piece of the code from the "simple" sketch over to its respective place in the pulse sensor sketch.
When you are finished it should look like this:
/* Pulse Sensor Amped 1.4 by Joel Murphy and Yury Gitman
---------------------- Notes ---------------------- ---------------------- This code: 1) Blinks an LED to User's Live Heartbeat PIN 13 2) Fades an LED to User's Live HeartBeat 3) Determines BPM 4) Prints All of the Above to SerialRead Me:... ---------------------- ---------------------- ---------------------- * / = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse //----------------------------- ADAFRUIT VARIABLES----------------------------- #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif // Which pin on the Arduino is connected to the NeoPixels? // On a Trinket or Gemma we suggest changing this to 1 #define PIN 8 //); //------------------------- ADAFRUIT setup code--------------------------- //. } //-------------------------------------------------------------------------- // Where the Magic Happens void loop(){ serialOutput() ; if (QS == true){ // A Heartbeat Was Found // BPM and IBI have been Determined // Quantified Self "QS" true when arduino finds a heartbeat //------------------------- ADAFRUIT loop code-------------------------------- //,0,255)); // Moderately bright green color. pixels.show(); // This sends the updated pixel color to the hardware. delay(2); // Delay for a period of time (in milliseconds). } //--------------------------------------------------------------------------- } void ledFadeToBeat(){ fadeRate -= 15; // set LED fade value fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers! analogWrite(fadePin,fadeRate); // fade LED }
I sectioned out each part of the code as they are spliced together, and I changed a couple values as well, one setting the color of the neopixels in this line:
"pixels.setPixelColor(i, pixels.Color(0,0,255));"
that 255 creates the brightest pure blue they can do, but you can set them to any color you want with RGB values. I also changed the data output pin to 8, Just in case you decide to use my code and things dont seem to be working.
Once you have your code put together verify, as long as you have your brackets in the proper place, it should compile nicely and be ready to go!
Step 4: Electronics Construction
Now that we have our code ready to go, its time to build the actual jacket portion starting with our Arduino connections. Remove all jumpers and wire connections from the arduino, and unplug it.
1. Reconnect the Pulse Sensor in the same way you did earlier when we tested it.
2. Connect a male/male jumper to a male/female jumper to create a double length jumper with male tips on both ends. Now do this two more times so we have a double length jumper for each connection that the NeoPixel ring needs.
3. Now we need to solder one end of each of the three jumpers to the Power 5V DC, Power Signal Ground, and Data Input connections on your NeoPixel ring, and clip off the ends of the jumpers. solder them from the underside of the ring.
4. Now that we have your ring with soldered connections, connect the Power Signal Ground wire to the second GND port on the Analog side, the Data Input wire to the output wire specified in the code, (pin 8 in my version) and finally the Power 5V DC to either pin 13, which will make the ring blink on and off, or to pin 5 which will cause the ring to light up and fade.
Normally the power wire would be connected to a 5 or 3.3V pin on the Arduino, but when it is connected to the output pins that would normally control the single LED's from the original Pulse Sensor sketch, they control the power flow to the NeoPixel ring, lighting it up the same way.
5. Next plug in the 9V battery connector and you should be ready to test!
Step 5: Jacket Construction
This is the last major portion of assembly, is connecting all the major portions of the project to the jacket itself. For this portion all you need is needle and thread, and patience.
1. Sew the pulse sensor to the inside of the right sleeve to keep the wires stable and keep the sensor close to your finger that you want to connect it to. A few tight loops of thread around the wire bundle will do to keep it in place. Also sew another loop around the wires close to the armpit on the inside of the jacket.
2. Sew the arduino to the right side of the jacket on the inside, there are 4 large holes in the board that are perfect to secure it to the jacket with thread
3. Sew the NeoPixel ring to the inside of the jacket, you may have to put it on to get the placement of the ring to the right height, and again use the extra holes that already exist in the ring to sew it on.
4. Sew down the wires as you see fit to make it more comfortable, at this point you should be wearing it and testing as you go.
5. Finally, cut a hole in the back of the front right pocket and feed your battery connector head through it so you can connect the battery on the inside of the pocket without having to unzip and open the jacket.
After you have it secured as much as makes you comfortable, you are ready to go!
Step 6: Wear and Enjoy!
Congrats! You have finished the project!
Plug in your 9 Volt, slip on the pulse sensor strap and enjoy!
Thank you so much for your interest in my project, and if you have any comments or questions please feel free to post them below. Have a great day!
|
http://www.instructables.com/id/NeoPixel-LED-Heart-Sensor-Jacket/
|
CC-MAIN-2017-17
|
refinedweb
| 2,048
| 66.67
|
Let's say you take an image, like the one on the left and then recreate it in the style of the image on the right. Neural Style Transfer allows you to generate new image like the one below...
So, we have mainly 2 images here, the content image and the style image. The content image has the original image that we want to transform. The style image has the new style that we want to transfer to the original image. In order to implement Neural Style Transfer, you need to look at the features extracted by ConvNet at various layers, the shallow and the deeper layers of a ConvNet. But let’s first ask about what are all these layers of a ConvNet really computing. What are deep ConvNets really learning?
Lets say you've trained a ConvNet, and you want to visualize what the hidden units in different layers are computing. Let's start with a hidden unit in layer 1 and suppose you scan through your training sets and find out what are the images or what are the image patches that maximize that unit's activation.
So in other words pause your training set through your neural network, and figure out what is the image that maximizes that particular unit's activation. If you noticed, will see only a relatively small portion of the neural network. If you plot what caused this unit's activation, you will see just a small image patches. If you pick one hidden unit and find the input images that maximizes that unit's activation, you might find nine image patches like those on the left.
You can see that the regions of the image that this particular hidden unit sees are corners and edges, it's looking for an edge or a line that looks like that. So those are the image patches that maximally activate one hidden unit's activation
Now, you can pick a different hidden unit in layer 1 and do the same thing. So that's a different hidden unit, and looks like this second one, represented by these images patches that looks like it is looking for a line sort of in that portion of its input region, in this case the eyes and eyebrows.
So these are different representative neurons and for each of them the image patches that they maximally activate on. This arrives at a certain conclusion that the hidden units in the first layer are often looking for relatively simple features such as edges or shades of certain colors.
Here is another network with the activations as well for the first layer
But, what if you do this for some of the hidden units in the deeper layers of the neuron network. What is the neural network learning at those deeper layers?
In the deeper layers, the hidden unit usually sees a larger portion of the image. Each pixel could affect the output of later layers of the neural network. So, later units actually see larger image patches.
So, this is a visualization of what maximally activates different hidden units in layer 2. These are patches of the image that cause activation of a certain hidden unit.
The interesting thing is that second layer looks like it's detecting more complex shapes like vertical edges.
So, what about the third layer?
It looks like there is a hidden unit that seems to respond to textures like honeycomb shapes, or square shapes...
How about the next layer?
Well, the fourth layer seems to detect even more complex shapes, you can see that is nearly detecting dogs, of course not by species or breeds but the general shape, remember we are only 4 layers deep.
To build a Neural Style Transfer system, we have to build a network, a cost function to minimize and then conduct the training.
Let’s define a cost function J that measures the quality of a generated image, we'll use gradient descent to minimize J in order to generate this image.
How good is a particular image?
We will define two parts to this cost function. First one is called the content cost which is a function of the content image and of the generated image. It measures how similar the contents of the generated image is to the content of the content image, then it will add that to a style cost function which measures how similar the style of the image generated image is to the style of the style image
Finally, we'll weight these with a hyper parameters alpha to specify the relative weighting between the content costs and the style cost, in the original paper of style transfer, it is proposed that 2 hyper parameters were used, alpha and beta.
So, the way the algorithm should run is that we initialize the generated image randomly, a 100x100x3 for example like shown below or whatever dimension you want it to be. After that, we define the cost function J.
We then use the traditional gradient descent to minimize this function. Denoting the generated image as G. So, G will be equal to G minus the derivative respect to the cost function of J. What you are doing now is that you are actually updating the pixel values of this image G that is a 100x100x3.
The cost function of the neural style transfer algorithm had a content cost component and a style cost component.
So, J = alpha * J_content + beta * J_style
Content cost
So, let us define the content cost component. Let us say that you use hidden layer L to compute the content cost. If L is a very small number like the first layer, it will force your generated image to pixel values very similar to your content image. Similarly, if you use a very deep layer, it is forced to add completely learned features into the generated image.
In practice, layer L chosen somewhere in between that is neither too shallow nor too deep in the neural network.
We will then use a pre-trained ConvNet and start to measure how similar a content image and a generated image are. So, if we compared the activations of a certain layer L on these two images and were found to be similar, then that would seem to imply that both images have similar content.
def content_cost(a_C, a_G): #a_C is hidden layer activations representing content of the Content image a_G hidden layer activations representing content of the Generated image m, n_H, n_W, n_C = a_G.get_shape().as_list() J_content = 1 / (4*n_H*n_W*n_C)*(tf.reduce_sum(tf.square(tf.subtract(a_C,a_G)))) return J_content
Style cost
Next, let's move on to the style cost function. What is the style of an image mean?
Let's say you have an input image and you've chosen some layer L to define the measure of the style of an image. The style is the correlation between activations across different channels in this layer L activation. So what you can to do is given an image computes something called a style matrix, which will measure all those correlations between the color channels in the images. But, what does it mean for these two channels to be highly correlated?
Well, if they're highly correlated, this means is whatever part of the image has a certain texture, that part of the image will probably have a corresponding style/color in the generated image. To be uncorrelated means that whenever there is this vertical texture, it's probably won't have that style.
And so the correlation tells you which of these high texture components tend to occur or not occur together in part of an image and that's the degree of correlation that gives you one way of measuring how often these different high level features.
def layer_style_cost(a_S, a_G): #a_S hidden layer activations representing style of the image Style image a_G hidden layer activations representing style of the image Generated image m, n_H, n_W, n_C = a_G.get_shape().as_list() a_S = tf.transpose(tf.reshape(a_S,(n_H*n_W,n_C))) a_G = tf.transpose(tf.reshape(a_G,(n_H*n_W,n_C))) GS = gram_matrix(a_S) GG = gram_matrix(a_G) J_style_layer = 1 /(4*n_H*n_W*n_C*n_H*n_W*n_C)*(tf.reduce_sum(tf.square(tf.subtract(GS,GG)))) return J_style_layer
In general, calculating the cost function will be like the following:
def total_cost(J_content, J_style, alpha = 10, beta = 40): #alpha -- hyperparameter weighting the importance of the content cost beta -- hyperparameter weighting the importance of the style cost J = alpha*J_content + beta*J_style return J
So, to sum up, transfer learning is used to add one or more styles to an image in the light of a style image. One can do this by calculating costs for both content and style images, calculating the loss and trying to minimize that loss. Spotting the transfer of learned features to the generated image follows. You can find style transfer as the backend of many applications today as Prisma.
Would you like to read more about this topic? More resources or code snippets? Just leave your comment in the box below this post (you need to login or register to comment).
Sources:
- A Neural Algorithm of Artistic Style, Leon A. Gatys, Alexander S. Ecker, Matthias Bethge
- Visualizing and Understanding Convolutional Networks, Matthew D Zeiler, Rob Fergus
Report comment
|
https://imaginghub.com/blog/80-neural-style-transfer-using-convolutional-neural-networks-in-art-generation
|
CC-MAIN-2020-05
|
refinedweb
| 1,560
| 60.04
|
Quickly project templates and the "Application Layer Cake"
Discuss code development, deployment, and application management by end users for application developers, and how all of these fit together. Relates to Automagic python build system.
The heart of this system is highly opinionated choices about how developers should build new apps for Ubuntu, as well as templates and other systems for helping them right their code in a guided manner. This also includes packaging and deplloying code.
The system should be EASY and FUN.
Blueprint information
- Status:
- Complete
- Approver:
- Martin Pitt
- Priority:
- High
- Drafter:
- Rick Spencer
- Direction:
- Needs approval
- Assignee:
- Rick Spencer
- Definition:
- Approved
- Implementation:
Implemented
- Milestone target:
ubuntu-9.10-beta
- Started by
- Martin Pitt on 2009-06-01
- Completed by
- Martin Pitt on 2012-05-15
Related branches
Related bugs
Sprints
Whiteboard
v0.2 will be universe right after desktopcouch is in main. Just waiting to test.
automagic python build system is under development as a separate project by pitti.
A prototype of quickly is available here: https:/
pitti, 2009-06-08:
- I made some typo fixes in the wiki spec
- How do commands look like in the quickly/templates/ hierarchy? (Calling convention, name, path)
- What is a ".quickly" file? If that's meant verbatim, you shouldn't use hidden files.
- implementation does not talk at all about Launchpad setup, integration, and PPA uploading; how is that achieved, which information does/should the user supply, and what is done automatically? (project registration or +junk? project description? what about namespace cluttering if 10 people write a "test" application? we don't have "PPA branches" in LP yet)
- "ubuntu-project commands proposition" is below "UDS discussion", which is not effectively part of the spec; in fact, all the discussion bits should be worked into the actual spec, and then deleted for clarity
- this whiteboard still has discussion notes, can they be dropped now or do they still have something important? If they do, please merge into spec.
pitti, 2009-06-16:
- "bzr whoami" needs to be configured by default. Likewise, "bzr launchpad-login" needs to be done first. How? (but see below)
- What does "(+junk if it's not a fix)" mean?
- I'm not convinced that we should semi-automatically create LP projects for all those; namespace collisions will be unavoidable, and we don't have per-user projects. Please consider not using LP project PPA branches for now.
- Consider "set-ubuntu-
- "quickly fix": Please try to rephrase; it's not really clear what this command should do; maintaining several stable branches sounds way outside the intended target audience, too. This leaves the area of "fun and easy", IMHO
didrocks, 2009-06-17:
* bzr whoami update path is:
- binding to LP with user,
- get bzr whoami, status it to default if it's "<some string> <current_
- then, set identifier to <launchpad_
- call bzr launchpad-login to set it to <launchpad_name>
* not +junk, trunk, updated
* discuted about that, I think you're right. So, "quickly release" should only ask for a project name, seek for them and choose an already existing one. Then, it goes to tagging, pushing, releasing a deb in the ppa…
The wiki has to be updated on that.
* set-ubuntu-version is a way better. I'm ok that the user wouldn't have tested his deb if he set another level. But I'm convinced that's something that people would ask when "quickly release" (this can be a parameter of quickly release, btw)
* this brings the subject that we must provide a command to be locally a deb?
* quickly fix: reading what you've writtent, you understood it. Ok, that's a more advanced concept, but if user don't use them, what the usage of tagging a branch when releasing a version?
* we must also define what "quickly save" does: offline "recording" (bzr commit), pushing the branch if launchpad binding have been set with a project (quickly release)?
* we have also to define a command to change the binded launchpad project (not having to change it manually in .quickly file).
didrocks, 2009-06-22: updated spec with previous remarks.
pitti, 2009-07-06: approved
Work Items:
Implement the ubuntu-project template: DONE
Design Review and modifications of ubuntu-project: DONE
Implement new window command: POSTPONE
Implement new dialog command: DONE
Implement new widget command: POSTPONE
Implement bash command completion: DONE
quickly command directing script: DONE
wrap automagic python build script: DONE
wrap project handling script: DONE
deal with setup.py : DONE
wrap release script : DONE
push to ppa in release script : DONE
create tutorial: TODO
Dependency tree
* Blueprints in grey have been implemented.
|
https://blueprints.launchpad.net/ubuntu/+spec/desktop-karmic-quickly
|
CC-MAIN-2016-30
|
refinedweb
| 769
| 51.68
|
I++ can get ugly. Archivist attempts to solve this problem by being extremely simple and non-intrusive. It does not esteem optimization or efficiency over simplicity. I am, you see, a minimalist of sorts. That said, I think you will find it quite powerful, or at least interesting.
I think the best way to introduce Archivist is to show you.
Let us consider a game. In this game you have multiple players who battle it out in an arena against monsters using various weapons.
The code may look something like this:
class Point2 { public: float x, y; public: //... }; namespace WeaponType { enum Enum { WaterPistol, NerfGun, Uzi9mm, Bazooka }; }; class Player { private: string name; Point2 position; uint32_t health; uint32_t ammo; WeaponType::Enum weaponType; public: //... }; class Monster { private: Point2 position; uint32_t health; public: //... }; class Arena { private: map< string, Player > playerList; list< Monster > monsterList; public: //... };
We could argue about exact implementation I'm sure, but let's keep it like this for the moment. There is already a bit of complexity here: you've got a few containers, an enum and a few non-primitive types.
Okay, so let's say you're going to implement your save system, how would you serialize this to disk?
Well, chances are you'd break out the old
fread() and
fwrite() calls. Probably you'd start adding
Save() and
Load() methods everywhere and call them as needed. It's not that hard, but it does create a lot of extra code and introduces a lot of potential for bugs.
Let's start with the
Point2 class since it is the simplest. Archivist lets you do this:
#include "Archivist" using namespace Archivist; class Point2 { public: float x, y; public: ArchiveAttributes( x, y ); //... };
And then you can do this:
Point2 point( 4, 5 ); Archive::Save( "point.plist", point.Encode() );
Which lets you open it in Property List Editor:
Does this get your attention? No?
Okay, let's fill out the rest of the code:
class Player { private: //... Enum< WeaponType::Enum > weaponType; public: ArchiveAttributes( name, position, health, ammo, weaponType ); //... }; class Monster { private: //... public: ArchiveAttributes( position, health ); //... } class Arena { private: //... public: ArchiveAttributes( playerList, monsterList ); //... }
The only tricky bit here is needing to wrap weaponType in
Archivist::Enum because enums are somewhat retarded and get treated like second-class types. Don't worry, the wrapped enum will still behave correctly. The rest is cake. And it lets you do this:
Arena arena; arena.AddPlayer( Player( "Mario", 10, 0 ) ); arena.AddPlayer( Player( "Luigi", 40, 0 ) ); for (int i = 0; i < 5; i++) { arena.SpawnMonster(); } Archive::Save( "arena.plist", arena.Encode() );
Which, in turn, lets you do this:
Do I have your attention now? Wow… tough crowd.
Even the STL container members are correctly encoded. Nifty. Okay, let me show you how to decode things before get too far along:
Arena arena2; arena2.Decode( Archive::Load( "arena.plist" ) );
And that's pretty much the basic use of Archivist. The rabbit hole goes a whole lot deeper of course and we'll get into the more complex scenarios like inheritance, polymorphism and wrapping structs and classes you don't have code for in future posts.
But before I sign off, let me add a few more points about how Archivist handles things internally.
Everything in Archivist encodes into a variant type called Unknown. Unknown can currently be one of the following types under the hood:
Object,
Array,
Signed,
Unsigned,
Float,
Boolean,
String and
Null. Unknown essentially wraps these. These types are enough to handle almost anything, including most of the STL containers.
The variants all know how to properly get encoded into and decoded out of any
std::stream, which means along with saving to files, you can throw in things like:
cout << monster.Encode();
That can be quite useful for debugging. Here's another example:
float volume = 85.5f; Unknown u = Encode( volume ); assert( u.Type() == Type::Float ); cout << u;
Which would output:
<real>85.5</real>
Or, to go back to our game example:
Arena arena; Unknown u = Encode( arena ); // which just calls arena.Encode(); assert( u.Type() == Type::Object ); cout << u;
Which would output a whole lot more, so I won't post it in here, but you get the idea.
Object is a
std::map-like container that stores Unknowns mapped to a std::string.
Array behaves pretty much like
std::vector (
std::deque actually), again storing Unknowns.
Signed and
Unsigned wrap 64-bit signed and unsigned integers respectively. Similarly,
Float stores a long double.
String wraps a std::string internally.
Boolean wraps a bool and
Null is not really used to store any meaningful value and represents the default value of an Unknown.
I had considered making internal types for every possible primitive type, but that would result in 10 integer types and 3 floating point types currently. That kind of goes against my simplicity over optimization principle, but I may change my mind about that. :)
As it is, any possible value you can hold in a primitive type can be stored by Archivist.
The beauty of the
Unknown variant type is that encoded data can be decoded before you know what it is. Then you can check its type and act appropriately. Most often Archivist avoids requiring you get your hands dirty that way, but the flexibility is there when you need it — and in the next installment we may just.
Well, that's it for now! There is more you need to know to use Archivist properly, but you can get the code from my GitHub account and play with it. Everything is in the
Archivist namespace so you shouldn't have any conflicts with your own code.
There is more to show-and-tell, and a few features I want to add to the library. I'll get to those in upcoming iDevBlogADay posts. I also have some exciting ideas to experiment with.
You can get Archivist here:
I would love to hear your thoughts on what you've seen so far!.
|
http://www.gallantgames.com/posts/9/simple-serialization-with-archivist
|
CC-MAIN-2019-35
|
refinedweb
| 994
| 67.15
|
I recently checked in a first cut of a JavaFX scripting framework for Java Database Connectivity, JDBC. This can be found at the openjfx-compiler project. The framework is located in the javafx.sql package of the runtime jar, javafxrt.jar. To get started, use the javafx.sql.DB class.
There are two ways to create a connection to the database, one with a javax.sql.Datasource, and one with the traditional Database URL/user/password combination. For the DataSource method, first create the Datasource or locate one via JNDI.
For MySQL, the class is either com.mysql.jdbc.jdbc2.optional.MysqlDataSource or com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource. Descriptions of these can be found in the MySQL Connector/J documentation. For other databases, check the specific JDBC documentation to see how a DataSource is supported. To create a javafx.sql.DB object using a DataSource, use an Object Literal while setting the dataSource property.
var dataSource = com.mysql.jdbc.jdbc2.optional.MysqlDataSource{};
dataSource.setServerName("localhost");
dataSource.setDatabaseName("fxtest");
dataSource.setUser("jclarke");
var db = DB {
dataSource: dataSource
}
To use the classical approach to open a JDBC connection, provide a database URL, and optional user and password attributes. The following opens the database connection using the same properties as used in the DataSource example above.
var db = DB{
user: 'jclarke'
dbUrl: "jdbc:mysql://localhost/fxtest";
};
If you have a problem connecting, and exception will print.
To execute an SQL statement, use the execute or executeUpdate methods. These do the exact same things, but execute returns a boolean indicating rows have been updated, while executeUpdate returns the number of rows actually updated. Using examples from the JDBC Tutorial, let's first create some tables:
db.execute("drop table if exists COFFEES");This is pretty straight forward. Now let's stuff some data into the tables:
db.execute("drop table if exists SUPPLIERS");
db.execute("create table SUPPLIERS " +
"(SUP_ID INTEGER NOT NULL, " +
"SUP_NAME VARCHAR(40), " +
"STREET VARCHAR(40), " +
"CITY VARCHAR(20), " +
"STATE CHAR(2), " +
"ZIP CHAR(5), " +
"primary key(SUP_ID))");
db.execute("create table COFFEES " +
"(COF_NAME varchar(32) NOT NULL, " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int, " +
"primary key(COF_NAME), " +
"foreign key(SUP_ID) references SUPPLIERSPK)");
db.executeUpdate("insert into SUPPLIERS " +
"values(49, 'Superior Coffee', '1 Party Place', " +
"'Mendocino', 'CA', '95460')");
var values = ["Kona", "00049", "15.99", "0", "0"];
db.execute("insert into COFFEES values(?,?,?,?,?)", values);
The first form is just a literal string, however, the second form uses a Parametrized SQL statement with the values taken from a JavaFX String Sequence. You could also have used the JavaFX String substitution syntax:
var coffee = "Kona";
var supId = 49;
var price = 15.99
var sales = 0;
var total = 0;
db.execute("insert into SUPPLIERS values('{coffee}', {supId), {price}, {sales}, {total}");
To fetch the data use the "query" method.
db.query("select COF_NAME, PRICE from COFFEES where COF_NAME = '{values[0]}'",
function(rs:java.sql.ResultSet):Void {
System.out.println("::{rs.getString("COF_NAME")} {%5.2f rs.getFloat("PRICE")}")
});
Using this form of the query method, the function parameter defines a function that takes a java.sql.ResultSet as an argument and is called once for each row of the result. Another form of query returns the ResultSet directly.
It is also possible to get at the basic JDBC objects. The following example show getting a PreparedStatement then using JavaFX Sequences to update rows in the COFFEES table.
var updateString = "update COFFEES " +
"set SALES = ? where COF_NAME like ?";
var updateSales = db.getPreparedStatement(updateString);
var salesForWeek = [175, 150, 60, 155, 90, 100];
var coffees = ["Colombian", "French_Roast", "Espresso",
"Colombian_Decaf", "French_Roast_Decaf", "Kona"];
for(c in coffees) {
updateSales.setInt(1, salesForWeek[indexof c]);
updateSales.setString(2, c);
updateSales.executeUpdate();
}
This is just a start to the JDBC framework in JavaFX script and the entire Tutorial.fx script can be downloaded from here.
Once the JavaFX reflection API is completed, I want to add mappings from SQL directly to and from JavaFX Objects. This will provide the ability to some really interesting things with database access.
I think you should remove all examples of easy constructing of SQL queries, where simple string concatenations and variable substitutions (bindings) are used. Yes, they look pretty but this is just not safe. Why create more good examples of a bad examples, where SQL injections just wait to rear their ugly heads?
Please consider making use of PreparedStatements even more natural and easy, and do not provide examples of queries without prepared statements unless really necessary. And even if so, please make sure you show an alternative code that uses PreparedStatement for comparison. Or as the very last resort, please explain *EVERY TIME* (people may read only excerpts of the docs) why it's important to validate all the input that is passed to the underlying database.
You don't believe me? Then how about me putting into some JavaFX login form following values:
Login: [admin'; --]
Password: [] (empty)
while the background SQL is like this:
db.query("select USER_NAME, USER_PASS from USERS where USER_NAME = '{values[0]}' and USER_PASS = '{values[1]}'",
Hint: the [';--] in SQL means: end the current query [;] and treat the rest as a comment [--]. So I might have just logged into the application without knowing the password, and just by guessing the account name ('admin' is a very typical login, just look at the GlassFish).
This would never happen if PreparedStatement was used!
As a side note, I'm tired of repeating the same to all my students (I'm a university teacher).
With best regards,
Wiktor Wandachowicz
Posted by Wiktor Wandachowicz on May 03, 2008 at 06:11 PM EDT #
@Wiktor Wandachowicz:
Hello Wiktor, I think that mr.clarkeman just to give simple example how to make a connection with JDBC, it doesn't matter if you give better examples to your student, but in my opinion, todays proggrammer must know about SQL injection theirself, because they can more understand about how it happen..
regrads
Wildan
Posted by whiledan on May 17, 2008 at 09:09 PM EDT #
What an arrogant bullshit you are Mr.whiledan.
Posted by 123.236.223.115 on May 21, 2008 at 05:07 PM EDT #
I think you are the one who is bullshit Wiktor. Wildan is right. Not all programmers can easily understand if you give a better example. The SIMPLER, the BETTER... You need to teach them from the basic and easy examples. Don't force them to try advance codes if they do not know the basics... OK?
Posted by gdpags5 on July 09, 2008 at 10:53 PM EDT #
I agree with wiledan & gdpags5.
Professional developers (java or not) MUST know about such things as routine SOP.
Posted by donlow on July 25, 2008 at 02:18 PM EDT #
I've just downloaded Netbeans 6.1. with JAVAFX Plugin.
I cannot find the class
import javafx.sql.*.
I'm a real beginner both in Java and Javafx.
I don't understand where I'm wrong.
Thanks for your samples anyway.
Henry
Posted by HenryMiller on August 18, 2008 at 05:16 AM EDT #
I try to use netbeans 6.1 for a web application with jsf like framework.
I declare a dropdown list for a table.
1) when i use a java programmme (using postgres) who read a table with 3000 tuples, this execution take 3 seconds.
2) when the drop down this take 10 seconds?
My question is why?
Posted by ongaro on November 05, 2008 at 06:16 AM EST #
well Mr hoity toity University teacher Wiktor Wandachowicz.
Wildan showed the basics, move from there.
at least he did something, THOSE THAT CAN DO, THOSE THAT CAN'T TEACH. And it is quite apparent in which category you fall.
There is nothing more nausiating than an academic who has never done any prodcution work himself dictating how it "should be".
get a real job.
Posted by Cam W on January 25, 2009 at 07:55 AM EST #
Advanced example with sourcecode
Posted by surikov on May 26, 2009 at 09:30 AM EDT #
hi
i want to use frame in javafx .but its not working javafx with netbean 6.5.1.and how can i use javafx ui package in same . plz suggest me how to do .
Posted by banita on June 13, 2009 at 08:37 AM EDT #
|
http://blogs.sun.com/clarkeman/entry/javafx_script_and_jdbc
|
crawl-002
|
refinedweb
| 1,377
| 58.28
|
DFS Link Overlaps existing replicated folder
- Thursday, September 11, 2008 8:06 PMWe had a DFS root on our server that replicated to 7 of our remote offices. Our server went down and had to be rebuilt.
I have been able to recreate the root, and all of the targets, however, when I try to configure the replication, there is a RED X over the folder with a message that states "This target is not eligible because the folder overlaps an existing replicated folder on that comptuer."
The only folder that doesn't have the red X is the local folder that I am looking to replicate out to the other offices.
What do I need to do to get rid of that message and allow replication to the other folders?
Thanks.
Tony.
All Replies
- Tuesday, September 16, 2008 9:58 AMHi customer,
According to the research, we will encounter this error message when we try to recreate the DFS structure because of the reason that the old information of the decommissioned DFS root server still exist in Active Directory database. To get rid of that message, we'd better first manually remove the old information from Active Directory and then create the new DFS structure in DFS management console.
Troubleshooting Steps:
1. Use the DFS utility (Dfsutil.exe) that is included in the Windows Server 2003 Support Tools to remove the root server from the DFS namespace.
Dfsutil /UnmapFtRoot /Root:DFS root /Server:RootTargetServer /Share:DFSsharename
DFSroot is in the form of: \\DomainOrServer\RootName
Please note: To install the DFS utility that is included in the Windows Server 2003 Support Tools, right-click Suptools.msi in the Support\Tools folder on the Windows Server 2003 CD-ROM, and then click Install.
2. On the decommissioned root target, remove DFS information from the registry by using the following Dfsutil.exe command:
Dfsutil /Clean /Server:RootTargetServer /Share:DFS share name
Please note: RootTargetServer refers to the root server that is to be decommissioned.
3. Remove the entry of the root target from Active Directory Users and Computers
Launch "Active Directory Users and Computers" -> Click "View" -> Select "Advanced Features" -> in the left tree, expand and locate "System" container -> Dfs-configuration -> Delete the old root target under the Dfs-configuration
4. On the decommissioned root server, run the following command in sequence.
net stop dfs
net start dfs
5. Please wait for some time and then recreate the DFS structure via DFS management console and check if the issue can be resolved.
Hope it helps.
David Shen - MSFT
- Marked As Answer by David Shen Friday, September 19, 2008 11:14 AM
-
- Wednesday, September 17, 2008 6:40 PMThanks for the response David.
I decommissioned the server, and "/cleaned" all the DFS information from the registry.
When I went into AD -> System Container, I found the DFS configuration to be empty. I did notice, however, that there was another folder in System -> File REplication Service -> DFS Volumes -> <old DFSroot> -> <old dfsshare> that listed all of my remote servers by GUID, along with the server name.
Is the error coming from the information that is stored here? Is it safe to remove these entries at the <old DFSroot> folder that exists?
Or will these folders remove themselves given some time?
Thanks.
- Thursday, September 18, 2008 12:02 PMHi,
Yes. It’s fine to remove these entries. However, it’s better for us to backup the Active Directory database before we remove it.
To backup Windows Server 2003 based domain, you may refer to:
How To Use the Backup Program to Back Up and Restore the System State in Windows 2000
(this article should be applied to Windows Server 2003)
To backup Windows Server 2008 based domain, you may refer to:
Perform a System State Backup of a Domain Controller by Using the Command Line (Wbadmin)
Meanwhile, after you manually delete the old entries, please reboot the server and then check if you can recreate the DFS structure via DFS management console again.
Hope it helps.
David Shen - MSFT
- Marked As Answer by David Shen Friday, September 19, 2008 11:14 AM
-
- Tuesday, September 23, 2008 5:03 AMworked well. Was able to add the targets and set up replication after deleting the DFS volumes from Active Directory.
Thanks again for your help David.
|
http://social.technet.microsoft.com/Forums/en-US/winserverfiles/thread/b4c88f6e-0711-4b8d-b36e-d6210ffe13b0
|
CC-MAIN-2013-20
|
refinedweb
| 718
| 59.23
|
Difference between revisions of "Use Cases And Requirements"
Revision as of 06:24, 4 October 2012
Contents
- 1 Linked Data Platform Use Cases And Requirements
- 1.1 Scope and Motivation
- 1.2 User Stories
- 1.2.1 Maintaining Social Contact Information
- 1.2.2 Keeping Track of Personal and Business Relationships
- 1.2.3 System and Software Development Tool Integration
- 1.2.4 Library Linked Data
- 1.2.5 Municipality Operational Monitoring
- 1.2.6 Healthcare
- 1.2.7 Metadata enrichment in broadcasting
- 1.2.8 Aggregation and Mashups of Infrastructure Data
- 1.2.9 Data Sharing
- 1.2.10 RESTful Interactions
- 1.2.11 Hosting POSTed Resources
- 1.2.12 LDP and Authentication/Authorization
- 1.2.13 Sharing binary resources and metadata
- 1.2.14 Data catalogs
- 1.2.15 Constrained Devices and Networks
- 1.2.16 Services supporting the process of science
- 1.2.17 Project Membership Information : Information Evolution
- 1.3 Use Cases
- 1.3.1 Actors
- 1.3.2 UC-BPR1: Retrieve RDF representation of a resource
- 1.3.3 UC-BPR2: Update existing resource
- 1.3.4 UC-BPR3: Determine if a resource has changed
- 1.3.5 UC-BPR4: Delete resource
- 1.3.6 UC-BPR5: Create resource
- 1.3.7 UC-BPC1: List resources within a container
- 1.3.7.1 Assumptions
- 1.3.7.2 Scenarios
- 1.3.7.2.1 Primary Scenario: List contained resources but not their properties
-
- 1.3.8 UC-BPC2: Create resource within a container
- 1.3.9 UC-BPC3: Retrieve non-member properties of a container
- 1.3.10 UC-BPC4: Add existing resource or container to a container
- 1.3.11 UC-BPC5: Update container non-membership properties
- 1.3.12 UC-BPC6: Determine if a container has changed
- 1.3.13 UC-BPC7: Delete a container
- 1.3.14 UC-BPC8: Remove a resource from a container without deleting it
- 1.4 Requirements
- 1.5 Acknowledgements
- 1.6 References
1 Linked Data Platform Use Cases And Requirements
This is a working document used to collect use cases and requirements for consideration by the WG. The starting point comes from Linked Data Basic Profile Use Cases and Requirements.
1.1 Scope and Motivation
1.2 User Stories
1.2.1.1 Analysis
The user story above includes the the following functional requirements:
The story describes an ideal situation where "we could update [contact] information in one spot." Such a master copy of a collection of contacts is represented as a container resource (Basic Profile Container).
- The platform should "support how to acquire a link to a contact." This is an example of use-case #UC-BPC1: List resources within a container.
A "common understanding of the resource" would be supported by using a well-known ontology such as FOAF (Friend of a Friend) to capture contact details. In addition to this, it should be possible, even at runtime, to "add some application-specific data about my contacts that the original design didn’t consider."
- It should be possible to "easily create a new contact and add it to my contacts." Contact details are captured as a resource (Basic Profile Resource) and it's properties. This is an example of use-case #UC-BPC2: Create resource within a container.
- A user should be able to read contact details so that they are able to interact with a contact. This is an example of use-case #UC-BPR1: Retrieve RDF representation of a resource.
"There might also be good reasons ... to maintain a local copy of the contact." HTTP clients may cache RDF representations of resources. When a contact changes "all copies of it would automatically be updated." This client-side behaviour is outside the scope of the LDP, however it should allow clients to determine whether or not contact details have changed so that they may trigger such an update.
- It should be possible to determine whether contact details have changed. This is an example of use-case #UC-BPR3: Determine if a resource has changed.
- It should be possible to update existing contact information. This is an example of use-case #UC-BPR2: Update existing resource.
- "when deleting a contact, ... it would be removed from my list of contacts." This is an example of use-case #UC-BPR4: Delete resource.
Within this story, contact information can be merged, "Regardless of whether a contact collection is my own, [or] shared." It is common for linked data publishers to use <> to define aliases between two resources; in this case between contacts in my own collection and those in a shared collection (see <>). The server may or may not support the dereferencing of sameAs links; this is outside the scope of the LDP. However, the data source can be treated as an independent actor within the use-case, leaving it free to perform this function or not, as the application demands.
1.2.2.1 Analysis
This describes a scenario where is is possible to "build a set of bookmarks" to our personal information. The LDP makes it possible to identify each resource of interest with a consistent URI. A "single consistent application interface" is provided by a RESTful HTTP interface and the exchange of RDF representations.
- The requirement "to examine or change their contents" are examples of use-cases #UC-BPR1: Retrieve RDF representation of a resource, #UC-BPR2: Update existing resource, and #UC-BPR4: Delete resource.
This user story emphasises that, directly or indirectly, containers may contain other containers. For example, "a collection of accounts for each of its collection of customers".
- Basic Profile Containers are a kind of Basic Profile Resource, therefore it is possible to directly create a container within another with use-case #UC-BPC2: Create resource within a container.
1.2.3.1 Analysis
OSLC Services use HTTP for create, retrieve, update and delete operations on resources. The OSLC core specifies the following resource operations:
- An OSLC client can HTTP GET a representation of a resource.
- Resource creation: To create an OSLC Resource, an OSLC client HTTP POSTs a representation of that resource to a Creation URI. See #UC-BPC2: Create resource within a container.
- Resource removal: To delete an OSLC Resource, a client performs an HTTP DELETE on the resource's URI. See #UC-BPR4: Delete resource.
- Resource update: To update an OSLC Resource, a client uses HTTP PUT to send the new representation to the resource's URI. See #UC-BPR2: Update existing resource.
- Resource paging: Enables clients to retrieve resources one page at a time. This scenario is captured in #UC-BPC1: List resources within a container.
1.2.4.1 Analysis
The 'Digital Objects Cluster' in LLD-UC." This is an example of #UC8: Add existing resource to a container.
- Enrichment: "Enable end-users to link resources together." New triples are added to the description of a resource in #UC-BPR2: Update existing resource.
- Browsing: "Support end-user browsing through groups and resources that belong to the groups." Browsing the content of a group is achieved in #UC-BPC1: List resources within a container, and by following links expressed in the RDF returned by #UC-BPR1: Retrieve RDF representation of a resource.
-." See #UC-BPC3: Retrieve non-member properties of a container.
- Collections discovery: "Enable innovative collection discovery such as identification of nearest location of a physical collection where a specific information resource is found or mobile device applications ... based on collection-level descriptions." The Basic Profile does not define how clients discover BPCs.
- Community information services: Identify and classify collections of special interest to the community.
1.2.6.1 Analysis
This story raises questions about the privacy and security of health information. In the US this requires compliance with the Health Insurance Portability and Accountability Act (HIPAA). The Privacy Rule standards address the use and disclosure of "individually identifiable health information" called “protected health information” (PHI). A goal of the Privacy Rule is to assure that an individual's health information is properly protected while allowing the flow of health information needed to provide and promote high quality healthcare as described above. Consequently, there are no restrictions on the use or disclosure of properly de-identified health information.
1.2.8.1 Analysis
The LDP specification supports scenarios that are "pull-based, where the data is requested from data sources." While out of scope, push-notifications may be supported by implementations.
1.2.9.1 Analysis
LDP implementations may employ different strategies for achieving scalable performance, including the use of federated web-servers as described.
1.11.1 Analysis
This relates to #UC-UC-BPC2: Create resource within a container. How does the new resource, in this case '_:newBug' relate to the POSTed representation.
1.2.2.13.
1.2.13.1 Analysis
(Andy):
A key issue for our work is whether to link these two elements or treat them separately:
Coupled: treat as a single BPR - one implication might be to allow a single POST/PUT with RDF and non-RDF parts, and have the BPR server manage the URI naming for the non-RDF part.
Separate: treat as the RDF data as a BPR - one implication might be that the image to be put somewhere with a URL, then receive just the metadata as a BPR which references the URL.
1.2.2.15.2.16 Services supporting the process of science
General mov.
Specific requirements
-).
- Compatibility with access control that can reflect the needs for privacy and publication at different stages of the research lifecycle.
1.2.17 Link
See also Maintaining Social Contact Information.
1.3 Use Cases
In the scenarios that follow, there are a number of commonly used namespace prefixes:
@prefix rdf: <>. @prefix rdfs: <>. @prefix bp: <>. @prefix xsd: <>. @prefix foaf: <>. @prefix wdrs: <>.
1.3.1 Actors
- Client: The client communicates with the LDP via an HTTP RESTful RDF protocol. It may cache RDF representations returned by the LDP.
- Data Source: The LDP communicates with one or more data sources that may perform application specific inference, such as type and sameAs closure.
1.3.2 UC-BPR1: Retrieve RDF representation of a resource
The LDP server accepts a GET request for a particular resource URI, returning an RDF representation comprising triples relevant to that resource. The request accept header specifies the required media type for the returned RDF serialization.
1.3.2.1 Assumptions
1.3.2.2 Scenarios
1.3.2.2.1 Primary Scenario: Request RDF representation of an information resource
In the basic case, the requested resource is an information resource:
- The client performs a GET request on a URI identifying a resolvable information.
The data source holds social contact information about Alice and Bob, and the client requests contact details for Alice. In this example the contact details make no distinction between the information resources and the people they describe.
@prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>; foaf:knows :bob. :bob a foaf:Person; rdfs:label "Bob"; foaf:mbox <mailto:bob@example.com>.
The resource identified by <> is requested below:
GET HTTP/1.1 Host: example.com Accept: text/turtle
The response describes Alice, but not Bob :
HTTP/1.1 200 OK Content-Type: text/turtle ETag: "123456789" @prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>; foaf:knows :bob.
1.3.2.2.2 Alternative Scenario: Request RDF description of a non-information resource
In the case that the URI is unresolvable, the LDP server may redirect the URI to a resolvable BPR.
- The client performs a HTTP GET request on a URI identifying a non-information resource.
- The server answers with an HTTP 303 See Other response code, redirecting the client to an information resource.
- The client performs an HTTP GET request on the resolvable BPR, with an accept header requesting information in the required format.
- The server answers with a HTTP response code 200 OK and sends the client the requested RDF representation.
The data source holds social contact information about Alice and Bob, and the client requests contact details for Alice. The wdrs:describedby relationships introduce a distinction between things and their descriptions.
@prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>; foaf:knows :bob; wdrs:describedby :alice.rdf. :bob a foaf:Person; rdfs:label "Bob"; foaf:mbox <mailto:bob@example.com>; wdrs:describedby :bob.rdf.
In this case, the <> resource is redirected to it's descriptive URI, <>.
GET HTTP/1.1 Host: example.com Accept: text/turtle
The first response is the 303 redirect to <>.
HTTP/1.1 303 See Other Location:
The client performs a GET of the returned location:
GET HTTP/1.1 Host: example.com Accept: text/turtle
The response includes information about <> and anything it describes.
HTTP/1.1 200 OK Content-Type: text/turtle ETag: "123456789" @prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>; foaf:knows :bob; wdrs:describedby :alice.rdf.
1.3.2.3 Non-Functional
- The response header includes the ETag for the BPR.
- The response contains a concise description (possibly application specific) of the requested resource. See <> for discussion of Concise Bounded Descriptions.
1.3.2.4 Issues
- Are non-resolvable non-information resources supported, and are they redirected to BPRs?
- Is Last-Modified returned in the entity header?
- If the describedby link is hosted on a different server, should the LDP simply redirect to that location, or fetch and merge the results with locally hosted RDF, and include the Content-Location in the response header?
1.3.3 UC-BPR2: Update existing resource
An HTTP PUT may be used to replace the current properties of a resource. Alternatively, an HTTP patch may be used to selectively update existing properties of the resource.
1.3.3.1 Assumptions
1.3.3.2 Scenarios
1.3.3.2.1 Primary Scenario: Replace the current resource in full
Replace the entire persistent state of the identified resource with the entity representation in the body of the request.
In the basic case, the requested resource is an information resource:
- The client performs a GET request on a URI identifying a Basic Profile, including the current ETag.
- The client performs a PUT on the same URI with RDF representing the updated resource, including an If-Match header with the current (expected) ETag.
- The server communicates the updated RDF representation to the data source, comparing ETags.
- The server responds with an appropriate status code
The data source holds social contact information about Alice, and the client wishes to update the email contact details for her.
@prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>.
The client performs an initial HTTP GET to establish the current state of the resource.
GET HTTP/1.1 Host: example.com Accept: text/turtle
As well as the RDF state, the client saves the ETag.
HTTP/1.1 200 OK Content-Type: text/turtle ETag: "123456789" @prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>.
The resource identified by <> is updated below, including the current ETag:
PUT HTTP/1.1 Host: example.com Content-Type: text/turtle If-Match: "123456789" @prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.org>.
The response confirms the update:
HTTP/1.1 200 OK Content-Type: text/turtle ETag: "123456790"
1.3.3.2.2 Alternative Scenario: Selective update of the resource
Selectively add and remove properties to and from the identified resource.
- The client performs a HEAD request on a URI identifying a basic profile resource.
- The server answers with HTTP response code 200 OK and returns ETag.
- The client sends an HTTP PATCH describing the updates.
- The server response describes the final updated state of the resource.
The data source holds social contact information about Alice, and the client wishes to update the email contact details for her.
@prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>.
The client may perform an HTTP HEAD to get the current ETag.
HEAD HTTP/1.1 Host: example.com Accept: text/turtle
The response contains the ETag header that will be added to the PATCH.
HTTP/1.1 200 OK Content-Type: text/turtle ETag: "123456789"
The resource identified by <> is updated below, including the current ETag. The PATCH is defined here using a changeset.
PUT HTTP/1.1 Host: example.com Content-Type: text/turtle If-Match: "123456789" @prefix : <>. @prefix cs: <> <change1> a cs:ChangeSet ; cs:subjectOfChange :alice ; cs:createdDate "2012-01-01T00:00:00Z" ; cs:changeReason "Update mbox" ; cs:removal [ a rdf:Statement ; rdf:subject :alice ; rdf:predicate foaf:mbox ; rdf:object <mailto:alice@example.com> . ] ; cs:addition [ a rdf:Statement ; rdf:subject :alice ; rdf:predicate foaf:mbox ; rdf:object <mailto:alice@example.org> . ] .
The response confirms the update:
HTTP/1.1 200 OK Content-Type: text/turtle ETag: "123456790" @prefix : <>. :alice a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.org>.
1.3.3.3 Non-Functional
1.3.3.4 Issues
- Should the basic profile recommend at least one patch format, so that we are able to develop concrete examples and test-cases; for example the Talis Changeset <>.
1.3.4 UC-BPR3: Determine if a resource has changed
The client may use the entity tag associated with a resource to determine if it has changed. In the simplest scenario, the client may perform an HTTP HEAD to retrieve and compare the latest entity tag with the entity tag of the cached copy. Alternatively, the client may conditionally request the resource using an HTTP GET with an 'If-None-Match' and the last known entity tag.
1.3.4.1 Assumptions
1.3.4.2 Scenarios
1.3.4.2.1 Primary Scenario: Use HTTP HEAD to retrieve ETag
1.3.4.2.2 Alternative Scenario: Conditional HTTP GET using 'If-None-Match'
1.3.4.3 Non-Functional
1.3.4.4 Issues
- Can the Last-Modified date be used in addition to the entity tag?
1.3.5 UC-BPR4: Delete resource
An HTTP DELETE is issued by the client to delete the resource and all it's properties, on the server.
1.3.5.1 Assumptions
1.3.5.2 Scenarios
1.3.5.2.1 Primary Scenario
1.3.5.3 Non-Functional
1.3.5.4 Issues
1.3.6 UC-BPR5: Create resource
A resource may be created independently of a container using HTTP PUT.
1.3.6.1 Assumptions
1.3.6.2 Scenarios
1.3.6.2.1 Primary Scenario
1.3.6.3 Non-Functional
1.3.6.4 Issues
1.3.7 UC-BPC1: List resources within a container
The LDP server accepts a GET request for a particular container resource, returning an RDF representation comprising information about that container and the resources that it contains. The properties for each resource may be retrieved at the same time, or separately. When the contents of a container are too numerous, it may be paginated.
1.3.7.1 Assumptions
1.3.7.2 Scenarios
1.3.7.2.1 Primary Scenario: List contained resources but not their properties
The accept header specifies the required media type for the returned RDF serialization.
This scenario is based on the user-story #Maintaining Social Contact Information. The LDP holds social contact information in a container called /mycontacts (an information resource).
<> a bp:Container; rdfs:member <>, <>. <> a foaf:Person; rdfs:label "Alice"; foaf:mbox <mailto:alice@example.com>; foaf:knows :bob. <> a foaf:Person; rdfs:label "Bob"; foaf:mbox <mailto:bob@example.com>.
The user requests information about the container resource.
GET HTTP/1.1 Host: example.com Accept: text/turtle
The response should include information about the container and references to contained resources, but not information about them.
<> a bp:Container; rdfs:member <>, <>.
- The member resources may include non-information resources.
1.3.8 UC-BPC2: Create resource within a container
An HTTP POST to the target container, including a representation of the new resource, creates a new resource with the provided properties within that container.
1.3.8.1 Assumptions
1.3.8.2 Scenarios
1.3.8.2.1 Primary Scenario
1.3.8.3 Non-Functional
1.3.8.4 Issues
- How does the created resource relate to the RDF description? See #Hosting POSTed Resources. Specifically, in the supplied representation does the document base have the same referent as the created resource?
- Should POST support a user supplied local-name 'hint', to support more human-readable URIs?
1.3.9 UC-BPC3: Retrieve non-member properties of a container
1.3.9.1 Assumptions
1.3.9.2 Scenarios
1.3.9.2.1 Primary Scenario
1.3.9.3 Non-Functional
1.3.9.4 Issues
1.3.10 UC-BPC4: Add existing resource or container to a container
The same resource may be a member of multiple containers.
1.3.10.1 Assumptions
1.3.10.2 Scenarios
1.3.10.2.1 Primary scenario: Add a pre-existing resource to a container
1.3.10.3 Non-Functional
1.3.10.4 Issues
- According to the Linked Data Basic Profile 1.0, PUT and PATCH should not be used:- "BPC servers should not allow HTTP PUT to update a BPC’s members" and should only use "HTTP PATCH as the preferred method for updating BPC non-membership properties." See ISSUE-7.
- As BPCs as noted as being potentially large memberships, sending a whole, updated BPC after changes is not practical. See ISSUE-7.
1.3.11 UC-BPC5: Update container non-membership properties
Use HTTP PUT or HTTP PATCH to update a BPC's non-membership properties.
1.3.11.1 Assumptions
1.3.11.2 Scenarios
1.3.11.2.1 Primary Scenario
1.3.11.3 Non-Functional
1.3.11.4 Issues
1.3.12 UC-BPC6: Determine if a container has changed
1.3.12.1 Assumptions
1.3.12.2 Scenarios
1.3.12.2.1 Primary Scenario
1.3.12.3 Non-Functional
1.3.12.4 Issues
1.3.13 UC-BPC7: Delete a container
1.3.13.1 Assumptions
1.3.13.2 Scenarios
1.3.13.2.1 Primary Scenario
1.3.13.3 Non-Functional
1.3.13.4 Issues
- Where BPR's are managed by a container, they may be deleted along with the container. See ISSUE-7, 'The doc talks about the "the BPC that was used to create it [BPR]"
(5.6.2) and "should remove it from any other containers..." This means the creating container is distinguished and needs to manage the BPRs is creates separately from those it did not.'
1.3.14 UC-BPC8: Remove a resource from a container without deleting it
1.3.14.1 Assumptions
1.3.14.2 Scenarios
1.3.14.2.1 Primary Scenario
1.3.14.3 Non-Functional
1.3.14.4 Issues
1.4
|
http://www.w3.org/2012/ldp/wiki/index.php?title=Use_Cases_And_Requirements&diff=prev&oldid=509
|
CC-MAIN-2015-11
|
refinedweb
| 3,831
| 51.95
|
As example, consider the simple bobo application as follows:
import bobo
@bobo.query
def hello():
return "Hello world!"
All one has to do to turn this into a WSGI script file suitable for use with mod_wsgi is add the single line:
application = bobo.Application(bobo_resources=__name__)
This one line creates an instance of the bobo WSGI application object and assigns it to 'application', the name of the WSGI application entry point which mod_wsgi expects to exist.
The '__name__' variable here is the name of the Python module containing the code. In other words, you are telling bobo to map requests back onto the same code file.
For normal Python modules the '__name__' variable, which is automatically put there by Python, would be the module name and or package path used when importing the module. For mod_wsgi the variable doesn't have quite the same meaning, but still exists, and is still used as the key into 'sys.modules' where the loaded module is placed.
To map the bobo application file at a specific URL, one uses WSGIScriptAlias or AddHandler mechanisms as normal for mod_wsgi.
In mod_wsgi 3.0 there is also a new feature that one could use to define a handler script for all bobo application script files and which transparently performs the job of creating the instance of 'bobo.Application()' for you. If this were used, one could place bobo application script files in a directory using a specific extension, just like with PHP, and not even have to worry about adding the line above. Any change to those files would also result in the process being reloaded if using mod_wsgi daemon mode. I'll talk about this trick another time.
|
http://blog.dscpl.com.au/2009/08/using-bobo-on-top-of-modwsgi.html
|
CC-MAIN-2017-30
|
refinedweb
| 283
| 62.58
|
Summary
This step-by-step article shows you how to apply an Extensible Stylesheet Language (XSL) Transformation (XSLT) to an Extensible Markup Language (XML) document by using the XslTransform class to create a new XML document. XSL is an XML-based language that is designed to transform one XML document into another XML document or an XML document into any other structured document.
This article assumes that you are familiar with the following topics:
RequirementsThis list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
- Microsoft Visual Studio 2008, Microsoft Visual Studio 2005, or Microsoft Visual Studio .NET.
- Microsoft .NET SDK QuickStarts
- XML terminology
- Creating and reading an XML file
- XML Path Language (XPath) syntax
- XSL
Steps to build the sampleThis example uses two files that are named Books.xml and Books.xsl. You can create your own Books.xml and Books.xsl files or use the sample files that are included with the .NET Software Development Kit (SDK) QuickStarts. You must copy the Books.xml and Books.xsl files to the Bin\Debug folder that is located underneath the folder in which you create this project. These files can be found in the following folder:
..\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\QuickStart\Howto\Samples\Xml\Transformxml\Cs
- Create a new C# console application in Visual Studio 2008 or in an earlier version of Visual Studio.
- Make sure that the project contains a reference to the System.Xml namespace, and add a reference if it does not.
- Specify the using statement on the Xml and Xsl namespaces so that you are not required to qualify declarations in those namespaces later in your code. You must use the using statement prior to any other declarations.
using System.Xml;
using System.Xml.Xsl;
- Declare the appropriate variables, and declare an XslTransform object to transform XML documents.
XslTransform myXslTransform;
- Construct a new XslTransform object. The XslTransform class is an XSLT processor that implements the XSLT version 1.0 recommendation.
myXslTransform = new XslTransform();
- Use the Load method to load the XslTransform object with the style sheet. This style sheet transforms the details of the Books.xsl file into a simple ISBN list of books.
myXslTransform.Load("books.xsl")
- Call the Transform method to initiate the transformation, passing in the source XML document and the transformed XML document name.
myXslTransform.Transform("books.xml", "ISBNBookList.xml");
- Build and then run your project. You can find the resultant ISBNBookList.xml file in the Bin\Debug folder under your project file's folder.
Complete code sample
using System;
using System.Xml;
using System.Xml.Xsl;
namespace XSLTransformation
{
/// Summary description for Class1.
class Class1
{
static void Main(string[] args)
{
XslTransform myXslTransform;
myXslTransform = new XslTransform();
myXslTransform.Load("books.xsl");
myXslTransform.Transform("books.xml", "ISBNBookList.xml");
}
}
}
References
For more information about the XslTransform class with the XslTransform object, visit the following MSDN Web site: MSDN Magazine. To do this, visit the following MSDN Web site:
Özellikler
Makale No: 307322 - Son İnceleme: 15 Kas 2012 - Düzeltme: 1
|
https://support.microsoft.com/tr-tr/help/307322/how-to-apply-an-xsl-transformation-to-an-xml-document-by-using-visual-c
|
CC-MAIN-2017-22
|
refinedweb
| 501
| 50.23
|
Braze Source, using Braze’s Currents product. Segment automatically collects marketing and analytics events, forwards them to your destinations, and loads them into your data warehouse.
In your favorite BI or analytics tool, you’ll be able to analyze your mobile, email, and web marketing campaign data in SQL or using drag-and-drop reports. You’ll be able to join your Braze data with the event data you’re already sending through Segment to analyze the impacts of your marketing and engagement programs.
Braze maintains this source. For any issues with the source, you can contact the Braze Support team.
If you’re interested in using Braze, contact your Braze Customer Success Manager. Braze Currents is only available in select Braze packages and can’t be configured without assistance from the Braze team.
Getting Started
- Go to Connections > Sources and click Add Source in the Segment app.
- Search for Braze in the Sources Catalog and click Add Source.
- Give the Source a nickname and click Add Source. The nickname is used as a label for the source in your Segment interface, and Segment creates a related schema name. The schema name is the namespace you’ll query against in a warehouse. The nickname can be anything, but Segment recommends sticking to something that reflects the source itself and distinguishes amongst your environments (for example,
Braze_Prod,
Braze_Staging,
Braze_Dev).
- Copy the Write Key on the Overview page.
- To finish the setup, contact Braze Support or your Customer Support Manager to activate Currents in Braze. Braze Currents is only available in select Braze packages and can’t be configured within Braze without assistance from your Braze Customer Success representative.
- Go back to Segment and click Add Destinations in your Braze source to add the destinations where you want to receive your Braze data.
Events are now sent to these destinations and automatically loaded into any warehouses you enabled.
The Braze Segment Currents integration doesn’t isolate events by different apps in a single app group. If you create more than 1 of the same Currents connectors (for example, 2 message engagement event connectors), they must be in different app groups. If you don’t do this, it leads to data deduping and lost data.
Components
Stream Braze uses Segment’s stream Source component to send events to Segment. These events are then available in any Destination that accepts server-side events, including your data warehouse.
Events
Below is a table of events that Braze sends to Segment. These events show up as tables in your Warehouse, and as regular events in your other Destinations.
Braze Event Properties
Below are tables outlining the properties included in the events listed above..
Adding Destinations
Now that your Source is set up, you can connect it with Destinations.
Log in to your downstream tools and make sure that the events are populating in your Debugger, and that they contain all of the properties you expect. If something isn’t working as you expect, see the Destination docs for troubleshooting.
If there are problems with how the events arrive to Segment, contact the Braze team.
Sending Data To Braze
The Braze Source works better when you also connect Braze as a Destination. With the Braze Destination, you can use Segment to send event data to Braze in order to target customers with messaging campaigns. Want to start sending data TO Braze? Head on over to our Braze docs.
This page was last modified: 16 Aug 2021
Need support?
Questions? Problems? Need more info? Contact us, and we can help!
|
https://segment.com/docs/connections/sources/catalog/cloud-apps/braze/
|
CC-MAIN-2021-43
|
refinedweb
| 592
| 64.51
|
Created on 2006-03-10 13:54 by hernanpd, last changed 2012-03-22 20:32 by asvetlov.
Example code:
#! /usr/bin/env python
import Dialog
from Tkinter import *
root = Tk()
Button(root, text="Hello!").pack()
root.update()
dialog = Dialog.Dialog(None, {'title': 'Test Dialog',
'text': "Text...",
'bitmap': '',
'default': 0,
'strings':
('Button0','Button1','Button2','Button3','Button4')})
print 'dialog: ', dialog.num
This example works well, except when clicking in
Button4 that fails:
Traceback (most recent call last):
File "test.py", line 12, in ?
dialog = Dialog.Dialog(None, {'title': 'Test Dialog',
File "/usr/lib/python2.3/lib-tk/Dialog.py", line 21,
in __init__
cnf['bitmap'], cnf['default'],
TypeError: getint() argument 1 must be string, not tuple
I tried to trace the error (learning in the way a
little bit of python and tcl/tk ;)), mostly due to the
bizarre nature of this problem (note that in tcl/tk
there are no problems when creating dialogs with 4 or
more buttons).
In /usr/lib/python2.3/lib-tk/Dialog/py the exception is
raised because it expects a string as the result to the
call to 'tk_dialog', and for some 'obscure' reason (and
I mean it, I even inspected the Tcl/Tk sources looking
for a reason for this) if the call to 'tk_dialog' has
more than 4 buttons (more than 4 string arguments at
the end) it return a tuple with only one element, the
string result.
The impression I got after browsing the sources of
python/tkinter and Tcl/Tk is that this may be caused
because in tcl there is almost no difference between a
list and string, in this way in the tcl language a
string or a list containing only one string are not
really different.
I have this problem when using python2.3 or python2.4
with Tcl/Tk8.4 (in my particular case under
Debian/Testing distribution);
A quick workaround (although I 'm not sure if it would
cause some problems with other things) would be to
change 'workarounds = 1' to 'workarounds = 0' in
Tkinter.py.
Another option would be to change all calls to tk
functions within tkinter that allways expect as a
result a string...
Hernan
(my apologies for making the report so long)
I just tried it here and it still happens, it also happens for the 11th
button and that is it (5th and 11th). I tried it with tk 8.4 and tk 8.5,
python-trunk, python 2.5.2.
I'm investigating this.
For some reason a pixel object is being returned inside a tuple.
_tkinter detects a ListType object, then creates a tuple with one
object, which is a pixel object and it has the value you would expect, 4
or 10.
The workaround is actually setting wantobjects to 0, which I doubt
everyone will like.
I've talked with a tcl developer and some interesting points were raised
from the talk:
1) Looking at typePtr in _tkinter isn't actually good (this is used to
convert the tcl object to a proper python object), because it may not
work always, like in this case. But the person also mentioned he didnt't
know of any good solutions to that problem.
2) Cause of the problem -- most likely: something else in the code that
creates the message box is using the literal string "5" as a
-borderwidth or a -padding or as something else that's passed to a
widget. And the compiler uses the same Tcl_Obj * for that "5" and the
"5" that you pass to [tk_dialog].
Apparently trying to fix this in Python would case some (major?) changes
in _tkinter.
This is a workaround and seems to be the way to go.
issue4333 fixes this too, btw
Interesting.. I tried testing Dialog for that bug, but generating
<Return> keypress (you can combine with keyrelease too) doesn't trigger
the problem (very weird to me). I will be simulating mouse clicks to see
if, for some reason, the bug gets noticed.
Attaching the test I tried just in case.
|
http://bugs.python.org/issue1447222
|
crawl-003
|
refinedweb
| 673
| 62.17
|
Node server framework for rapidly developing web sites, services, and APIs.
A set of nice wrapper functionality for quickly building web services
Nosef requires formidable and mime which can be found via npm.
See CHANGELOG for recent changes.
Nosef is in npm and can be installed with:
npm install nosef
Nosef provides a couple of useful functions that wrap up some of the node http functionality and provide a simple mechanism for building web applications.
var nosef = require("nosef"); function echo_handler(request, response, params) { response.JSON(params); } function hello_handler(request, response, params) { response.template("Hello {{who}}", params.url, "text/plain"); } var config = { port: 8765, urls: [ ["/echo/{{path}}", echo_handler], ["/hello/{who}", hello_handler] ] }; nosef.server(config, function() { console.log("Server started"); }, function() { console.log("Server stopped"); });
See the examples folder for more examples
A Nosef server simply listens on the chosen address and port for HTTP requests and calls handler functions based on URL patterns
To start a server, you call
nosef.server, passing in a configuration object.
var nosef = require("nosef"); var server = nosef.server(config);
The Nosef server is an instance of node's HTTP server with one additional event:
start which is emitted when the server is started
config is a configuration object of the following format:
var config = { port: 8000, // Default: 80 address: "127.0.0.1", // Default: "0.0.0.0", middleware: function(request, response) { // Middleware is optional console.log(request.url); }, urls: [ // An array of arrays mapping URL patterns to handler functions ["/echo/{{path}}", echo_handler], ["/hello/{name}", hello_handler] ] };
The config object must define a
urls parameter which contains an array of arrays that map URL patterns to handler functions as per the example above
URL patterns are strings with optional variables that match against the path requested by a client. e.g. If you visit in a browser, the path would be
/echo/and/the/bunnymen.
Variables in URL patterns can take two forms:
{name}
/)
/products/get/{id}
{{name}}
/docs/{{path}}
The
middleware parameter in the config object is a function or an array of functions that take a
request and a
response object and can act upon them for every request even if there is no URL match. Examples of use could be logging, CSRF verification, authentication etc.
Nosef has one built-in middleware function:
nosef.middleware.request_log
Simply logs out the request method and URL, e.g.
POST /index.html
A handler is a function that takes a
request, a
response, and a
parameters object as it's arguments. Nosef adds some convenience functions to the response object and parses GET, POST, and file upload data into the parameters object to save on the gruntwork.
function echo_handler(request, response, params) { response.write(params.path); };
The params object looks like:
{ url: {}, // Variables from the URL pattern get: {}, // Query string parameters post: {}, // POST parameters request: {}, // get and post values combined files: {} // A map of uploaded file names to file objects }
The file objects are created by formidable.
The extensions to the response object are:
response.JSON(object)
response.not_found(message)
response.error(message, code)
Returns an HTTP error code back to the client with a message.
code is optional and defaults to 500
response.template(template_string, content, content_type, escape_html)
Replace variables in
template_string with values in
content as per the description of templates below.
content_type is the content type string to return to the client along with the filled-in template; it defaults to "text/html"
If
escape_html is true, values in
content will have special HTML character (e.g. < and >) escaped as HTML entities (e.g. < and >).
response.file_template(template_path, content, content_type, escape_html)
response.templateexcept that the template is loaded from
template_pathand cached (so it won't be loaded next time it's needed)
response.redirect(redirect_url, permanent)
permanentis true) to redirect the client to
redirect_url
Additionally, there are a couple of functions in
nosef.handlers which serve as a convenience to quickly create handlers to do simple things. For example:
nosef.handlers.file("./media_folder", "path")
This will map a URL parameter called
path (specify it in the URL pattern such as
/media/{{path}}) and serve files from the local folder
./media_folder.
nosef.handlers.file("./robots.txt")
This will simply serve the contents of the file
robots.txt to the URL it is bound to.
nosef.handlers.redirect("", true);
This will redirect the client to. The second parameter indicates whether the redirect is permanent or temporary;
true for permanent.
You can use these convenience handlers in the place of a normal handler. For example:
var config = { urls: [ ["/media/{{ path }}", nosef.handlers.file("./media_folder", "path")] ] };
Nosef includes a simple system for reading and caching template files and then merging data into them before sending the result out to the client.
Templates are used by calling
response.template from within a handler. Variables passed to
response.template should be stored in an object and can be retrieved in the template using some very simple notation:
Property names of the object passed in should not contains spaces.
If you have a content object that looks like this:
var content = { foo: "This is foo", bar: { stool: "A bar stool", bar: "Black sheep", things: { i: "eye", four: 4 } }, array: ["first", "second", "third"] }
You could use the following template to access them all:
Foo is "{{foo}}" Bar: Stool: {{bar.stool}} Bar: {{bar.bar}} Things: {{bar.things.i}} and {{bar.things.four}} Array: {{array.0}}, {{array.1}}, and {{array.2}}
There is also two very basic conditional blocks.
{% if bar.stool %}There is a bar stool!{% endif %}
This checks that there is a variable called bar.stool and if so, displays the content.
{% if not bar.stool %}There is no bar stool!{% endif %}
This does the opposite of 'if'.
Nosef is released under the BSD license. See the
COPYING file for more information
|
https://www.npmjs.com/package/nosef
|
CC-MAIN-2015-48
|
refinedweb
| 961
| 57.77
|
src/examples/example.py
Python interface
Basilisk also includes a high-level interface for the Python programming language.
This example documents how to use this interface to setup the decaying two-dimensional turbulence simulation.
First check that Basilisk is configured properly for use with Python.
Basilisk python module
The first step is to create a python module importing the necessary functions from Basilisk. For this example we just need to create a file called stream.c with the following lines
#include "grid/multigrid.h" #include "navier-stokes/stream.h"
i.e. we will use the streamfunction–vorticity Navier–Stokes solver with a multigrid discretisation.
To create the corresponding python module, assuming that a Makefile has been setup properly, we can just do
make stream.py
Python program
The next step is to create the python program itself, let’s call it example.py.
We first import matplotib, numpy and our Basilisk module.
from __future__ import print_function import matplotlib.pyplot as plt import numpy as np import stream as bas
We setup a numpy regular grid which will hold the values interpolated from the Basilisk field.
N = 256 x = np.linspace(0, 1, N) y = np.linspace(0, 1, N) X,Y = np.meshgrid(x,y)
We define a function which sets initial conditions for the vorticity \omega: a white noise.
def init(i,t): bas.omega.f = bas.noise
We define a function which uses matplotlib to generate a graph of the \omega field.
def graph(i,t): print ("t=",t) Z = bas.omega.f(X,Y) plt.cla() plt.imshow(Z) plt.pause(0.0001)
We setup Basilisk’s resolution to match that of our numpy grid.
bas.init_grid(N)
We register the initial condition (at t=0) and graph function (at t = 0,10,20,…,1000).
bas.event(init, t = 0.) plt.ion() plt.figure() bas.event(graph, t = range(0,1000,10))
We run the simulation.
bas.run()
|
http://basilisk.fr/src/examples/example.py
|
CC-MAIN-2021-39
|
refinedweb
| 321
| 60.51
|
The Use of Property Law Tools for Soil Protection
Abstract
Where conservationists are dissatisfied with public measures of soil protection, property law may provide a vehicle for private action to meet soil protection goals. Specifically, this chapter explores how property law concepts could be used to conserve soil. One can always decide as a landowner to engage in soil protection measures, but landownership is a limited soil conservation strategy. Instead, this chapter explores how NGOs or interested parties could use future interests or partial property rights to constrain land use in a way that will be most protective of soils. Using the United States as an example (but detailing a worldwide pattern of developing partial property rights), this chapter shows how traditional servitude law may be able to protect some soils, but its reach is limited. Instead, jurisdictions are building on previous property law concepts to create new structures. The most popular of which is the conservation easement, a nonpossessory right in land with a conservation goal that can be enforced in perpetuity. This chapter explains the strengths and weaknesses of various property rights approaches and ends with a caution to tread carefully when using perpetual tools in a changing world.
Literally speaking, the health and the productivity of the ground that we stand on will largely determine the future prosperity and security of humankind.1
1 Introduction
While there is no doubt among conservationists that protection of the soil is important for the health and prosperity of the planet,2 it is a resource that fails to garner the same attention as other aspects of our natural world. Even in the realm of land conservation, an area that one might think would be dominated by questions of soil health and conservation, the discussion is more likely to center on scenic values, water, biodiversity, and other ecosystem services. Such an approach may be particularly shortsighted in a world marked by climate change.
Soil conservation practices can do more to mitigate climate change than other approaches, and the role of healthy soil in adaptation efforts is unquestionable.3 As protecting the soil can be more forward thinking than making land‐conservation decisions based on other environmental characteristics, soil protection can be viewed as environmental protection writ large.
As conservationists have considered how to incorporate climate change into their planning, some have advocated for shifting from a focus on species or even on the historical or present ecosystems to thinking about “conserving nature’s stage.”4 That is, some conservation scientists recommend looking at the geophysical characteristics of a landscape, advocating that we shift our conservation focus from current ecosystems and refugia to something that considers the potential ecosystem makeup, and these researchers assert that the best way to make that assessment is by considering soils, geology, elevation, and similar characteristics.5 This suggests that looking at the geological composition of the landscape and the components of the soil will provide better indicators of which lands are worthy of protection. Indeed, they argue that examination of the conditions beneath the surface may be the most useful in determining which ecosystems (and their associated services) will be able to thrive as the climatic conditions change.6 This approach to conservation (which is gaining broader acceptance)7 highlights the importance of soil integrity as an element of ecosystem protection.
The international community has recognized the importance of soil protection. We can see this most prominently in the Sustainable Development Goals and the United Nations Convention to Combat Desertification. The Sustainable Development Goals (a project led by the United Nations with the support of over 190 countries) set 17 global goals with 169 total targets within those goals.8 Goal 15 is to “[p]rotect, restore and promote sustainable use of terrestrial ecosystems, sustainably manage forests, combat desertification, and halt and reverse land degradation and halt biodiversity loss.”9 This goal clearly ties to the conservation of soil, and the goal’s 12 targets with their indicators show an even stronger link.10
Target 15.3 gives a clear mandate from the international community as it seeks to “combat desertification, restore degraded land and soil, including land affected by desertification, drought and floods, and strive to achieve a land degradation-neutral world.”11 The Sustainable Development Goals set a date of 2030 for meeting this target and lists “proportion of land that is degraded over total land area” as the indicator for determining whether the goal has been met (but does not dictate what this proportion must be).12 Referred to as Land Degradation Neutrality or LDN, Target 15.3 has been a focus of the UN Convention to Combat Desertification (UNCCD) and the United Nations Environment Programme (UNEP).13 Thus identified as a major concern of our era, the negative trends on land and soil has harmed food and water security and reduced the ability of communities to be resilient in the face of climatic changes.14 Moreover, soil health is indicative of agricultural productivity.15
Achieving land degradation neutrality is no easy task, and the established work plan begins with a target-setting process where countries determine national baselines, set land degradation targets, and explore measures to reach those targets.16 Currently, over 100 countries are involved in this effort.17 The hardest step in this process is undoubtedly trying to determine (and then implement) the strategies that actually conserve the land. Once we acknowledge that soil conservation is important, what can we do to prevent degradation and promote and protect healthy soils? How can we actually reach the land neutrality targets, and equally importantly, how can we ensure that we do not backslide once those targets have been achieved? How do we maintain the vigilance needed to ensure that successful land protection projects remain in place? Additionally, once we agree that soils should be protected, we need to identify which soils. Which areas should we choose? How should we choose them? Acknowledging that some development is not only inevitable but desirable, we do not want to protect all soils to the detriment of other societally beneficial land uses.
This chapter seeks to explore these questions through the lens of property law, with a focus on the development of property law in common law countries but with an acknowledgment that these arrangements occur all over the world, with different terms but similar concepts. This chapter begins in Sect. 2 with a brief glimpse into how countries are addressing soil conservation before investigating, in Sect. 3, public and private approaches to land degradation. From there, the chapter touches briefly on the contract law approach to conservation in Sect. 4 before describing in detail the property law approaches in Sect. 5—the heart of the chapter. These property law tools vary from complete control over a parcel to limited ability to control certain aspects of land use for a limited time. There is a variety of property law tools available, and this area continues to develop. Land conservationists, however, must consider their choice of property tool carefully as the restrictions can be hard to change and may not always be consistent with changing societal needs. Thus, the chapter ends in Sect. 6 with a note of caution.
2 Soil Protection and Land Conservation
To understand the role that law can play in soil conservation, we can begin by thinking about the measures that countries might use to meet those land conservation antidegradation targets. To consider a few examples (but far from an exhaustive list), we see that some countries are focusing on protection of forestland and planning to implement projects to restore degraded forests.18 Other countries are working to promote sustainable land management. For example, in Kenya, the government is promoting sustainable land management as a way to achieve land degradation neutrality.19 Colombia, which identifies its major soil concern as erosion, has created a national policy for sustainable soil management.20 Some projects focus on simply ceasing restrictive activity, while others call for more active land management behavior. How do we protect such land though, and once you have implemented your on-the-ground projects, how do you ensure that they remain in place?
For most countries, we do not yet have information about land protection goals or implementation. We are quite a way off from having implementation plans or rules for conservation. Most countries are at the stage of formulating their plans. They are identifying their priorities and setting goals, but they have not drilled down into all the details of how the targets will be reached. Countries set land degradation neutrality targets and then work with the United Nations and other agencies to help meet those targets. This chapter can help with that phase. As we seek to protect land and prevent further degradation, the mechanisms available through property law may facilitate building rules for ecological management.
3 Approaches to Land Conservation
There are a number of legal tools at our disposal for soil protection. We can largely think of the approach as following either a public route or a private one. In terms of public land protection, we see governments controlling the land uses and practices on government-held land. We also see the government acting as a regulator. In legislating for the public health, safety, and welfare, governments at all levels constrain individual behavior with the hope of improving environmental conditions. Thus, the public land conservation route involves the government either constraining its own behavior or constraining the behavior of people within its jurisdiction. Unfortunately, our public regulations have focused on pollution control and land use without addressing soil health and protection directly.
On the private actor side, we look to nonprofit organizations and individuals who do not have the power to legislate as governments do. Nor do they hold the power to acquire land for public use through eminent domain or similar mechanisms. This leaves private actors with the more traditional private law tools of torts, contracts, and property law. Tort law has not been particularly helpful in soil conservation, offering only limited assistance in the realm of nuisance law. Contract law and property law have been more promising, with the use of property law flourishing in the context of land conservation.
This section considers both public and private land conservation strategies from the legal perspective. It begins with an overview of the public conservation efforts and then addresses the private methods. The following section goes into more detail about the workings and potentials of property law as a land conservation avenue.
3.1 Public Land Conservation
A primary tool of land conservation worldwide is government ownership of at-risk areas. The government then places these special areas under its protection and limits the activities that can be done on the land. In this way, we have something that looks like state action, but, in reality, the state is behaving more like a run-of-the-mill private landowner who can decide what she wants to do with her land and chooses to be as environmentally protective as she wants to be. A difference occurs between the private landowner and the state as landowner because many jurisdictions view the state as having an obligation to protect the land and other natural resources on behalf of its citizens. Sometimes called the public trust doctrine, this theory places differing level constraints on government behavior in different countries.21
Beyond acting as a conservation-minded proprietor or landowner, the government can also protect soils by regulation of harmful activities, something common and uncontroversial in most countries. For example, government agencies can mandate specific agricultural techniques or limit the amount of developable land area on a parcel. The effectiveness of such a technique depends on the strength of the governmental institutions, on other legal structures and restrictions, and on the capacity of the governmental entities involved. It may be particularly hard, for example, for government officials to monitor agricultural or forestry practices. Such an action clearly requires a lot of funding and staff—not something always in ample supply. In fact, constraints on public entities and their lack of capacity to monitor the land have led to (1) government entities building partnerships with NGOs and seeking their assistance in implementing or enforcing public goals and (2) NGOs setting out on their own to protect soils based on their belief that the government is not doing an adequate job on this task. In the first scenario, we see that even what we label as public land conservation can be dominated by private action. In the second, we see a frustration with public action leading to an increase in private action. Either way, the pattern seems to be an increasingly important role for private conservationists.
3.2 Private Land Conservation
Contrasted with public efforts are the private law avenues for land conservation. As noted above, this often occurs where conservationists are dissatisfied with the public methods or extent of conservation. Where a private organization or individual seeks to protect soils, however, the legal tools available for such protection vary. NGOs do not have the same ability to pass laws and promulgate regulations to shape land use as government entities do. Nor do they have the power of acquiring land through eminent domain. Instead, NGOs and the government agencies that they work with are turning to other legal tools that are better fits, in what we think of as the realm of private law. Most markedly, this occurs in the realm of contract law and property law.
When we discuss private land conservation efforts, we need to identify the private parties we are talking about. While one might envision wealthy individuals with an interest in environmental protection taking action in this realm,22 we are mostly referring to nongovernmental organizations: NGOs of different sizes and styles that come together to use property and contract law to protect the land. Notice that these NGOs differ from other environmental NGOs because of the tools they use. Less likely to spend energy on lobbying politicians or using public pressure or litigation to achieve their goals, these NGOs are less likely to be seen organizing a protest or circulating a petition (although of course some of them engage in such activities). Instead, we see a class of NGOs that focus their time and energy on securing property rights to land (or entering into contracts with landowners). We are particularly interested here in the NGOs that use property tools. In the United States, these organizations are labeled land trusts, perhaps because of their link to older trustee organizations but also because of their link to older ideas of trust lands in both the United States and the United Kingdom (school trust lands, the National Trust, etc.). In Latin America or Europe, these groups are often labeled land custodians, land stewards, or custodial entities. Phrases that also seem to indicate a standard of care regarding the land that is something more than landownership.
While we are chiefly interested in this chapter with exploring the property law tools available for soil conservation, a brief foray into contract law can help illustrate the options available and why property law has become the tool of choice.
4 Contracts for Land Conservation
Contract law can serve as an avenue for land conservation. Landowners can enter into contracts with NGOs that take the form of payments for ecosystem services.23 The landowner agrees to engage in certain land-use practices that enhance or preserve the soil (or perhaps agrees to refrain from engaging in activities that would damage the soil).24 In return (as consideration), the NGOs provide the landowners with payments or some other valuable item (facilitating a permit application, for example).25 The contract agreement protects the individual parcel to which it applies and can be tailored to fit the circumstances involved. Thus, the contract can be a more fine-tuned tool than a government regulation, which is likely to apply more broadly. Contracts are voluntary, though, and will only be useful where the landowner is willing to be bound by one. The parties involved negotiate the terms, and it may be hard to create coherent rules across parcels as the landowners involved might have different goals for the land or ecology.
There is, however, an even greater concern than coherency with contract law in that a contract only binds the parties that enter into the contract. In the realm of soil conservation, this means that only the landowner who signed the contract will be required to comply with the terms of the contract. If the landowner sells the property, the restrictions will not be enforceable against the subsequent landowner. Therefore, whenever a landowner wants to change land uses, she need only sell the land to wipe the restrictions away. Thus, a more desirable restriction is one that binds even the subsequent landowners. But we do not do that with contract law—we do not like to require things of nonparties. This is where property law comes in handy for NGOs that believe that the government is not doing enough through public law.
5 Property Restrictions for Land Conservation
Unlike contract law, property rights in the land can be associated with a parcel and not solely with an individual. Property rights come in many shapes and sizes, and this section describes different types of property rights before delving more deeply into the partial nonpossessory property rights that have become the favored tool of land conservationists in the United States that we now see spreading across the globe.
For purposes of our discussion here, we can group property rights into full or partial and possessory or nonpossessory. The sections below describe each type and illustrate how the nonpossessory partial interest in land has become a particularly useful tool for conservation.
5.1 Possessory Interests
5.1.1 Full Fee Simple Absolute
One of the most straightforward ways to use property rights to protect land is through purchase of the land. In the common law system, we use the phrase “fee simple” to describe present possessory interest in the land. Where a landowner has the present possessory rights in a parcel, she has the ability to make decisions regarding the use of that land subject to general rules and regulations of the governments that have jurisdiction over the land and also in accordance with general laws of landownership, like nuisance, that prohibit a landowner from using her property in ways that unreasonably harm neighboring property. Holding title to the land bestows the landowner with freedom of action regarding the land and can enable land preservation alongside active conservation and management. Where an NGO wants extensive control over the activities on the land, this might be the best option. Moreover, if an NGO identifies that a parcel could potentially benefit from active soil conservation measures, the NGO would be most secure in holding the title to the land. With title, there will be little objection to whichever land conservation measures the NGO determines will be most beneficial.
Yet the ability to conserve soil through ownership by NGOs or conservation-minded individuals is limited. An obvious obstacle is the expense. Not only can land be expensive to purchase, but added costs come from management of the land. The NGOs not only need money for land purchases but also need capacity to staff, manage, and monitor the soil conservation efforts. In some places, this may mean being full-time occupiers of the land. Lack of vigilance could lead to interlopers. Additionally, depending on the interventions needed, the staff may need training or equipment that can add to the expenses.
Conservation efforts through fee simple ownership are also limited to where there are willing sellers. Without the government power to condemn land, NGOs can only gain title where landowners are willing to sell. This may not be beneficial for strategic soil conservation. Even where conservationists can identify the parcels that are most important for soil conservation, it does them little good if landowners are unwilling to sell those parcels. This means that strategic or important areas could go unpreserved with energy (and funding) being applied to marginal soils. This limitation makes it difficult to take a holistic or strategic approach to soil conservation.26
Where NGOs hold fee simple title, land may be taken completely out of production and even result in a removal of people from the land. Such a development can change the patterns and composition of communities. Where we think of conservation as originating in a park‐like concept that separates people from the land, NGOs can take on the aspect of a neocolonial power dictating land uses and community makeup. This may be particularly pronounced when international or foreign NGOs (or individuals) purchase land. Decision making may be coming from people who have no experience working the land or working with the people. While this concern has lessened over the years as NGOs have improved their working relationships within the communities they operate, we still see objections in the United States and across the world when private nonprofit organizations shape the landscape.27 In some jurisdictions, this can have an added financial dimension as, in many cases, NGOs pay lower taxes and, in some cases, no property tax. The lower tax base can result from the status of the landowner as an NGO or the limitations on land use that restrict the development of the highest and best use of the land. To alleviate such concerns, NGOs sometimes make voluntary tax-like payments in the regions where they own land to avoid impacts on schools on other social services that might occur with reduced public funding.
5.1.2 Co-ownership (in Fee Simple Absolute)
Because of the inherent limits of soil conservation by fee simple ownership, conservationists began to explore partial property rights. Is there a way for us to get some of the same soil conservation benefits without needing to be the owner of the land?
In some cases, this might occur with a possessory interest like joint ownership. Where a property owner holds a portion of the property rights, she has the ability to control or at least influence conduct on the land. In the common law tradition, this ability is clear. Co-owners of property that all hold possessory interests have the right to use and occupy the whole.28 Furthermore, co-owners have an obligation to each other to prevent abuse of the land and will be liable to one another for damage done to the land.29 These background principles, however, may do little to prevent negative impacts on the soil. In the eyes of most courts, there is nothing unreasonable about traditional exploitation of the land (through forestry, agriculture, or grazing) and little that would limit development of natural resources. At some level of exploitation, some methods would become unsupportable, particularly if they started to look like nuisance or waste, but court interpretations of such behavior are uncertain, and seeking to constrain land by simply holding a small percentage of the present possessory interest would be ill-advised.
5.1.3 Defeasible Fees
I leave my land to my son Jaime so long as he continues to employ soil conservation techniques.
All of my property to my sister Victoria and her heirs, but if the soil quality reduces appreciably during their tenure, then to The Nature Conservancy.
Through language such as this, present-day landowners can make long-term decisions regarding their land. In these examples, both Jaime and Victoria have a right to hold and possess the land. Indeed, their rights look similar to the rights of a fee simple landowner. Yet the rights are not as complete because of the possibility that they will lose their property rights. In this way, defeasible fees constrain the activity of the landowner. The person creating the defeasible fee (often a person writing a will, but again the transfer need not be upon the death of a former owner) plays a powerful role, setting the agenda for the future of the land. The length of their control is limited by the law of the jurisdiction. Some countries may not allow such dead hand control, while others may be quite willing for a person living today to decide what may or may not happen on her land far into the future. A limitation of conservation by defeasible fee is the rigidness of the constraint. Careful drafting is needed to enable desirable changes to the land. For example, a restriction that requires a tobacco farm to continue to be a tobacco farm might hamper development in a world that no longer wants as much tobacco or hamper the ecology of a region that no longer has the right conditions for tobacco farming. Such rigid constraints can be particularly troublesome as climate change, and the uncertainty of the exact scope and location of its effects, shapes our land.
5.2 Nonpossessory Property Rights
The limitations on possessory ownership lead us to examine nonpossessory interests. These can take the form of either present or future interests. The essential feature of a nonpossessory interest is that the holder of that interest does not have the ability to presently occupy and use the land. This does not make it less of a property right, though. The holder still has a valuable right that she can buy and sell. Moreover, she also has the ability to constrain the actions of possessory holders to protect her rights.
5.2.1 Future Interests
A concept that often confuses students and laypeople is the idea of the future interest. Although not recognized in all countries, the future interest is a nonpossessory interest that can be invoked to achieve some soil protection goals. The holder of a future interest holds a valuable property right today—one that can be bought, sold, and passed on to heirs like other property rights. The holder does not yet have the right to use and possess the land, however. This means that associated with every future interest is another property holder who has the present possessory interest. The future interest is waiting in the wings (sometimes patiently and sometimes no) for her nonpossessory property right to become possessory.
Depending on the jurisdiction in which you are operating, these property rights can take many forms and be rather complicated. For the purposes of this chapter, however, we need only understand that a known future landowner can have a say over what the current landowner can do on the property. Generally, the limitations are embodied in the doctrine of waste. This doctrine limits the ability of the current landowner to use the property in such a way as to hamper the future landowner. This can prevent destruction of a house, depletion of natural resources, and similar behavior. Unfortunately, the doctrine is coarse and cannot work to protect soils unless it can be shown that the depletion of the soil by the present landowner is an unreasonable and destructive use of the property. Reasonable and customary land uses (perhaps the ones that have led to environmental problems to begin with) will not meet the threshold of harm needed for the future interest holder to be able to constrain the activity.31
5.2.2 Servitudes
More useful than the future interest is a present interest even if that interest is nonpossessory. Indeed, the present nonpossessory interest is an attractive tool for many, meeting many land conservation goals.
The most classic example (and in the most widespread use) is the easement. An easement allows someone to have a right in someone else’s land without actually becoming the owner or permanent occupier of the entire parcel land.32 The most common example is an access easement. Your neighbors have the right to drive across your land to access their home. The electric company has a right to place and maintain electrical poles and wires on your property. Easements can take several forms and could include things like a right to hunt or gather wood. The easement holder might be an individual, a family, a business, or a group.
Traditionally, easements gave someone other than the fee simple landowner the right to do something on the land that the landowner would have otherwise been able to prevent. That is, they gave the easement holder an affirmative right. In some narrow circumstances, some jurisdictions also recognized negative easements. A negative easement prohibits a landowner from engaging in an otherwise lawful activity on her land. The most common examples of negative easements are prohibitions on disrupting free flowing water or sunlight. Where enforceable, negative easements are few, and the options are specifically enumerated by statute.
Traditional easements also were constrained as to who was recognized as a legitimate easement holder. As a property rights arrangement, easements were viewed as agreements binding the land. Such an arrangement has the benefit of creating agreements that remain tied to the land regardless of who owns the land, but they also limit the number of people or entities that can enter into an easement. To begin with, one has to be a landowner, but some jurisdictions go even further and limit the acceptable parties to adjacent landowners. A common exception to this rule is the utility easement. All states in the United States recognize the ability of utilities to hold easements for pipelines, power lines, cables, and similar equipment. Yet they do not recognize this based on the status of the utility as a landowner. In property law terms, we label such easements as “in gross” as opposed to “appurtenant.” In gross easements do not have a benefited parcel of land, only a benefited person or entity. Such easements were historically disfavored and maybe limited by statute or common law.33
The limitations of the easement for protection of the soil thus become clear. In many jurisdictions, there is a limitation on using easements to control the landowner’s behavior; they are more focused on the easement holder’s behavior. One could envision an affirmative easement that allowed the easement holder to engage in activities to protect the soil, but without accompanying restrictions on the landowner that may not be that fruitful. Additionally, operating by affirmative action may be more cumbersome (and more expensive in terms of the staffing needed) than enforcing a negative restriction on behavior. The limits on who can enter into such an agreement also presents a quandary as it would only enable landowners to do so and might require purchases of small anchor parcels beside any land where one seeks an easement. The impracticality of such a rule for NGOs seeking to protect the soil is obvious.
The limitations of easements gave birth to two additional types of servitudes: real covenants (also labeled restrictive covenants) and equitable servitudes. These restrictions look a bit more like contracts than easements do. Indeed, they are sometimes called promises regarding the land. While the terms may look like contracts, the essential difference is that real covenant and equitable servitudes can bind future landowners and have life beyond the original parties to the agreements. However, various limitations on the use of these tools also limit their utility for soil conservation. Without delving too deeply into the potential variations in every jurisdiction, we can highlight a few concerns. Many restrictive covenants can only be enforced with damages. That is, when a landowner breaks a promise, the court just requires the landowner to make a payment for what it calculates to be the value of the promise. It does not require the landowner to actually change behavior and implement the soil conservation measures.
Another hindrance occurs in jurisdictions that put rigid limitations on who can enforce the agreement over time. In particular, we see restraints on who assumes the burden or the benefit of the promise with strict rules on transferability (or in property law terms, whether the agreements will run with the land). The conclusion then is that such servitudes can provide an avenue for soil conservation, but one has to look very carefully at the laws of the jurisdiction to ensure that the tool does not come with limitations that impede soil conservation efforts.
5.2.3 Conservation Easements
Discontent with the options above, conservationists began to seek out ways to use partial property rights to achieve land conservation goals but without the complications described above. In the United States, this led to the birth of the conservation easement. The use of the word “easement” places the tool in the context of servitudes, but it would be a mistake to think of it as a traditional easement because it has different rules and lifts many of the restriction associated with easements.
A conservation easement then is a nonpossessory property right that limits landowner behavior with the goal of producing a conservation benefit.34 The agreements must have the purpose of producing one of the conservation benefits enumerated in the statute that governs that jurisdiction. There is no requirement that the agreements actually yield a benefit, just that they seek to do so.35 While the list of acceptable conservation purposes varies slightly by jurisdiction, they generally follow the pattern of the Uniform Conservation Easement Act (UCEA). Acceptable purposes for conservation easements under the UCEA “include retaining or protecting natural, scenic, or open-space values of real property, assuring its availability for agricultural, forest, recreational, or open-space use, protecting natural resources, maintaining or enhancing air or water quality, or preserving the historical, architectural, archaeological, or cultural aspects of real property.”36
Conservation easements have the benefit of being enforceable not just with damages like a real covenant but also with injunctive relief—meaning that one can actually force the landowner to comply with the restrictions. Conservation easement enabling acts set forth acceptable holders as governmental agencies and nonprofit organizations that have conservation as part of their central purposes.37 This obviates the requirement that holders have to own an anchor parcel or indeed need to be landowners at all.
Finally, the statutes confirm the ability of both the benefit and the burden of conservation easements to run with the land, that is, changes to the identity of the landowner or the conservation easement holder to not hinder enforcement of the agreement. A hallmark of conservation easements and what has made them especially attractive to conservationists is the fact that they are usually perpetual. Indeed, in the United States, three states (California, Hawaii, and Florida) require the agreements to be perpetual.38 Most states make it the default duration, and only one state prohibits it (North Dakota limits conservation easements to 99 years).39
While conservation easements are most popular in the United States (where we see the first laws enabling them), they are growing in popularity across the globe, although they sometimes have a different name. They are now well developed in Canada and Australia. They are growing in New Zealand, Spain, and Scotland. There is a proposed law enabling them in England and Wales. Kenya, Chile, Columbia, and Mexico are developing similar ideas. And these are but a few examples. We also see the idea being exported by companies and intergovernmental organizations that are investing in climate change adaptation and other environmental projects abroad. They want guarantees that their projects will have longevity and are requiring conservation-easement-like arrangements to achieve that goal.40
The benefits of conservation easements for soil conservation are clear. With this tool, conservationists (government agencies or NGOs) can tailor restrictions to individual parcels, implementing conservation programs across the landscape. Landowners get to remain on their land, and community composition does not change. Instead, communities receive payments or other amenities to make smaller changes to behavior. The conservationists can pay for exactly what they want to implement. On some parcels, land uses might be curtailed severely where in others it is a smaller restriction on certain farming techniques. Scientists can work with the lawyers to craft agreements that best achieve soil conservation goals. The agreements last forever and are often enforced by private organizations, limiting the strain on the public coffers as government agencies can remain on the sidelines if they so desire.
5.2.4 Other Ideas
Beyond the options discussed here, conservationists have been exploring other ways that concepts from property law might protect land. These ideas are still theoretical and experimental, so we do not yet have a full understanding of how they might work. Some have argued that real estate options could be a way to achieve environmental goals. An option gives someone a right to acquire land for a certain time period but does not obligate that person to acquire the land. When real estate is burdened by an option, the landowner cannot materially change or degrade the land without violating the terms of the option. As the penalty is usually paying back the option price and the conservation is a passive one, it may not suit the needs of many who are working in land conservation. Yet the existence of this idea shows the efforts underway to explore new ways to achieve land conservation goals through property rights trends. We also see proposals for options to purchase conservation easements, annuity easements, and moveable easements. There are likely many other creative arrangements connected to ideas of private law developing around the world.
6 Conclusion
While the development of private law tools to protect soil offers encouraging news for those seeking more ways to protect the land, we also need to be cautious about the use of these tools.
First of all, turning from public law to private law (even if the line between them is a blurry one) can raise concerns about democracy. These property law arrangements are available to government agencies but mostly reside in the hands of NGOs. This tool actually enables those NGOs to circumvent public plans for the landscape. For example, elected officials may create a development plan that protects some areas but allows development in others. A nonprofit organization may be unhappy about the planned development and use conservation easements to prevent development even in the area chosen for that purpose. Where we agree with the NGO, we may like the tool, but we need to recognize that it is not a democratic tool. Indeed, patterns of usage in the United States suggest that the individuals most likely to benefit from conservation efforts of this type are wealthy landowners who had little intention of engaging in destructive practices to begin with.41
Even where government agencies are using the tool, they may be doing so to prevent future changes by other government officials. Elected officials could often achieve the same goals by regulation. They may choose property tools over regulation because it appears more politically palatable or because they can draw upon the power of NGOs for assistance, but some local governments have also stated that they use conservation easements because they are more permanent than legislation that can be changed by the next legislature and want to prevent future politicians from making decisions that the current politicians do not like.42 To a supporter of conservation, this may seem like a desired outcome. To a supporter of democracy, this is unquestionably problematic. If we think that partial property rights hinder government action, then we may have a problem. If we think that partial property rights can disrupt community efforts to make decisions, we might have an issue with that too.
Permanence may be both part of the solution and part of the problem. One of the most attractive aspects of partial property rights is the ability for the agreements to be perpetual. Generally, we view a contract as only binding the parties that enter into the contract. But property rights are something different. Property rights are agreements regarding the land and that stay with the land. This is attractive from a land conservation standpoint because they enable long-term protection of the land. Transferring the ownership of the land (or the ownership of the partial nonpossessory property right) does not remove the protection. This gives us some peace of mind for soil conservation: protections put in place will not easily disappear.
However, it is not just that they do not easily disappear, they also do not change that easily either. The details of the agreements are written today, with today’s goals and today’s knowledge. They are often written in static terms, seeking to preserve the status quo or protect specific landscapes and practices. They offer little room for changing societal goals, but perhaps even more troublesome they offer little room to adjust to changing environmental circumstances or changing information. New studies that provide better guidance on soil management, for example, may not be able to influence conduct on land encumbered by a conservation easement as that agreement already sets the rules. Jurisdictions differ on the degree to which they are willing to allow changes or adjustment to such agreements, but the trend is toward only allowing agreements that remain in line with stated purposes. This means that a measure that is more protective of the soil on a conservation easement that seeks to protect the soil will probably be allowed (but not necessarily so), but a change from protecting species to protecting soil would not be permitted even if studies reveal that such efforts would be a better use of the land.43
In the end, this chapter presents a complicated story. The development of private law tools to protect the soil is exciting. It demonstrates a new energy to achieve conservation goals with engagement of new (and more players). People are thinking creatively about what can be done to improve the world we live in. Yet the excitement of using property law tools sometimes leads organizations to quickly tie up the land with agreements that have complicated and uncertain implications. As with all legal strategies, we must think carefully before assessing which tool is right for the project we want. In our current world, we must always assume change. As things get worse (or better) for soils, will we be able to achieve our goals with the tools we have chosen?
Footnotes
- 1.
UNCCD Executive Secretary Monique Barbut in September of 2015 in response to the 2030 Agenda for Sustainable Development;.
- 2.
- 3.
- 4.
- 5.
- 6.
Id.
- 7.
- 8.
- 9.
- 10.
Id.
- 11.
Id.
- 12.
Id.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
A 2017 report from the Brookings Institute suggest that current patterns of conservation easement use are not likely to preserve lands strategically to meet environmental goals and instead are more likely to maximize private goals like tax savings. Looney (2017). Recent work from economists at the University of Wisconsin and North Carolina State, however, argue that there is no evidence that conservation easements are concentrated on lower quality lands because conservation easement holders serve a gatekeeping function that prevents such a pattern from developing. (Parker and Thurman 2017).
- 27.
- 28.
- 29.
- 30.
Defeasible fees and future interests (discussed below) are much more complicated than these simple examples indicate. What is important to understand for the purposes of this chapter is that one can place constraints on land uses when conveying land. Additionally, in some jurisdictions a landowner can voluntarily constrain her rights by converting her fee simple absolute into a defeasible fee. 1-13 Powell on Real Property § 13.02 (2017); 1-13 Powell on Real Property § 13.05 (2017). The contours of such conveyances and how long the constraints might last differ by jurisdiction and should always be confirmed with legal counsel.
- 31.
- 32.
- 33.
Id.
- 34.
- 35.
- 36.
UCEA § 1(1).
- 37.Again, the exact contours of eligible holders vary by jurisdiction. For example, some places require certain tax status for the NGOs, others specifically identify Native American tribes as eligible holders. Owley (2012c). The Uniform Conservation Act (a model act that nearly have of the U.S. States have adopted) lists the following acceptable holders:
- 38.
California, Hawaii, and Florida require conservation easements to be perpetual (California Civil Code § 815.2(b); Hawaii Revised Statute § 198-2(b), Florida Statutes Ch. § 704.06(2)) as does the Internal Revenue Code for those hoping to associate their conservation easement with a tax deduction (Internal Revenue Code § 170(h)(2)(c)). See Korngold (2007).
- 39.
- 40.
- 41.
- 42.
- 43.
References
- Allouche J (2010) The sustainability and resilience of global water and food systems: political analysis of the interplay between security, resource scarcity, political systems and global trade. Food Policy 36(Suppl 1):S3–S8CrossRefGoogle Scholar
- Anderson MG, Ferree CE (2010) Conserving the stage: climate change and the geophysical underpinings of species diversity. PLoS One 5(7):e11554CrossRefGoogle Scholar
- Boyd J, Banzhaf S (2006) Resources for the Future, What Are Ecosystem Services?: The Need for Standardized Environmental Accounting Units.
- Brechin E (2015) Rockefellers a force in conservation. Ellsworth American, 8 June 2015.
- Chasek P, Safriel U, Shikongo S, Fuhrman VF (2015) Operationalizing zero net land degradation: the next stage in international efforts to combat desertification? J Arid Environ 112:5–13CrossRefGoogle Scholar
- Cheever F, McLaughlin NA (2015) An introduction to conservation easements in the United States: a simple concept and a complicated mosaic of law. J Law Prop Soc 1:107Google Scholar
- Davidson EA, Janssens IA (2006) Temperature sensitivity of soil carbon decomposition and feedbacks to climate change. Nature 440:165–173CrossRefGoogle Scholar
- Doran JW, Safley M (1997) Defining and assessing soil health and sustainable productivity. Biol Indic Soil HealthGoogle Scholar
- Food and Agriculture Organization of the United Nations (FAO) (2015) Soils store and filter water.
- IUCN (2015) Land degradation neutrality: implications and opportunities for conservation, Technical Brief 2nd edn, November 2015. IUCN. Nairobi, 19pGoogle Scholar
- Kibblewhite MG, Ritz K, Swift MJ (2008) Soil health in agricultural systems. Philos Trans R Soc B Biol Sci 363(1492):685–701CrossRefGoogle Scholar
- Korngold G (2007) Solving the contentious issues of private conservation easements: promoting flexibility for the future and engaging the public land use process. Utah Law Rev 2007:1039Google Scholar
- Lal R (2004) Soil carbon sequestration to mitigate climate change. Geoderma 123:1–22CrossRefGoogle Scholar
- Lawler J, Watson J et al (2015a) Conservation in the face of climate change: recent developments, F1000 Research 2015 4 (F1000 Faculty Rev): 1158Google Scholar
- Lawler JJ, Ackerly DD et al (2015b) The theory behind, and the challenges of, conserving nature’s stage in a time of rapid change. Conserv Biol 9(3):618–629CrossRefGoogle Scholar
- Looney A (2017) Charitable contributions of conservation easements. Brookings Institute,
- Mercer E et al (2011) Taking stock: payments for forest ecosystem services in the United States, forrest trends: ecosystem marketplace 1. Available at
- North Dakota Central Code § 20.1-02-18.2Google Scholar
- Owley J (2006) The emergence of exacted conservation easements. Nebraska Law Rev 84:1043–1112Google Scholar
- Owley J (2012a) Tribes as conservation easement holders: is a partial property interest better than none? In: Rosser E, Krakoff S(eds) Tribes, land and the environment. Ashgate Press, pp 171–191Google Scholar
- Owley J (2012b) Neoliberal land conservation and social justice. IUCN Acad Environ Law E-J 3:6–17Google Scholar
- Owley J (2012c) Use of conservation easements by local governments. In: Salkin P, Hirokawa K (eds) Greening local government. A.B.A. Publishing, pp 237–255Google Scholar
- Owley J (work in progress on file with author) Exporting American Property LawGoogle Scholar
- Owley J, Doane C (2017) Exploiting conservation lands: can hydrofracking be consistent with conservation easements? Kansas Law Rev 66 (forthcoming)Google Scholar
- Owley J, Rissman AR (2016) Trends in private land conservation: increasing complexity, shifting conservation purposes and allowable private land uses. Land Use Policy 51:76–84CrossRefGoogle Scholar
- Owley J, Takacs D (2016) Flexible conservation in uncertain times. In: Kundis Craig R, Miller SR (eds) Contemporary issues in climate change law and policy: essays inspired by the IPCC, pp 65–104Google Scholar
- Pacala S, Socolow R (2004) Stabilization wedges: solving the climate problems for the next 50 years with current technologies. Science 305:968CrossRefGoogle Scholar
- Pappas M (2014) Anti-waste. Ariz Law Rev 56:741Google Scholar
- Parker DP, Thurman WN (2017) Tax Incentives and the Price of Conservation (unpublished manuscript on file with author) CHECK FOR UPDATE BEFORE PUBLICATIONGoogle Scholar
- Powell on Real Property (2017)Google Scholar
- Republic of Indonesia (2015) Indonesia—land degradation neutrality national report.
- República de Costa Rica (2015) Costa Rica Degradación neutral de la tierra informe nacional.
- Turner Enterprises Inc. Turner Ranches. (last visited Feb. 16, 2017)
- Turner Foundation. (last visited Feb. 16, 2017)
- UNCCD (2016) Land Degradation Neutrality: The Target Setting Programme.
- UNCCD (2017a) Kenya launches roadmap to set land degradation neutrality targets.
- UNCCD (2017b) Colombia advances on the SDG 15 agenda on “life on land” through the implementation of the National Policy for Sustainable Soil Management.
- Uniform Conservation Easement Act (UCEA).
- United Nations (2015) Resolution adopted by the General Assembly on 25 September 2015, 70/1.
- United Nations (2017a) Sustainable Development Goals, 17 Goals to Transform our World.
- United Nations (2017b) Sustainable development goal 15.
- United Nations Convention to Combat Desertification ((UNCCD) (2017) Land Degradation Neutrality.
- Wachter v. Commissioner of Internal Revenue, 142 Tax Court No. 7 (March 11, 2014)Google Scholar
- Watts v. Krebs, 131 Idaho 616, 962 P.2d 387 (1998)Google.
|
https://link.springer.com/chapter/10.1007%2F978-3-319-68885-5_18
|
CC-MAIN-2018-39
|
refinedweb
| 8,215
| 50.67
|
Need a Javascript function that would work like this .includes(['1', '2', '3'])
Apologies if this has been asked before and if what I am asking doesn't make sense please let me know and I will do my best to clarify.
What I am looking for is a function that works the same way as the .includes() function does, but I would like it to accept an array. It seems that the "includes" function only looks for 1 needle in a haystack instead of multiple needles.
Any help with this would be great.
For Context: I am working in Vuejs, and I have a computed property that is taking an array of objects and each object contains another array of colors. To sort I am adding color codes to the selectedColors array and would like to filter my searchArray results based on the selectedColors array.
Below is what I have in my computed property as of now... and obviously when the selectedColors array has anything in it, no results are returned.
colorArray: function() { return this.searchArray.filter(station => { if (this.selectedColors) { return station.colors.includes(this.selectedColors) } else { return this.searchArray } }) }
Here is an example of my searchArray:
this.searchArray: [ {title: 'first', colors: ['BL', 'YL']}, {title: 'second', colors: ['YL']}, {title: 'third', colors: ['OR', 'GR']}, ]
Here is an example of my selectedColorsArray:
this.selectedColors: ['BL', 'YL']
Any help with this is greatly appreciated! Thanks
See also questions close to this topic
- How can I add my React code to my Gatsby project?
So I'm creating a website in Gatsby but I've been trying to find a way to write some javascript so I can toggle the navigation for mobile. I have created the navigation and hamburger menu but I have no clue how I can write javascript in gatsby or react to make it executable. Can anyone help me how to do it?
My Code:
const Header = () => { return( <header> <p>STIJN REYGAERTS</p> <div className='Icon'> <div></div> <div></div> <div></div> </div> </header> ) } export default Header <---------------------------------------> import React from 'react' import { Link } from 'gatsby' const Navbar = () => { return ( <nav className='Navigation'> <ul> <li><Link to="/Index">HOME</Link></li> <li><Link to="/Aanbod">AANBOD</Link></li> <li><Link to="/Aboutme">OVER MIJ</Link></li> <li><Link to="/Contact">CONTACT</Link></li> </ul> <div className="achtergrond"></div> </nav> ) } export default Navbar
- Rails 6 & Materialize: Select multiples close after selecting one value
I'm trying to create a dynamic select multiple that allows an "Admin" to select some users. It works totally fine, but every time I select a value, it closes out of the dropdown. Here's the relevant code:
Here's the javascript code:
document.addEventListener("turbolinks:load", function() { var elems = document.querySelectorAll('.dropdown-trigger'); var instances = M.Dropdown.init(elems, {constrainWidth: false}); });
Here's the form's code:
<div class = "xtrapadding"> <%=f.label "Select Intern(s)"%> <%= f.collection_select(:user_ids, User.all, :id, (:fullname) , {class: "stopDrop"}, {:multiple => true})%> </div>
I tried adding that class "stopDrop" with the following code, but could never get it to fire:
document.addEventListener("turbolinks:load", function() { $('.stopDrop').on("click", function() { console.log("Test") alert("test"); event.stopPropagation(); }); });
Thanks for any help you can give! This is something I've been beating my head on for a few hours.
- Discord.js v12 How could I check if a message in a certain channel is a VIDEO attachment?
I am trying to make the bot in a certain channel if a video attachment is sent in for example
#videoand if it is actually a video attachment, the bot will reply in that channel something and copy the video attachment to another channel. If it's a text message, the bot will just delete the text message. I currently have no code because I have no idea lol.
- Maximize array sum
Suppose I have given an integer array of size n.It is given that we can multiply the value of (i)th and (i+1)the elements by -1 in one Operation.we can perform this Operation as many times as we want. Our goal is to maximize the sum of the eintire array . And print that sum.
Constraints:
2<=n<=10^5
-10^9 <=a(i) <= 10^9
My code:
#include<bits/stdc++.h> using namespace std; int main() { int n,a,i; cin >> n; vector<int>v1; for(i=0;i<n;i++) { cin >> a; v1.push_back(a); } for(i=0;i<n-1;) { if(v1[i]<0 && v1[i+1]<0) { v1[i]=v1[i]*(-1); v1[i+1]=v1[i+1]*(-1); i=i+2; } else { i++; } } long long int sum=0; for(i=0;i<n-1;i++) { if(v1[i]<0 && abs(v1[i])>abs(v1[i+1])) { v1[i]=v1[i]*(-1); v1[i+1]=v1[i+1]*(-1); } } for(i=0;i<n;i++) { // cout <<v1[i] << " "; } for(i=0;i<n;i++) { sum=sum+v1[i]; } cout << sum; }
My code is accepted for some of the test cases. Can anyone please help me to find out the proper logic for this question?
- I am trying to send a range in google sheets as a pdf in an email. My script is getting stuck on getid()
I am trying to create a macro in Google scripts that sends me an email of a worksheet I created. When I try to run this, the script gets stuck at the function GetSheetID(). (4th line of 2nd function)
"TypeError: Cannot read property 'getSheetId' of undefined (line 51, file "macros")"
I am open to other email techniques as well. My main goal is to take a range and send as a picture or PDF in an email.
function sendSheetToPdfwithA1MailAdress(){ // this is the function to call var ss = SpreadsheetApp.getActiveSpreadsheet(); var sh = ss.getSheets()[4]; // it will send sheet 0 which is the first sheet in the spreadsheet. // if you change the number, change it also in the parameters below var shName = 4 //sh.getName() var shNum = 4 var shRng = 'A1:R35' var pdfName = 'Automated Snapshot' var email = 'email@gmail.com' var subject = 'Daily Snapshot' var htmlbody = '' mailPdf(shNum,shRng,pdfName,email,subject,htmlbody); } function mailPdf(shNum,shRng,pdfName,email,subject,htmlbody) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var ssId = ss.getId(); var shId = shNum ? ss.getSheets()[shNum].getSheetId() : null; var url_base = ss.getUrl().replace(/edit$/,''); var url_ext = 'export?exportFormat=pdf&format=pdf' //export as pdf + (shId ? ('&gid=' + shId) : ('&id=' + ssId)) + (shRng ? ('&range=E1:L25') : null) + '&format=pdf' //export format + '&size=letter' //A3/A4/A5/B4/B5/letter/tabloid/legal/statement/executive/folio //+ '&portrait=false' //true= Portrait / false= Landscape //+ '&scale=1' //1= Normal 100% / 2= Fit to width / 3= Fit to height / 4= Fit to Page //+ '&top_margin=0.00' //All four margins must be set! //+ '&bottom_margin=0.00' //All four margins must be set! //+ '&left_margin=0.00' //All four margins must be set! //+ '&right_margin=0.00' //All four margins must be set! + '&gridlines=false' //true/false //+ '&printnotes=false' //true/false //+ '&pageorder=2' //1= Down, then over / 2= Over, then down //+ '&horizontal_alignment=CENTER' //LEFT/CENTER/RIGHT + '&vertical_alignment=TOP' //TOP/MIDDLE/BOTTOM //+ '&printtitle=false' //true/false //+ '&sheetnames=false' //true/false //+ '&fzr=false' //true/false frozen rows //+ '&fzc=false' //true/false frozen cols //+ '&attachment=false' //true/false var options = { headers: { 'Authorization': 'Bearer ' + ScriptApp.getOAuthToken(), 'muteHttpExceptions': true } } var response = UrlFetchApp.fetch(url_base + url_ext, options); var blob = response.getBlob().setName(pdfName + '.pdf'); if (email) { var mailOptions = { attachments:blob, htmlBody:htmlbody } MailApp.sendEmail( // email + "," + Session.getActiveUser().getEmail() // use this to email self and others email, // use this to only email users requested subject+' (' + pdfName +')', 'html content only', mailOptions); } }
- Customized colormap out of color vector in python
I have an array of colors of shape (x, 4) that looks like this:
[0.94402153, 0.96856594, 0.99212611, 1. ], [0.91941561, 0.95281815, 0.98425221, 1. ], [0.89480969, 0.93707036, 0.97637832, 1. ],
I used it to plot different lines and each line gets one row of this array as color.
I was wondering how I could now use this same vector do display a colormap next to my plot using the same indices displayed for my lines.
Thank you for your help
- How do I select a record from a Realm database?
how do i select a record? I did so but it gives me a mistake.
func getidPet() -> Pet? { let realm = try! Realm.init() let results = realm.objects(Pet.self).sorted(byKeyPath: **"petId" = diaryPetId**) guard !results.isEmpty else { return nil } return results[0] }
I wish "petId" = diaryPetId
I tried this too but nothing happens:
let results = realm.objects(Pet.self).filter("petId = 'diaryPetId'")
- C# Sorting dictionary using CompareTo does not work for dictionaries with more than 16 items
I have two collections:
One the one hand, a dictionary containing Products with Id's and on the other hand, a list of Id's containing the order in which they should be ordered.
The dictionary contains objects like this:
The sorting list is just a simply int array
{1, 3, 2, 5, 7...}
To sort the dictionary using the orderArray, I'm using the following code:
foreach (var index in orderList) { dictionary.Value.Sort((first, second) => { var x = first["ID"].Equals(index).CompareTo(second["ID"].Equals(index)); return x; }); }
This code works fine for dictionaries up to and including 16 items, but as soon as a larger dictionary is passed in, the sorting algorithm breaks. What could be the cause of this?
- How to sort by date and time in python?
How to sort this list by date in python:
tab =[{"name": "1", "date": "2003-05-28 09:54"}, {"name": "2", "date": "2005-05-28 09:54"}, {"name": "3","date": "2009-05-28 09:54"}, {"name": "4", "date": "2008-05-28 09:54"}]
- reload page without refresh in laravel and vue.js
I want add some data in database in laravel . and I want refresh my li item in web form. how can I refresh data with vue.js without reload page. are there anybody can do it????
- Shopware 6 | Cloning CmsElement and get null as data
I try to clone the content element
image-slideror
image-gallery(the error will come at both) to extend them. First I register a new CmsElement like the original only changes the name from
image-sliderto
image-slider-example
import './component'; import './config'; import './preview'; Shopware.Service('cmsService').registerCmsElement({ name: 'image-slider-example', label: 'sw-cms.elements.imageSlider.label', component: 'sw-cms-el-image-slider', configComponent: 'sw-cms-el-config-image-slider', previewComponent: 'sw-cms-el-preview-image-slider', defaultConfig: { sliderItems: { source: 'static', value: [], required: true, entity: { name: 'media' } }, displayMode: { source: 'static', value: 'standard' }, minHeight: { source: 'static', value: '300px' }, verticalAlign: { source: 'static', value: null } }, enrich: function enrich(elem, data) { if (Object.keys(data).length < 1) { return; } Object.keys(elem.config).forEach((configKey) => { const entity = elem.config[configKey].entity; if (!entity) { return; } const entityKey = entity.name; if (!data[`entity-${entityKey}`]) { return; } elem.data[configKey] = []; elem.config[configKey].value.forEach((sliderItem) => { elem.data[configKey].push({ newTab: sliderItem.newTab, url: sliderItem.url, media: data[`entity-${entityKey}`].get(sliderItem.mediaId) }); }); }); } });
Now It shows me the new element in the Shopping Experience, where I can use it.
After that I create for the storefront the
cms-element-image-gallery-example.html.twigfile, which will be loaded by Shopware.
{% sw_extends '@Storefront/storefront/element/cms-element-image-slider.html.twig' %} {% block element_image_slider_alignment %} <pre> {{ dump(element) }} </pre> {{ parent() }} {% endblock %}
Now I extend the original storefront element from which I was cloning and add a
dumpto see all data. But there I have the issue, that the
element.dataare
nullbut there should be all images stored.
- How do I prevent a short flickering at dragstart in Vuejs
I am trying to make a DIV draggable. It all works quite well except for a shot flickering at startdrag.
Here is a JSFiddle of the issue
Below is the code so far:
<template> <div> <div id="mydiv" : <div id="mydivheader" draggable @DRAG</div> <p>BLA</p> <p>BLA</p> <p>BLA</p> </div> </div> </template> <script> export default { name: 'Home', data () { return { cordY: 200, cordX: 200, divY: 0, divX: 0 } }, methods: { dragStart: function (e) { var img = new Image() img.src = '../assets/nonexisting.png' e.dataTransfer.setDragImage(img, 10, 10) this.divX = e.pageX - e.target.getClientRects()[0].left this.divY = e.pageY - e.target.getClientRects()[0].top this.cordY = e.pageY - this.divY this.cordX = e.pageX - this.divX }, dragging: function (e) { this.cordY = e.pageY - this.divY this.cordX = e.pageX - this.divX }, dragEnd: function (e) { this.cordY = e.pageY - this.divY this.cordX = e.pageX - this.divX } } } </script>
The desired outcome is a draggable element without the flickering at the start.
-.
|
https://quabr.com/58849803/need-a-javascript-function-that-would-work-like-this-includes1-2-3
|
CC-MAIN-2020-29
|
refinedweb
| 2,098
| 57.47
|
You.
I couldn’t disagree more with this approach.
First, my approach to testing the `short_people`:
`Person.should have(3).short_people
Person.short_people.should include(people(:linda), people(:dwane), people(:rick))`.
Granted, ActiveRecord objects can lead to some gnarly test failure messages, but
that should be no reason to change how you write your tests. Instead, overriding
`ActiveRecord::Base#inspect` can clean up your failures messages, but still allow
you to write tests that better convey their intent to the reader.
Mapping a collection that is the result of a test not only obfuscates
the test’s intent, but also leads to more brittle tests. What if, for
some reason, you decided to do away with the `first_name` method on the
objects in the collection. You’d be faced with an unrelated code change
that broke tests.
If tests were meant to be written with the purpose of creating pretty failure
messages, I’d be absolutely onboard with you. I don’t think that’s the point though,
and as a result, I think `collect` is a mistake to add to tests.
October 28, 2008 at 6:42
October 28, 2008 at 7:16 am
>.
October 28, 2008 at 7:36 am
@Pat – Aww, you beat me to it. On Casebook, we added the include_all matcher.
[1,2,3].should include_all(3,1,2)
The code is not available publicly, at this time. We also made the error message more explicit.
October 28, 2008 at 1:38 pm
You are missing the even more controversial:
Person.short_people.collect{|p|p.reason_to_live}.should == []
Sorry, I just couldn’t resist. Gotta love Randy Newman.
October 28, 2008 at 4:28 pm
.
October 28, 2008 at 4:40 pm
.”
You’re right Pat, we fundamentally disagree.
I expect you to look at a collect to first_name and think “hmm, all we care about is that Linda, Dwane, and Rick are in the array”. Or at least, after having had a conversation like this, you would find it unsurprising and maybe even reasonable.
Or to put it another way, I claim that tests that involves needlessly complex objects, when primitives will do, are less optimal because they turn the reader’s attention away from the important point (in this case, the content of the array). I wouldn’t claim that using full objects is in any way bad, or that (god forbid) what I’m proposing is a “best practice”. Just that overall I find the benefits to exceed the cost of the collect statement. You may not.
Also, the problem with overriding inspect is that – especially with model objects – what you want to see on inspect is too context-dependent. Consider an import test where I care about how each attribute of the model turns out, vs something like the above.
“Granted, ActiveRecord objects can lead to some gnarly test failure messages, but that should be no reason to change how you write your tests.”
I can think of few better reasons to change how I write my tests. Surely, even for you, when you evaluate how you will express something in the form of a test, the setup code, assertions, and error messages are all important factors, and part of a whole, where you try to get the best reading and execution experience by playing with all three. Right?
October 28, 2008 at 6:02 pm
I generally prefer custom matcher to mapping because I find tests with less punctuation to be easier to read.
include_all’s main intent is to give you a very detailed error message, including what’s missing and what’s there but shouldn’t be. It prints each member of the array on a separate line, so it’s easy to quickly identify the offending entries without having to horizontally scroll through the output.
@pat maddox: I agree that include_all is not the best name. It’s worked very well at allowing us to quickly identify the differences in arrays of complex objects.
I think to make array matchers better, we could:
* Have the output of our matchers look for an `rspec_inspect` method that, if defined on that AR class from a spec_helper, would show you that result (so you could define `rspec_inspect` to return `:first_name` for people, if you wanted but keep it in one place and out of your code)
* Add 2 new matchers, one that asserts that it contains exactly the same elements (unordered), and one that asserts that it contains at least some elements
It might look like this:
# in some spec helper
Person.class_eval { def rspec_inspect; first_name; end }
# the matchers
Person.tall_people.should contain_exactly(
people(:linda),
people(:dwane),
people(:rick)
)
Person.tall_people.should contain_at_least(
people(:linda),
people(:rick)
)
# the output
expected
['Linda',
'Dwane']
to include
['Darrel']
not to include
['Rick']
Pat Maddox’s matcher file can be found [here][2], and I posted the _include_all_ matcher Brian referred to as a [gist][1] if you want to take a look.
[1]:
[2]:
October 29, 2008 at 3:18 am.
October 30, 2008 at 5:49 am
Hopefully better array matching will be a part of rspec soon – you can follow the progress at [the lighthouse ticket]()
November 3, 2008 at 3:23 am.
November 3, 2008 at 3:21 pm
?
November 6, 2008 at 2:12 pm
).
November 6, 2008 at 9:38 pm?
November 11, 2008 at 11:15 pm
Just for fun, a ridiculously overreaching yet minimally applicable solution:
class Person
class << self
attr_accessor :tall_people
end
self.tall_people = []
attr_reader :name
def initialize(name=nil)
@name = name
end
end
require ‘rubygems’
require ‘spec’
describe Person do
attr_reader :timmy, :linda
before(:all) do
Object.class_eval do
def linda?
name == ‘L
November 12, 2008 at 8:37 am
|
http://pivotallabs.com/testing-tip-asserting-object-array-contents-using-collect/?tag=government
|
CC-MAIN-2014-52
|
refinedweb
| 955
| 62.07
|
DTML is the kind of language that "does what you mean." That is good, when it does what you actually want it to do, but when it does something you don't want to do, it's bad. This chapter tells you how to make DTML do what you really mean.
It's no lie that DTML has reputation for complexity. And it's true, DTML is really simple if you all you want to do is simple layout, like you've seen so far. However, if you want to use DTML for more advanced tasks, you have to understand where DTML variables come from.
Here's a very tricky error that almost all newbies encounter. Imagine you have a DTML Document named call itself and call itself, ad infinitum, until you get an "excessive recursion" error. So instead of doing what you really meant, you got an error. This is what confuses beginners. In the next couple sections, we'll show you how to fix this example to do what you mean.
There's are actually two ways to fix the DTML error in the zooName document. The first is that you can rename the document to something like zopeNameFormOrReply and always remember this special exception and never do it; never knowning very top most object in the stack. If the name can't be found there, then the next item down is looked Figure 7-1. Figure 7-2
Figure 7-2 Initial DTML namespace stack.
The client object is the first object on the top of the DTML namespace stack. What the client object is depends on whether or not Figure 7-3. Chapter 4, .
The request object is the very bottom most print the REQUEST out in an HTML page:
<dtml-var standard_html_header> <dtml-var REQUEST> <dtml-var standard_html_footer>
Try this yourself, you should get something that looks like Figure 7-4..
Now that you have seen that.
The with tag pushes an object that you specify onto the top of specify:
variables and their values Chapter 10, control
the namespace to look exactly in the right place for the name you are
looking for.
Like all things in Zope, the DTML namespace is an object, and it can can be accessed directly in DTML with the _ (underscore) object. The _ namespace is often referred to([start,], stop, [step])
startto
stopcounting
stepintegers at a time.
startdefaults to 0 and
stepdefaults to 1. For example:
'_.range(3,9,2)' -- gives '[3,5,7,9]'. 'len(sequence)' -- 'len' returns the size of *sequence* as an integer.
Many of these names come from the Python language, which contains a set
of special functions called
built-ins. The Python philosophy is to
have a small, set number of built-in names. The Zope philosphy can be
thought of as having a large, complex array of built-in names.
The under namespace can also be used to explicitly control variable look up. There is a very common usage of this syntax. You've seen that sum variable named selectedDoc we want to insert the variable named by selectedDoc. For example, the value of selectedDoc might be chapterOne. Using indirect variable insertion you can insert the chapterOne variable. This way you can insert a variable whose name you don't know when you are authoring the DTML.
If you a python programmer and you begin using the more complex aspects of DTML, consider doing a lot of your work in Python scripts that you call from DTML. This is explained more in Chapter 10, , than the security system will raise an Unauthorized error and the user will be asked to present more privileged authentication credentials.
In Chapter 7, the restrictions on looping and memory are pretty tight, which makes DTML
To:>
Batch processing can be complex. A good way to work with batches is to use the Searchable Interface object to create a batching search report for you. You can then modify the DTML to fit your needs. This is explained more in Chapter 11, .
You can raise exceptions with the raise tag. One reason to raise exceptions is to signal an error. For example you could check for a problem with the if tag, and in case there was something wrong you could report the error with the raise tag.
The raise tag has a type attribute for specifying an error type. The error type is a short descriptive name for the error. In addition, there are some standard error types, like Unauthorized and Redirect that are returned as HTTP errors. Unauthorized errors cause a log-in prompt to be displayed on the user's browser. You can raise HTTP errors to make Zope send an HTTP error. For example:
<dtml-raiseNot Found</dtml-raise>
This raises an HTTP 404 (Not Found) error. Zope responds by sending the HTTP 404 error back to the client's browser.
The raise tag is a block tag. The block enclosed by the raise tag is rendered to create an error message. If the rendered text contains any HTML markup, then Zope will display the text as an error message on the browser, otherwise a generic error message is displayed.
Here is a raise tag example:
<dtml-if <dtml-call <p><dtml-var debit_amount> has been deducted from your account <dtml-var account>.</p> <dtml-else> <dtml-raise <p>There is not enough money in account <dtml-account> to cover the requested debit amount.</p> </dtml-raise> </dtml-if>
There is an important side effect to raising an exception, exceptions cause the current transaction to be rolled back. This means any changes made by a web request to be ignored. So in addition to reporting errors, exceptions allow you to back out changes if a problem crops up.
If an exception is raised either manually with the raise tag, or as the result of some error that Zope encounters, you can catch it with the try tag.
Exceptions are unexpected errors that Zope encounters during the execution of a DTML document or method. Once an exception is detected, the normal execution of the DTML stops. Consider the following example:
Cost per unit: <dtml-var expr="_.float(total_cost/total_units)" fmt=dollars-and-cents>
This DTML works fine if total_units is not zero. However, if total_units is zero, a ZeroDivisionError exception is raised indicating an illegal operation. So rather than rendering the DTML, an error message will be returned.
You can use the try tag to handle these kind of problems. With the try tag you can anticipate and handle errors yourself, rather than getting a Zope error message whenever an exception occurs.
The try tag has two functions. First, if an exception is raised, the try tag gains control of execution and handles the exception appropriately, and thus avoids returning a Zope error message. Second, the try tag allows the rendering of any subsequent DTML to continue.
Within the try tag are one or more except tags that identify and handle different exceptions. When an exception is raised, each except tag is checked in turn to see if it matches the exception's type. The first except tag to match handles the exception. If no exceptions are given in an except tag, then the except tag will match all exceptions.
Here's how to use the try tag to avoid errors that could occur in the last example:
<dtml-try> Cost per unit: <dtml-var <dtml-except ZeroDivisionError> Cost per unit: N/A </dtml-try>
If a ZeroDivisionError is raised, control goes to the except tag, and "Cost per unit: N/A" is rendered. Once the except tag block finishes, execution of DTML continues after the try block.
DTML's except tags work with Python's class-based exceptions. In addition to matching exceptions by name, the except tag will match any subclass of the named exception. For example, if ArithmeticError is named in a except tag, the tag can handle all ArithmeticError subclasses including, ZeroDivisionError. See a Python reference such as the online Python Library Reference for a list of Python exceptions and their subclasses. An except tag can catch multiple exceptions by listing them all in the same tag.
Inside the body of an except tag you can access information about the handled exception through several special variables.
You can use these variables to provide error messages to users or to take different actions such as sending email to the webmaster or logging errors depending on the type of error.
The try tag has an optional else block that is rendered if an exception didn't occur. Here's an example of how to use the else tag within the try tag:
<dtml-try> <dtml-call feedAlligators> <dtml-except NotEnoughFood WrongKindOfFood> <p>Make sure you have enough alligator food first.</p> <dtml-except NotHungry> <p>The alligators aren't hungry yet.</p> <dtml-except> <p>There was some problem trying to feed the alligators.<p> <p>Error type: <dtml-var error_type></p> <p>Error value: <dtml-var error_value></p> <dtml-else> <p>The alligator were successfully fed.</p> </dtml-try>
The first except block to match the type of error raised is rendered. If an except block has no name, then it matches all raised errors. The optional else block is rendered when no exception occurs in the try block. Exceptions in the else block are not handled by the preceding except blocks.
You can also use the try tag in a slightly different way. Instead of handling exceptions, the try tag can be used not to trap exceptions, but to clean up after them.
The finally tag inside the try tag specifies a cleanup block to be rendered even when an exception occurs.
The finally block is only useful if you need to clean up something that will not be cleaned up by the transaction abort code. The finally block will always be called, whether there is an exception or not and whether a return tag is used or not. If you use a return tag in the try block, any output of the finally block is discarded. Here's an example of how you might use the finally tag:
<dtml-call acquireLock> <dtml-try> <dtml-call useLockedResource> <dtml-finally> <!-- this always gets done even if an exception is raised --> <dtml-call releaseLock> </dtml-try>
In this example you first acquire a lock on a resource, then try to perform some action on the locked resource. If an exception is raised, you don't handle it, but you make sure to release the lock before passing control off to an exception handler. If all goes well and no exception is raised, you still release the lock at the end of the try block by executing the finally block.
The try/finally form of the try tag is seldom used in Zope. This kind of complex programming control is often better done in Python or Perl..
|
http://www.faqs.org/docs/ZopeBook/AdvDTML.html
|
CC-MAIN-2016-26
|
refinedweb
| 1,825
| 63.29
|
Accessing SOAP Lite server thru WSDL
Expand Messages
- I have a very simple question. I have been successfully using SOAP
Lite with an older version .5x for some time. The client is
implemented on unix using perl. The server side is on Windows 2000
using .5x. I am trying to bring up the client interface on a new
unix environment. SOAP Lite .67 is installed on this machine. I am
getting this error an cannot figure out how to get around it.
$soap = SOAP::Lite
-> service()
-> Accept(hhh,hhh,hh,hh)
I get the following:
"use_prefix has been deprecated. If you wish to turn off or use on
the use of a default namespace, then please use either ns(uri) or
default_ns(uri) at ./SOAP/Lite.pm line 858"
I have read the following:
uri and use_prefix deprecated in next release
I so:
<soap:Envelope>
<soap:Body>
<myMethod xmlns="">
<foo />
</myMethod>
</soap:Body>
</soap:Envelope>
ns($uri,$prefix=undef) ->
I have tried various permutations using ns and/or default_ns with no
luck. I can't figure out what I need to change since I am not using
the use_prefix or uri subroutines directly. Do I have a
compatibility issue between the server and client?
Any inputs would be appreciated.
Your message has been successfully submitted and would be delivered to recipients shortly.
|
https://groups.yahoo.com/neo/groups/soaplite/conversations/topics/5976?xm=1&m=p&tidx=1
|
CC-MAIN-2017-51
|
refinedweb
| 222
| 66.13
|
Introduction to Python Filter Function
The filter function is one of the programming primitives that you can use in Python programs. It’s built-in to Python that offers an elegant way to filter out all the elements of a sequence for which the function returns True using Lambda expressions. Unlike the map function, the filter function requires only one iterable.
What are Lambda Expressions?
A lambda expression is an anonymous, in-line declaration of a function, usually passed as an argument. It can do anything a regular function can, except it can’t be called outside of the line where it was defined since it is anonymous: it has no name. Lambda functions are quite useful when you require a short, throwaway anonymous function. Something simple that you will only use once. Common applications are sorting and filtering data.
lambda arguments: expression
Type a keyword Lambda followed by zero or more inputs. Just like functions, it is perfectly acceptable to have anonymous functions with no inputs. Next, type a colon. Then finally you enter a single expression. This expression is a return value. You cannot use Lambda expressions for multi-line functions.
Syntax of filter():
filter (function, iterable)
Filter Parameters :
The filter function takes two parameters:
- Function: Function that tests if elements of an iterable are True or false. If none, the function defaults to identity function returning false if any elements are false.
- Iterable: Iterable which is to be filtered could be sets, tuples, lists or containers of any iterators.
Examples to Understand Python Filter Function
Let’s discuss the Python Filter Function:
Filtering values above average.
Example #1
Code:
import statistics
data = [1,3,5,7,11,17] #The short list of data is collected from a nearby fuel sensor.
avg= statistics.mean (data)
new =filter(lambda x : x > avg, data)
print(new)
new =list(filter(lambda x: x>avg, data))
print(new)
- First, import the statistics module since it contains the mean function.
- Let us compute the average of this data.
- Then display the average so that you can see that the filter works as intended.
- Now we use the filter function to select the data greater than the average.
- We create an anonymous function that creates the input (Lambda expressions) to see if it is above average.
- Next, pass in the last of data.
- The filter() will only return the data for which the function is true.
Output:
Pretty neat huh! Let’s see a few more.
Note:.
Example #2
Consider a program that filters out odd and even numbers.
Code:
Fibnocci = [0,1,1,2,3,5,8,12,21,34,55]
odd_numbers = list (filter (lambda x : x %2, Fibnocci))
print (odd_numbers)
even_numbers = list (filter(lambda x : x%2 == 0, Fibnocci))
print(even_numbers)
Output:
Example #3
What happens when the None value is passing the parameter?
A list of random data has been created below, which consists of strings, integers, and Boolean values. When the function parameter to the filter is None, it filters out data based on whether the element is True or False and returns accordingly.
Code:
New_list = [0, 1, 'a', 'B', False, True, '0', '4']
filtered_list = filter (None, New_list)
print('Filtered elements')
for element in filtered_list:
print(element)
Output:
In Python, the values that are treated as false are the empty string “”, zero 0, an empty list [], empty tuple (), empty dictionary {}, false, none, and those objects that gesture Python that it is a trivial instance.
But be careful while using the filter function in this way. Like, zero 0 is a valid piece of data in most of the situations and would not want to filter that out.
Wondered if there is any such function which filters false items?
Yes, indeed.
Itertools. Ifilterfalse (function, iterable)
Conclusion liner.
Recommended Articles
This is a guide to Python Filter Function. Here we discuss the syntax and parameters of filter function along with different examples and its code implementation. you may also have a look at the following articles to learn more –
|
https://www.educba.com/python-filter-function/
|
CC-MAIN-2020-24
|
refinedweb
| 667
| 55.84
|
.Iterator; 24 25 import javax.el.ELException; 26 import javax.faces.FacesException; 27 import javax.faces.component.UIComponent; 28 29 import com.sun.facelets.FaceletContext; 30 import com.sun.facelets.tag.TextHandler; 31 import com.sun.facelets.tag.jsf.ComponentConfig; 32 import com.sun.facelets.tag.jsf.ComponentHandler; 33 34 /** 35 * Facelets component-handler which creates a FlowCallComponent instance. 36 * <p> 37 * Note that a facelets ComponentHandler is a subclass of TagHandler. The methods in TagHandler 38 * are "tag oriented", ie focused on handling a tree of tags. The methods in a ComponentHandler 39 * are "higher level", ie the callbacks are focused on component creation and configuration. 40 * <p> 41 * Facelets first parses the input into a syntax tree (of Facelets Instruction nodes) and caches 42 * it (for later use). It then walks the tree, invoking the appropriate tag or component handler. 43 * Each ComponentHandler has access to the list of nodes nested within it via the "nextHandler" 44 * member. 45 */ 46 public class FlowCallComponentHandler extends ComponentHandler 47 { 48 public FlowCallComponentHandler(ComponentConfig config) 49 { 50 super(config); 51 } 52 53 /** 54 * When Facelets encounters the start tag for this component, it will create the component and assign any 55 * attributes. It then calls this method. 56 * <p> 57 * Here we ask the nodes nested within this element to return their text. Then the nested text is passed 58 * to the new component. This has the same effect as a JSP tag overriding "doAfterBody", but is pull-style 59 * rather than waiting for a callback to occur. Note, however that the body of this element *has* already 60 * been parsed into instruction nodes; there appears to be no way to stop Facelets doing this. 61 * <p> 62 * Note that even though we process the body text explicitly here, facelets will try to process the nested 63 * Instruction nodes after this method has returned. Therefore the applyNextHandler method is overridden 64 * to prevent that. 65 */ 66 @Override 67 protected void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) 68 { 69 StringBuffer content = new StringBuffer(); 70 71 // Method findNextByType will scan the list of child "nodes" for the "StartElementInstruction" node 72 // that triggered the call to this method. We actually expect just one node (of type Instruction) 73 // which implements the TextHandler interface. It will internally have broken down the XML content 74 // of the flowCall element into separate nodes for the xml elements, attributes and body-text. 75 // However we don't need to know that; just calling getText on that top-level child will cause 76 // it to append together the text representations of all the child elements and return the complete 77 // string. 78 // 79 // The loop is just in case there are multiple child Instruction objects for some reason; this is 80 // not expected. The iterator always stops (hasNext is false) when there are no more child nodes 81 // for this flowCall element. 82 content.append("<flowCall>\n"); 83 Iterator<?> iter = findNextByType(TextHandler.class); 84 while (iter.hasNext()) 85 { 86 TextHandler text = (TextHandler) iter.next(); 87 88 // Fetch the text without evaluating any EL expressions. 89 // Note that text.getText(ctx) *would* evaluate EL expressions 90 String textBlock = text.getText(); 91 92 content.append(textBlock); 93 } 94 content.append("</flowCall>"); 95 96 ((FlowCallComponent) c).setBody(ctx, content.toString()); 97 } 98 99 @Override 100 protected void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent) 101 { 102 // do nothing 103 } 104 105 @Override 106 protected void applyNextHandler(FaceletContext ctx, UIComponent c) 107 throws IOException, FacesException, ELException 108 { 109 // Do nothing. 110 // 111 // This method is called by the Facelets framework immediately after onComponentCreated 112 // is called. 113 // 114 // The normal behaviour is to call this.nextHandler.apply(ctx, c) in order to iterate over 115 // the child instructions of this element and process them. But we don't want this as out 116 // onComponentCreated method has already extracted all of the data we wanted. Without 117 // this override, transient text children would be added to component "c". 118 // 119 // It would be better if we could tell Facelets to not create Instruction nodes for the 120 // nested content of this element at all; then it would not be necessary to override 121 // this method as there *would* be no nested Instruction nodes. But I haven't figured 122 // out how to do that. Facelets is of course driven by a normal XML parser that will 123 // always break down the input into SAX events anyway... 124 } 125 }
|
http://myfaces.apache.org/orchestra/myfaces-orchestra-flow/xref/org/apache/myfaces/orchestra/flow/components/FlowCallComponentHandler.html
|
CC-MAIN-2015-48
|
refinedweb
| 744
| 56.25
|
integral-functions for the long period are incorrect
Hi.
We have some counter for the number of function calls that are sent to the graphite.
The rate is almost the same, so we may treat it as a constant.
We have the following retention rules:
retentions = 60:10080,
So we have one week with 1m data, next month of 5m data, and so on.
If I use any integral function ("integral" of "summarize") it works in such a way:
integral(
integral(
when i use 7d (or 1w), it starts using 5m-data. If I'm not mistaken, it just sums all values, and as the number of values is 5 times less, so the summ is 5 times less than real value.
I've made a screenshots with examples:
http://
The "6d" integral is about 7.2M, so "1w" should be about 7.2M/6 *7 = 8.4M, but it shows 1.7M (=8.4M/5).
I suppose the same problem occurs on the "1m" boundary and "1y" boundary.
What am I doing wrong? Should I change smth in config files or smth?
My usual usecase is to check the following graphs:
summarize(
summarize(
etc.
How should I do this?
Best,
Ivan.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Graphite Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2011-10-07
- Last reply:
- 2011-10-07
Hi Chris,
Thanks for your answer.
If I understand correctly, by using the specified method I wouldn't be able to check the "usual" graphics (I mean "target=series" without "integral" or "summarize")?
The thing is that I forgot to mention that we also do introspecting of the graphics (not the integral values)
so in addition to the usecases above we also do:
target=
target=
etc.
Could I use your method and don't break smth in my data?
Ivan.
I haven't checked the code thoroughly, but it seems to me that it might be done on-the-fly:
webapp/
def integral(
...
current += val
If we could check that the "val" is not from the 1m data, but from the 5m data (or 15m data) we could multiply it by the needed number and get the correct answer.
I mean smth like that (pseudocode):
...
current += val * multiplier(
...
def multiplier(
if timeseries = "5m":
return 5
elif timeseries = "15m":
return 15
....
elif timeseries = "1y":
return 60 * 24 * 356;
Surely, it can be done in a more accurate way, I just made it so rough to make my idea clear.
The methods I outlined change the way whisper aggregates data as it rolls into lower precision archives, so it changes what aggregate values get stored. The summarize() function lets you change how the rendering buckets datapoints and as long as your data is stored correctly (ie. you probably want to aggregate your counters with sum instead of average) then it should give you what you want. But again changing aggregationMethod will only affect future aggregations and thus won't affect any existing aggregated data. So yes I would change the aggregationMethods and use summarize. The rendering code isn't aware of aggregation configurations so we can't do what you suggest of multiplying the value based on the aggregation config.
I think the problem is that your older data in lower precision archives is averaged when you probably want it summed. If you are on a recent trunk checkout or 0.9.9 you can configure the aggregation method whisper uses to rollup datapoints into lower precision archives. To do this you can GET the url http://
graphite/ metrics/ set-metadata? metric= foo.bar. baz&key= aggregationMeth od&value= sum
You can verify it with:
http://
graphite/ metrics/ get-metadata? metric= foo.bar. baz&key= aggregationMeth od
Note that this will only affect future aggregations, it cannot recompute the current aggregate values. You can also change it en masse by POSTing application/json data like this to the set-metadata url:
{
hod", "value": "sum"}, hod", "value": "sum"},
"operations": [
{"metric": "foo.bar.baz", "key": "aggregationMet
{"metric": "foo.bar.baz2", "key": "aggregationMet
...
]
}
In order to make sure metrics created in the future have the proper aggregationMethod, create a /opt/graphite/
conf/storage- aggregation. conf file. It works the exact same way storage- schemas. conf does except instead of specifying 'retentions' for a set of metrics, you define 'aggregationmethod' and/or 'xfilesfactor'. For example:
[latency-metrics]
pattern = .*responseTime
aggregationmethod = average
[everything-else]
match-all = true
aggregationmethod = sum
Again this only works with 0.9.9 or recent trunk. I hope that helps.
|
https://answers.launchpad.net/graphite/+question/173304
|
CC-MAIN-2016-50
|
refinedweb
| 756
| 64.61
|
Due to a snafu, the TFS docs were inadvertently removed from the VS2008 SDK. The situation has been remedied. You will find the latest version of the TFS SDK docs here:. Many of you probably never noticed – all the better 🙂 However I did get quite a few inquiries about it. Thanks for your patience.
Brian
Join the conversationAdd Comment
PingBack from
I can’t find the documentation for the classes in the Microsoft.TeamFoundation.Build.Client namespace in the new TFS SDK.
In particular I’m interested in how to get a valid buildUri to pass to the IBuildServer.GetBuild(Uri) method using only the values available in the BuildStatusChangedEvent notification data.
Regards,
– Jason
I’m afraid your eyes are not deceiving you. Docs for the new build API have not been published. We are working with the doc team now to get them written. Send me email at bharry@microsoft.com and I’ll get you hooked up with the right person to get your questions answered.
Brian
Charles Sterling on Team System Productivity Case Studies. The Teams WIT Tools Blog on FAQ #5: How do…
|
https://blogs.msdn.microsoft.com/bharry/2008/02/06/the-tfs-sdk-docs-are-back/
|
CC-MAIN-2018-09
|
refinedweb
| 187
| 68.77
|
Ads by The Lounge
[UPDATE: I finally built an installer and added some error handling, so this should be easier to set up and use. Download the setup from web radio stations (like the super cool SomaFM) only offer PLS playlists, and Windows Media Player doesn't support PLS playlists even though they're about the simplest file imaginable.I whipped up a simple app (OpenPlsInWMP) that parses the stream url out of a PLS file and shells out to WMP, so if you associate PLS files with OpenPlsInWM it'll seem like Windows Media Player decided to play nice with PLS files.
It's working pretty well for me. If the stream is interrupted you may have to kill WMP and click the PLS link again - it doesn't seem to restart as well as with ASX streams. YMMV.Download It [updated]Dirt Simple Code:using System;using System.IO;namespace Jon.Galloway.Wrote.Me{ class OpenPlsInWM { [STAThread] static void Main(string[] args) { if (args.GetUpperBound(0) > -1) { string filename = args[0]; using (StreamReader sr = new StreamReader(filename)) { string line; while ((line = sr.ReadLine()) != null) { if (line.ToLower().StartsWith("file1=")) { string url = line.Split('=')[1]; System.Diagnostics.Process.Start("wmplayer.exe",url); break; } } } } else { Console.WriteLine("Usage: OpenPlsInWM \"playlist.pls\""); Console.WriteLine("Associate PLS file extension with this application to allow Windows Media Player to play them."); } } }}
Yes! I have been listening to SomaFM on Realplayer and it sucks. I also dislike winamp. This is a great solution. Thanks!
Hi there. How do I "associate PLS files with OpenPlsInWM"? Thanks in advance!
Joe - One way to associate PLS files with OpenPlsInWM:
1) Save a PLS file to your desktop
2) Right click / Open with
3) Browse to where you saved OpenPlsInWM.exe
4) Check the "Always use the selected program..." checkbox.
5) Hit okay.
Absolutely brilliant program. Thanks a lot!
I like your idea, but it does not work on my machine. I'm running win2K. Any suggestions? -John
John -
First step is to verify you have Microsoft.NET framework 1.1 installed. Check this page for some info:
If you do and it still doesn't work, I'll need more info. Did you follow the steps I gave to Joe?
I'm planning to do another release of this that includes a friendlier installer, by the way.
Thank you so much for this! awesome work around
this rocks... thanks for making it... I don't like having multiple pieces of software on my machine, all doing the same thing, and winamp isn't as good as WMP all around.... thanks again
nice program. i just have one small problem... i use live365.com which requires a login. in linux, xmms handles this fine but wmp+openplsinwmp doesnt seem to be able to. any ideas?
I encountered the error message C00D11CD through windows media player. I'm running Media player 9.0 with windows XP.
Any ideas? I'd be delighted if this works.
Jason -
Man, that C00D11CD error is a pain. It's basically a "catch all" message meaning something bad happened. I looked at this a little, but don't have any ideas yet.
Pen-n-Paper -
Interesting - I hadn't thought about Live365 for this - it can work with WMP as an internal player. I'll have to poke around when I get a chance. If you beat me to it, let me know.
This works great! Thanks for sharing!
Awesome program...works great!
Hey it sounds cool, but I have Windows Media Player 10.00.003473 and Windows XP SP2 so do you think you can make it support the new Windows Media Player?
davo -
i'm running XP SP2 and WMP 10.00.003473 and it's working for me. can you give me info on what problems you're having? did you read the other comments for things other users have run into?
I'm using wmplayer 11, and it's working fine with it. Only the problem is, that it can't log into live365.com.
I can listen live365 if:
1. copy the string beginig http://......
2. open wmplayer -> file -> open url, and paste the full address.
Thx :D
Very good job
This program doesn`t work as it should do.
I know what i`m talking about.
It doesn`t support WMP 10, and when i downgrade to 9.0, it won`t work at all.
Maybe a new fix for your program.
I tried it at several sites, and always does your program appear wit great results, but ity doesn`t work with wmp 10.
Tried on several pc`s
actually, it does work with WMP 10. because thats what i'm using and have no problems at all.
He he he excellent! Using the Version 11 Beta of WMP and it works fine :-)
I am so glad people share
I love this man. Just what I was looking for and so easy to use.
Thanks.
I am using Windows Media player 10.
And I would so love to be able to play pls files. Please update this thing! I'm an idiot, and do not have the foggiest idea how it works. If it doesn't have gears and bearings, I'm lost.
I have no idea how to use this. I enter the .pls location in my browser and hit enter and it says it cant play it. I try to save it as a file and there's no "open with". There's only "send to"
Thank you, very good program, works like a charm!
Just wondering, is it possible to incorporate the "Now Playing" feature that winamp has into this plugin? I like to see what track and artist is playing while listening to shoutcast streams (the only advantage to winamp so far!)
Thanks
Totally Cool, you are my Person Of The Week!!!!!
Agreed with Steve above - would love to see the "Now Playing" feature
Thank you, this works GREAT!
Great.
Thanks man.
You do not need to have this program. All someone has to do is open the .pls with notepad and copy the and paste the URL into WMP.
Here is a screenshot:
In the linux/unix world you teach people how to do things if there is a solution instead of making software all of the time if it's not needed, and in this case this software was not needed to help address this issue.
Give a man a fish and he'll eat for a day, teach a man to fish and he'll eat for life!
ALOHA
@Das - That's exactly what the program does. I distribute the source with it, so you can see. The point is that it's a stupid waste of time to have to download the pls file, edit it, find the mp3 stream, and open it in Windows Media Player. What's the point of doing that? Why not use a tiny program to do that for you? If you only want open one pls stream the manual solution may be fine, but try browsing through shoutcast that way.
Very nice tool!! Works fine, though it has a hard time playing AAC+ files, it gives an error and than play it anyway ;)
tnx!
Jon:
Since installing .PLS APP and .NET Framework, I lost all audio. Any ideas ?
Thanks.......
This is great.Keep up the good work.
I got an error "Unable to check the stream to check for AAC+ Please change your firewall settings to allow this program to access the internet."
I'm in a business setting where messing with firewall settings is impossible. WMP accesses the internet with no problem - any workaround suggestions?
Seoman
Back in April I wrote a very basic console app which would (theoretically) allow you to play Shoutcast
Dude you rule! I've been looking for something to make this easy for a while!
I get the same Unable to check the stream to check for AAC+ error and have configured both Zone Alarm and NIS to allow OpenPLSInWMP.exe internet access. I've also disabled them both and still I get the error. I've downloaded and installed the AAC+ codec from.
Any ideas?
great program... but everytime i open a pls. file a cmd.window will flash before the media player play, is it normal?
I am trying to load a .pls link with your program and get the following error message:
"Windows Media Player cannot play the file. One or more codecs required to play the file could not be found."
OW: Windows XP Pro Version 5.1 SP2
Windows Media Player version 10.00.00.4036
Ignore my above comment, silly me, forgot to reboot after install.
Uh oh, the link to download is broken!
@Chris Hills - Thanks! I updated the link.
download does not seem to work...
@hara - Thanks, I updated the other download link. You'll need Javascript enabled to download from.
The download link still does not work. Also, I got the app from another site but no function on wmp 11. Hope you can get it working soon. I like ultra player but I don't like having multiple apps. Oh check out BS Player. Can I modify the source to play .pls is BS.
@Chad - Do you have Javascript disabled? I just downloaded it from the site.
i keep getting this error message:
Windows Media Player cannot connect to the server. The server name might not be correct, the server might not be available, or your proxy settings might not be correct.
i've set my protocol to "autodetect proxy settings" and "use proxy settings of the Web browser" and neither worked. i got the same message for both. any suggestions?
I have the .PLS file associated with your program, and it parses the file to open in WMP11. However right when that happens and mp opens i get "You've encountered error message C00D109B" "Windows Media Player cannot play the file. One or more codecs required to play the file could not be found."
i have the orbit plugin and the k-lite pack. Am I missing something?
thanks for the hard work.
Hi could somebody sent the file to me via email. gonzalo_duque@yahoo.com
When I tried to download it nothing happens
thanks
I need to play vedio files which is stored in webserver onclick event. How can I do this in asp.net 1.1......Thanks in advance
Hey thanks alog for this app, I would never say WMP is better than winamp... If you use winamp these days you wouldn't have anyway to say that... The sound quality for one is superior on my X-Fi with winamp. It glitches less then WMP, especially with streaming music. Theres so many things winamp can do by default that WMP needs to be configured for, or apps like these made to get it to do a simple task... If you dont want multiple programs on your computer, delete WMP and use winamp... Then we dont have to waste our time MAKING windows media player do what it should by default... Just my two cents.
Please host this file somewhere else so we can grab it
I fixed the link on the download page.
i got the error "the specified module could not be found"
what should i do in order to fix this problem?
Excellent. Thanks.
Anyone know how to stream video via shoutcast to media player?
Im stuned to see all those comments in favor of WMP, instead of WINAMP. is this what shows the grasp of M$ since some of you probably cant install winamp at work bcos you may not use non M$ programs? and since WMP comes "free" installed with u know what.
eat fish... lol.
ps. Jon good work! no disrespect! was just looking for a way to get rid of the WMP streaming annoyance and try to get it working in Winamp and came across your site. since many windows people use wmp you helped a lot of them and thats good work.
-ps english no good me sorry me dutch- :)
@Obelix - No disagreement. I switched to Winamp when WMP 11 came out.
Since I can't get Winamp to run reliably in Vista, this application has made living with Windows Media Player much more bearable. Thanks tons!
Good site thanks <a href= > mature thin blonde </a> <a href= > mature babe </a> <a href= > free matures </a> <a href=-***.info/ > mature gay truckers </a> <a href= > big ass mature </a> <a href= > hairy mature </a>-***.info/
hi Jon, this worked like a charm with wmp11. thanks!
Thx for sharing it but it cant show song title
Thanks. Worked as described. Now to get more streaming stations to fly in linux....a different story. This worked well.
Quick question, I was playing around with the included file "OpenPlsInWMP.cs" that comes with the installer and trying to get it to do more stuff and noticed that you include both MeesageBox and Console code, is there a newer version coming, or should I add a reference to Sys.Win.Forms.
Thanks,
jim
You can download Live365 right into WMP10, not WMP11. I followed the notepad cut n paste and it worked great, even for WMP11 which is only wants to push "Urge." So, either roll back to WMP10 or do the notepad thing. Works great.
I could not make this program work with WMP 10 on my slimmed-down media center 2005 (xp pro). Unfortunately none of the suggestions for codecs etc. helped. But I was motivated to install Winamp (which I have been putting off for some time). Great decision! What have I been thinking? Forget WMP! Install Winamp.
Well I may give up. I installed the program, but the PLS from this site won't play. WMP 11 says pls is a non recognizable format.
Any Ideas ??
Cheers
Sorry this is the actual site as well.
Can anyone get this working with OpenPls ???
Okay after a late night I figured out why it would not work.
The program did not automatically associate itself with the pls files, rather WMP bypassed the openpls altogether.
Once i realized that I changed the association and Presto. Works like a charm.
Thanks John for a great piece of Work...
Works awsome,no need to use WinAmp,thanks for
giving that gem for free.
hi - thanks for sharing this tool - i'm a bit stuck trying to get it working with live365 though - using wmp10 and XP, would like to use to add radio stations from live365 to wmp so that I can then stream them to a media streamer.
OpenPls seems to work a treat but I keep getting aplayed an audio file saying my session is invalid - assume this is something to do with login on live365?
any thoughts?
Hi Jon, great work.. All WinAMP-whiners, shut up... I used to have WinAMP installed on every PC I owned(Which are a lot), till they brought a bunch of buggy, resource-eating, adware-infested, lame releases, with too much non-interesting options and lame music or coupons... Nowadays, WMP is just as good as WinAMP, just install the right codecs and no more hustling around with software that looks like it's made by a hobbyist... If you can't set up your PC or program the right way, don't bother criticizing ppl that actually make stuff that make things easier... Especially when they give out their sourcecode, so other ppl can learn from that!!!
If anyone has probs with a lot of interrupted streams, putting in a bigger buffer could help... WMP has a default of 5 seconds... Go to the options, tab Performance and set the buffer to 10 or 20 secs... The buffer from WinAMP is also bigger than 5 secs by default, so I think this probably will work quite well...
Jon, I only have only one thing on my wishlist for this great tool: A lot of Shoutcast streams have more than 1 server.. Maybe a next version can support this?? I have no experience with programming these things, but if I have some time in the near future, I'll have a look at it too and let you know if I find something..
<a href= >a summary of the life of olaudah equiano</a> <a href= >a ouija</a> <a href= >a shock to the system simon brett</a> <a href= >a models life</a> <a href= >a good man is hard to find study questions</a>
so simple, yet makes something i wanted to do possible. thanks for doing this and offering it.
I love this, I uninstalled winamp (that I only had because it played pls files). Good job man !
dude you are the man!!!
this fix works great. u r awsome!
Hi Jon,is there a new version for Vista 32 bit,or the actual version works with it?,thanks
for any information.
Jon, outstanding little program. Worked 1st time perfectly (as predicted) on my P4 XP-Pro SP2 machine at work running WMP9. The basic theory of parsing the stream url out of a PLS file then opening in WMP worked as well but obviously without the convenience of the program's file association.
Before installing the program on my PCs at home, I tried the parsing of the stream URL routine to see if WMP8 would work. It didn't work. Could this be because WMP8 is incapable of playing playlist files (.pls) using this technique or perhaps that the Microsoft.NET framework is not installed? Apologies in advance...I did not check to see if it was there on the home machines. I only read that it was required just prior to sending this note. The version of .Net on the work PC is v2. Home PCs are all XP-Pro SP1a w/WMP8.
Any thoughts?
works like a CHARM! bless you.
The program is working great in Windows Media Player 11, however would like to know how can I get it to display the artist name and son
nice programm,works fine ( i just gets an error message because of acc blalba but this seems to be my firewall).thanks:]
Simple solutions:
Play PLS file in Media Player Classic
Download Codec Pack free:
K-Lite Codec Pack 3.4.5 Full
and associate PLS files with
Media Player Classic (installed with K-Lite)
------------------------------
and K-Lite Codec Pack allows you to play almost every movie file
in Windows Media Player
is it possible for listeners to listen my shoutcast in Windows Media Player? without downloading something? so that they just click and opens in Windows Media Player?? Thanx a lot!!
Will it work with PLS files that simply list a series of MP3 files located on a local or network drive? I have ripped most of my CDs to MP3 and created PLS files for each. I would like to try M3U so I can listen in WMP but this is hundreds of files so an easy conversion tool would be welcomed.
Nice job! Haven't done any programming in years, so have no idea how to do this but - how could you suppress the cmd window? Set it to run minimized might be less obvious. Is it the console.writeline statements that cause it to pop up? Just curious, as it works exactly as described with XPProSP2 and WMP11.
Thanks!
Grand stuff, now I can hear Somafm at a better rate. Handshake from me!
works perfectly.
firefox, wmp11, xp sp2.
awesome work.
Hello and thanx for a great program.
AAC+ streams doesnt work, not in WMP11 anyway.
The workaround is to drag the saved pls file into the playlist window and doubleclick. Still it would be nice if it could work with your program.
hey Jon! I love this software. I listen to a lotta trance on freakradio.fm, & your suggestion has made listening to it much easier.
anyway, i was wondering if it is possible to save the playing tracks onto your hard disk, in mp3 or any audio format. i know it's highly unlikely, but if possible, it'll be the best thing ever..............hope you can help me!!!
Your program worked just fine on my PC. Thank you for your good work and congratulations.
Genius. Thats great works nicely. Thanks dude.
You're program is awesome. Even winamp wasn't running the .pls file I was trying to get to.
I have Windows XP and WMP ver. 11.05721.5230, if you're keeping track. :-)
Thanks a bunch!
you the man!, thank-you so much for this really useful app....absolute brilliance.
Great Utility!!!!
I like the toolbar option of WMP and have been listening to Bluemars radio, but they use the pls format. Thanks to you I can use the WMP toolbar for Bluemars.
Wow, fantastic little program- works like a dream! Thanks!
thank you thank you thank you
Awesome, thanks. I translated your work into python because I don't want to install .NET. Check it out if you are interested:
python.pastebin.com/f1d53dfae
Thanks For All The Info.
I had mad an internet music station using pls. extension cus the price to run a shoutcast station was cheaper then running a asx. mm. files using WMP.
I downloaded the the file so it can play in WMP.
Plays now in WMP with no prolem.
WMP v11.
Thank You... Have A Great Day.
Pingback from Windows » re: [Util] Open PLS Playlist in Windows Media Player
here using windows media player 11? well if you want to use shoutcast pls files in it it's really simple if you can edit the *.pls file take the"> Out of the pls file and open url with media player and pit it in as follows don't need no little hacks nor programs to make it work :)
There's a shareware tool called shoutscan (free to try) that rips tons of radio stations and can save both in .pls and .asx and .m3u
.asx is directly supported in Windows Media Player
<a href=>">> </a>
Hi I have tried and tried to get this radio station to play in real player in winamp player and now windows media player that link you sent i could not get it to work i have windows xp and you said something about java enabled how do i find out if it is,,,thanks in advance
I get an error page when I click on your download link:
DotNetNuke Error: - Version 04.06.02
Index was outside the bounds of the array.
When I try to download your compiled proramme I get this:
A critical error has occurred.
Could not find file 'D:\Websites\tools.veloc-it.com\Portals\2\Repository\OpenPlsInWmp2Setup.45a14f27-82ff-4ef9-9b6e-3a29d3d34c26.zip'.
When I go to the place you specify in your link and try to get the programme, I get the following:
regards: Nick
this is soo HACKS!
I tried to use this program with the file from the URL that i've given. It doesnt work. Im using Windows Media Player Fileversion 11.0 And my OP is Windows Vista
Cheap zolpidem. Zolpidem online. Zolpidem without prescription. Zolpidem fedex. Zolpidem.
The download link is broken.
tools.veloc-it.com/.../Default.aspx
Claims the hostname is bad.
Same problem as GLyndon. Hostname is bad.
I've moved it to a new permanent home:
"Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file."
error message C00D1199
Got Windows Vista and WMP11
What am I supposed 2do?
Same as the last person. Its very flakey under vista with WMP11. It worked the first time I installed it. Then clicked on a PLS link after 10 times and it finally worked.
Vista 64 SP1
havnt thought about this in ages, seen this ages ago and used it for long time before i realized that if you use this then itll play in wmp
sc1.netstreamer.net
THANKS! I can finally stream my college radio station! (via WMP 11.0.6001.7000 on Vista SP1) Works great.
Hi
Very nice program. But It does not recognize rtsp:\\ or ULS with no extention. Could you make it a bit more flexible so it recognize other streams than mms://
An interface for URL-handler to manually change settings would be nice from user's point of view . Or it that to hard to implement?
Thx a lot!
Thanks!!
I was scared that it wouldnt work because I have Vista and well, things dont work for it sometimes, but this does.
Jon, can your app be loaded onto a smartphone such as the samsung saga, which runs Windows Mobile 6.1 with Windows Media Player Mobile edition? Will it work once it's loaded? Thank you.
Very cool tool! I'm really happy that I stumbled upon this.
I'm having a problem with AAC+ Shoutcast stations, though. I have the Orban plugin installed and I can play streams in WMP if I open them from the Tuner2 site or if I paste the URL in the format that Orban defines(icyx://123.45.67.8:8000). When I try to open it from Shoutcast directly, I get the error message in WMP "Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file."
Suggestions?
ewe. BSD bracket style
It'a working also on Vista?
I'm asking if it's working under Vista because I tried and still can't listen pls files
U rock, it works! haha
Does not work on my computer. I have an mp3 song that opens with windows media player classic but not with media player 11. How can i make it work with WMP 11? or make it work with classic without changing the default program of all my other songs?
sv1296@hotmail.com
|
http://weblogs.asp.net/jgalloway/archive/2004/04/08/109672.aspx
|
crawl-002
|
refinedweb
| 4,352
| 84.47
|
The ES2020 specification brought many interesting features. In this tutorial, you will learn about seven ES2020 features that attracted the most attention:
BigInt,
matchAll(),
globalThis, dynamic import,
Promise.allSettled(), optional chaining and nullish coalescing operator.
BigInt
The first of ES2020 features, new data type called
BigInt, can seem like a minor. It might be for many JavaScript developers. However, it will be big for developers who have to deal with large numbers. In JavaScript, there is a limit for the size of a number you can work with. This limit is 2^53 – 1.
Before the
BigInt type, you could not go above this limit because the
Number data type just can't handle these big numbers. With
BigInt you can create, store and work with these large numbers. This includes even numbers that exceed the safe integer limit. There are two ways to create a
BigInt.
The first way is by using
BigInt() constructor. This constructor takes a number you want to convert to
BigInt as a parameter and returns the
BigInt. The second way is by adding "n" at the end of an integer. In both cases, JavaScript will add the "n" to the number you want to convert to
BigInt.
This "n" tells JavaScript that the number at hand is a
BigInt and it should not be treated as a
Number. This also means one thing. Remember that
BigInt is not a
Number data type. It is
BigInt data type. Strict comparison with
Number will always fail.
// Create the largest integer let myMaxSafeInt = Number.MAX_SAFE_INTEGER // Log the value of "myMaxSafeInt": console.log(myMaxSafeInt) // Output: // 9007199254740991 // Check the type of "myMaxSafeInt": console.log(typeof myMaxSafeInt) // Output: // 'number' // Create BigInt with BigInt() function let myBigInt = BigInt(myMaxSafeInt) // Log the value of "myBigInt": console.log(myBigInt) // Output: // 9007199254740991n // Check the type of "myBigInt": console.log(typeof myBigInt) // Output: // 'bigint' // Compare "myMaxSafeInt" and "myBigInt": console.log(myMaxSafeInt === myBigInt) // Output: // false // Try to increase the integer: ++myMaxSafeInt // Output: // 9007199254740992 ++myMaxSafeInt // Output: // 9007199254740992 ++myMaxSafeInt // Output: // 9007199254740992 // Try to increase the BIgInt: ++myBigInt // Output: // 9007199254741007n ++myBigInt // Output: // 9007199254741008n ++myBigInt // Output: // 9007199254741009n
String.prototype.matchAll()
The
matchAll() is another smaller item on the list of ES2020 features. However, it can be handy. What this method does is it helps you find all matches of a regexp pattern in a string. This method returns an iterator. When you have this iterator, there are at least two things you can do.
First, you can use a
for...of loop to iterate over the iterator and get individual matches. The second option is to convert the iterator to an array. Individual matches and corresponding data will become one individual items in the array.
// Create some string: const myStr = 'Why is the answer 42, what was the question that led to 42?' // Create some regex patter: const regexp = /\d/g // Find all matches: const matches = myStr.matchAll(regexp) // Get all matches using Array.from(): Array.from(matches, (matchEl) => console.log(matchEl)) // // ] // Get all matches using for...of loop: for (const match of matches) { console.log(match) } // // ]
globalThis
JavaScript developers working with different environments have to remember that there are different global objects. For example, there is the
window object in the browser. However, in Node.js, there is
global object. In case of web workers, there is the
self. One of the ES2020 features that aims to make this easier is
globalThis.
The
globalThis is basically a way to standardize the global object. You will no longer have to detect the global object on your own and then modify your code. Instead, you will be able to use
globalThis. This will always refer to the global object for the environment you are working with at the moment.
// In Node.js: console.log(globalThis === global) // Output: // true // In browser: console.log(globalThis === window) // Output: // true
Dynamic import
One thing you have to deal with are various imports and growing amount of scripts. Until now, when you wanted to import any module you had to do it no matter the conditions. Sometimes, you had to import a module that was not actually used, based on the dynamic conditions of your application.
One of the ES2020 features, quite popular, are dynamic imports. What dynamic imports do is simple. They allow you to import modules when you need them. For example, let's say you know you need to use some module only under certain condition. Then, you can use if...else statement to test for this condition.
If the condition is met you can tell JavaScript to import the module so you can use it. This means putting a dynamic import inside the statement. The module will be loaded only when condition is met. Otherwise, if the condition is not met, no module is loaded and nothing is imported. Less code, smaller memory usage, etc.
When you want to import some module using dynamic import you use the
import keyword as you normally would. However, in case of dynamic imports, you use it as a function and call it. The module you want to import is what you pass into the function as an argument. This import function returns a promise.
When the promise is settled you can use the then() handler function to do something with the imported module. Another option is to use the await keyword and assign the returned value, the module, to a variable. You can then use that variable to work with the imported module.
// Dynamic import with promises: // If some condition is true: if (someCondition) { // Import the module as a promise // and use then() to process the returned value: import('./myModule.js') .then((module) => { // Do something with the module module.someMethod() }) .catch(err => { console.log(err) }) } // Dynamic import with async/await: (async() => { // If some condition is true: if (someCondition) { // Import the module and assign it to a variable: const myModule = await import('./myModule.js') // Do something with the module myModule.someMethod() } })()
Promise.allSettled()
Sometimes, you have a bunch of promises and don't care if some resolve and some reject. What you want to know is if and when all those promises are settled. This is exactly when you might want to use the new
allSettled() method. This method accepts a number of promises in the form of an array.
It is only when all promises in the array are settled this method resolves. It doesn't matter if some, or all, promises are resolved or rejected. The only thing that matters is that they are all settled. When they are, the
allSettled() method will return a new promise.
This value of this promise will be an array with statuses for each promise. It will also contain value for every fulfilled promise and reason for every rejected.
// Create few promises: const prom1 = new Promise((resolve, reject) => { resolve('Promise 1 has been resolved.') }) const prom2 = new Promise((resolve, reject) => { reject('Promise 2 has been rejected.') }) const prom3 = new Promise((resolve, reject) => { resolve('Promise 3 has been resolved.') }) // Use allSettled() to wait until // all promises are settled: Promise.allSettled([prom1, prom2, prom3]) .then(res => console.log(res)) .catch(err => console.log(err)) // Output: // [ // { status: 'fulfilled', value: 'Promise 1 has been resolved.' }, // { status: 'rejected', reason: 'Promise 2 has been rejected.' }, // { status: 'fulfilled', value: 'Promise 3 has been resolved.' } // ]
Optional chaining
As a JavaScript developer you probably often work with objects and their properties and values. One good practice is to check if specific property exists before you try to access it. This okay if the structure of the object is shallow. It can quickly become a pain if it is deeper.
When you have to check for properties on multiple levels you quickly end up with long conditionals that can't fit the whole line. You may no longer need this with one of the ES2020 features called optional chaining. This feature caught a lot of attention. This is not a surprise because it can help be very helpful.
Optional chaining allows you to access deeply nested object properties without having to worry if the property exists. If the property exists, you will get its value. If it doesn't exist, you will get
undefined, instead of an error. What's also good about optional chaining is that it also works on function calls and arrays.
// Create an object: const myObj = { prop1: 'Some prop.', prop2: { prop3: 'Yet another prop.', prop4: { prop5: 'How deep can this get?', myFunc: function() { return 'Some deeply nested function.' } } } } // Log the value of prop5 no.1: without optional chaining // Note: use conditionals to check if properties in the chain exist. console.log(myObj.prop2 && myObj.prop2.prop4 && myObj.prop2.prop4.prop5) // Output: // 'How deep can this get?' // Log the value of prop3 no.2: with optional chaining: // Note: no need to use conditionals. console.log(myObj.prop2?.prop4?.prop5) // Output: // 'How deep can this get?' // Log non-existent value no.1: without optional chaining console.log(myObj.prop5 && myObj.prop5.prop6 && myObj.prop5.prop6.prop7) // Output: // undefined // Log non-existent value no.2: with optional chaining // Note: no need to use conditionals. console.log(myObj.prop5?.prop6?.prop7) // Output: // undefined
Nullish coalescing operator
This feature, nullish coalescing operator, is also among the ES2020 features that caught a lot of attention. You know that with optional chaining you can access nested properties without having to worry if they exist. If not, you will get undefined. Nullish coalescing operator is often used with along with optional chaining.
What nullish coalescing operator does is it helps you check for "nullish" values and act accordingly. What is the point of "nullish" values? In JavaScript, there are two types of values, falsy and truthy. Falsy values are empty strings, 0,
undefined,
null,
false,
NaN, and so on.
The problem is that this makes it harder to check if something is only either
null or
undefined. Both
null and
undefined are falsy and they will be converted to
false in boolean context. The same will happen if you use empty string or 0. They will also end up
false in boolean context.
You can avoid this by checking for
undefined and
null specifically. However, this will require more code. Another option is the nullish coalescing operator. If the expression on the left side of the nullish coalescing operator evaluates to
undefined or
null, it will return the right side. Otherwise, the left.
One more thing. The syntax. The syntax of nullish coalescing operator is quite simple. It is composed of two question marks
??. If you want to learn a lot more about nullish coalescing operator take a look at this tutorial.
// Create an object: const friend = { firstName: 'Joe', lastName: undefined, // Falsy value. age: 0, // falsy value. jobTitle: '', // Falsy value. hobbies: null // Falsy value. } // Example 1: Without nullish coalescing operator // Note: defaults will be returned for every falsy value. //: // 'Age is unknown.' // Log the value of jobTitle (value is '' - falsy) console.log(friend.jobTitle || 'Job title is unknown.') // Output: // 'Job title is unknown.' // Log the value of hobbies (value is null - falsy) console.log(friend.hobbies || 'Hobbies are unknown.') // Output: // 'Hobbies are unknown.' // Log the value of non-existing property pets (falsy) console.log(friend.pets || 'Pets are unknown.') // Output: // 'Pets are unknown.' // Example 2: With nullish coalescing operator // Note: defaults will be returned only for null and undefined. //: // 0 // Log the value of jobTitle (value is '' - falsy) console.log(friend.jobTitle ?? 'Job title is unknown.') // Output: // '' // Log the value of hobbies (value is null - falsy) console.log(friend.hobbies ?? 'Hobbies are unknown.') // Output: // 'Hobbies are unknown.' // Log the value of non-existing property pets (falsy) console.log(friend.pets ?? 'Pets are unknown.') // Output: // 'Pets are unknown.'
Conclusion: 7 JavaScript ES2020 features you should try
The ES2020 specification brought many features. Some of them are more interesting and some less. Those seven ES2020 features you've learned about today are among those features that deserve attention. I hope this tutorial helped you understand how these features work and how to use them.
Discussion (10)
Actually, the limit for the number you can work with is not exactly correct. JavaScript implements IEEE 754 floating point numbers, which means that while yes, you have a 53 bit mantissa which allows you to define numbers with full integer precision up to 2*53-1, you also have a binary exponent of 11 bits, so the largest number is +-1,798 * 10*308.
Optional chaining and the nullish coalescing operator are pretty sweet additions to the language. I don't want to miss them now that I'm used to using them.
The concern is with the most positive and negative safe integer - i.e. without any loss of precision.
With numbers that large, a little loss of precision might not matter, depending on the use case. But yes, BigInt is a bit step forward in all other cases.
The magnitude of the quantity isn't the deciding factor whether precision is significant - what the quantity represents is. In some contexts an accurate difference between quantities is more important than the quantities themselves.
Also not everyone who writes a program is fully aware of the implications of floating point representations - especially the limitations of whole numbers represented therein.
What Every Programmer Should Know About Floating-Point Arithmetic
That's what I said: it depends on the use case. And I wholeheartedly agree that we should be conscious about the data formats we use every day and the implications of their use - especially in the context of coercion in weak-typed languages like JavaScript.
As you point out the implicitness of type coercion (also falsy and truthy) can lead to surprising behaviour - coming from other languages. However the notion of strong or weak-typed isn't all that useful.
JavaScript is dynamically typed (as opposed to statically typed) and it's loosely typed as non
constbindings can change the type they refer to at run-time. But everything has a type in the sense that it is either a primitive value, a structural type, or
null- a structural root primitive.
The issue is that before
BigInt(caiuse BigInt: note: IOS prior to 14 doesn't support it) there wasn't a dedicated integer type and even now there are performance implications with using
BigInt. So for the general
Numberuse case anything outside the [-253 - 1, 253 - 1] range is effectively a floating point value due to the lack of precision and constant care has to be taken that an "integer" value isn't inadvertently turned into a "floating point" value (e.g.
dividend/divisorinstead of
Math.trunc(dividend/divisor)).
And then bitwise operators only operate on 32-bit values (Int32, Uint32 for unsigned right shift (>>>); Integers and shift operators in JavaScript).
Douglas Crockford went as far as proposing an alternate number format some time around or before 2014 - DEC64.
Before BigInt, there was asm.js (which automatically handled numbers that were floored with
|0in any operation as integers) and Typed arrays. But other than that, you're right.
i.e. trunctated, not floored - and that tactic is limited to signed 32 bit values.
Interestingly enough Rescript adopted 32 bit signed integers while TypeScript never bothered with them.
TypedArray/ArrayBuffer/DataView are less about integers and more about a performant means of sharing/moving binary data between execution contexts.
Hey, thanks for sharing this great post.
I have also created a series of my own dedicated to new JS features that are less commonly used. Here is the last post - but you can go back through the series and find my description of many more features too: dev.to/ianholden/future-javascript...
Also
debuggeris a good keyword too
|
https://dev.to/alexdevero/7-javascript-es2020-features-you-should-try-4p9d
|
CC-MAIN-2021-10
|
refinedweb
| 2,600
| 59.3
|
Hey Folks
I have an issue with my core after I’ve used the pin triggered sleep. The core didn’t connect to the cloud, but it does connect to the wifi. When it tries to connect to the cloud (the RGB led trying to go to a breathing cyan), it turns to the white color and return back to the green led. Any suggestion please?
Here is my code that I’m using:
Many thanks for @ScruffR @peekay123 for helping me in this code:
#include "application.h" #include "Serial2/Serial2.h" char szReceive[64] = { '\0' }; int RxPin = D0; int idx = 0; uint32_t ms; uint32_t msPublish; bool frameStart = false; void setup() { Serial2.begin(19200); Serial.begin(19200); pinMode(RxPin, INPUT); } void loop() { ms = millis(); while (Serial2.available() && millis() - ms < 1000 && idx < 38) { Serial2.flush(); char c = Serial2.read(); Serial.write(c); if (c == 'S') { frameStart = TRUE; idx = 0; } if (frameStart) { szReceive[idx++] = c; szReceive[idx] = '\0'; } } Serial.println("Fallen out of while"); if (idx >= 38 && millis() - msPublish > 1000) { Serial.println(szReceive); Spark.publish("Carpet1", szReceive, PRIVATE); msPublish = millis(); idx = 0; frameStart = FALSE; } Serial.print(idx); Serial.print('\t'); Serial.print(frameStart); Serial.println("-----------------------------------"); Spark.sleep(D0,RISING); }
I’m facing hard time in testing the code, since I should make a factory reset each time the core goes to the sleep mode to check the modified code. Actually, I don’t know how I can download the new code to the core while it is in the sleep mode.
Thanks in advance.
Ahmed.
|
https://community.particle.io/t/the-core-didnt-connect-to-the-cloud-after-waking-up-from-a-pin-triggered-sleep/13907/3
|
CC-MAIN-2022-27
|
refinedweb
| 253
| 66.23
|
<mux-video/><mux-video/>
IntroductionIntroduction
<MuxVideo/> is a Mux-flavored React video component.
If you are familiar with using
<video /> + Hls.js in your application, then you'll feel right at home with this React component.
InstallationInstallation
If you're using
npm or
yarn, install that way:
Package managerPackage manager
yarn add @mux/mux-video-react
or
npm i @mux/mux-video-react
Then, import the library into your application with either
import or
require:
import MuxVideo from '@mux/mux-video-react';
or
const MuxVideo = require('@mux/mux-video-react');
Features and benefitsFeatures and benefits
Without
<MuxVideo/>, if you want to use the browser built-in HTML5 video element for playback you would have to wire up Hls.js and Mux Data yourself.
<MuxVideo/> will automatically handle recoverable errors that happen during video playback. This is particularly handy for live streams that may experience disconnects.
<MuxVideo/> will use the optimial Hls.js settings for Mux Video so you don't have to worry about that.
<MuxVideo/>-video>.
Now you are free to use this web component in your HTML, just as you would with the HTML5
<video> element.
const MuxVideoExample = () => { return ( <div> <h1>Simple MuxVideo Example</h1> <MuxVideo style={{ height: '100%', maxWidth: '100%' }} playbackId="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe" metadata={{ video_id: 'video-id-123456', video_title: 'Super Interesting Video', video.
video_title: string: Title of the videoVideo/>can make optimizations based on the type of stream.
startTime: number (seconds): Set this to start playback of your media at some time other than 0.
In addition, any props that you would use on a
<video> element like
poster,
controls,
muted and
autoPlay are available and should work the same as they do when using a video element in react. One sidenote about
autoPlay though -- read this to understand why that might not always work as expected.
Advanced: preferMseAdvanced: preferMse
By default
<MuxVideo/> will try to use native playback via the underlying
<video/>Video playback-id="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe" metadata={{ video_id: 'video-id-123456', video_title: 'Super Interesting Video', viewer_user_id: 'user-id-bc-789', }} preferMse controls />
Advanced: typeAdvanced: type
By default
<MuxVideo/> will try to figure out the type of media you're trying to play (for example, an HLS/m3u8 media source, an mp4, etc.) based the extension of the file from the
src attribute's url. This allows
<MuxVideo/> to determine whether it can/should use an in-code player or native playback. By way of example, the code below has an identifiable "mp4" extension, so
<MuxVideo/> will rely on native playback via the underlying
<video/> tag.
<MuxVideo src="" metadata={{ video_id: 'video-id-123456', video_title: 'Super Interesting Video',Video src="" type="application/vnd.apple.mpegurl" metadata={{ video_id: 'video-id-123456', video_title: 'Super Interesting Video', viewer_user_id: 'user-id-bc-789', }} controls />
Or, for convenience, we also support the shorthand
type="hls:
<MuxVideo src="" type="hls" metadata={{ video_id: 'video-id-123456', video_title: 'Super Interesting Video',Video/> with
TypeScript?
Yes! In fact,
@mux-element/mux-video video is compliant with the HLS spec. Any video video.
|
https://www.npmjs.com/package/@mux/mux-video-react
|
CC-MAIN-2022-33
|
refinedweb
| 494
| 52.49
|
Forward declaration. More...
#include <Graphic3d_Camera.hxx>
Forward declaration.
Camera class provides object-oriented approach to setting up projection and orientation properties of 3D view.
Enumerates vertices of view volume.
Enumerates approaches to define stereographic focus.
Enumerates approaches to define Intraocular distance.
Enumerates supported monographic projections.
Default constructor. Initializes camera with the following properties: Eye (0, 0, -2); Center (0, 0, 0); Up (0, 1, 0); Type (Orthographic); FOVy (45); Scale (1000); IsStereo(false); ZNear (0.001); ZFar (3000.0); Aspect(1); ZFocus(1.0); ZFocusType(Relative); IOD(0.05); IODType(Relative)
Copy constructor.
Get camera display ratio.
Get camera axial scale.
Get Center of the camera, e.g. the point where camera looks at. This point is computed as Eye() translated along Direction() at Distance().
Convert point from projection coordinate space to view coordinate space.
Convert point from view coordinate space to projection coordinate space.
Convert point from view coordinate space to world coordinates.
Convert point from world coordinate space to view coordinate space.
Copy properties of another camera.
Initialize mapping related parameters from other camera handle.
Initialize orientation related parameters from other camera handle.
Get camera look direction.
Get distance of Eye from camera Center.
Dumps the content of me into the stream.
Get camera Eye position.
Adjust camera to fit in specified AABB.
Get Field Of View (FOV) restriction for 2D on-screen elements; 180 degrees by default. When 2D FOV is smaller than FOVy or FOVx, 2D elements defined within offset from view corner will be extended to fit into specified 2D FOV. This can be useful to make 2D elements sharply visible, like in case of HMD normally having extra large FOVy.
Get Field Of View (FOV) in x axis.
Get Field Of View (FOV) in y axis.
Calculate WCS frustum planes for the camera projection volume. Frustum is a convex volume determined by six planes directing inwards. The frustum planes are usually used as inputs for camera algorithms. Thus, if any changes to projection matrix calculation are necessary, the frustum planes calculation should be also touched.
Fill array of current view frustum corners. The size of this array is equal to FrustumVerticesNB. The order of vertices is as defined in FrustumVert_* enumeration.
Get Intraocular distance definition type.
Linear interpolation tool for camera orientation and position. This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
Eye/Center interpolation is performed through defining an anchor point in-between Center and Eye. The anchor position is defined as point near to the camera point which has smaller translation part. The main idea is to keep the distance between Center and Eye (which will change if Center and Eye translation will be interpolated independently). E.g.:
This transformation might be not in line with user expectations. In this case, application might define intermediate camera positions for interpolation or implement own interpolation logic.
Invalidate orientation matrix. The matrix will be updated on request.
Invalidate state of projection matrix. The matrix will be updated on request.
Get Intraocular distance value.
Return TRUE if custom projection matrix is set.
Return TRUE if custom stereo frustums are set.
Return TRUE if custom stereo projection matrices are set.
Check that the camera projection is orthographic.
Check whether the camera projection is stereo. Please note that stereo rendering is now implemented with support of Quad buffering.
Return TRUE if camera should calculate projection matrix for [0, 1] depth range or for [-1, 1] range. FALSE by default.
Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVx exceeds FOV2d.
Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVy exceeds FOV2d.
Get orientation matrix.
Get orientation matrix of Standard_ShortReal precision.
Return a copy of orthogonalized up direction vector.
Orthogonalize up direction vector.
Project point from world coordinate space to normalized device coordinates (mapping).
Get monographic or middle point projection matrix used for monographic rendering and for point projection / unprojection.
Get monographic or middle point projection matrix of Standard_ShortReal precision used for monographic rendering and for point projection / unprojection.
Returns modification state of camera projection matrix.
Unset all custom frustums and projection matrices.
Get camera scale.
Changes width / height display ratio.
Set camera axial scale.
Sets Center of the camera, e.g. the point where camera looks at. This methods changes camera direction, so that the new direction is computed from current Eye position to specified Center position.
Set custom projection matrix.
Set custom stereo frustums. These can be retrieved from APIs like OpenVR.
Set custom stereo projection matrices.
Set distance of Eye from camera Center.
Sets camera Eye position. WARNING! For backward compatibility reasons, this method also changes view direction, so that the new direction is computed from new Eye position to old Center position.
Sets camera Eye and Center positions.
Set Field Of View (FOV) restriction for 2D on-screen elements.
Set Field Of View (FOV) in y axis for perspective projection. Field of View in x axis is automatically scaled from view aspect ratio.
Sets camera parameters to make current orientation matrix identity one.
Sets Intraocular distance.
Change camera projection type. When switching to perspective projection from orthographic one, the ZNear and ZFar are reset to default values (0.001, 3000.0) if less than 0.0.
Sets camera scale. For orthographic projection the scale factor corresponds to parallel scale of view mapping (i.e. size of viewport). For perspective camera scale is converted to distance. The scale specifies equal size of the view projection in both dimensions assuming that the aspect is 1.0. The projection height and width are specified with the scale and correspondingly multiplied by the aspect.
Sets the Tile defining the drawing sub-area within View. Note that tile defining a region outside the view boundaries is also valid - use method Graphic3d_CameraTile::Cropped() to assign a cropped copy.
Sets camera Up direction vector, orthogonal to camera direction. WARNING! This method does NOT verify that the new Up vector is orthogonal to the current Direction().
Set using [0, 1] depth range or [-1, 1] range.
Sets stereographic focus distance.
Change the Near and Far Z-clipping plane positions. For orthographic projection, theZNear, theZFar can be negative or positive. For perspective projection, only positive values are allowed. Program error exception is raised if non-positive values are specified for perspective projection or theZNear >= theZFar.
Right side direction.
Get stereo projection matrices.
Get stereo projection matrices.
Get current tile.
Transform orientation components of the camera: Eye, Up and Center points.
Unproject point from normalized device coordinates to world coordinate space.
Get camera Up direction vector.
Returns modification state of camera world view transformation matrix.
Get the Far Z-clipping plane position.
Change Z-min and Z-max planes of projection volume to match the displayed objects.
Estimate Z-min and Z-max planes of projection volume to match the displayed objects. The methods ensures that view volume will be close by depth range to the displayed objects. Fitting assumes that for orthogonal projection the view volume contains the displayed objects completely. For zoomed perspective view, the view volume is adjusted such that it contains the objects or their parts, located in front of the camera.
Get stereographic focus value.
Get stereographic focus definition type.
Get the Near Z-clipping plane position.
|
https://dev.opencascade.org/doc/occt-7.6.0/refman/html/class_graphic3d___camera.html
|
CC-MAIN-2022-27
|
refinedweb
| 1,239
| 53.58
|
displaying image in awt - Java Beginners
to display image using awt from here and when I execute the code I am getting... : method drawImage(Image,int,int,ImageDemo)
location: class java.awt.Graphics... ActionListener{
JFrame fr = new JFrame ("Image loading program Using awt");
Label
awt
Java AWT Applet example how to display data using JDBC in awt/applet
awt - Swing AWT
,
For solving the problem visit to :
Thanks... market chart this code made using "AWT" . in this chart one textbox when user
Java AWT Package Example
Java AWT Package Example
In this section you will learn about the AWT package of the Java. Many
running examples are provided that will help you master AWT package. Example
Java AWT Package Example
java swings - Swing AWT
. swings I am doing a project for my company. I need a to show... write the code for bar charts using java swings. Hi friend,
I am
query - Swing AWT
java swing awt thread query Hi, I am just looking for a simple example of Java Swing:
Program for Calculator - Swing AWT
Program for Calculator write a program for calculator? Hi Friend,
Please visit the following link:
Hope that it will be helpful
slider - Swing AWT
://
Thanks... Example");
Container content = frame.getContentPane();
JSlider slider - Swing AWT
java Write Snake Game using Swings
Authentication of password - Swing AWT
information.
Thanks Code - Swing AWT
Java Code Write a Program using Swings to Display JFileChooser that Display the Naem of Selected File and Also opens that File
java - Swing AWT
java while inserting in data in text field and click the jButton and save the data in sql 2005
Java - Swing AWT
How to start learning Java I am a Java Beginner ...so, please guide me how to start
b+trees - Swing AWT
b+trees i urgently need source code of b+trees in java(swings/frames).it is urgent.i also require its example implemented using any string by inserting and deleting it. Hi Friend,
Try the following code:
import
java programming - Swing AWT
java programming Develop a simple paint like program that can draw basic graphical primitives in different dimensions and colors. use appropriate menus and buttons
Java Code - Swing AWT
Java Code How to Make an application by using Swings JMenuBar and other components for drawing various categories of Charts(Line,Bar etc
java swings - Swing AWT
java swings hi everyone,
can we make a chain of frames with JSplitpane and run a shell script in any one of those frames
java - Swing AWT
java i need to set the popup calender button in table column&also set the date in the same table column using core java-swing
java swing - Swing AWT
java swing how i can insert multiple cive me exampleolumn and row in one JList in swing?plz g Hi Friend,
Please clarify your question.
java - Swing AWT
java Hello Sir/Mam,
I am doing my java mini project.In that, i want to upload any .jpg,.gif,.png format image from system & display... for upload image in JAVA SWING.... Hi Friend,
Try the following code
Graphical calculator using AWT - Java Beginners
Calculator example");
this.setResizable(false);
}//end constructor...://
Amardeep Sir how can i design flow chart and Synopsis for random password generation by using swing in java . Hi Friend,
Try the following code:
import java.io.*;
import java.util.*;
import java.awt.*;
import
Java question - Swing AWT
Java question I want to create two JTable in a frame. The data in one JTable will be shown as a result of a query i.e. the data in a resultset. This query is fixed. This query is "select * from item". Item table has following
|
http://www.roseindia.net/tutorialhelp/comment/80828
|
CC-MAIN-2014-10
|
refinedweb
| 611
| 63.09
|
Generally good game. Good graphics, nice puzzle arrangement - not one step after another, like less imaginative games - and solutions that generally make sense.
(Spoilers here on in)
Some slight annoyances, though: the arrows for changing rooms are confusing, as sometimes going left brings you to a spot where you have to go left to return (the plant room) and in the corridor, the open door appears to just be a graphic denoting your return route, when in fact it is an extra room to travel to.
The 'blue flowers' clue is a little annoying as well, as you can click on the blue flowers, but at the moment when you would want to find out what is underneath them, you have no object that will work on them. Instead, you are expect to find a spot that appears to be unmarked and invisible /near/ them to go down. I realize there is a clue suggesting you do this, but having found the blue flowers, it takes ages to realize that you don't click on them to find out what is beneath them.
Actually, in general having a message that denotes why you've failed to choose the right object might be helpful.
Otherwise, good set of puzzles, better than the average stuff that we often find! Good job.
Rated 4.5 / 5 stars
Good game, but some hints (pool table, combination in the room below conservatory) could be useful.
Rated 5 / 5 stars
I love it
Rated 5 / 5 stars
it is a really good game .thx for this game
Rated 4 / 5 stars
not bad
it was fun but the girl looked weird... 0.0
|
http://www.newgrounds.com/portal/view/588707
|
CC-MAIN-2017-26
|
refinedweb
| 277
| 63.22
|
Thanks Liam and Kent! Regards, Justin On Mon, 13 Dec 2004 07:57:45 -0500, you wrote: > >Liam Clarke wrote: >> Hey Justin, >> >> Tricky one this.. >> >> as far as I know, and I'm a beginner myself, a dictionary stores a >> reference to the function, not the actual function. > >Yes. In fact this is a good way to think about all variables in Python. A variable stores a >reference to a value, not the value itself. I think of variables as somehow pointing at the value. >Some people like to think of the variable as a sticky note stuck on the value with its name. >Pythonistas say that the name is 'bound' to the value; the assignment 'x = 2' binds the name 'x' to >the value '2'. > >The *wrong* way to think about variables in Python is to think of them as containers that hold a >value. This is appropriate for some languages but it is not a helpful model for Python. > >> So - >> >> >>>command = {'1': spam(), >>> '2': breakfast(), >>> '3': bridgekeeper() >>> } >> >> >> Try this instead - >> >> command = {'1': spam, '2':breakfast, '3': bridgekeeper} > >Yes. The difference is, you are storing a reference to the actual function object, rather than the >result of calling the function. > > >>> def foo(): >... return 3 >... > >The function name is actually a variable which is bound to a function object. When you use the bare >variable name, you are referring to this object: > >>> foo ><function foo at 0x008D6670> > >On the other hand when you use the function name with parentheses, you call the function. The value >of this expression is the return value of the function. > > >>> foo() >3 > >Here is a dictionary with both usages: > >>> d = { 'foo':foo, 'value':foo() } > >>> d >{'foo': <function foo at 0x008D6670>, 'value': 3} > >If you put foo in the dict, you have access to the function. If you put foo() in the dict, you have >access to the result of calling the function. If I store a reference to the function, I can retrieve >it and call it like this: > >>> d['foo']() >3 > >Kent > >>>if select in options: >>> command[select] >> >> >> change this to - >> >> select = raw_input('Chose an option [1|2|3]: ') >> >> if select in command.keys(): >> command[select]() >> >> >> >> That one had me going round in circles when I first met it. >> AFAIK, everything is stored in dictionaries apparently. If you have a >> function called 'dude()' you could probably call it as a dictionary of >> 'dude' from the namespace... > >Yes, under the hood, binding a name to a value turns into adding a mapping to a special dictionary. >For variables with global scope, you can access this dictionary with the globals function. Both the >dict d and the function foo are in my globals: > > >>> globals() >{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'foo': <function foo at >0x008D6670>, '__doc__': None, 'd': {'foo': <functi >on foo at 0x008D6670>, 'value': 3}} > >>> globals()['d'] >{'foo': <function foo at 0x008D6670>, 'value': 3} > >> >> Standard disclaimer - >> >> Someone more knowledgable would probably be along shortly to point out >> a simpler, elegant way to do it, but my way works. Mostly. > >Actually you got the code right :-) I just thought the explanation needed a little fleshing out. > >Kent >_______________________________________________ >Tutor maillist - Tutor at python.org > regards, Justin --- You may have noticed, Im not all there myself. -Cheshire Cat
|
https://mail.python.org/pipermail/tutor/2004-December/034061.html
|
CC-MAIN-2018-05
|
refinedweb
| 542
| 68.6
|
14 July 2008 13:04 [Source: ICIS news]
LONDON (ICIS news)--Specialty chemical deal making in the ?xml:namespace>
Two high-profile
But the bank believed that deal making was region specific given currency movements and the focus in
Very few large buyers remained, the bank's analysts said.
BASF was struggling to sell its commodity styrenics business and had €9bn ($14bn) of debt, Credit Suisse said, adding its gearing in 2007 was 47%.
“We do not see a significant move into European specialty players any time soon,” it added.
The Dow offer was made at 11.1 times enterprise value (EV) to estimated 2008 earnings before interest, tax, depreciation and amortisation (EBITDA), Credit Suisse said and the Ashland offer was made at 8.4 times, according to consensus figures.
“Although European valuations are attractive we do not see sizeable buyers any more and believe action in
(
|
http://www.icis.com/Articles/2008/07/14/9140072/no-specialties-buying-spree-in-europe-bank.html
|
CC-MAIN-2014-42
|
refinedweb
| 147
| 53.71
|
Created on 2012-10-18 09:33 by ADechaume, last changed 2013-02-16 20:48 by eric.snow. This issue is now closed.
Example:
from collections import OrderedDict
print OrderedDict(a=0,b=1,c=2)
I get
OrderedDict([('a', 0), ('c', 2), ('b', 1)])
I expected
OrderedDict([('a', 0), ('b', 1), ('c', 2)])
This is documented at:
"""The OrderedDict constructor and update() method both accept keyword arguments, but their order is lost because Python’s function call semantics pass-in keyword arguments using a regular unordered dictionary."""
Thanks Ezio.
I did read the docs before submitting, obviously my brain was not plugged in.
I am sorry for the noise.
FWIW, I'm working toward making **kwargs an OrderedDict. First step: issue #16991
|
http://bugs.python.org/issue16276
|
CC-MAIN-2017-30
|
refinedweb
| 124
| 56.15
|
Chatlog 2012-03-29
From Provenance WG Wiki
See original RRSAgent log or preview nicely formatted version.
Please justify/explain all edits to this page, in your "edit summary" text.
14:51:51 <RRSAgent> RRSAgent has joined #prov 14:51:51 <RRSAgent> logging to 14:51:53 <trackbot> RRSAgent, make logs world 14:51:53 <Zakim> Zakim has joined #prov 14:51:55 <trackbot> Zakim, this will be 14:51:55 <Zakim> I don't understand 'this will be', trackbot 14:51:56 <trackbot> Meeting: Provenance Working Group Teleconference 14:51:56 <trackbot> Date: 29 March 2012 14:51:59 <pgroth> Zakim, this will be PROV 14:51:59 <Zakim> ok, pgroth; I see SW_(PROV)11:00AM scheduled to start in 9 minutes 14:52:17 <pgroth> Agenda: 14:52:29 <pgroth> Chair: Paul Groth 14:52:47 <pgroth> Scribe: Daniel Garijo 14:52:58 <pgroth> Regrets: Simon Miles 14:53:05 <pgroth> rrsagent, make logs public 14:53:39 <jun> jun has joined #prov 14:54:39 <Zakim> SW_(PROV)11:00AM has now started 14:54:46 <Zakim> +[IPcaller] 14:54:48 <dgarijo> dgarijo has joined #prov 14:55:45 <Zakim> +??P15 14:55:57 <dgarijo> Zakim, ??P15 is me 14:55:57 <Zakim> +dgarijo; got it 14:56:08 <dgarijo> scribe: dgarijo 14:56:27 <Zakim> + +329331aaaa 14:56:58 <Zakim> +Luc 14:57:29 <Tom_De_Nies> Zakim, +329331aaaa is me 14:57:29 <Zakim> +Tom_De_Nies; got it 14:59:45 <tlebo> tlebo has joined #prov 14:59:59 <Curt> Curt has joined #prov 15:00:01 <Zakim> +tlebo 15:00:06 <Paolo> Paolo has joined #prov 15:00:27 <Zakim> +Curt_Tilmes 15:01:18 <SamCoppens> SamCoppens has joined #prov 15:01:31 <Tom_De_Nies> Zakim, Tom_De_Nies is with SamCoppens 15:01:47 <Zakim> sorry, Tom_De_Nies, I do not recognize a party named 'SamCoppens' 15:01:53 <Zakim> +??P50 15:01:56 <Zakim> +??P43 15:01:56 <jcheney> Zakim, ??P50 is me 15:02:02 <jun> zakim, ??P43 is me 15:02:20 <Zakim> +jcheney; got it 15:02:29 <Zakim> +jun; got it 15:02:38 <Zakim> +[IPcaller.a] 15:02:56 <Paolo> zakim, [IPcaller.a] is me 15:03:08 <Zakim> +??P49 15:03:10 <Zakim> +Paolo; got it 15:03:12 <pgroth> q? 15:03:19 <pgroth> Zakim, who is on the call? 15:03:19 <Zakim> On the phone I see [IPcaller], dgarijo, Tom_De_Nies, Luc, tlebo, Curt_Tilmes, jcheney, jun, Paolo, ??P49 15:03:28 <pgroth> Zakim, [IPcaller] is me 15:03:30 <Zakim> +pgroth; got it 15:03:49 <dgarijo> yes 15:03:58 <StephenCresswell> StephenCresswell has joined #prov <pgroth> Topic: Admin <pgroth> Summary: General issues. Introduced Tom De Nies as a new working group member from IBBT. 15:04:07 <pgroth> Minutes last telco: 15:04:15 <dgarijo> +1 15:04:21 <Curt> +1 15:04:23 <Tom_De_Nies> +1 15:04:24 <tlebo> +1 15:04:28 <jcheney> +1 15:04:30 <GK1> GK1 has joined #prov 15:04:33 <Paolo> +1 15:05:01 <Zakim> +??P53 15:05:06 <pgroth> Approved Minutes of the March 22 2012 Telecon 15:05:15 <GK> GK has joined #prov 15:05:24 <dgarijo> pgroth: open actions 15:05:32 <dgarijo> ... there is still 1 open, on me 15:05:48 <dgarijo> ... I think the action is done (new version of the paq) 15:05:58 <dgarijo> ... next topic: reminder about the scribes 15:06:27 <Zakim> +OpenLink_Software 15:06:28 <dgarijo> ... welcome to Tom De Nies 15:06:35 <MacTed> Zakim, OpenLink_Software is temporarily me 15:06:35 <Zakim> +MacTed; got it 15:06:37 <MacTed> Zakim, mute me 15:06:37 <Zakim> MacTed should now be muted 15:06:43 <dgarijo> tom: colleague of SamCoppens 15:07:05 <dgarijo> ... work in enrichment of news and provenance assessment of news. Very happy to be here 15:07:12 <pgroth> q? 15:07:19 <dgarijo> paul: questions? 15:07:23 <pgroth> Topic: PROV-DM <pgroth> Summary: A status update on the dm was given. Both prov-dm and prov-n are pretty much ready to go for review on monday. prov-dm-constraints will be worked on this weekend. Luc has set-up issue numbers that general comments (grammer, etc) on these documents should be tagged with. The issue numbers can be found in the agenda. 15:07:35 <Zakim> +??P16 15:07:36 <dgarijo> pgroth: stauts update? 15:07:39 <Luc> 15:08:11 <GK> Zakim, ??P16 is me 15:08:11 <Zakim> +GK; got it 15:08:20 <MacTed> it would be VERY helpful if links to relevant docs can always be included in (added to) the Agenda 15:08:22 <dgarijo> luc:We've been working quite hard on the model. The documents are ready today (deadline is monday). In the wikipage there is a to do list and most of the items are covered. 15:08:31 <Paolo> "align collection productions [PM]" done, actually 15:08:40 <dgarijo> ... invalidation will not be covered. It will be written and merged separately. 15:08:49 <Zakim> +??P10 15:08:55 <zednik> zednik has joined #prov 15:09:03 <dgarijo> ... for provn we've done checks for everything except collections 15:09:09 <Paolo> @Luc collections productions done this morning 15:09:14 <sandro> sorry, previous meeting ran late. 15:09:16 <dgarijo> ... constraints part has not been started. 15:09:24 <Zakim> +sandro 15:09:33 <dgarijo> ... will try to have it for monday, although we are not sure. 15:09:38 <pgroth> q? 15:09:43 <dgarijo> pgroth: questions? 15:09:45 <tlebo> q+ 15:09:54 <pgroth> ack tlebo 15:10:00 <Paolo> :collection (paolo) -- fix the constraints to allow for multiple contained() assertions" --> please see my mail this morning re: this 15:10:11 <dgarijo> tlebo: curious about the "finished today but still something to do for monday" 15:10:16 <Paolo> (have to go, sorry in between trains) 15:10:25 <Zakim> -Paolo 15:10:27 <dgarijo> luc: part 2 is the one we are going to start tomorrow. 15:10:33 <pgroth> q? 15:10:53 <Tom_De_Nies> Zakim, mute me 15:10:53 <Zakim> Tom_De_Nies should now be muted 15:10:56 <tlebo> (DM and N are finished today, CONSTRAINTS is for Monday.) 15:11:05 <dgarijo> luc: we have identified a number of questions for reviewers: 15:11:24 <dgarijo> ... can the doc be released as a fwd? 15:11:29 <dgarijo> ... blockers? 15:12:16 <dgarijo> ... reviewers with pending issues please confirm if they can be clsoed 15:12:25 <dgarijo> s/clsoed/closed 15:12:37 <Zakim> -??P53 15:12:51 <dgarijo> ... typos gramatical issues can be submitted in issues 331, 332 and 333 15:12:56 <pgroth> q? 15:13:09 <pgroth> q? 15:13:12 <Zakim> +??P22 15:13:39 <dgarijo> paul: reviewers for provd and provn can start reviewing now? 15:13:44 <stainPhone> stainPhone has joined #prov 15:14:00 <Paolo> Paolo has joined #prov 15:14:09 <dgarijo> luc: they could. But there are a few tweaks we'll have to do once we reach the constraints on part to. Up to the reviewers. 15:14:15 <tlebo> Monday is fine :-) 15:14:17 <Zakim> -??P22 15:14:30 <Paolo> zakim, ??P22 is me 15:14:31 <Zakim> I already had ??P22 as ??P22, Paolo 15:14:41 <dgarijo> pgroth: reviewers were: Tim, khalid, curt, jun and... 15:15:14 <dgarijo> luc: if you are in agreement the we can send a notification on monday 15:15:33 <GK> I'm not seeing the document URIs at the page posted previuously 15:15:33 <Curt> I can't really do it until next week anyway 15:15:34 <dgarijo> pgroth: ok, so wait till monday to begin the review. 15:15:36 <pgroth> q? 15:15:54 <tlebo> 15:15:55 <pgroth> Topic: PROV-O <pgroth> Summary: PROV-O will be ready to go by monday and be made available in mecurial repository. In addition to the current set of reviewers, MacTed and Sam agreed to try to review as well. 15:16:12 <pgroth> pgroth has left #prov 15:16:17 <dgarijo> tlebo: different parts of the team working on different parts of the doc. 15:16:19 <pgroth> pgroth has joined #prov 15:16:34 <dgarijo> ... some questions to the reviewers are on the link posted in the irc 15:16:45 <dgarijo> ... will be ready for review by monday 15:17:01 <Zakim> +??P22 15:17:06 <Luc> where is the prov-o.html document? 15:17:10 <Zakim> +??P24 15:17:15 <dgarijo> tlebo: the organization scheme has changed 15:17:23 <dgarijo> @Luc: in aquarius :( 15:17:34 <Luc> thanks 15:18:09 <pgroth> q? 15:18:12 <dgarijo> tlebo: is it enough to understand everything, are the cross references useful? 15:18:36 <dgarijo> tlebo: please start to be familiar with the ontology. 15:18:43 <dgarijo> ... should we add more examples. 15:19:13 <dgarijo> pgroth: would you move this to the w3c site (what people are supposed to review). 15:19:19 <pgroth> q? 15:19:29 <dgarijo> tlebo: yes, it will be a save as in mercurial 15:19:53 <dgarijo> pgroth: could anybody else volunteer to review? 15:20:11 <SamCoppens> I will review it also 15:20:18 <MacTed> Zakim, unmute me 15:20:18 <Zakim> MacTed should no longer be muted 15:20:20 <GK> (I may, but reluctant to over-commit right now) 15:20:34 <dgarijo> luc: macTed? 15:20:43 <dgarijo> macTed: I'll try to have a look 15:20:49 <MacTed> Zakim, mute me 15:20:49 <Zakim> MacTed should now be muted 15:20:50 <Luc> @paul, could you remind us the timing for review 15:21:05 <dgarijo> paul: so sam an macTed as new reviewers. 15:21:28 <pgroth> april 9th 15:21:35 <dgarijo> pgroth: monday is the release, April 9th is the due date for the reviews. 15:21:38 <Zakim> -??P22 15:21:49 <pgroth> q? 15:22:09 <GK> q+ 15:22:17 <dgarijo> ... will try to reach consensus on 12 or 19th depending on the feedback. On monday we'll send an email to remember everyone 15:22:17 <pgroth> ack GK 15:22:34 <Luc> they will be emailed on Monday 15:22:38 <dgarijo> GK: Can I ask for confirmation of the URIs of the docs to be reviewed. 15:22:54 <dgarijo> pgroth: will send them on monday, when they are ready to be released. 15:22:59 <pgroth> q? 15:23:05 <pgroth> Topic: Prov-Primer <pgroth> Summary: The primer will be ready to release on Monday. It was agreed that collections would be postponed until the next working draft of the primer. 15:23:35 <dgarijo> pgroth: simon couldn't be here, but sent an update: Comments by Stian and Paolo are addrssed. 15:23:45 <Zakim> -??P24 15:23:47 <dgarijo> ... he will have the rest by monday (examples) 15:23:57 <dgarijo> ... he might be postponing collections. 15:24:14 <Zakim> +??P22 15:24:43 <pgroth> q? 15:24:48 <dgarijo> ... questions for the reviewers: The primer doesn't talk that mucho about qualified involvement. What is the opinion of the reviewers about that? Can that be left for a later draft? 15:24:51 <Luc> q+ 15:24:53 <dgarijo> ... blocking issues? 15:24:56 <pgroth> ack Luc 15:25:21 <dgarijo> luc: how do we talk about roles withouth qE? 15:25:34 <dgarijo> s/qE/qI 15:25:46 <Luc> yes 15:25:50 <stainPhone> time can be mentioned wirh location and custom attributes 15:25:53 <pgroth> q? 15:26:11 <stainPhone> +1 15:26:12 <dgarijo> paul: that might be the question he's asking to the reviewers. 15:26:14 <dgarijo> +1 15:26:37 <dgarijo> ... so sounds reasonable to delay the discussion about collections in the primer. 15:27:05 <dgarijo> luc: agrees. 15:27:17 <dgarijo> pgroth: I will send an email to Simon. 15:27:19 <pgroth> q? 15:27:26 <pgroth> Topic: PAQ <pgroth> Summary: Graham and Paul gave a status update on the PAQ. They think they have addressed most issues. They plan to release something for review by next week if all goes well. There was a discussion around what to use to substitute for entity-uri. 15:27:29 <stainPhone> and I am Stephan are doing the prov-o mapping of collections. 15:27:40 <pgroth> sure 15:28:02 <dgarijo> GK: I made a past to the doc simplifying sections. 15:28:20 <dgarijo> ... still to discuss some of the changes with paul. 15:28:26 <pgroth> updated version is here: 15:28:44 <dgarijo> ... there are still issues to resolve in the doc. 15:29:31 <dgarijo> ... unify the namespace. Added an appendix. Issues like 70, 211 have been addressed. 233, 76 too. 15:30:16 <dgarijo> ... should we be changing the prov:entity uri with sime other thing? 15:30:32 <dgarijo> paul: we need to follow up some of these issues. 15:30:39 <MacTed> Zakim, who's noisy? 15:30:50 <Zakim> MacTed, listening for 10 seconds I heard sound from the following: GK (50%) 15:30:59 <dgarijo> ... how to use sparql and linked data. 15:31:05 <MacTed> mute would be appreciated on clacky keyboard 15:31:05 <dgarijo> ... with prov. 15:31:15 <Paolo> Paolo has joined #prov 15:31:36 <dgarijo> ... people wanted to retrieve the prov of entities and activities 15:31:37 <dgarijo> Zakim, mute GK 15:31:37 <Zakim> GK should now be muted 15:31:51 <dgarijo> @graham, sorry, I couldn't hear :( 15:31:56 <Zakim> +??P0 15:32:03 <MacTed> Zakim, unmute me 15:32:03 <Zakim> MacTed should no longer be muted 15:32:09 <pgroth> q? 15:32:11 <Paolo> akim, ??P0 is me 15:32:11 <MacTed> q+ 15:32:18 <dgarijo> paul: what do the gorup thinks about that? 15:32:21 <Zakim> -GK 15:32:21 <stainPhone> provElement or similar? 15:32:24 <Paolo> zakim, ??P0 is me 15:32:24 <Zakim> +Paolo; got it 15:32:41 <Zakim> +??P2 15:32:43 <dgarijo> MacTed: distinction between entity and activity is artificial. 15:32:47 <GK> zakim, ??p2 is me 15:32:47 <Zakim> +GK; got it 15:33:01 <dgarijo> ... we're building ourselves problems. 15:33:02 <Tom_De_Nies> Tom_De_Nies has joined #prov 15:33:20 <Luc> q+ 15:33:29 <pgroth> ack MacTed 15:33:32 <pgroth> ack Luc 15:34:12 <dgarijo> luc: paul mentioned activities and entities. There are a lot of terms with ids (nearly all of them). I don't think it is artificial 15:34:15 <pgroth> q? 15:35:19 <dgarijo> MacTed: however it is a redefined type. Entitiy has a common usage in the world, and we are using it in a total different way. The struggle to keep that in a different way is the thing that I don't like 15:35:20 <pgroth> q? 15:35:27 <Luc> but this would be teh case for any word we use, wouldn't it? 15:35:28 <pgroth> q? 15:35:47 <GK> q+ to ask if any alternative terms have been suggested? 15:36:33 <Curt> the concept represented by our term entity is inherently complex 15:36:33 <dgarijo> pgroth: for the paq we need a term that represents everything with an identity in the model. Maybe provenance element, or ideantifiable. 15:36:42 <stainPhone> "about" ? ;) 15:36:43 <GK> Ah... 15:37:16 <dgarijo> MacTed: it continues to be confusing for us all. 15:37:22 <pgroth> q? 15:37:25 <pgroth> ack GK 15:37:25 <Zakim> GK, you wanted to ask if any alternative terms have been suggested? 15:37:43 <pgroth> q? 15:37:48 <dgarijo> GK: has an alternative name been suggested? 15:38:04 <dgarijo> pgroth: maybe we should go back to the paq itself 15:38:28 <dgarijo> ... we will release it next week for people to look at it 15:38:28 <pgroth> q? 15:38:32 <Luc> @GK: I agree that one can always propose better names, but for now, we don't have any other suggestion 15:38:41 <pgroth> q? 15:38:46 <Luc> q+ 15:38:47 <GK> @Luc hence my Q :) 15:39:07 <dgarijo> luc: what is your timetable. Synchronized release? 15:39:14 <dgarijo> pgroth: I don't think so. 15:39:52 <Luc> we could release it shortly afterwads 15:39:53 <dgarijo> ... it is almost there, but almost everyone is commmitted to reviewing something. And also, it is somehow separate. 15:40:04 <GK> Not so much "separate" as "orthogonal" ? 15:40:22 <dgarijo> ... next week we'll have something when people have time to review 15:40:55 <dgarijo> GK: I may be travelling next week. Limited internet connection access. 15:41:23 <pgroth> Topic: Namespace Unification <pgroth> Summary: Paul reported on an email conversation with Jeni Tennison confirming that using a url with a hash was ok for xml. The group voted to use a common namespace . Paul agreed to create an html index for this namespace and consult Ivan about having content negotiation to the owl file. 15:41:40 <pgroth> 15:41:43 <dgarijo> pgroth: last week we talked about the ns unification. The use of the hash 15:42:02 <dgarijo> ... is this use violated in rdf/xml serializations? 15:42:20 <dgarijo> ... sandro contacted the xml working group 15:42:24 <pgroth> q? 15:42:27 <pgroth> ack Luc 15:42:50 <dgarijo> .... they encouraged us to have a common namespace 15:42:59 <dgarijo> ... the one proposed is fine with xml 15:43:13 <dgarijo> ... it doesn't really matter what you have. 15:43:31 <GK> I'm happy with that resolution. 15:43:44 <pgroth> Propose that we use as the common namespace for all prov specs 15:43:52 <GK> +1 15:43:52 <dgarijo> +1 15:43:54 <Curt> +1 15:43:55 <tlebo> +1 15:43:58 <Zakim> -??P22 15:44:00 <jcheney> +1 15:44:04 <sandro> +1 15:44:06 <zednik> +1 15:44:07 <SamCoppens> +1 15:44:09 <StephenCresswell> +1 15:44:12 <jun> +1 15:44:12 <MacTed> +0 15:44:26 <Tom_De_Nies> +1 15:44:35 <pgroth> Accepted: use as the common namespace for all prov specs 15:44:42 <pgroth> Close ISSUE-224 15:44:45 <dgarijo> pgroth: we can close issue 224 15:45:27 <dgarijo> ... provide an html index to link all the docs toghether. 15:45:45 <dgarijo> ... are there volunteers for this? 15:45:47 <pgroth> q? 15:45:59 <pgroth> q? 15:46:26 <dgarijo> ... I'll go ahead and start doing it after monday 15:46:52 <dgarijo> ... I'll need some help 15:46:55 <pgroth> q? 15:47:10 <Luc> q+ 15:47:17 <pgroth> ack Luc 15:47:32 <dgarijo> luc: regarding collections: 3 relations are being proposed. 15:47:46 <pgroth> Topic: Collections <pgroth> Summary: Luc raised the problem of naming relations for collections. There was limited comment. 15:48:03 <dgarijo> ... do we want to have the same form (in the past) as the o ther properties? 15:48:17 <pgroth> q? 15:48:21 <dgarijo> it would be nice to have some input 15:48:32 <GK> What's the anticip[ated context of use? 15:49:06 <Paolo> q+ 15:49:14 <pgroth> ack Paolo 15:49:46 <dgarijo> paolo: any time you want to track the prov of the collection. 15:49:51 <jun> do we have a link to the proposal? 15:50:11 <GK> SO, if it's for tracking provenance of collections as well as members, I think using the same form is appropriate. 15:50:50 <dgarijo> ... for workflows is more important (to know if an element of the collection belonged to an execution, etc) 15:50:55 <pgroth> q? <pgroth> Topic: Substitute for entity-URI in PAQ <pgroth> Summary: The group returned to the conversation around what to use instead of entity-uri in the PAQ. In order to support, the retrieval of provenance for other provenance constructs (e.g. activity). Luc suggested to use the term "resource". Graham and Paul agreed that this is maybe a good option and to investigate more. 15:51:47 <dgarijo> paul: I want to come back about the name in the PAQ for entity URI 15:52:29 <pgroth> q? 15:52:30 <Luc> q+ 15:52:31 <dgarijo> ... any suggestions would be helpful 15:52:42 <dgarijo> luc: why not resource? 15:53:00 <dgarijo> - Provenance element? provenance resource? 15:53:30 <dgarijo> gk: It was because we wanted to have a way of talking about the views. 15:54:02 <dgarijo> paul: the scruffyness of the dm allows us to refer to resource. 15:54:30 <dgarijo> gk: I'm trying to see what are the implications about this. I'm not sure 15:54:48 <dgarijo> ... I would have to check the rest of the document. Maybe works. 15:54:58 <dgarijo> luc: It is a reasonable suggestions 15:55:50 <dgarijo> pgroth: the distinction between entity/process is more a dm problem. 15:56:12 <Luc> q+ 15:56:17 <dgarijo> ... you could raise an issue, MacTed, and propose other names. 15:56:24 <pgroth> ack Luc 15:56:31 <dgarijo> Luc: do you have suggestions for other names? 15:56:59 <Curt> we went through other terms people didn't like.... They don't like entity either, but it was left standing after other terms were eliminated. 15:57:01 <dgarijo> ... that was the best one we came up with. We used to have Bob (and we don't want to go back there). 15:57:09 <pgroth> +1 curt 15:57:21 <dgarijo> ... the only way to move forward is through new proposals 15:57:25 <GK> q+ to say I think I can see a way to revising PAQ 1.2 to remove "entity" and just talk about "resource" without losing the essence of the material 15:57:44 <dgarijo> MacTed: I don't think we are the first people to look at these questions. 15:58:09 <dgarijo> pgroth: the conclusion is: If you have a better name for consideration, feel free to propose it. 15:58:18 <pgroth> ack GK 15:58:18 <Zakim> GK, you wanted to say I think I can see a way to revising PAQ 1.2 to remove "entity" and just talk about "resource" without losing the essence of the material 15:58:46 <dgarijo> GK: we can eliminate the term entity without loosing much in the doc. 15:59:29 <pgroth> q? 15:59:36 <dgarijo> pgroth: good bye everyone 15:59:39 <Zakim> -Curt_Tilmes 15:59:44 <Zakim> -tlebo 15:59:44 <dgarijo> ... and good luck for monday 15:59:47 <Zakim> -pgroth 15:59:49 <Zakim> -jcheney 15:59:52 <Zakim> -Luc 15:59:55 <Zakim> -jun 15:59:57 <Zakim> -GK 16:00:00 <Zakim> -dgarijo 16:00:03 <Zakim> -Paolo 16:00:04 <pgroth> daniel I'll do the minutes 16:00:05 <Zakim> -MacTed 16:00:07 <Zakim> -sandro 16:00:09 <Zakim> -??P10 16:00:09 <dgarijo> ok, thanks! 16:00:12 <dgarijo> bye! 16:00:17 <Zakim> -Tom_De_Nies 16:00:27 <Tom_De_Nies> bye! 16:00:47 <pgroth> rrsagent, set log public 16:00:53 <pgroth> rrsagent, draft minutes 16:00:53 <RRSAgent> I have made the request to generate pgroth 16:00:58 <pgroth> trackbot, end telcon 16:00:58 <trackbot> Zakim, list attendees 16:01:06 <trackbot> RRSAgent, please draft minutes 16:01:06 <RRSAgent> I have made the request to generate trackbot 16:01:07 <trackbot> RRSAgent, bye 16:01:07 <RRSAgent> I see no action items 16:01:08 <GK> @Paul: would you like me take to a pass at this while it's fresh in my mind (s/entity/resource/) # SPECIAL MARKER FOR CHATSYNC. DO NOT EDIT THIS LINE OR BELOW. SRCLINESUSED=00000374
|
http://www.w3.org/2011/prov/wiki/Chatlog_2012-03-29
|
CC-MAIN-2014-35
|
refinedweb
| 4,037
| 74.29
|
Hi, Am Mittwoch, den 15.02.2012, 11:22 +0900 schrieb Charles Plessy: > Let's try to agree on a brief policy on naming schemes. Perhaps Perl, > Python and Java maintainers can comment on whether it would make sense > to have a common one (drafted as a DEP ?). with my Haskell Group hat on, although not in your list, I am strongly in the favor of renaming such language-specific libraries unless there is a good reason for that (e.g. a name that is known beyond the programming community of that language, e.g. “xmonad”). Here is a selection of Haskell packages that are currently packaged as “haskell-foo” – surely nobody would want these taken as source package names directly: arrows authenticate binary cairo bzlib brainfuck boolean clock cgi csv debian(!) devscripts(!) dpkg hostname keys text zlib So I’d say that every group maintaining a set of packages from one source where the upstream names behave as if they have a namespace all for themselves (as it is the case with Haskell packages, but also for example R packages) needs to come up with a policy to take them out of the Debian namespace. I do not think that there is a need for an agreement between the different groups. None of the groups will likely want to spend the time to rename all source packages.. Obviously, I prefer lang-foo (shorter, less noise, in sorted list the packages are grouped) and would appreciate if new groups would follow the scheme. But again, I don’t think we’d need a formal DEP or something, and just leave it to the groups to do the sensible thing.
|
https://lists.debian.org/debian-devel/2012/02/msg00668.html
|
CC-MAIN-2018-26
|
refinedweb
| 279
| 63.73
|
The Azure Cosmos DB team is excited to announce new features and improvements for developers:
- 1-month free trial of Azure Cosmos DB
- SDK updates to support multi-region writes
- Cosmos Explorer
- Portal UX updates and recommendations
- Azure DevOps build task
1-month free trial of Azure Cosmos DB
You can now try Azure Cosmos DB for free for an entire month! This trial allows you to evaluate Azure Cosmos DB’s capabilities for free for 30 days, including creating a database with up to 25 containers (collections) and up to 10,000 Request Units (RU)/second of throughput, no Azure subscription or credit required. Get started with Try Azure Cosmos DB. Azure Cosmos DB is also included in the Azure free account, which includes 400 RU/s for 12 months.
.NET, Java, JavaScript, and Python SDK updates
The JavaScript 2.0 SDK is now generally available. We’ve added support for multi-region writes, a new “fluent” style object model – making it easier to reference Cosmos DB resources without an explicit URL– and support for promises and other modern JavaScript features. It is also written in TypeScript and supports the latest TypeScript 3.0.
With these changes, you can create a new database, container, and add an item in 10 lines of code!
In the new Python 3.0 SDK, in addition to multi-region write support, we’ve changed the namespace to azure.cosmos, and renamed ‘document_client’ to ‘cosmos_client.’ Because Azure Cosmos DB supports multiple API models, we’ve also renamed the concepts of “collection” and “document” to “container” and “item.”
Cosmos Explorer
Cosmos Explorer provides a full-screen standalone web-based version of the popular Azure Cosmos DB Data Explorer. With Cosmos Explorer, you can access your database accounts and containers, run queries, and view results, all with the full-screen real estate. You can also share temporary access to authorized peers, without the need for them to have subscription or Portal access.
Cosmos Explorer also supports showing query execution metrics, under the Query Stats tab. You can also download a CSV to view detailed metrics at the partition level. Learn more about these metrics and how to tune your queries in Azure Cosmos DB.
To try Cosmos Explorer, navigate to Data Explorer, and click the Open Full Screen link. You can also go directly to and paste in a connection string. Learn how to use Azure Cosmos DB explorer to manage your data.
New UX for creating accounts in the Portal
We’ve updated the Azure Cosmos DB account creation experience in the Portal. Now, you can take advantage of the full screen when creating new Azure Cosmos DB accounts.
You can also track the status of your account creation.
Recommendations
The Azure Cosmos DB Portal can now show you alerts, recommendations, and messages for your account. To see them, navigate to the Overview tab and view the Notifications section.
For example, the recommendation below suggests that many values of the partition key property in a collection are null and should be reviewed to ensure a good distribution.
Azure Cosmos DB Emulator updates
The Azure Cosmos DB Emulator provides a local environment that emulates the Azure Cosmos DB service for development purposes. The emulator allows you to develop and test your application locally, without creating an Azure subscription or incurring any costs.
If you’ve ever tried to set up the Azure Cosmos DB emulator to run as part of your build and release process, you know it can be hard to maintain. Now, you can use the new Azure Cosmos DB Emulator build task extension for Azure DevOps (formerly Visual Studio Team Services). With the build task, you can run tests directly against the emulator, all as part of your CI pipeline!
To get started, follow the tutorial and install the extension from the Marketplace.
Stay up-to-date on the latest Azure #CosmosDB news and features by following us on Twitter @AzureCosmosDB. We are really excited to see what you will build with Azure Cosmos DB!
|
https://azure.microsoft.com/cs-cz/blog/cosmos-developer-experience/
|
CC-MAIN-2020-24
|
refinedweb
| 672
| 53.21
|
{-# LANGUAGE MagicHash #-} -- | Evaluate an array in parallel in an interleaved fashion, -- with each by having each processor computing alternate elements. module Data.Array.Repa.Eval.Interleaved ( fillInterleavedP) where import Data.Array.Repa.Eval.Gang import GHC.Exts import Prelude as P -- | Fill something in parallel. -- -- * The array is split into linear chunks and each thread fills one chunk. -- fillInterleavedP :: Int -- ^ Number of elements. -> (Int -> a -> IO ()) -- ^ Update function to write into result buffer. -> (Int -> a) -- ^ Fn to get the value at a given index. -> IO () {-# INLINE [0] fillInterleavedP #-} fillInterleavedP !(I# len) write getElem = gangIO theGang $ \(I# thread) -> let !step = threads !start = thread !count = elemsForThread thread in fill step start count where -- Decide now to split the work across the threads. !(I# threads) = gangSize theGang -- All threads get this many elements. !chunkLenBase = len `quotInt#` threads -- Leftover elements to divide between first few threads. !chunkLenSlack = len `remInt#` threads -- How many elements to compute with this thread. elemsForThread thread | thread <# chunkLenSlack = chunkLenBase +# 1# | otherwise = chunkLenBase {-# INLINE elemsForThread #-} -- Evaluate the elements of a single chunk. fill !step !ix0 !count0 = go ix0 count0 where go !ix !count | count <=# 0# = return () | otherwise = do write (I# ix) (getElem (I# ix)) go (ix +# step) (count -# 1#) {-# INLINE fill #-}
|
http://hackage.haskell.org/package/repa-3.1.4.1/docs/src/Data-Array-Repa-Eval-Interleaved.html
|
CC-MAIN-2015-22
|
refinedweb
| 200
| 68.57
|
Nice post. Comments inline :
Andrew McIntyre wrote:
> On 6/22/06, Daniel John Debrunner <djd@apache.org> wrote:
>>
>>.
>
> +1
I just can't agree that this is true as much as I want to, because the
draft license is clear, and the spec itself claims that any
implementation of a driver is a JDBC implementation.
However, it may not matter.
>
> I agree, on rereading the JSPA agreement, the text I quoted in my
> previous email refers to independent implementations of the core
> classes covered by JSR-221. i.e. the java.sql.* classes, etc.
> Applications which happen to implement interfaces in those packages in
> their own namespace don't seem to be covered by anything in the JSPA.
>
> But, looking at the evaluation license you need to agree to download
> the spec, it contains this:
>
[snip spec license blurb]
>
> Presumably this is where the idea that you can't ship something that
> implements an interface in a JSR comes from, because you would have
> needed to copy material which is copyrighted by Sun, and to which
> you've agreed to this license to have knowledge of. Let's assume that
> the people who implemented the Derby implementations of the JDBC 4
> interfaces are subject to this agreement. And, that this means that
> the method signatures described in the spec and any javadoc comments
> in the JDBC 4.0 spec are the IP in question here that we have
> 'acquired no right' to use. The method signatures in the Derby classes
> were clearly copied from the spec, and I believe perhaps some javadoc
> comments as well, although I would need to check that.
>
> Now, there are two things involved in our catch-22:
>
> * Mustang wants to ship a GA Derby 10.2, which supports JDBC 4.0.
>
> Sun wants to release a version of Derby with the JDK that (I would
> assume) includes javadoc for Derby that includes material copied from
> the JDBC 4 spec. But if Sun shipping the JDK is the event which
> satisifes ' (ii) the date on which the final version of the
> Specification is publicly released' then the license above expires and
> the people who were reading the spec and copied parts of it into Derby
> are no longer bound by this agreement either. It's not clear what
> license is then in effect, but I would like to think that by virtue of
> the contributors in question, the ASL is the license in effect on that
> code, since it was contributed to Derby by employees of Sun under its
> CCLA and the various ICLAS in effect for the individual contributors.
> But then, IANAL.
The Apache License is the only copyright license on the code for
downstream licensees. Nothing else - Sun's weird theories about spec
Patents are another story, of course, but unless Sun or other
contributors to the 221 EG assert that there are necessary patents, we
should ignore them here. (Which brings up an interesting situation for
discussion at another tim that if there are necessary patents held by an
EG member, and there is no TCK for which to certify compatibility of an
implementation, which the spec claims a driver is....)
>
> As far as the Derby bits that Sun ships in the JDK, well, it's not
> really Derby they've committed to shipping but JavaDB. So they can
> twiddle the bits as they see fit I suppose, as long as they don't call
> it an official Derby release anywhere in the JDK. I could imagine a
> situation where they simply flip the beta flag and update the version
> so that Derby reports itself as a 10.2.0.0 database at whatever
> revision it happens to be the day the JDK ships, along with the
> modified 'M' flag in the version string. If Sun says that all that did
> was ship the Derby code at that revision level with the necessary
> version bits modified, then anyone using the Derby bundled with the
> JDK will just have to believe them.
This is where things start to smell like a fork.
If JavaDB behaves differently than Apache Derby for the same version
number, that's a problem.
>
> If, say, that version happens to not upgrade to official Derby
> releases for some bizarre reason, then suddenly there are lots of new,
> irate users complaining that Derby is broken. This would make the
> Derby community look bad through no fault of its own (and Sun has a
> sticky problem to boot). Hopefully this won't be an issue, though.
>
> * Derby can't ship a GA 10.2 until JDBC 4.0 is GA, which is with Mustang.
>
> One modification here: Derby could ship a GA 10.2 any time it likes.
> Just not with the JDBC 4 bits. Nor would it want to, anyway, since
> besides the evaluation license probably covering material that Derby
> would be releaseing, Derby could possibly ship incorrect
> implementations of interfaces defined in the spec, and nobody in the
> community is interested in that. :-)
>
> But, once the spec is final, then the Derby community can release its
> JDBC 4 bits at its leisure, since the evaluation license has expired
> and presumably the bits in question (i hope) are then covered by the
> ASL.
Don't worry about the "expiration" mechanism - once the spec is final,
it's clear Derby can ship an implementation of it.
BTW, those "bits in question" are *always* covered by the Apache License
(it's not the "ASL" by the way - that was v1.x) The issue is if the
project can distribute them. The issue really is if it's legal to
implement, but Sun has acknowledged this problem with a new version of
the spec license this last May.
>
> And, hopefully whatever Derby bits Sun releases as part of the JDK
> will be compatible with future Derby releases. The Derby community
> obviously has no responsibility for anything Sun releases, but it can
> definitely be affected, negatively or positively, by whether or not
> they get this 'right'. Let's hope they do.
Exactly.
>
>"?
>?
geir
|
http://mail-archives.apache.org/mod_mbox/db-derby-dev/200606.mbox/%3C449BCE21.2000207@pobox.com%3E
|
CC-MAIN-2017-22
|
refinedweb
| 1,008
| 65.96
|
I have a hw problem that has me baffled. Im sure It is not a big deal, i just am not that familiar with c++ yet.
I am tasked with assigning a char value to rate an employee
if I enter certain char's i should display a specified string.
and if the display is invalid I am to display that it was and to try again.
seems simple but It is beating me up.
First when I enter the char with cin>> the loop continously runs until i close the console.
second I am not even sure it is executing the strings if i enter a specified char.
Please help me.
#include <cstdlib> #include <iostream> using namespace std; void GetRating(int x);// function prototype int value; int x=0; int main () { for (x=0;x==0;) {cout<< "Enter employee rating"<<endl; cout<< "use E, G, A or P: "<<endl; cin>>value; GetRating(x); } system("PAUSE"); return EXIT_SUCCESS; } //************************************************************************************************** void GetRating (int x) { if (x=='e') cout<< " the employees rating was excellant"<<endl; else if (x == 'g') cout<< " the employees rating was good"<<endl; else if (x=='a') cout<< " the employees rating was average"<<endl; else if (x=='p') cout<< " the employees rating was poor"<<endl; else cout<< "Rating invalid Please try again:"<<endl; }
|
https://www.daniweb.com/programming/software-development/threads/392650/void-function-hw-please-help-me
|
CC-MAIN-2017-09
|
refinedweb
| 213
| 66.37
|
I was trying to write a wrapper for number_to_currency to return
currency in pounds. I used a helper class to do this.
def number_to_pounds(amt)
number_to_currency(amt, :unit => “”)
end
This works fine, but I am trying to understand why I can’t use a
symbol to pass the values. I thought symbols were like pointers. (you
now know I am a newbie).
def number_to_pounds(:amt)
number_to_currency(:amt, :unit => “”)
end
Note - amt is not the name of the variable my view works on, it is
price, so I tried the symbol :price, it wouldn’t work either. I am
googling to learn about the symbols. Any link for that would be really
helpful.
Thanks
|
https://www.ruby-forum.com/t/doubt-with-symbols-in-rails/197595
|
CC-MAIN-2021-43
|
refinedweb
| 113
| 74.79
|
- Type:
Bug
- Status: Closed (View Workflow)
- Priority:
High
- Resolution: Fixed
- Affects Version/s: 5.34/00
- Fix Version/s: None
- Component/s: Core Libraries
- Labels:None
- Environment:
all
char *TClass::EscapeChars(const char *text) const allocates a 128-byte static buffer for its output. It checks if the input text isn't larger than 127 chars (good), but after escaping, the output written to the buffer may be larger, leading to memory corruption.
The interpreter doesn't (always) crash: silent memory corruption. G++-compiled programs usually get very upset (seg fault). Code to reproduce:
#include "TClass.h"
#include <iostream>
using namespace std;
int main()
{
TClass a;
cout << a.EscapeChars("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[") << endl;
return 0;
}
|
https://sft.its.cern.ch/jira/browse/ROOT-6239?workflowName=classic+default+workflow&stepId=6
|
CC-MAIN-2020-10
|
refinedweb
| 112
| 58.99
|
Related link:
The W3C just announced “Extending XLink,” a Working Group Note that “describes changes that could be incorporated into an XLink Version 1.1 specification to address usability, dependence on annotations provided by external grammars, and interoperability.” It’s short and makes a good beginning at what I see as the fundamental problem with moving the W3C’s little-used linking standard forward: everyone agrees that XLink is too complicated and messy, and should be cut down to a leaner, more manageable core, but few agree on what to cut out and what to leave in. (It’s a classic engineering problem, and anyone who appreciates it should be even more impressed with the effort that went into whittling down SGML into XML.) The new note addresses the simplest, most basic problems to clear out of XLink. I’d summarize them here, but the document is so short that if you’re interested in linking at all you should take five minutes to read the whole thing yourself.
(One picky tech writer complaint: it assumes that all readers know what the acronym “IRI” refers to. Try a Google search on the term for a laugh—International Republican Institute? Information Resource, Inc.? International Research Institute for Climate Prediction? Those are just the first three hits, with the W3C/IETF meaning of the acronym currently showing up at number 48. The XLink note refers to Internationalized Resource Identifiers, a complement to URIs that reduces the dependence on ASCII.)
One Small Step...
Kudos to Norm for another typically excellent job of editing. Overall, it's a pretty straightforward set:
1. Make simple XLinks an application-level default.
Smart.
2. Reserve all attributes in the XLink namespace.
Uh, yeah. Is anybody actually abusing it this way?
3. Allow IRIs
Why not?
4. Provide Sample XML Schema and RELAX NG Grammars.
Non-normitive at that. A minor but welcome change.
Is it worth it? Probably not. An XLink 1.1 would probably not even fare as well as XML 1.1. The reasons for low adoption of XLink are not solved by any of these four things.
-m
In favor of taking the step
Thanks, Micah. I'm certainly going to argue in favor of producing a 1.1 spec. To my mind, the only technical obstacle to wider XLink adoption is solved by point 1 of the proposed changes.
|
http://www.oreillynet.com/xml/blog/2005/01/cleaning_up_xlink.html
|
crawl-002
|
refinedweb
| 396
| 66.64
|
Type: Posts; User: RileyDeWiley
I will answer my own question for benefit of the search engines ... I was working on development hardware in which the device ID and vendor ID were set to pre-release default values. The right way to...
I have two instances of a given device on a given machine (actually they are different devices but they use the same driver). I need to know which of these two instances I am talking to.
The...
I am writing a user level app that needs to get the memory range used by a driver. To be clear, the value I need can be viewed in the Device Manager on the Resources tab of the Properties page, so I...
I can't post the code, but can tell you what is going on.
There are three pages that matter:
-Landing page, on which you login;
-Start page, which has a link to page X;
-Page X, which has a...
I am dealing with a bug related to using history (back button or backspace key) to revisit a page. The bug seems to be related to cookie presentation (the bug is that a login page is shown if the...
I needed FieldInfo.DeclaringType.
Thank me very much ..
I have some code that uses one base class and about 100 (yes, really!) derived classes.
I wish to put into the base class some code that will serialize/deserialize any derived class. To do this I...
<whine>
But the types for which I instantiate it do in fact have a Parse() method... can't the compiler wait and see what I am using it for? A c++ compiler would.
</whine>
I have a workaround. ...
When I compile this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace App1
{
I have some code I am porting from c++ to c#, and have gotten into a corner. I know there is an easy way out but don't see it.
In C++:
char * sBuf = malloc(100 * sizeof(char));
...
Error 1 'System.Windows.Forms.DataGridView' does not contain a definition for 'DataBind'
Has to be something like that, though ...
I have a DataGridView object on a form and wish to populate it from a list or array (I have used List<>, ArrayList, and BindingSource to no avail).
The basic problem is that no data appears after...
I need to serialize / deserialize the unmanaged class. That gonna work?
Riley
I have a problem that must be fairly common for c#-ies.
I have a nifty set of unmanaged c++ classes, and a new requirement that the classes must be xml-serializable. So I have some choices:
...
|
http://forums.codeguru.com/search.php?s=cb845bc330f73c60e4e047066d9dce3d&searchid=7001531
|
CC-MAIN-2015-22
|
refinedweb
| 444
| 76.01
|
action I find frustrating in C# is where a particular action needs to be taken based off of the type of a particular object. Ideally I would like to solve this with a switch statement but switch statements only support constant expressions in C# so no luck there. Previously I've had to resort to ugly looking code like the following.
Type t = sender.GetType();
if (t == typeof(Button)) {
var realObj = (Button)sender;
// Do Something
}
else if (t == typeof(CheckBox)) {
var realObj = (CheckBox)sender;
// Do something else
}
else {
// Default action
}
Yes I realize this isn't the ugliest code but it seems less elegant to me over a standard switch statement and I find the casting tedious. Especially since it requires you to write every type twice.
What I want to say is "Given this type, execute this block of code." So I decided to run with that this afternoon. Lambdas will serve nicely for the block of code and using type inference will allow us to avoid writing every type out twice. What I ended up with was a class called TypeSwitch with 3 main methods (see bottom of post for full code).
I wrote a quick winforms app to test out the solution. I dropped some random controls on a from and bound the MouseHover event for all of them to a single method. I can now use the following code to print out different messages based on the type.
TypeSwitch.Do(
sender,
TypeSwitch.Case<Button>(() => textBox1.Text = "Hit a Button"),
TypeSwitch.Case<CheckBox>(x => textBox1.Text = "Checkbox is " + x.Checked),
TypeSwitch.Default(() => textBox1.Text = "Not sure what is hovered over"));
Notice that for check box I was able to access CheckBox properties in a strongly typed fashion. The underlying case code will optionally pass the first argument to the lambda expression strongly typed to the value specified as the generic argument.
There are a couple of faults with this approach including Default being anywhere in the list but it was a fun experiment and works well.
TypeSwitch code.
static class TypeSwitch {
public class CaseInfo {
public bool IsDefault { get; set; }
public Type Target { get; set; }
public Action<object> Action { get; set; }
}
public static void Do(object source, params CaseInfo[] cases) {
var type = source.GetType();
foreach (var entry in cases) {
if (entry.IsDefault || type == entry.Target) {
entry.Action(source);
break;
}
}
}
public static CaseInfo Case<T>(Action action) {
return new CaseInfo() {
Action = x => action(),
Target = typeof(T)
};
}
public static CaseInfo Case<T>(Action<T> action) {
return new CaseInfo() {
Action = (x) => action((T)x),
Target = typeof(T)
};
}
public static CaseInfo Default(Action action) {
return new CaseInfo() {
Action = x => action(),
IsDefault = true
};
}
}
Published Friday, May 16, 2008 8:00 AM
by
Jared Parsons
You can have a version that uses IsSubclassOf instead of == so that for example the checkbox case fires for classes derived from checkbox. (And then the Default case becomes just IsSubclassOf(Object).)
oldnewthing
Agreed. This sample can definately be expanded upon for sub typing and potentially other items such as interface implementation.
Jared Parsons
I guess my point was that some people who do 'switching on types' really do expect subclasses to match. Otherwise you get problems like "This code says that I have to pass a checkbox, and I do pass a checkbox, but it still throws a 'wrong type' exception!"
Having read Jared Parsons blog entry on Switching on Types , I was inspired to follow on with a class
Virtual Static Void
I just did something similar today, I wrote an enum containing the type names I expected, and then parsed the name of the type as the enum and switched on the resultant enum value, roughly like this:
enum Types { Button ... } ;
Types typ = System.Enum.Parse
( typeof(Types) , sender.GetType().Name ) ;
switch ( typ ) { case Types.Button : ...
PIEBALDconsult
Oh, please no!
C# left this functionality out for a good reason. Please let it stay out.
In object-oriented programming, you should never care what kind of object you're working with. Never check what an object type is and then take an action. Instead, ask an object to do something, and the object will take the appropriate action.
Especially now that you can add methods to existing classes, there should be no need for this type of code.
Your example should read:
textBox1.Text = sender.DefaultDescriptiveText;
and each class should implement DefaultDescriptiveText appropriately, for example Button returns "Hit a Button". If there is no more specific action, the base class would implement the default action.
Not only is this cleaner, it maintains knowledge of what the sender should do in the sender's class rather than strewing it all over your project wherever the sender gets used. With your implementation, what happens to all those places where you've got "Hit a Button" when you want to change it to "Click a button"? Or, the real win, when change the code, and suddenly sender can now be a scrollbar how many places to I need to change the code? One -- in scrollbar. With your method, I need to find every use of sender to check if scrollbars are handled correctly.
Please, don't encourage use of type tests, they're contrary to well designed object-oriented programming. For that matter, switch statements should largely be eliminated too. (I won't as far as some and suggest elimination of if statements though.)
E.
Silverhalide
Hey Silverhalide,
In general I agree. Making decisions based off of types is not the ideal approach. Virtual method dispatch or interfaces are much more suitable.
The problem with your solution though is it assumes that I have the ability to modify the types in question. In this case they are BCL types and I do not have this ability.
I could subclass these types and add an interface. This is not a general solution though because the type in question could be sealed. In addition it's quite annoying to have to subclass multiple classes when I just want to call a single method based on the type of the object. Doubly so when it will only be used in one particular method call in one object.
Yes, this is more complicated if you can't alter the classes being used. I could have sworn that adding methods to existing classes was added to C# in the last couple of years (maybe there's limits on it that slip my mind right now). However, an alternative approach is to make use of parametric polymorphism.
Your example would read:
textBox1.Text = DefaultDescriptiveText.Generate(sender);
and then the DefaultDescriptiveText class would implement Generate(CheckBox), Generate(Button), and so on. Again this would be able to handle inheritance hierarchies, etc. that the original proposal couldn't deal with nicely.
I chose my career wisely. I can tell because at least once a week I run across a nifty small thing
Steve's Tech Talk
|
http://blogs.msdn.com/jaredpar/archive/2008/05/16/switching-on-types.aspx
|
crawl-002
|
refinedweb
| 1,148
| 63.49
|
SFML community forums
Help => Network => Topic started by: TestZombie on April 03, 2016, 01:38:36 am
Title:
Sockets cannont be a vector
Post by:
TestZombie
on
April 03, 2016, 01:38:36 am
I dont know what to do
(click to show/hide)
#include <SFML\Network.hpp>
#include <SFML\System.hpp>
void main()
{
std::vector<sf::TcpSocket> socket;
socket.resize(1);
}
this throws this error in vs2015
Severity Code Description Project File Line Suppression State
Error C2280 'sf::TcpSocket::TcpSocket(const sf::TcpSocket &)': attempting to reference a deleted function Test c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 655
Title:
Re: Sockets cannont be a vector
Post by:
Ixrec
on
April 03, 2016, 10:25:13 am
That error message is telling you that sf::TcpSocket lacks a copy constructor. Many SFML classes deliberately lack copy constructors because semantically it just doesn't make any sense to copy things like keyboards or mice or network connections (see the sf::NonCopyable documentation ( for a list of all the other non-copyable SFML classes).
The issue you've run into, which is a general C++ thing and not unique to SFML, is that std::vector can only store copyable types (or in C++11, moveable types). This is correct, because many of the typical std::vector operations require copying (or moving) the contained objects, so it would be wrong to let you compile this.
Depending on what you want to do with sockets, you can either use a raw array as your container, or you can have your container hold smart pointers to sf::TcpSockets instead of the sf::TcpSockets themselves.
Title:
Re: Sockets cannont be a vector
Post by:
TestZombie
on
April 04, 2016, 05:03:07 am
Thanks!
Title:
Re: Sockets cannont be a vector
Post by:
namosca
on
April 05, 2016, 10:50:32 pm
Hey!
I dont know if you want a vector just because you want to store your objects in an organized way, or just because you want to resize the vector, but an std::list will work fine assuming your most wanted need is to store your objects in an organized way.
It just worked for me:
std::list<sf::TcpSocket> connectionList;
connectionList.emplace_back();// This creates a new socket, directly inside the list
For resizing, this looks dangerous to me to resize without knowing what will happen to the clients connected to your sockets, but this function is also avaiable in list. You can watch all a list can do here on this link:
Have a nice time!
Title:
Re: Sockets cannont be a vector
Post by:
Ixrec
on
April 06, 2016, 09:03:48 pm
For completeness, what namosca said is true of any "node-based container" (i.e. a container implemented with "nodes" that hold one item alongside pointers to other nodes). That includes std::list, std::map, std::set, and so on. These containers do not require the items they contain to be copyable because they
never
copy an item after it's been inserted, no matter what methods you call on them, which is why they work with non-copyable classes like sf::TcpSocket.
The downside of a node-based container is that it can't guarantee contiguous memory like a std::array or std::vector can, and there's the storage and runtime costs of chasing a bunch of pointers. But for many purposes you won't even notice that. It was silly of me not to mention this option in the last post.
SMF 2.0.18
|
SMF © 2021
,
Simple Machines
Simple Audio Video Embedder
|
https://en.sfml-dev.org/forums/index.php?action=printpage;topic=20079.0
|
CC-MAIN-2022-21
|
refinedweb
| 601
| 56.18
|
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/RecyclingAllocator.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <new>
#include <utility>
Go to the source code of this file.
This file implements a coalescing interval map for small objects.
KeyT objects are mapped to ValT objects. Intervals of keys that map to the same value are represented in a compressed form.
Iterators provide ordered access to the compressed intervals rather than the individual keys, and insert and erase operations use key intervals as well.
Like SmallVector, IntervalMap will store the first N intervals in the map object itself without any allocations. When space is exhausted it switches to a B+-tree representation with very small overhead for small key and value objects.
A Traits class specifies how keys are compared. It also allows IntervalMap to work with both closed and half-open intervals.
Keys and values are not stored next to each other in a std::pair, so we don't provide such a value_type. Dereferencing iterators only returns the mapped value. The interval bounds are accessible through the start() and stop() iterator methods.
IntervalMap is optimized for small key and value objects, 4 or 8 bytes each is the optimal size. For large objects use std::map instead.
Definition in file IntervalMap.h.
|
https://www.llvm.org/doxygen/IntervalMap_8h.html
|
CC-MAIN-2022-27
|
refinedweb
| 223
| 51.44
|
User talk:Privatemusings
a natural aversion to red links leads me to somewhat redundantly welcome discussion here.........
[edit] Welcome to Wikiversity
[edit] Welcome
Hello Privatemuschmidt 23:28, 19 January 2008 (UTC)
[edit] Brave and Foolish
There is a classical Jungian archetype and story about being brave and foolish. The story is variously known as Parsifal, Fisher King, or Grail Quest. Parsifal (aka Gawain) is the witless fool whose simple act of compassion heals the wound of Amfortas, the Fisher King. In Jungian Analysis, the Amfortas Wound is the persistent wound that seemingly never heals, because it can only be healed by a gracious act of compassion that rarely occurs (except in remarkable stories like The Fisher King). In terms of our model of ethics, perfect compassion corresponds to Carol Gilligan's Ethics of Care, which the ancients called Thummim. —Moulton 14:54, 4 August 2008 (UTC)
[edit] Audio introduction
Would you like to participate at Ethical Management of the English Language Wikipedia/Audio or Ethical Management of the English Language Wikipedia/Audio/Transcripts? --JWSchmidt 04:59, 26 August 2008 (UTC)
[edit] Thank you for restructuring
Thank you for cleaning up the mess caused by the edit warring. I hope we can put the edit war in the past, but I doubt it. But let's hope for the best. WAS 4.250 00:11, 29 August 2008 (UTC)
- No worries! - glad you liked it :-) - it'll all come out in the wash in the end....! Privatemusings 00:12, 29 August 2008 (UTC)
[edit] evolution
Thanks for your comments on my user talk page. I was amused that you seemed to be walking on egg shells while you were on your way to whisper in my ear. The intent of the message at the top of my talk page is to encourage people to talk to me even when they want to tell me something that might make me unhappy. Anyhow, I think I understand everything you said and I think it cuts right to an important matter. I agree that it is understandable that intelligent design-advocates can cause problems on Wikipedia and that can lead to "a response" from Wikipedians who oppose the goals of the intelligent design movement. It is a fundamental human problem that when we "come under attack" we get upset and often start fighting back. However, the rules of Wikipedia basically say, "stay calm, stay polite, listen to well-intentioned complaints from other people even if you think the complaints are misguided". During conflicts that exist at the boundary between religion and science there is a problem in how language serves our needs. Scientists and non-scientists do not share a common set of definitions for terms such as "evolution". Important words mean different things to scientists and to non-scientists. This means that scientists and non-scientists are constantly talking past eachother and not understanding eachother. So, Wikipedians who are editing at the boundary between science and religion need to be aware of this, they need to be mature and recognize the problem, and they need to make a special effort to understand what they hear and they need to do their "work" at Wikipedia with constant attention to the goal of making sure that all points of view are heard and fairly presented by Wikipedia. One of the key problems in communication relates to what you said here: "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 agree that for most people, the term "evolution" (when used in its biological context) is treated synonymously with 'darwinian natural selection'. However, I'll ask you to take the time to open your favorite dictionary and read the definition of "evolution". Many dictionaries do not mention "natural selection" at all when giving the meaning of "evolution" (example, my dictionary is The American Heritage Dictionary of the English Language from 1978, see also this). Please note that the Wikipedia article on Evolution correctly makes a distinction between the terms "evolution" and "natural selection". The distinction is that natural selection is a mechanism or process that can play an important role in the way many types of evolutionary change take place. Further, scientists who study evolution know that natural selection is not the only process that is important for the evolution of life. So for a scientist to say,
1) "We are skeptical of claims for the ability of random mutation and natural selection to account for the complexity of life. Careful examination of the evidence for Darwinian theory should be encouraged."
in no way contradicts or conflicts with
2) "the vast (vast) majority of scientific opinion supports evolution".
Do you see the distinction? Many scientists study other mechanisms of evolution besides natural selection. Darwinian natural selection only deals with how a biological species can transform into a new species. Many people who study the complexity of life study molecular evolution and the transition of molecules to the living state, a transition that involved the evolution of molecular complexity before there ever was a "species" that could be subjected to Darwinian natural selection. Anyhow, the bottom line is that some Wikipedian's jumped to the conclusion that anyone who agrees with statement #1 (above) is a friend of the discovery institute and their methods and their goals. That's false and I think it is really crazy that some Wikipedia editors still believe it after having been told repeatedly why they are mistaken. Such failure to listen to people who tell you why you are wrong and why what you posted on Wikipedia is wrong is absolutely against Wikipedia policy. I feel that for Wikipedians to attack people who are trying to correct Wikipedia's errors and for abusive administrators to participate in well-orchestrated efforts to ban editors who are trying to correct Wikipedia's errors is sickening. Its not right and Wikipedia has a problem with this. I hope that the "ethics in Wikipedia" project here in Wikiversity can help lead to changes at Wikipedia that will prevent this problem from continuing. Would you be willing to ask me the "3 questions" some time or should I just do a recording by myself the way you did? --JWSchmidt 16:37, 30 August 2008 (UTC)
- thanks for the response, JW :-) - I'd love to ask you the questions - but equally feel free to 'go solo' for the sake of timeliness if you want to... best, Privatemusings 04:30, 31 August 2008 (UTC)I'm sure we'll continue the above in terms of the ethics project, and possibly the broader issue in the future too!
[edit] PodCast with NewYorkBrad (Thursday, Sept 4)
Please sign me up to participate in Thursday's SkypeCast with NewYorkBrad. —Moulton 13:24, 2 September 2008 (UTC)
- I'm afraid I've had to drop out of this 'cos I'm a bit busy this week... that could mean that it might be delayed? - I'll try and catch up with you about this soon(ish) :-) Privatemusings 02:58, 4 September 2008 (UTC)
- Please use your good offices to ensure that I am not locked out of this session when it occurs. I would be grateful if you would discuss with NewYorkBrad the issue, that Filll and Durova had previously locked out Greg Kohs, and Filll had previously sought to lock me out of the roundtable with Brian Bergstein. —Moulton 11:12, 4 September 2008 (UTC)
[edit] Your page on the ethics project
Hi, privatemusings. Thanks for showing me the link. I think in general that everyone who was involved with the ethics project is going to need to review their material and think about where it is appropriate to post it, what kind of page title is appropriate, and whether any content is inappropriate. I'm sure that there is both good and bad all over the place. I think one user has made a good start by moving "his" pages into his user namespace. A good way forward might be for all the contributors to move "their" pages into their user namespaces quite quickly, pending a slower general discussion of restructuring, renaming and perhaps suspending the project. Please feel welcome to drop by on my talk page if you need any guidance on this. --McCormack 08:44, 15 September 2008 (UTC)
[edit] Reflection
Hi Privatemusings - yes, I'd really appreciate having that discussion. Of course I acknowledge that mistakes have been made, and that I had a role in those - or even made them directly! I also think the ethics project could be relaunched - but only within some very specific guidelines about the ethics of "learning" about another person's online contributions. I have faith that the remaining participants will be able to work on these guidelines, and make the ethics project into a stimulating resource - I've always loved the idea, just not some of the practice. Cormaggio talk 10:26, 9 October 2008 (UTC)
- coolio :-) - maybe if you get a mo. you could take a quick look at my ethics sandbox, where I thought I'd sort of pull together a few of my ideas. Feel free to edit, discuss, whatever on those pages - I'm just sort of in a holding pattern collecting a few thoughts while other stuff settles down a bit. After this post I'm going to head over there and try and write some guidelines for myself - your thoughts and feedback will be most welcome.. thanks! Privatemusings 02:51, 10 October 2008 (UTC)
[edit] Wikimedia Ethics
"trying to help a Wikiversity 'Wikimedia Ethics' project make some sense eventually" <-- I would like to get clear in my own thinking to what extent all the various participants in the ethics project think of it as a research project. Jimbo suggested some specific ideas for how Wikiversity might modify its policy on research in light of the hornets nest that research for the ethics project stirred up. My thoughts are still in orbit around the issue of needed changes for the research policy. I like to think of Wikiversity as a playground where I can have fun learning about things that interest me. For a nerd like me, research is one of the most fun things to play with. I would like to find a way to keep doing research projects here at Wikiversity that does not include the traditional part of the process in which the researchers are attacked by an angry mob who would prefer that sleeping dogs be left un-researched. I've long recognized the need for Wikiversity participants to practice self-censorship....this is not something that I am happy about.....it is just the reality we live with. It has always been and will always be the case that a tension exists between people who want to use new technology in new ways and people who want to live in the past where they do not have to deal with the changes caused by new technology. I'm one of the trouble-makers who wants to explore just what can be accomplished with wiki technology. I am constantly creating a tension between the "thrust" of opening up new spaces for the exploration of the potential of wiki technology and the resulting "parry" from people who say, "we are not ready for that". Sorry about the sword fighting analogy, it is just the first thing that came to mind. I have always envisioned Wikiversity as a gentle place where we can explore the boundary of the possible and be guided to consensus by discussion, not fighting. I suppose there is is a blurry boundary between discussion and fighting that we are also exploring. I was trained in the ways of a culture where the discussions are open, direct and designed to cut to the truth as quickly as possible. It is a learning experience for me to explore the extent to which I can play around with open and direct research without getting myself, and all of Wikiversity, in trouble. Okay, that is a brain dump about me and where I am with respect to the ethics project...I hope it qualifies as useful "feedback" for you. As for "advice", I've never been much good at giving advice....in the context of wiki editing I seem to usually end up saying something like: have fun doing what most interests you. I really value you as a Wikiversity participant so I hope our play times/topics intersect in the future and we can continue to share wonderful collaborations. --JWSchmidt 13:10, 10 October 2008 (UTC)
[edit] the future of Wikimedia ethics project
Feel free to add, but please do not delete without first getting consensus. Thanks. WAS 4.250 18:06, 10 October 2008 (UTC)
[edit] WMA
Thanks for the heads up; I've joined the mailing list - one step at a time!
-- Jtneill - Talk - c 12:09, 16 November 2008 (UTC)
[edit] Voice Artist needed?
Hi,
Someone's been busy in connection with WikiCampusRadio..
Would you be willing to help in getting content recorded?
More details if interested? 212.225.116.192 16:48, 12 September 2009 (UTC)
[edit] Note
I can turn my back on possible iffy things that are minor, but I definitely cannot turn my back on that. Please understand that it crossed the line. Okay? Moulton was banned for using WV to run around other media. What you put is something that cannot be hosted here. It is for your good, my good, and all of Wikiversity's good that you don't re-post it. I will not delete the rest of your information or allusions, but no guides nor any in-depth details. Ottava Rima (talk) 01:42, 1 March 2010 (UTC)
- hmmm... well I'm having trouble swallowing the implications that such material is banned from here. Would you mind writing something neutral up for the colloquium so we can have a bit of a chat about this one? I'm developing that project at an absolute snail's pace, and have no urgent problem with your actions (ie. I think you're mistaken that material 'cannot be hosted here' - or at least that material ;-) - but I don't really care if it's deleted for a while, while we chat about it) - my wiki time is stretched at the mo - and I'll probably respond at the colloquium, or kick off a netural thread myself after a day or two... hope you're good anywhooo.... Privatemusings 22:48, 3 March 2010 (UTC)
- Posting a guide for how to sock when it was deleted from other wikis wouldn't make a lot of people happy. We already had problems with allowing Wikiversity encouraging negative interactions with Wikipedia, which socks can definitely do. You can -discuss- such actions, but please no guides on what can be seen as violating rules. Wikiversity cannot be a place which promotes violations of other Wikis rules. Regardless, I am sure plenty of people have an idea on -how- to do the socking without you having to tell them how, so you can find that the need for such a guide is moot, no? Ottava Rima (talk) 03:47, 4 March 2010 (UTC)
- I think a guide on hacking/cracking would be considered useful to people wanting to learn about security. I'm not sure how lessons on socks would be any different. Lessons could be useful for understanding the weaknesses in the wiki model. I don't think we should be deleting things just because they might/could upset people on other wikis. What next, do we delete lessons that suggest the Holocaust never happened because that might encourage a negative reaction? I think its not always possible to avoid controversy in education and what is taught. That said seems like some kind of balance should be possible, but I doubt its a compromise that everyone can be happy with. People use socks for good reasons just as well as for bad reasons. I think a balanced lesson probably should cover both the good and bad, the reasons why wikis don't like people to use socks, what usually happens if a person is caught using a sock for reasons not liked, along with ways people detect socks and ways people avoid detection. I think ways people avoid detection could be useful for wiki administrators because you can't always rely on tools to figure out whose a sock and whose not. In programming, sharing information would probably be considered security through transparency, while hiding information would probably be considered security through obscurity. I may be wrong, but I don't think Privatemusings is anything like Moulton. I also think Moulton was banned for entirely different reasons. -- darklama 04:54, 4 March 2010 (UTC)
- Did a colloquium discussion kick off? (I don't think so, but I've missed things before!) - I can see OR's point that hosting such stuff might be moot - but to my mind that just makes it less of a deal (and it's not a very big deal to begin with!) - so on balance, I'd still like to use the material in my project. I'll sniff round a bit more to look for the discussion, and drop one in myself later on (in the week, most likely) - obviously feel free (anyone really!) to write something neutral up, and we'll move forward. best, Privatemusings 23:02, 7 March 2010 (UTC)
- There has been no colloquium discussion on this yet. I saw the deletion soon after it happened which sparked my curiosity a bit. I thought I would watch, wait, and see how the discussion would develop and what would happen out of curiosity. Thats the only reason I'm aware of this discussion. -- darklama 00:59, 8 March 2010 (UTC)
< bit busy today and tomorrow - but will probably follow this up on fri :-) Privatemusings 02:03, 10 March 2010 (UTC)
- posted to colloquium Privatemusings 02:52, 12 March 2010 (UTC)
[edit] note
Mornin' all - there's clearly quite a lot to catch up on here, regarding the deletion of the ethical breaching experiment page, and my block from wv by jimbo - I see SB has undeleted the page and discussion has begun - I'm a bit busy today, but look forward to joining as soon as poss. - and if anyone's watching this, they might like to know that although I appear to have been unblocked - I think I'm still caught by an 'Autoblock', fwiw.... hope we can be thoughtful and calm and pursue discussion on all this :-) cheers, Privatemusings 21:37, 13 March 2010 (UTC)
- Ah, sorry about that... I forgot to check for autoblocks. You should be fine now. Your input would of course be greatly appreciated on the review page. --SB_Johnny talk 22:47, 13 March 2010 (UTC)
[edit] Chat
I hope to see you on IRC sometime. --JWSchmidt 18:03, 14 March 2010 (UTC)
- it's monday morning now, and I have a wee bit of time - I'm a bit befuddled about where to start with all this, but will install chatzilla, and hop onto IRC to see if that helps any :-) Privatemusings 22:23, 14 March 2010 (UTC)
[edit] Blocked
This is to notify you that you have been reblocked. Please see this discussion for more information. Ottava Rima (talk) 17:57, 15 March 2010 (UTC)
- well that's a shame. I'd like to be unblocked, and find this action clumsy and uneccessary - I'm not even sure of the policy (site, or foundation) which suggests this is acceptable.
- Main thing, I hope, is for all to be calm and chilled - Ottava, would you mind writing something netural up for the community review indicating that I would like to be unblocked, that I am happy to committ to following all foundation, and site, policies, and that I would like to be a part of the important, ongoing related discussions. cheers, Privatemusings 22:31, 15 March 2010 (UTC)
- I don't think that is up to us at the moment. Nevertheless, abiding by policies isn't necessarily going to be good enough for Jimbo or others. The reality, and part of what has caused some of the problem here, is that we perhaps don't have appropriate policies to deal with delicate situations. It is of some concern that you don't seem to recognise that problem and want to see a policy of some kind which supports what Jimbo has done as if a policy will exist for every situation. I hope, if some good can come out of this incident, that we can improve our policies, guidelines, and processes to avoid such situations happening again, but we can never anticipate every possible situation.
- I don't think you can ask or expect anyone here to consider unblocking you at this time, particularly in light of what happened to the last custodian that decided to do so. It is only my opinion but I feel it is better for Wikiversity to tread very carefully when it comes to researching other WMF projects or avoid doing so altogether if that isn't possible. Both your breaching experiments project, and the Court of WMF style analysis of conflicts on other WMF projects that we've seen previous under the "Wikimedia Ethics" banner go too far for Wikiversity in my view.
- One of the most fundamental problems with trying to research anything WMF related is that Wikiversity cannot detach itself from that community. It will always be a difficult area to research on Wikiversity. Better for us to focus on developing learning resources that have a much wider public appeal and alongside that develop the polices, guidelines, and procedures, that will allow us to host more challenging research projects in the future. Let's not try to run before we can walk. Adambro 23:03, 15 March 2010 (UTC)
- Thanks for your response, Adam - and despite wanting to be unblocked, I understand that it's not really reasonable (or sensible!) in the light of Jimbo's clumsy agressiveness, for a custodian to unblock me at the mo.
- I understand your concern that I don't understand the problem - I want to reassure you that I absolutely can see the paramount need for care and caution in working in an area like 'ethics' or 'the ethics of breeching experiments' - I've mentioned elsewhere previously that I support the direction the project was taking (removing planning etc. and moving towards writing up others' previous actions (ie. the Mike Handel thing) - I guess I was just trying to keep it simple, but I should be clear that I absolutely support the spirit of all the policies as well as the letter, and what I really want to do is to learn, and enjoy sharing learning with anyone else who's interested.
- This whole broo ha ha has actually created enough material for an ethics project to discuss and write up for quite a while - I remain hopeful that it'll all come out in the wash in due course - thanks once again for your response, and I hope to work more with you in sunnier times before too long... best, Privatemusings 23:40, 15 March 2010 (UTC)
- Despite that it might be true to say that this "whole broo ha ha has actually created enough material for an ethics project to discuss and write up for quite a while", I trust you understand that would be inappropriate. Can you reassure me that my understanding is correct? Apologies for asking you to clarify this comment but you'll appreciate it often isn't clear in what tone comments are made. Adambro 15:06, 18 March 2010 (UTC)
- The material I intended to refer to is the stuff linked to by User:AFriedman (who used his mascot / alternative account), and the stuff posted by Jon Awbrey, and RTG here - I hadn't really read the First Monday journal before, and found it interesting and a bit inspiring - it's the sort of standard I feel I would aim to reach here - that's what I mean by 'discuss and write up' (the discuss bit is a shorthand way of saying I can hopeful bend someone's ear to help me learn more and dig deeper into the substance of said links - the write up is what I would hope could be 'first monday' standard in due course).
- I don't think you'd categorise that as inappropriate - but perhaps you felt I was meaning something else - as you say, tone (and often even basic meaning in my case!) can be difficult in text only comm.s - thanks for asking for the clarification - something I'm always happy to give. Hope you're good, Privatemusings 01:01, 19 March 2010 (UTC)
[edit] more thoughts on the current situation
I noticed Jimbo say this 'Privatemusings can contact me privately to discuss conditions for his reinstatement.' - and I also noticed Jimbo mention that he's discussing closing wikiversity with the board, that he has the support of Sue Gardner, and that he has the full support of the Wikimedia Foundation - I would like to ask for some more detail - perhaps the nature of the board discussions, perhaps some detail on what exactly has been said to Sue (and why she is unable to speak for herself?) and what exactly Jimbo means by the support of the foundation - there are some very strong implications in those statments, and I'm afraid I feel that Jimbo is simply upping the ante to squish discussion, rather than representing the issues in a calm and clear manner - if other stakeholders in the foundation (board members, staff, respected wmf volunteers) feel the same way as Jimbo, then further discussion will no doubt be useful. The few I have spoken to thus far have asked to review the material before forming a view - something Jimbo may or may not agree with.
I feel a bit grumpy about how I've been treated here (though I'm no big deal, and I think the way SB has been treated is shocking and inexusable) - and I'd really vastly prefer communication with me to be out in the open - to that end, I've just sent Jimmy this;
Hi Jimmy,
I'd like to be unblocked on Wikiversity.
I'd prefer to discuss unblocking on the wikiversity pages - I think it would be good for that community as well as easier and more transparent for us if we did so. I have some availability for IRC too if you'd prefer, or a Skype conversation.
I'll reiterate that I feel you've seriously misunderstood and misrepresented many aspects of 'the ethics of breeching experiments' - and you also have an unhelathy predeliction for using 'troll' to shut down discussions in my view. Whether or not you close your own mind, mentioning troll, claiming a false authority and behaving in a bullying fashion is not the way forward - I hope to have some calm discussion about moving forward as soon as possible.
best,
Peter, PM.
I hope we can move forward very soon. Privatemusings 00:41, 17 March 2010 (UTC)
[edit] Unblock request
I put one of the template things here, really just to underline my request to be unblocked - Adam replied;
Disregarding my own reservations for the moment, Jimbo has explained that Privatemusings should contact him regarding this, at least initially, so it wouldn't be appropriate for anyone else to consider unblocking until such discussions have taken place. Privatemusings has accepted that "it's not really reasonable (or sensible!) ... for a custodian to unblock me at the mo" and so it probably isn't wise to have a request for the block to be reviewed sitting here ready to catch someone out. Jimbo can discuss this with you here if he likes of course but I don't think he needs an {{unblock}} template to do so. Adambro 08:48, 17 March 2010 (UTC)
- Thanks for your reply, Adam - you're right that it's not really a big deal to have such a template for my request to be clear (and I don't think it's the case that Jimbo has been waiting for one to appear!) - I won't replace it for a week or two, by which point I hope you may be willing to discuss the reservations you have (maybe this will happen at a review anyways? I don't know) - either ways, I hope you might agree that a fortnight or so is a reasonable timescale to allow Jimbo the kind of sole authority he claims as his own in this case? (I have no problem with that on a pragmatic level, despite the sincere belief that jimbo using his flags in this way sets a terrible precedent, is clumsy, aggressive, and generally not-so-great, nor permissible within foundation, or site, policy and practice really)
- Hope you're good, and if you'd be interested in my response to any of the stuff that's gone on, please do let me know - it would be good to talk. cheers, Privatemusings 09:03, 17 March 2010 (UTC)
[edit] follow up
I received a further email from Jimbo, in which he mentioned that he needs a pledge from me to avoid the topic of the project completely, or be willing to reformulate it. He also asserted that I have a long track record of being 'socially tone deaf', unnecessarily confrontational, and he said that he feels that it will not be possible for me to work on this project without annoying people. I have replied;
Hi Jimmy,
I remain happy to reformulate the project - I think this was happening organically to be honest - I feel that I've learnt quite a lot from the various links and materials people have produced in discussion at the community review - and maybe you'll even stick around and engage? You may or may not know, but encouraging more communication over voice is one of my pet wiki things, I think I'll see if I can work in that area on this project for the next little while - maybe you'll be up for a chat at some point?
I don't think it's accurate or necessary to describe my approach as unnecessarily confrontational, nor do I think it's appropriate for you to assert that I am unable to work without annoying people (although the irony is somewhat delicious ;-)
Please unblock me on wikiversity.
best,
Peter, PM.
Privatemusings 06:37, 18 March 2010 (UTC)
Thanks for keeping us updated on progress, privatemusings. -- Jtneill - Talk - c 01:05, 19 March 2010 (UTC)
- no worries - it's useful for me too :-) best, Privatemusings 01:11, 19 March 2010 (UTC)
- If justice is blind what does that say about being socially tone deaf? What does socially tone deaf mean anyways? Sounds to me like if someone is socially tone deaf they would have trouble with being unintentionally confrontational which might annoy some people. I am unaware of any Wikiversity participants being annoyed with you. I guess some Wikimedia people are though. I guess to me based on the reading of justice is blind that someone socially tone deaf would favor objective considerations over emotional considerations. If that is what it means to be socially tone deaf, I guess I am socially tone deaf as well. -- darklama 01:43, 19 March 2010 (UTC)
[edit] thread following
conversation on this matter is spreading out in such a way that makes it a bit hard to follow - here's what I've found (and please feel free to add / edit this);
- The Community Review - quite long now.
- User_talk:Jimbo_Wales - relating to Jimbo's behaviour mainly
- Foundation-l thread - mainly a 'what's going on?' at this point
- En Wiki news story]
- my follow up to one of the authors.
- Discussion thread at Wikipedia Review
- the original notification on Jimbo's talk page
- Leigh's blog - more related to the board / closure aspect
- JWSchmidt's blog - with an image which made me smile!
probably more I've missed - please do update! (links work at timestamp, may archive in due course - sorry!) Privatemusings 01:09, 19 March 2010 (UTC)
[edit] after the weekend
well I was rather hopeful that I'd have heard something over the weekend - or indeed in the last 5 days - sadly I haven't heard anything from Jimbo in the last 5 days, since sending him the message above.
I would like to be unblocked on wikiversity as soon as possible. Privatemusings 00:18, 22 March 2010 (UTC)
- FYI, Jimbo says that you and he are in email discussion and that you may be unblocked soon: [1] -- Jtneill - Talk - c 00:29, 22 March 2010 (UTC)
- thanks for that, Jt - the discussions we're in are reflected above, and I do hope they either continue, or I'm unblocked soonish :-) Privatemusings 00:32, 22 March 2010 (UTC)
[edit] headless
I was afraid you'd return from Devil's Island minus your head. --JWSchmidt 03:23, 24 March 2010 (UTC)
- Wikiversity open letter project/WMF Board March 2010 --JWSchmidt 15:55, 24 March 2010 (UTC)
- Wikiversity:Requests for Deletion#Undeletion requests --JWSchmidt 16:29, 24 March 2010 (UTC)
- well I probably would have lost my head if it wasn't screwed on :-) - Meanwhile I think the colour of that dress is particularly fetching, and I'm quite enjoying it! - Thanks for those links etc. - I certainly have plenty to say, and will no doubt engage in due course. I'd hope the key to moving forward is to find the common ground amongst wv participants, and (without being too cheesy or anything) 'come together' as we move on.... good to be back! Privatemusings 01:03, 25 March 2010 (UTC)
[edit] Complete reformation
I note your suggestions that Jimbo has asked that the project is completely reformed or abandoned. However, I also note the block log comment that the unblock is "Conditional on not restarting the breaching experiment project in any form" and he's said just a few hours ago that "Your unblock is conditional on your completely and totally abandoning this project of yours. Stay very far away from it." That would seem to contradict his earlier suggestions to completely reform the project and so could you ask Jimbo to make a comment as to what he would envisage a completely reformed project would look like. Until we've got some clarification about that I'd ask that you don't recreate or ask anyone to restore anything relating to this. Thanks. Adambro 08:41, 25 March 2010 (UTC)
- there's no rush, and I've already indicated that I'll not be restoring or working in this area while matters calm down (happy to reiterate that again though) - As you've no doubt read many of the threads though, I wonder if I could ask you one favour - many of the folk commenting seem to be under the impression that at least some of the contributors to the now deleted page/s are blocked or banned from one or more wmf projects (or were at the time of editing) - I'm not sure at all that this is the case - would you mind clarifying this? I'd appreciate a list of contributors to Wikimedia_Ethics/Ethical_Breaching_Experiments. Privatemusings 23:15, 28 March 2010 (UTC)
- the log of contributors is here - I bumped into Ottava who provided me with it (thanks!) Privatemusings 01:39, 29 March 2010 (UTC)
- I have signed on to the new resource page, Wikimedia Ethics/Response testing on WMF projects, but please do not move any specific project to accepted status, and I highly recommend that you take a relatively passive role with this project, as you have indicated you will. I have added an NPOV tag to the resource page, and hope to contain project activity, with the support of the community here, to the collection and organized presentation of evidence on the topic, through the observation of what has been done, not through organizing or encouraging response testing itself. If we are careful, there should be no legitimate opposition, and what illegitimate opposition is possible will not be able to hide under what is arguably legitimate. We should assume that all prior opposition has been legitimate, in essence, until and unless there is some consensus otherwise. Thanks for taking the initiative, however. The topic is very important, too important to be neglected. I am new to Wikiversity, and may stick my foot in my mouth as to local customs. All advice and comment is welcome on my Talk page and will be carefully considered, please consider yourself free to comment there or by email to me privately. Thanks. --Abd 18:31, 13 April 2010 (UTC)
- a few days seems an age in wiki time once more - I'm back playing catch up - but I'll get there! :-) - I'm not sure that I'd categorise my intentions as being 'relatively passive' - I'm really here for calm active learning, and I'm not sure you and I sing completely from the same hymn sheet - which is cool, because I'm sure there's harmony to be had somehow! I've half caught up on many threads around the place, and may have some time today to reply in a few places, or make some notes somewhere :-) cheers, Privatemusings 23:29, 15 April 2010 (UTC)
[edit] Thankyou for help with Open academia in practice
Several UC staff were thankful today for your assistance with finding free images on their topic areas - User:A George appreciated the links to specific commons pages for drug images and User:Fannyl was amazed with the import of the cardboard chair image from flickr. This really opened their eyes about the sprit and possibility of collaboration, so thankyou. -- Jtneill - Talk - c 06:00, 29 March 2010 (UTC)
- it's a pleasure :-) - it's nice to help out... best, Privatemusings 23:20, 29 March 2010 (UTC)
[edit] Don't do that
This was rude. I won't ask again.--Jimbo Wales 15:27, 14 April 2010 (UTC)
- Jimbo, I highly recommend that you recuse yourself whenever you think someone is uncivil to you personally, or even if it can appear that your response is personal. Please set a good example for others, there are too many admins on en.wiki who will block someone for being rude to them, as they perceive it, and this has --properly -- led to a loss of the bit, when they didn't back up and recognize the error and the matter became disruptive enough to get to ArbComm. I commend you for your restraint here.
- I agree that the comment was uncalled-for, it was taunting, and I seriously hope that Privatemusings will get it that he needs to stop this, or I fear that Wikiversity will lose this participant. Please leave enforcement of civility policy to others when you are involved, unless there is an emergency, and a fact tag is far short of an emergency, whereas even removing it might possibly create more disruption, if you are the one who does it. I saw that tag and somehow misread the diffs and thought that you had put it in, which didn't make sense, but lots of things don't make sense. Had I realized that Privatemusings had put it in, I'd have reverted it myself.
- Privatemusings, please sit on your hands and think carefully before acting in any way, here, that could further inflame the situation. The long-term effect of this affair may be good, but please give it time, don't keep fanning the flames, okay? Do you have a problem with Jimbo that you want to resolve? I'm confident that this would be possible, but you'd have to want to actually resolve it (as would Jimbo), not to stretch out the trading of potshots. --Abd 17:47, 14 April 2010 (UTC)
- See also Wikiversity:Civility. :-) Hillgentleman | //\\ |Talk 16:29, 14 April 2010 (UTC)
- heh - well okey dokey! - I'd hoped it was clear that I was trying to make / reiterate a substantive point in good humour, and I'm happy to apologise for the hurt / discourtesy if it was unable to be taken in such a spirit - that's a shame..... [User:Privatemusings|Privatemusings]] 23:31, 15 April 2010 (UTC)
- ps. to respond to abd's question about whether or not I have a problem with Jimbo - I think the answer is 'not really' - I mean I think Jimbo was clumsy and a bit of a boob in the way he bungled in his handling of wikiversity, and I'd like to encourage him to consider simple, open and honest answers and discussion to the various confusions he created - to that end, I'm happy to try and talk things through, but I'm not really sure that he's all that interested? Either ways, he's a lovely chap, and I hope he doesn't feel too upset by what he felt was me being rude. Privatemusings 23:34, 15 April 2010 (UTC)
[edit] Wikimedia Ethics/Response testing on WMF projects/Newbie treatment at Criteria for speedy deletion
No objection having been registered within a week, I have opened up a resource page for this specific study, and have suggested some guidelines on the attached Talk page, which I hope you will review. You are being notified because you supported this project (not to mention starting it!). Do you think I should notify all those who commented on the Talk page? Other than from myself, I didn't see specific comment there on this specific project, just advice, mostly for you, about the Whole Idea. I'm hoping that the guidelines will alleviate at least some of the fears about a project like this, and I very much doubt that there will be any negative consequences if we follow the guidelines and are responsive to objections as described. "Responsive" means that we don't barge ahead without consensus, such as steam-rollering a single editor because there are two of us, and because we don't want our "freedom" interfered with. --Abd 01:45, 22 April 2010 (UTC)
- coolio :-) - I have a few things to follow up around and about, but will get to it eventually! - did I mention my preference for a glacial pace? :-) Privatemusings 00:27, 27 April 2010 (UTC)
- You did take your own sweet time, but you got a Round Tuit. We should have a Round Tuit award here, sounds nicer than barnstars to me, no sharp points. I'll get right on it, Ma'am! When I get one, that is. Might take a while. --Abd 14:42, 27 April 2010 (UTC)
- well more accurately I signaled my intention to consider pursuing a round tuit - in my experience they can roll pretty fast, and fairly often I'll fail to get a round tuit - as indeed has been the case here for the last week+ - got distracted by talking about sex on commons ;-) - off for the weekend now, but have a round tuit trap all planned for next week sometime :-) Privatemusings 09:09, 30 April 2010 (UTC)
[edit] Principles
I had asked here a serious question about your assessment of the principles of the English Wikipedia's WP:POINT policy. It's been more than a month, and I wonder if you have avoided it or just didn't see it. 71.198.176.22 06:41, 7 May 2010 (UTC)
- thanks for the follow up - I had in fact seen it, but events / distractions clearly overtook me. Are you ok if we discuss it here? (a page which helpfully emails me when it's changed :-).
- I think the 'wp:point' principle is sound in many contexts - for me it's largely a corollary of 'assume good faith' - again a very important principle for collaborative efforts. I do think though, that both of these things tend to work much better on a smaller level like article writing, or wiki-project co-ordination. At this level, obviously if you wanted to raise the concern about inaccurate sources being used, it would be unhelpful and a bad idea to do that by using a poor source, then pointing at it - it's far better to say 'so how can we make sure our sources are really good?'.
- On a project scale though, both assume good faith and 'wp:point' become less useful, and sometimes active problems for appropriate critical examination of issues that come up. 'Assume good faith' tends to become meaningless, because of course it's perfectly possible (indeed, human nature) for people of good faith to disagree, and the nitty gritty of policy development in the area of biographies, for example, simply isn't related to the 'faith' of the editors involved - more the dynamics of the project, and objectively observable realities. 'wp:point' likewise becomes unhelpful if used as a rationale for the prevention of things like response testing, quality control etc. which are generally considered to provide useful (even vital) data and information about how we could improve things.
- Does that help as an overview? cheers, Privatemusings 07:04, 7 May 2010 (UTC)
- I don't understand the distinction between smaller and project scale applications of the principles you are trying to draw. Are you saying that people of good faith will disagree less about article content than policy development? Do you have any evidence to support that assertion? Even if it were true, wouldn't a larger amount of potential disagreement suggest that less disruption, not more, is appropriate?
- Furthermore, do you believe that testing and quality control require disruption, in any sense? That is not at all clear to me, and my opinion in general is that responsible endeavors do not involve disruption. It seems you disagree, so again I ask, what evidence do you have in support of your opinion? I do see the need for civil disobedience of unjust policy, to set an example for others in some cases, but the sorts of disruption you contemplated in your EthicsSandbox occur in the wild. For example, why bother introducing inaccuracies when people do it all the time? Isn't it harder to measure the quality control implications of an intentionally introduced inaccuracy, because you have to wait for someone to address it, than it is to measure inaccuracies which have already been addressed in a page's history?
- On the other hand, I can see the rationale for introducing a limited number well-sourced but poorly-formatted new articles, because if they are deleted then there is no way to examine them after the fact. But why would Wikiversity be a better venue than Meta for that? 71.198.176.22 23:15, 7 May 2010 (UTC)
- thanks for your patience in this chat, 71 - I've been both distracted, and busy (again!) - I'll get to this before too long though - a quick response which may help you see where I'm coming from though is that I (broadly) support quality control measures such as 'mystery shopper' (where they ask where something is in a shop, despite not really wanting it - they're being paid by the shop's owners) - or more seriously, security testing by an agency investigating, for example, airport baggage handling - I see these things as roughly analogous to response testing / breaching experiments on wikis - obviously it could be done really well or really badly, but even if done well some might assert that it's disruptive - I would even concede that, though I'd also say that it's at least conceptually possible for it to be worth it (ie. benefits outweigh the disruption) - more anon.... Privatemusings 00:22, 13 May 2010 (UTC)
< my apologies for letting this slide once more - are you (IP person) still around? still interested in chatting? cheers, Privatemusings 01:26, 2 June 2010 (UTC)
- Yes. 71.198.176.22 04:34, 5 June 2010 (UTC)
- coolio - this being my talk page, I've also made the decision to pop Abd's comment out of this section, and into its own - really because I think this is one of those rare instances where a two way chat (or chats) might be more fruitful than a round table - happy to get feedback on that too.
- So you were asking me about principles, and about the application of the 'wp:point' policy. Perhaps we can re-start these discussions with a mini-statement. I do not believe that 'wp:point', either as a rule, or the principles behind it, will apply in every single situation. I believe the benefit of gathering tangible concrete data in something like a breaching experiment has the potential, if properly constructed and executed, of being both in violation of that rule, and beneficial to the project. I'd go further, in fact, and say that if any rule gets in the way of something improving the project, then it should be discarded (or ignored ;-) - I'm happy to answer specific questions if you think that might now help us move forward a little :-) (thanks once again for your patience too) best, Privatemusings 05:17, 18 June 2010 (UTC)
[edit] Abd's comment from above
It will be better to examine the kinds of "disruption" that were alleged to result from the response testing in the Newbie project that is a current topic here, see Wikimedia Ethics/Response testing on WMF projects/Newbie treatment at Criteria for speedy deletion. The ideal response test there was not "bad edits," but rather good but incomplete or unpolished edits, the kind that started Wikipedia. The goal was to see how newcomers were treated if they failed to properly source, or didn't use standard form for sourcing, or the like. Were the newcomers treated as valuable contributors, or were their contributions summarily deleted without research? This testing was considered to be a POINT violation by some, but, in fact, there was no disruption; that is, the contributions were designed to be positive, simply incomplete. The response testing project resulted in new articles meeting guidelines. The only time that was wasted was that of those who didn't take much time, who popped a speedy tag on an article, say, that wasn't qualified for speedy -- or that shouldn't have qualified, it could be argued. Indeed, I've created articles that were just stubs. Was this a point violation? Hardly!
- It apparently embarrassed some whose treatment of newcomers was, indeed, embarrassing. However, I note that an admin who speedy deleted an article thanked the creator, when the test was revealed, for showing him that he was being hasty. That was a proper response, and I hope and assume it was sincere.
- I do suggest we identify the allegations of POINT violation during that sequence of events, we can do that neutrally. --Abd 02:03, 13 May 2010 (UTC)
[edit] Future work: Why are active administrators leaving?
For future work, why not focus on tallying the reasons that administrators leave? Lately I fear part of the reasons have become self-perpetuating, i.e., "there aren't enough administrators, which makes is more difficult to be an administrator, so administrators are leaving." That sort of thing could get in to a tailspin, so it would be very helpful to at least have a measurement of how much is feedback. W.D.Ikon 05:16, 13 May 2010 (UTC)
- Great idea. The response testing study was, I believe, started off on the wrong foot, under Ethics, which implied, immediately, a kind of judgment and even condemnation. That's way premature, in my view. Rather, we should have what might be called Wiki studies which would research what actually happens with Wikipedia and other wikis, without mixing it with concepts of what should happen. A study was started at one point on Wikipedia to look at why editors were "retiring" or disappearing, and that included administrators. The editor who started it was banned. It's tempting to suggest cause and effect there, but it wasn't that simple. Perhaps the fact is that someone particularly interested in how the wiki isn't working may easily become disruptive in some way or other, or may have been inclined that way initially, or became that way as a result of perceived abuse. As to admins leaving, there is a natural attrition, but it appears to be accelerating, with long-time editors and administrators leaving with a sense of frustration rather than simply moving on. Any study that we do of this should attempt to begin with overall views and statistics, and then neutrally analyze the data and flesh it out with individual histories. My own sense is that problems with wiki structure cause editors in general to burn out, and as they burn out, some become impatient and abusive, or tendencies in this direction become exaggerated. But it is difficult to discuss this without creating the appearance of a personal attack; and when an incident is discussed by someone who was involved, it becomes, indeed, difficult to avoid implications of wrongdoing. So we should be especially careful in discussing any sequence of events where we were personally involved, or have some possible agenda with respect to one who was involved, and much of the problems here in working on the "ethical" issues have been associated with such personal connections.
- I do have an idea of how to address this. We can interview people who were involved. The interview and write-up should be done by someone who was not involved. Anyone involved would be treated as someone who has a conflict of interest, they are invited to, within civility guidelines, comment in Talk, but should not edit a resource page with respect to anything where they were specifically involved. --Abd 12:57, 13 May 2010 (UTC)
- Why would interviewing and write-ups be any more neutral or easier than an anonymous survey initially of, say 30-50 formerly active administrators, allowing them to write their reasons in free form followed by categorization to produce a check-boxes-with-"other"-blank survey of another 100-300 formerly active administrators? I am told that Google Apps Spreadsheet Forms are the easiest way to do that sort of thing these days. You would want to make sure that you sent the survey link by email to formerly active admins so you only got actual formerly active admins and not people disgruntled by admins. 71.198.176.22 19:11, 16 May 2010 (UTC)
- I'm interested in this approach, but don't think it tweaks my interest sufficiently for me to lead it - I'd like to read it though :-) cheers, Privatemusings 01:26, 2 June 2010 (UTC)
- Sounds good to me. However, as to the energy for it, ditto. In many respects, as to Wikipedia, I'm a "formerly active" editor. The place tends to sap one's energy, long-term, my experience, and that seems to happen on all "sides," leaving behind some exceptions. The exceptions aren't necessarily the best editors and administrators, and so the place becomes even more of a drain. Or does it? I have only my experience and that of a possibly biased sample. --Abd 19:48, 2 June 2010 (UTC)
Please see [3]. 71.198.176.22 04:35, 5 June 2010 (UTC)
- looks interesting - I'm sure you've also read this which explains much to me :-) Privatemusings 05:10, 18 June 2010 (UTC)
- The WikiLifeCycle description is accurate for wikis that don't learn how to develop extended integration, that builds a wide user based while only having a subset of active editors. The WLC process applies to ad hoc organizations of any kind, and functions to together with the w:Iron law of oligarchy which tends to divide and weaken communities, on the one hand, while making them more efficient and stronger on the other. The interplay between those two effects can cause major ups and downs in success. There are theoretical solutions that have never been applied to large-scale projects, though they represent combinations of techniques known to work individually. Easily, experimentation could be done on Wikipedia, but a thoroughly harmless attempt at w:WP:PRX was immediately shot down and rejected, even though what it suggested could be -- and was -- done without "permission," and the proposer was blocked for an offense of questionable blockworthiness, a long-time contributor with a clean block record.... long story, for sure. --Abd 00:15, 21 June 2010 (UTC)
[edit] whisper it quietly....
I think I'll have a wee bit of time to pop back and pick up some of the stuff which still interests me..... certainly before September :-) Privatemusings 09:50, 21 July 2010 (UTC)
- Well, it's been a tad ... interesting ... here. This time we cannot blame anyone outside those who are directly participating. i.e., ourselves. But, persistence of vision. It must be their fault. You know, them. I think we are going to have some local Stuff to analyze. Etheticists, ethicize yourselves. Cool, eh? --Abd 20:23, 21 July 2010 (UTC)
- heh... it'll all come out in the wash eventually.... I plan on picking up the 'response testing' project a bit soon(ish) - time permitting :-) Privatemusings 23:43, 21 July 2010 (UTC)
[edit] Wikiversity:Community Review/Jtneill
Whilst I agree with the sentiment of your comments, I don't think it is appropriate to start blanking such pages. Ideally people would just move on and find more constructive things to be doing. Adambro 10:49, 7 August 2010 (UTC)
- Plus, Privatemusings, the thing doesn't call for any "punishments". It just organizes three problems and asking for Jtneill to take some time to sit back, relax, and the rest. And it is hard for someone to ask others to be generous when that someone happened to post up a socking "how to". :P Ottava Rima (talk) 14:25, 7 August 2010 (UTC)
I'm thinking about starting an educational "how to live like privatemusings". Here is a sneak preview.
- 8 AM - wake up, throw some shrimp on the barbie.
- 8:30 AM - hop with kangaroos and toss around boomerang
- 9 AM - fend off dingo attacks on baby
- 10 AM - find two friends, dress up as women, and cross the outback
- 11 AM - drink from cans of beer that are larger than a 40 galloon oil drum
- 12:30 PM - fend off koala attacks
- 3 PM - be cheeky on WMF related sites
- 4 PM - noife? now thees es ah noife.
- 5 PM - pass out
- :P Ottava Rima (talk) 14:30, 7 August 2010 (UTC)
- Sounds like serious fun to me. PM, can I join the party? --Abd 16:12, 7 August 2010 (UTC)
- it's open slather :-) (although not terribly accurate - some of the timings are over 20 minutes out........ and strangely enough we drink smaller glasses of beer down here - a pint gets warm before you finish it, you see.....) Privatemusings 01:09, 9 August 2010 (UTC)for forms sake, I must once again point out that I am in fact a pom, but lucky enough to be living in god's country :-)
[edit] Helping out with Motivation and emotion
Thanks for asking. Feel free to jump in. I'm hoping the enrolled students will be the primary authors of the textbook chapters, but I'm also hoping that they'll get a bit of a hand with getting going, linking to related resources, and wikification of their efforts etc. So please feel welcome. -- Jtneill - Talk - c 03:11, 31 August 2010 (UTC)
- coolio :-) - I've done so. Privatemusings 09:50, 1 September 2010 (UTC)
|
http://en.wikiversity.org/wiki/User_talk:Privatemusings#Note
|
crawl-003
|
refinedweb
| 10,000
| 55.17
|
1. Download tcc (Tiny C Compiler), by Fabrice Bellard, from ““.
2. Install tcc on your system by simply uncompressing the downloaded file to the desired directory.
3. In any convenient location, create a new directory and name it “HelloWorld”.
4. Open the newly created HelloWorld directory.
5. In the HelloWorld directory, create a new text file and name it “HelloWorld.c”.
6. Open the newly created HelloWorld.c in a text editor and enter the following text.
#include <stdio.h> int main(int argc, char *argv[]) { printf("Hello, world!\n"); system("PAUSE"); return 0; }
7. Save HelloWorld.c and exit the text editor.
8. Still in the HelloWorld directory, create a new text file and name it “ProgramBuild.bat”.
9. Right-click the newly created ProgramBuild.bat file and select “Edit” from the context menu that appears. The file will be opened in a text editor.
10. Enter the following text, substituting the path of the directory where tcc.exe is located on the first line. This directory was created in step 2.
set compilerPath="[ the path where tcc.exe is located ]" for %%* in (.) do (set programName=%%~n*) %compilerPath%\tcc.exe %programName%.c pause
11. Save ProgramBuild.bat and exit the text editor.
12. Double-click the icon for ProgramBuild.bat. A console window will appear and tcc will compile HelloWorld.c.
13. After the compilation is complete, a prompt saying “press any key to continue” will appear. Press a key to close the console window.
14. In the HelloWorld directory, a new file called “HelloWorld.exe” should now be present. Double-click the file’s icon to run it. A console window will appear, and the text “Hello, World!” will be displayed in it.
Thanks for this tutorial-I tried it but unsuccessfully so far:
C:\Program Files (x86)\Arena\Engines\SecondChess_latest\pocopito-secondchess-v0.
1-35-gd1633e5\pocopito-secondchess-d1633e5>”[ C:\Users\Richard\Downloads\tcc-0.9
.25-win32-bin\tcc ]”tcc.exe pocopito-secondchess-d1633e5.c
The filename, directory name, or volume label syntax is incorrect.
C:\Program Files (x86)\Arena\Engines\SecondChess_latest\pocopito-secondchess-v0.
1-35-gd1633e5\pocopito-secondchess-d1633e5>pause
Press any key to continue . . .
Sorry to hear you’re having trouble. You might try removing the brackets (“[” and “]”) around your directory name. When I tried adding them to mine, it failed the same way yours did. Oh, I also noticed that you didn’t put a backslash at the end of your compilerPath variable. It hadn’t occurred to me that that might happen, so I updated the ProgramBuild.bat listing to include a “safety” backslash, just in case. Now it works whether you put a backslash at the end of your variable value or not. Hopefully things’ll be a little easier now.
|
https://thiscouldbebetter.wordpress.com/2011/03/13/compiling-a-c-program-in-windows-without-an-ide/
|
CC-MAIN-2017-13
|
refinedweb
| 461
| 62.24
|
Duncan Coutts wrote: > > That looks good, I didn't see this 'hack away' version when I found splitAt on the web. I'm now wondering why my splitAtRK function in the following code makes it run in 11 seconds given a parameter of 2500000 but it takes 14 seconds when I change it to splitAt. Am I accidentally invoking the (take, drop) version of splitAt? Why is mine so much faster than the built-in version? (Using GHC 6.8.2, W2K, Intel Core 2 Duo 2.33GHz) Maybe mine isn't working properly somehow. (I hadn't intended to post this code just yet because I wanted to do a bit more testing etc then ask for suggestions for simplifying and improving it. I actually want to get rid of the line containing splitAt because it's ugly. All suggestions for improvement gratefully received. The time function is just temporary. This code is about three or four times slower that the current fastest Haskell entry for the Fasta shootout benchmark. I'll elaborate it for speed when I've got down to the simplest version possible.) Richard. {-# OPTIONS -O2 -fexcess-precision #-} -- -- The Computer Language Shootout : Fasta -- -- -- Simple solution by Richard Kelsall. -- -- import System import Text.Printf import System.CPUTime time :: IO t -> IO t time a = do start <- getCPUTime v <- a end <- getCPUTime let diff = (fromIntegral (end - start)) / (10 ^12) printf "Calc time %0.3f \n" (diff :: Double) return v main = do time $ comp comp :: IO () comp = do n <- getArgs >>= readIO . head title "ONE" "Homo sapiens alu" writeLined (cycle alu) (n * 2) title "TWO" "IUB ambiguity codes" let (r1, r2) = splitAtRK (fromIntegral (n * 3)) (rand 42) writeLined (map (look iubs) r1) (n * 3) title "THREE" "Homo sapiens frequency" writeLined (map (look homs) r2) (n * 5) splitAtRK n xs | n <= 0 = ([], xs) splitAtRK _ [] = ([], []) splitAtRK n (x : xs) = (x : xs', xs'') where (xs', xs'') = splitAtRK (n - 1) xs title :: String -> String -> IO () title a b = putStrLn $ ">" ++ a ++ " " ++ b look :: [(Char, Float)] -> Float -> Char look [(c, _)] _ = c look ((c, f) : cfs) r = if r < f then c else look cfs (r - f) lineWidth = 60 writeLined :: [Char] -> Integer -> IO () writeLined cs 0 = return () writeLined cs n = do let w = min n lineWidth (cs1, cs2) = splitAt (fromInteger w) cs putStrLn cs1 writeLined cs2 (n - w) rand :: Int -> [Float] rand seed = newran : (rand newseed) where im = 139968 ia = 3877 ic = 29573 newseed = (seed * ia + ic) `rem` im newran = fromIntegral newseed / fromIntegral im alu = "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\ \TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\ \AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\ \GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\ \CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA" iubs = [('a', 0.27), ('c', 0.12), ('g', 0.12), ('t', 0.27), ('B', 0.02), ('D', 0.02), ('H', 0.02), ('K', 0.02), ('M', 0.02), ('N', 0.02), ('R', 0.02), ('S', 0.02), ('V', 0.02), ('W', 0.02), ('Y', 0.02)] homs = [('a', 0.3029549426680), ('c', 0.1979883004921), ('g', 0.1975473066391), ('t', 0.3015094502008)]
|
http://www.haskell.org/pipermail/haskell-cafe/2008-April/042186.html
|
CC-MAIN-2013-48
|
refinedweb
| 475
| 67.86
|
Back to Visual Programming and Structure Editors
Structure editors and visual programming could be dead-on-arrival -concepts; There are too many details that need to be solved for it to be practical and the benefits look and feel meager. It seems you would mostly get a peace of mind from coding in structures. But I've obtained reasons that make it worthwhile for me to pursue these ideas once again.
Lisp
Choosing between lisp and other languages is a tradeoff. Lisp is more generic and encourages very solid semantics. You only need to learn few special forms to use lisp. Therefore it is easy to learn. Lisp can evolve to fit new purposes and new users. Unfortunately it is hard to read because there are lot of parentheses. And a badly matching parenthesis spanning multiple lines is hard to detect but may profoundly change meaning of the program.
There have been attempts to produce readable notation for lisp. David A. Wheeler, author of the readable lisp expressions, believes those languages lost the advantages of lisp expressions. Lisp syntax is distinct and valued because it is generic and homoiconic. I believe he's right, because if a language maintains these properties, it probably belongs to the lisp family.
Genericity means that the syntax is detached from semantics. In lisp the semantics come from how the lists are interpreted.
Homoiconicity means that the underlying data structure can be recognised from the syntax. In lisp parentheses form a list. It is clear that everything that is not an atom is a list.
If you use box instead of parentheses to denote a list, you get a visual programming language instead of lisp. It is generic if the data structure would be detached from semantics. It is Homoiconic if the visualization maintains certain level of invariance: Items will stay within boxes and they won't shuffle around in the representation.
If these properties are kept invariant, and if the users choose their semantics carefully, then the editor should be able to handle anything you throw at it. If you remove the unnecessary while you maintain the homoiconicity and genericity, you end up with the following production rules:
atom -> List label, [atom]
| Marker label
| Symbol label, text
label -> string | null
text -> string
label must be in place for semantics. Otherwise you need to denote the representation with symbols for semantics. This is the minimal viable syntax for a visual programming language. It becomes burnensome to attempt to do it with less, or more.
This kind of clearly defined, clear structure is important for the user. It is very difficult to operate the editor without having an intuitive notion of what is it editing. It is also important as a provider of stability and freedom over the remaining design. Problems related to structure editors are difficult.
Oculus Rift
I have heard the DK2 has progressed a lot since the DK1 that I experienced. So many things have improved that I'm expecting the "Civilian Version 1" to be qualified for many things beside gaming. These devices mean for new ways to represent information to user.
For some things such as modelling it is obvious how Oculus Rift might help. But computer programming may benefit from it too. For the first time we may show interactive holograms to the user with affordable hardware.
The first people wanting to develop inside HMD are the developers who create HMD-enabled software. It is frustrating and jarring the workflow to constantly remove and wear the headset when you're experimenting with visuals. People could keep coding just like usual within a headset. But there are more possibilities so everybody should be more open for new alternatives.
Only communicative text is necessary
Many programming languages attempt to minimize the amount of text used to represent structure of the code. Python is considered readable. If you take the structure apart from the text in a factorial, you get 12 tokens of each:
def factorial(k):
if k <= 1:
return 1
else:
return k * factorial(k-1)
def ( ) : if : return else : return ( )
factorial k k <= 1 1 k * factorial k - 1
You could argue that the
* is structure, and technically you'd be correct. But I consider the
* as a function. The infix notation is the structure.
Lets consider Lisp factorial:
(define (factorial k)
(cond
((<= k 1)
1)
(else (* k (factorial (- k 1))))))
( define ( ) ( cond ( ( ) ) ( else ( ( ( ) ) ) ) ) )
factorial k <= k 1 1 * k factorial - k 1
There are 12 tokens, just like there were in python, but nearly doubled amount of structure, 21 tokens! For this example, the structure/data ratio of Lisp is 1.75, whereas for python it is 1.0. Other languages fall somewhere in between.
We refer to the data tokens as the communicative part of the program. The data lacks everything that forms the structure. Ultimately you try to minimize the amount of structure tokens by introducing syntax, but even in the best case you have one structure token for every data token.
Now if we move to structure editors. If we're representing the same factorial example in our structure editor, we'll have 12 data tokens, just like python or lisp had. The data tokens are the kind of text we cannot discard. But we no longer have any structure tokens. It's up to the writer of the code to decide whether he wants to denote structure somehow. As long as the language accepts the communicative part in the order, you may decide how to visualize it.
Programmers already think about code in terms of semantics rather than text
I've noticed I'm not really coding in text when using text editor. Rather, I'm using keystrokes to transform the meaning of the program. It is visible in a workflow recording I made few months ago. The code constantly visits a state where it's structurally valid. If I design an input system that takes this into account, it could let me actually be faster with structure editors than I am with vim, which is a highly optimized system for editing text.
One important detail aside this is that writing text tends to be a bottom-up experience. The data tokens appear before the structure is complete. An enjoyable experience of using structure editor probably requires something similar. You should be able to introduce the data tokens first, and have ways to glue them together with structures later on.
Browsers already solve some code layouting problems
How to layout and represent the code to the user is one of the big obstacles in designing a well working structure editor. I found a nice article about the browser internals. Having read that I believe it's easier to design a layouting engine that is good enough. Modern web browsers do not entirely solve the problem of layouting for code, but they provide a nonzero starting point.
I made a prototype people can try
If someone is not studying and designing structure editors the benefits and deficits will be never known. We may speculate as much as we want, but that isn't better than actually trying it out.
I have tried to implement visual programming numerous times. Having done that often makes me one of the few people who could actually create a functioning structure editor. It seems that in this sense I have to finish what I started.
My latest structure editor prototype is still missing important features. But you can try it and get a feeling of how the editing would work. It is open source. You can fork, modify, send proposals with issues system and follow it's overall progress in github. The editor implements a keyboard controlled modal input scheme.
I've got a upgrade coming to the layouting engine, and the input processing. Both made possible by having this prototype up in the web. I'm planning to bootstrap the editor into a programmable programming environment. But it is not useful prior a nearly complete input processing.
|
http://boxbase.org/entries/2014/aug/25/back-to-visual-programming/
|
CC-MAIN-2018-34
|
refinedweb
| 1,337
| 64.51
|
I2C LCD: code inside
Hi all,
I'm new on this forum, and with LoPy also.
I want to share my experience with 0.91" 128x32 I2C OLED Display, I forced it to work with LoPy.
Its not mentioned clearly in the manual, i2c pins are G16,G17 on the prototype board (P9-P10 on the LoPy).
So, it works :)
[0_1479599353875_DSC_0609.JPG]
(It looks like inserting screenshots is not working here btw :) )
Code here:
Its only a prototype, will be improved later
PS: Update from 17.12.2016: SPI version added too.
@daniel
if you look at my post
it looks same as @Jiemde problem
i have also malformed files - look for line
oryginal filein my post
- Jiemde Pybytes Beta last edited by Jiemde
- Jiemde Pybytes Beta last edited by
@daniel Yes it's with that release! but it's also the same with FTP there is modification of the original file like I explain in an other post like "bytearray" who became "dytearray" and some part of the code who are missing
Jiemde
@Jiemde have you tried with the latest firmware (1.5.0.b2)? We have increased the memory available which was the main reason syncing with Pymakr was not working...
- Jiemde Pybytes Beta last edited by
@DVE I have the same result when the WiPy2 have the right main.py, but in my case it's the transfert of the main.py by Pymakr or by FTP who don't work !
Finaly I got 128x64 I2C screen from Ebay. No visible problems, all works nice on standard firmware.
And I don't see any cropping, btw.
@leelive, did you try the last version from my library?
I tried this code on the i2c 128x64 version of this oled. All the characters are missing the top and bottom pixels. They're the correct characters, but are clipped. Example: The capital 'L' in LoPy is just 3 vertical pixels, and the lower case 'o' is just 2 vertical pixels on for each side. Been messing with it all day and haven't found an obvious problem in the code. I don't have another display to try, but don't think the displays the problem. Any ideas?
Cool :) I didn't connect CS pin at all, maybe ground is really better.
@rdixey Dmitri.....I went ahead and tied my 128X64 OLED CS Pin to ground, and now the code you provided is working for me as SPI Master. I'm now able to write text to the display. Nice Job :) Many Thanks!
@DVE Hey Dmitrii ...... I see your 128X64 OLED has a SPI CS Pin but when I look at your code it appears that you do not connect it to a GPIO Pin. The Adafruit ssd1306 lib sequences the OLED CS signal high to low to do write operations. How did you eliminate having to do that with your configuration? I ask because I have tried your code using your default pin config (no connection to OLED CS) but it will not turn on for me. On my OLED pcb the CS pin is high (3.3V) by default, did you pull it low all the time on your OLED pcb?
@brotherdust Hey Brother...I appreciate you sharing your Python code and the advice on recompiling the microcode to add framebuf. Have not had a chance to try it yet since I am still trying to understand how to recompile the microcode. Once I've done that I'll let you know how this worked out for me. BTW - chose to use SPI for this display as a way to learn SPI. Could not get SPI to work on my Gumstix Overo running OMAP Linux / Yocto. Thought it might be easier to learn on the LoPy.
2 All:
Hardware SPI support was added to the library. Now the library should support SPI/IIC displays as well.
Sources address is the same:
- brotherdust last edited by
@rdixey :
Here's the code I've been using. It's meant as more of a stress test on the I2C bus and the LoPy itself (watchdog issues over time). It does the following:
Set up I2C bus at 400,000 bps
Initialize BME280 sensor on default I2C address
Initialize SSD1306 display on secondary I2C address 0x3D
While True:
- Read sensor data
- Blank the display buffer
- Write some text to the buffer
- Write the buffer to the display
- Sleep for 1ms
# class SSD1306_SPI(SSD1306): def __init__(self, width, height, spi, dc, res, cs, external_vcc=False): self.rate = 10 * 1024 * 1024 dc.init(dc.OUT, value=0) res.init(res.OUT, value=0) cs.init(cs.OUT, value=1) self.spi = spi self.dc = dc self.res = res self.cs = cs super().__init__(width, height, external_vcc) def write_cmd(self, cmd): self.spi.init(baudrate=self.rate, polarity=0, phase=0) self.cs.high() self.dc.low() self.cs.low() self.spi.write(bytearray([cmd])) self.cs.high() def write_data(self, buf): self.spi.init(baudrate=self.rate, polarity=0, phase=0) self.cs.high() self.dc.high() self.cs.low() self.spi.write(buf) self.cs.high() def poweron(self): self.res.high() time.sleep_ms(1) self.res.low() time.sleep_ms(10) self.res.high() # Author: Paul Cunnane 2016 # # This module borrows heavily from the Adafruit BME280 Python library # and the Adafruit GPIO/I2C library. Original copyright notices are reproduced # below. # # Those libraries were written for the Raspberry Pi. This modification is # intended for the MicroPython and WiPy boards. # # # Copyright (c) 2014 Adafruit Industries # Author: Tony DiCola # # Based on the BMP280 driver with BME280 changes provided by # David J Taylor, Edinburgh () # # Based on Adafruit_I2C.py created by Kevin Towns time # BME280 default address. BME280_I2CADDR = 0x77 # Operating Modes BME280_OSAMPLE_1 = 1 BME280_OSAMPLE_2 = 2 BME280_OSAMPLE_4 = 3 BME280_OSAMPLE_8 = 4 BME280_OSAMPLE_16 = 5 # BME280 Registers BME280_REGISTER_DIG_T1 = 0x88 # Trimming parameter registers BME280_REGISTER_DIG_T2 = 0x8A BME280_REGISTER_DIG_T3 = 0x8C BME280_REGISTER_DIG_P1 = 0x8E BME280_REGISTER_DIG_P2 = 0x90 BME280_REGISTER_DIG_P3 = 0x92 BME280_REGISTER_DIG_P4 = 0x94 BME280_REGISTER_DIG_P5 = 0x96 BME280_REGISTER_DIG_P6 = 0x98 BME280_REGISTER_DIG_P7 = 0x9A BME280_REGISTER_DIG_P8 = 0x9C BME280_REGISTER_DIG_P9 = 0x9E BME280_REGISTER_DIG_H1 = 0xA1 BME280_REGISTER_DIG_H2 = 0xE1 BME280_REGISTER_DIG_H3 = 0xE3 BME280_REGISTER_DIG_H4 = 0xE4 BME280_REGISTER_DIG_H5 = 0xE5 BME280_REGISTER_DIG_H6 = 0xE6 BME280_REGISTER_DIG_H7 = 0xE7 BME280_REGISTER_CHIPID = 0xD0 BME280_REGISTER_VERSION = 0xD1 BME280_REGISTER_SOFTRESET = 0xE0 BME280_REGISTER_CONTROL_HUM = 0xF2 BME280_REGISTER_CONTROL = 0xF4 BME280_REGISTER_CONFIG = 0xF5 BME280_REGISTER_PRESSURE_DATA = 0xF7 BME280_REGISTER_TEMP_DATA = 0xFA BME280_REGISTER_HUMIDITY_DATA = 0xFD class Device: """Class for communicating with an I2C device. Allows reading and writing 8-bit, 16-bit, and byte array values to registers on the device.""" def __init__(self, address, i2c): """Create an instance of the I2C device at the specified address using the specified I2C interface object.""" self._address = address self._i2c = i2c def writeRaw8(self, value): """Write an 8-bit value on the bus (without register).""" value = value & 0xFF self._i2c.writeto(self._address, value.to_bytes(1)) def write8(self, register, value): """Write an 8-bit value to the specified register.""" value = value & 0xFF self._i2c.writeto_mem(self._address, register, value.to_bytes(1)) def write16(self, register, value): """Write a 16-bit value to the specified register.""" value = value & 0xFFFF self.i2c.writeto_mem(self._address, register, value) def readRaw8(self): """Read an 8-bit value on the bus (without register).""" return int.from_bytes(self._i2c.readfrom(self._address, 1)) & 0xFF def readU8(self, register): """Read an unsigned byte from the specified register.""" return int.from_bytes( self._i2c.readfrom_mem(self._address, register, 1)) & 0xFF def readS8(self, register): """Read a signed byte from the specified register.""" result = self.readU8(register) if result > 127: result -= 256 return result def readU16(self, register, little_endian=True): """Read an unsigned 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).""" result = int.from_bytes( self._i2c.readfrom_mem(self._address, register, 2)) & 0xFFFF if not little_endian: result = ((result << 8) & 0xFF00) + (result >> 8) return result def readS16(self, register, little_endian=True): """Read a signed 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).""" result = self.readU16(register, little_endian) if result > 32767: result -= 65536 return result def readU16LE(self, register): """Read an unsigned 16-bit value from the specified register, in little endian byte order.""" return self.readU16(register, little_endian=True) def readU16BE(self, register): """Read an unsigned 16-bit value from the specified register, in big endian byte order.""" return self.readU16(register, little_endian=False) def readS16LE(self, register): """Read a signed 16-bit value from the specified register, in little endian byte order.""" return self.readS16(register, little_endian=True) def readS16BE(self, register): """Read a signed 16-bit value from the specified register, in big endian byte order.""" return self.readS16(register, little_endian=False) class BME280: def __init__(self, mode=BME280_OSAMPLE_1, address=BME280_I2CADDR, i2c=None, **kwargs): # Check that mode is valid. if mode not in [BME280_OSAMPLE_1, BME280_OSAMPLE_2, BME280_OSAMPLE_4, BME280_OSAMPLE_8, BME280_OSAMPLE_16]: raise ValueError( 'Unexpected mode value {0}. Set mode to one of ' 'BME280_ULTRALOWPOWER, BME280_STANDARD, BME280_HIGHRES, or ' 'BME280_ULTRAHIGHRES'.format(mode)) self._mode = mode # Create I2C device. if i2c is None: raise ValueError('An I2C object is required.') self._device = Device(address, i2c) # Load calibration values. self._load_calibration() self._device.write8(BME280_REGISTER_CONTROL, 0x3F) self.t_fine = 0 def _load_calibration(self): self.dig_T1 = self._device.readU16LE(BME280_REGISTER_DIG_T1) self.dig_T2 = self._device.readS16LE(BME280_REGISTER_DIG_T2) self.dig_T3 = self._device.readS16LE(BME280_REGISTER_DIG_T3) self.dig_P1 = self._device.readU16LE(BME280_REGISTER_DIG_P1) self.dig_P2 = self._device.readS16LE(BME280_REGISTER_DIG_P2) self.dig_P3 = self._device.readS16LE(BME280_REGISTER_DIG_P3) self.dig_P4 = self._device.readS16LE(BME280_REGISTER_DIG_P4) self.dig_P5 = self._device.readS16LE(BME280_REGISTER_DIG_P5) self.dig_P6 = self._device.readS16LE(BME280_REGISTER_DIG_P6) self.dig_P7 = self._device.readS16LE(BME280_REGISTER_DIG_P7) self.dig_P8 = self._device.readS16LE(BME280_REGISTER_DIG_P8) self.dig_P9 = self._device.readS16LE(BME280_REGISTER_DIG_P9) self.dig_H1 = self._device.readU8(BME280_REGISTER_DIG_H1) self.dig_H2 = self._device.readS16LE(BME280_REGISTER_DIG_H2) self.dig_H3 = self._device.readU8(BME280_REGISTER_DIG_H3) self.dig_H6 = self._device.readS8(BME280_REGISTER_DIG_H7) h4 = self._device.readS8(BME280_REGISTER_DIG_H4) h4 = (h4 << 24) >> 20 self.dig_H4 = h4 | (self._device.readU8(BME280_REGISTER_DIG_H5) & 0x0F) h5 = self._device.readS8(BME280_REGISTER_DIG_H6) h5 = (h5 << 24) >> 20 self.dig_H5 = h5 | ( self._device.readU8(BME280_REGISTER_DIG_H5) >> 4 & 0x0F) def read_raw_temp(self): """Reads the raw (uncompensated) temperature from the sensor.""" meas = self._mode self._device.write8(BME280_REGISTER_CONTROL_HUM, meas) meas = self._mode << 5 | self._mode << 2 | 1 self._device.write8(BME280_REGISTER_CONTROL, meas) sleep_time = 1250 + 2300 * (1 << self._mode) sleep_time = sleep_time + 2300 * (1 << self._mode) + 575 sleep_time = sleep_time + 2300 * (1 << self._mode) + 575 time.sleep_us(sleep_time) # Wait the required time msb = self._device.readU8(BME280_REGISTER_TEMP_DATA) lsb = self._device.readU8(BME280_REGISTER_TEMP_DATA + 1) xlsb = self._device.readU8(BME280_REGISTER_TEMP_DATA + 2) raw = ((msb << 16) | (lsb << 8) | xlsb) >> 4 return raw def read_raw_pressure(self): """Reads the raw (uncompensated) pressure level from the sensor.""" """Assumes that the temperature has already been read """ """i.e. that enough delay has been provided""" msb = self._device.readU8(BME280_REGISTER_PRESSURE_DATA) lsb = self._device.readU8(BME280_REGISTER_PRESSURE_DATA + 1) xlsb = self._device.readU8(BME280_REGISTER_PRESSURE_DATA + 2) raw = ((msb << 16) | (lsb << 8) | xlsb) >> 4 return raw def read_raw_humidity(self): """Assumes that the temperature has already been read """ """i.e. that enough delay has been provided""" msb = self._device.readU8(BME280_REGISTER_HUMIDITY_DATA) lsb = self._device.readU8(BME280_REGISTER_HUMIDITY_DATA + 1) raw = (msb << 8) | lsb return raw def read_temperature(self): """Get the compensated temperature in 0.01 of a degree celsius.""" adc = self.read_raw_temp() var1 = ((adc >> 3) - (self.dig_T1 << 1)) * (self.dig_T2 >> 11) var2 = (( (((adc >> 4) - self.dig_T1) * ((adc >> 4) - self.dig_T1)) >> 12) * self.dig_T3) >> 14 self.t_fine = var1 + var2 return (self.t_fine * 5 + 128) >> 8 def read_pressure(self): """Gets the compensated pressure in Pascals.""" adc = self.read_raw_pressure() var1 = self.t_fine - 128000 var2 = var1 * var1 * self.dig_P6 var2 = var2 + ((var1 * self.dig_P5) << 17) var2 = var2 + (self.dig_P4 << 35) var1 = (((var1 * var1 * self.dig_P3) >> 8) + ((var1 * self.dig_P2) >> 12)) var1 = (((1 << 47) + var1) * self.dig_P1) >> 33 if var1 == 0: return 0 p = 1048576 - adc p = (((p << 31) - var2) * 3125) // var1 var1 = (self.dig_P9 * (p >> 13) * (p >> 13)) >> 25 var2 = (self.dig_P8 * p) >> 19 return ((p + var1 + var2) >> 8) + (self.dig_P7 << 4) def read_humidity(self): adc = self.read_raw_humidity() # print 'Raw humidity = {0:d}'.format (adc) h = self.t_fine - 76800 h = (((((adc << 14) - (self.dig_H4 << 20) - (self.dig_H5 * h)) + 16384) >> 15) * (((((((h * self.dig_H6) >> 10) * (((h * self.dig_H3) >> 11) + 32768)) >> 10) + 2097152) * self.dig_H2 + 8192) >> 14)) h = h - (((((h >> 15) * (h >> 15)) >> 7) * self.dig_H1) >> 4) h = 0 if h < 0 else h h = 419430400 if h > 419430400 else h return h >> 12 @property def temperature(self): "Return the temperature in degrees." t = self.read_temperature() ti = t // 100 td = t - ti * 100 return "{}.{:02d}C".format(ti, td) @property def pressure(self): "Return the temperature in hPa." p = self.read_pressure() // 256 pi = p // 100 pd = p - pi * 100 return "{}.{:02d}hPa".format(pi, pd) @property def humidity(self): "Return the humidity in percent." h = self.read_humidity() hi = h // 1024 hd = h * 100 // 1024 - hi * 100 return "{}.{:02d}%".format(hi, hd) from machine import I2C i2c = I2C(0, I2C.MASTER, baudrate=400000) sensor = BME280(address=119, i2c=i2c) display = SSD1306_I2C(width=128, height=64, i2c=i2c, addr=0x3d) while True: temperature = "T: {}".format(sensor.temperature) humidity = "H: {}".format(sensor.humidity) pressure = "P: {}".format(sensor.pressure) display.fill(0) display.text(temperature, 0, 0) display.text(humidity, 0, 28) display.text(pressure, 0, 56) display.show() time.sleep_ms(1)
I left it running for a couple of days and it's proven pretty stable. One thing to note is that the SSD1306 (at least mine) requires additional initialization before it will start working. It took me a while to puzzle it out! What happens on startup is the display will show the contents of the memory buffer. If it's unpowered for more than a few seconds, it just looks like static. Setting the RESET pin to LOW clears this and makes the display ready.
I'm curious to know why you selected SPI over I2C. I haven't had a chance to play with SPI yet because all my stuff supports I2C and it's sufficient for my purposes. What are your thoughts @rdixey ?
@brotherdust I appreciate the straightforward answer. I'm thinking that by using SPI, I will avoid the I2C primitives issues that you encountered. And hopefully not run into other SPI related issues.
Since I've not ever recompiled the firmware before, this will be an adventure that should keep me occupied and out of trouble for a while.
- brotherdust last edited by
@rdixey said in I2C LCD: code inside:
.
@rdixey :
The SSD1306 driver that comes with MicroPython references methods in the I2C class that aren't available by default in PyCom's ESP32 port. I applied the changes indicated in the commits from my git branch repo (links below) and recompiled the firmware. After that, I was able to use the driver just fine. I then combined the driver code with @DVE's font code and some other functions and it worked pretty well. I'd post the final script here, but I don't have access to it right now. Give my suggestions a shot first and see what you can come up with. =)
Enable framebuf
Enable I2C primitives
.
Hi all.
Now its a very slow software implementation. Its just a code and connection diagram, converted to Python from here:
I'll share code soon, want to improve it a bit.
|
https://forum.pycom.io/topic/290/i2c-lcd-code-inside/?page
|
CC-MAIN-2019-18
|
refinedweb
| 2,485
| 51.55
|
Hi,
the “Split”-command for polygons generates a new object containing only the selected polygons.
my little script to delete this polygons in the original object does not work anymore since in R21 the selected object is the new one.
is there a command for selecting the object above the current selected in the object manager which could be used in python?
Normally I copy the commands out of the script log but in this case it does not work.
Cheers
Simon
"split and kill" script in R21?
Hi,
The parent of an object can be easily obtained via:
obj.GetUp()
If you would like to have somebody, who knows a bit more about coding, take a look at your script, feel free to contact me via PM.
Here’s our Split’n’Kill script:
import c4d from c4d import utils # Splits the current polygon selection into a new object # and deletes it from the original object def main(): old = doc.GetActiveObject() c4d.CallCommand(14046, 14046) # Split new = doc.GetActiveObject() doc.SetActiveObject(old) c4d.utils.SendModelingCommand(command=c4d.MCOMMAND_DELETE, list=[old], mode=c4d.MODELINGCOMMANDMODE_POLYGONSELECTION, doc=doc) doc.SetActiveObject(new) # Execute main() if __name__=='__main__': main()
There’s no need to select the object above in this case, just save a reference to the currently selected (old) object into a variable before calling the split command, then you can switch between the new and old objects to do the cleanup work.
|
http://forums.cgsociety.org/t/split-and-kill-script-in-r21/2055213
|
CC-MAIN-2019-47
|
refinedweb
| 240
| 53.21
|
Working with Search Scopes
In Microsoft Office SharePoint Portal Server 2003, search scopes were based on content sources and were tied to crawling. Content could be in only one scope at a time. In Microsoft Office SharePoint Server 2007, search scopes are expanded to represent a collection of items based on a common element among the items within that scope. For example, in addition to a search scope that represents content from a particular content source ("Portal Content"), it is now possible to define search scopes such as "All documents authored by ****" or "All documents related to Marketing". Scopes are no longer tied to content crawls, so when you create a scope, you do not have to wait for a recrawl of the content before the items in that scope are available for Search.
There are two types of search scopes: basic and compound.
Basic Scopes
Basic scopes are generated automatically from the scope plug-in when content is indexed by the crawler, and are based on specific properties of the content being indexed.
"All items authored by <specific author name>" is an example of a basic scope.
By default, the scope plug-in creates scopes for the following:
Display URL
Site (domain, subdomain, host name)
Author
All content (used to include all content)
Global query exclusions (used to exclude content)
Compound Scopes
Compound scopes are Boolean combinations of basic scopes. They can be grouped together and ordered within scope groups.
Search Scope Object Model
You can find the classes for managing search scopes in the Microsoft.Office.Server.Search.Administration namespace, located in Microsoft.Office.Server.Search.dll.
Following is a diagram of the Search Scopes object model.
For management of the overall scope system, you use the Scopes class. Table 1 describes the methods available in this class.
The ScopeCollection class is the collection object for scopes.
Individual scopes are represented by the Scope class. Table 2 describes the Scope class properties.
The Rules property of the Scope class contains a ScopeRuleCollection object, which is the class that contains the set of rules, each as a ScopeRule object. These are applied to include or exclude content from that scope. The ScopeRule class is the base class for these rules. Three classes inherit from ScopeRule, as described in Table 3.
To manage the display of the scopes, use the ScopeDisplayGroup class. The ScopeDisplayGroupCollection class contains all of the display groups and is used to manage the display groups for the Search system.
|
https://msdn.microsoft.com/en-us/library/ms498209(v=office.12).aspx
|
CC-MAIN-2016-44
|
refinedweb
| 413
| 62.88
|
#include "vil_save.h"
#include <vcl_cctype.h>
#include <vcl_cstring.h>
#include <vcl_string.h>
#include <vcl_iostream.h>
#include <vxl_config.h>
#include <vil/vil_open.h>
#include <vil/vil_new.h>
#include <vil/vil_copy.h>
#include <vil/vil_pixel_format.h>
#include <vil/vil_image_resource.h>
#include <vil/vil_image_view.h>
Go to the source code of this file.
Modifications 23 Oct.2003 - Peter Vanroose - Added support for 64-bit int pixels
Definition in file vil_save.cxx.
Send vil_image to disk.
Send a vil_image_view to disk, given filename.
Definition at line 30 of file vil_save.cxx.
save to file, deducing format from filename.
Send a vil_image_view to disk, deducing format from filename.
Definition at line 122 of file vil_save.cxx.
Given a filename, guess the file format tag.
The returned pointer may point into the filename string - so keep it valid.
Definition at line 80 of file vil_save.cxx.
Send vil_image to disk.
Send vil_image_resource to disk.
Definition at line 128 of file vil_save.cxx.
save to file, deducing format from filename.
Save vil_image_resource to file, deducing format from filename.
Definition at line 147 of file vil_save.cxx.
|
http://public.kitware.com/vxl/doc/release/core/vil/html/vil__save_8cxx.html
|
crawl-003
|
refinedweb
| 179
| 66.1
|
Hello, readers! In this article, we will be focusing on Different Ways to Create a Subset of a Python Dataframe in detail.
So, let us get started!
Table of Contents
First, what is a Python Dataframe?
Python Pandas module provides us with two data structures, namely, Series and Dataframe to store the values.
A Dataframe is a data structure that holds the data in the form of a matrix i.e. it contains the data in the value-form of rows and columns. Thus, in association with it, we can create and access the subset of it in the below formats:
- Access data according to the rows as subset
- Fetch data according to the columns as subset
- Access specific data from some rows as well as columns as subset
Having understood about Dataframe and subsets, let us now understand the different techniques to create a subset out of a Dataframe.
Creating a Dataframe to work with!
To create subsets of a dataframe, we need to create a dataframe. Let’s get that out of our way first:
import pandas as pd data = {"Roll-num": [10,20,30,40,50,60,70], "Age":[12,14,13,12,14,13,15], "NAME":['John','Camili','Rheana','Joseph','Amanti','Alexa','Siri']} block = pd.DataFrame(data) print("Original Data frame:\n") print(block)
Output:
Original Data frame: Roll-num Age NAME 0 10 12 John 1 20 14 Camili 2 30 13 Rheana 3 40 12 Joseph 4 50 14 Amanti 5 60 13 Alexa 6 70 15 Siri
Here, we have created a data frame using
pandas.DataFrame() method. We will be using the above created dataset throughout this article
Let us begin!
1. Create a subset of a Python dataframe using the loc() function
Python loc() function enables us to form a subset of a data frame according to a specific row or column or a combination of both.
The
loc() function works on the basis of labels i.e. we need to provide it with the label of the row/column to choose and create the customized subset.
Syntax:
pandas.dataframe.loc[]
Example 1: Extract data of specific rows of a dataframe
block.loc[[0,1,3]]
Output:
As seen below, we have created a subset which includes all the data of row 0, 1, and 3.
Roll-num Age NAME 0 10 12 John 1 20 14 Camili 3 40 12 Joseph
Example 2: Create a subset of rows using slicing
block.loc[0:3]
Here, we have extracted the data of all the rows from index 0 to index 3 using slicing operator with loc() function.
Output:
Roll-num Age NAME 0 10 12 John 1 20 14 Camili 2 30 13 Rheana 3 40 12 Joseph
Example 3: Create a subset of particular columns using labels
block.loc[0:2,['Age','NAME']]
Output:
Age NAME 0 12 John 1 14 Camili 2 13 Rheana
Here, we have created a subset which includes data from rows 0 to 2, but includes that of only some specific columns i.e. ‘Age’ and ‘NAME’.
2. Using Python iloc() function to create a subset of a dataframe
Python iloc() function enables us to create subset choosing specific values from rows and columns based on indexes.
That is, unlike loc() function which works on labels, iloc() function works on index values. We can choose and create a subset of a Python dataframe from the data providing the index numbers of the rows and columns.
Syntax:
pandas.dataframe.iloc[]
Example:
block.iloc[[0,1,3,6],[0,2]]
Here, we have created a subset which includes the data of the rows 0,1,3 and 6 as well as column number 0 and 2 i.e. ‘Roll-num’ and ‘NAME’.
Output:
Roll-num NAME 0 10 John 1 20 Camili 3 40 Joseph 6 70 Siri
3. Indexing operator to create a subset of a dataframe
In a simple manner, we can make use of an indexing operator i.e. square brackets to create a subset of the data.
Syntax:
dataframe[['col1','col2','colN']]
Example:
block[['Age','NAME']]
Here, we have selected all the data values of the columns ‘Age’ and ‘NAME’, respectively.
Output:
Age NAME 0 12 John 1 14 Camili 2 13 Rheana 3 12 Joseph 4 14 Amanti 5 13 Alexa 6 15 Siri
Conclusion
By this, we have come to the end of this topic. Feel free to comment below, in case you come across any question. For more such posts related to Python, stay tuned, and till then, Happy Learning!! 🙂
|
https://www.journaldev.com/46411/create-subset-of-python-dataframe
|
CC-MAIN-2021-17
|
refinedweb
| 760
| 68.4
|
Forum:The 1th Annual UnLeaks Liberation Authority-GTC Writing Contest
From Uncyclopedia, the content-free encyclopedia
Citizens, today, after seeing the success of the Poo Lit Suprise, Foolitzer Prize, Pulitzer Price, Happy Monkey Writing Comptetition, VFH Top 10 and the Hourly Writing Contest, I started up a new writing contest: to see how many articles you can write in a week. A week. A week. A week. I'll say it again. in ONE FUCKING WEEK, MOTHERFUCKER.
Starting on <s>Sunday 27 March 2011Sunday April 3 2011, you have to write as many articles as you can, regardless of quality, in a week. Write up about any subject, any namespace, my namespace or yours (conditions apply). And the competition is open to anyone who has an Uncyc account. No exceptions.
But there is one condition: you cannot write your articles in your userspace, the article must have at least one picture in your article, and you cannot use the construction template for saving your article. And the competition ends on
Saturday 2 April 2011Saturday 9 April 2011 at 11:59PM (UTC+10), 1:59PM (GMT) or 8:59AM (UTC-5) sharp. No exceptions.
And at the end of the date, the articles will be judged. The winner will have the articles kept in the userspace, and be forced to continue editing the page. Losers will have one hour to move their articles to their userspace. Failure to do so will result in having their articles placed on VFD. No exceptions.
|Si Plebius Dato' (Sir) Joe ang Aussie CUN|IC Kill
| 10:28, March 25, 2011 (UTC)
- Note: You have only one day left to sign up. Sign up now, or it's too" alt="800px-Flag of the Philippines svg" src="" width="24" height="12" data- | 08:07, March 26, 2011 (UTC)
- I think the lack of response might be due to:
- 1. Normally, someone comes up with an idea for a competition, we argue, argue and argue, then it gets organized, judges are picked, new judges are picked...and eventually a date is chosen.
- 2. There's some Euro-writing thing happening here soon. Right in the middle of this one that you have. Sir Modusoperandi Boinc! 09:25, March 26, 2011 (UTC)
- What the Operandi guy said. Postpone this like a motherfucker. --)}"> 09:37, March 26, 2011 (UTC)
- The image contest starts April 1st. Also, we need one more judge for that if anyone is interested. -- Brigadier General Sir Zombiebaron 15:15, March 26, 2011 (UTC)
- STOP PRESS! We need judges! Judges interested can sign up below!)}"> | 05:51, March 27, 2011 (UTC)</s>
This is closed. Admins, please delete this. Visit this post instead, guys.:05, March 27, 2011 (UTC)
Sign Up Here (if you want to compete in this contest)
- -- Brigadier General Sir Zombiebaron 15:18, March 26, 2011 (UTC)
Judge Sign-Up (we need 7, including myself)
Want to be a judge? Sign up here below:
|
http://uncyclopedia.wikia.com/wiki/Forum:The_1th_Annual_UnLeaks_Liberation_Authority-GTC_Writing_Contest?oldid=5034725
|
CC-MAIN-2014-35
|
refinedweb
| 491
| 73.27
|
We return once again to the topic of programmatic purging and learn the history and latest news about the venerable Autodesk Camel:
- Purge unused using eTransmitForRevitDB.dll
- The Autodesk office Camel
- Node.js reference architecture
Purge Unused using eTransmitForRevitDB.dll
Last month, we discussed several approaches to automating the purge command.
Now Emiliano Capasso, Head of BIM at Antonio Citterio Patricia Viel, shared an even better one, explaining why the Revit Purge command is an act of love, or Perché il comando "Purge" di Revit è un atto d'amore:
I'm writing this hoping it will be useful for all BIM Managers, Head of BIMs, BIM Directors, etc. around the world.
The Life-Changing Magic of Tidying is the mantra of Marie Kondo, and the Japanese chain MUJI even published a book named “CLEANING” with hundreds of photos of cleaning activities all over the world.
An organised life is key and so why our models should be a mess?
Purging, cleaning the models is the key of maintaining a high-quality standard, and for us delivering state of the art BIM Models is the priority.
Messy models are problematic, all of our systems work around the clock with automations and data extractions to our BI dashboards to monitor KPI. But as most of our architects are deeply caught in the design process and they forget to keep a tidy model, but our BIM department is here to help.
But with more than 40 active projects, how could we purge (3 times) manually every one of the 500ish models that we have?
The Purge via API Method
Tons of words have been spent about Purging in Revit via API, which is apparently impossible, cf., the latest post on the topic).
There are lots of workarounds, such as PerformanceAdvisor and PostableCommand, but none of which was satisfying me.
So I was wondering, how the marvellous eTransmit addin made by Autodesk is actually Purging the models whilst transmitting?
So I went looking into the folder, found the .dll and in our addin referenced the eTransmitForRevitDB.dll and looked into its public methods:
Wow.
Could that be so easy?
Yes.
Below the snippet:
public bool Purge(Application app, Document doc) { eTransmitUpgradeOMatic eTransmitUpgradeOMatic = new eTransmitUpgradeOMatic(app); UpgradeFailureType result = eTransmitUpgradeOMatic.purgeUnused(doc); return (result == UpgradeFailureType.UpgradeSucceeded); }
Just create an instance of
eTrasmitUpgradeOMatic passing the
Application and call its method
purgeUnused passing the
Document;
that will return an
UpgradeFailureType.
Now you have your model purged (3 times also).
So satisfying.
Many thanks to Emiliano or his research and nice explanation!
The Autodesk Office Camel
Nicolas Menu and other colleagues from Neuchatel shared the story of the Autodesk office Camel on LinkedIn.
This is an important story, so I take the opportunity to preserve it here as well:
After many years at Autodesk European headquarter office in Neuchatel, Switzerland, the Camel (our office's mascot) moved tonight to the Swiss Siberia.
History...
- 1982 Autodesk, Mill Valley, Marin County, CA, USA
- 1991 Autodesk European Headquarters, Marin, Switzerland
From Marin County, to... Marin, Switzerland!
The office later moved a few km away to Neuchatel, and the camel remained in the new office as a mascott, a landmark.
- 2017... Autodesk European headquaters close and move to Dublin.
But The Camel didn't like it and decided to remain fidel and stay right here...
For about 5 years he stays with Coral and Francesco, and tonight it has find a new home... guess where :)
The Camel is now with our family in the coldest village of Switzerland... Long Life to the Camel!
Claudio Ombrella adds: Nice. Let me take the opportunity to share the story of the camel. It was January 1993 when I joined the Marin, Switzerland office from Autodesk in Milano. The Autodesk office was located at the first floor of the number 14b of the Av. Champs Montant. All people driving to find the office did it from the West side: at the ground floor there a Persian carpet shop named Tapis d'Orient. They had put a camel, better say the camel outside the office. It quickly became the 'signpost' to arrive to the office: 'our entrance is by camel' used to say our colleague Sheila Ahles to any visitor needing instructions.
One day the shop closed and the camel became orphan. But not for so long, because Autodesk employees pulled the camel into the office. And it became the mascot with its own badge that was regularly reprinted at every company logo change!
In 1994 we moved to the Puits Godet office and the camel moved too. With the years it deteriorated a bit and then Bodo Vahldieck loaded on his VW Multivan and took it home for a complete restore. Then it came back to the office in perfect shape.
In 2015 my team opened a job and a young person applied for it, so we invited for an on-site interview. When the person saw the camel he said to me: “and you have the camel? I am the son of the shop Tapis d’Orient, I am so surprised to see it again”.
Thank you, Nicolas, for giving a new life to our old friend, the camel.
John C.: The camel was first on the list of assets to be moved from Marin to Puits-Godet! Thanks for bringing such good memories!
Lisa Senauke: James Carrington and I arrived when the Marin office had just opened and we were among the first 5 or 6 to arrive – Kern (and John Walker) Hans, Sheila, James, and I – who else? Creighton? When we were campaigning to be chosen to work in Switzerland, one of my proudest moments was when Hansi said to me, while I was pondering if we would get to go, and if there would be a job for me as well. Hans looked at me and said, "Lisa, where I go, YOU go!" 🥰 And I did! The Camel was standing proud and tall by the entrance of the building, welcoming us to our new home! For me, it was a Jungian peak experience!
Raquel Aragonés: I had completely forgotten about the camel. I was there from 1992-3 to 1997! Long live the camel!
Node.js Reference Architecture
Moving from the desktop to the cloud, could you use some advice on which components to employ for your Forge app?
Or are you working with other cloud applications and confounded by the plethora of available libraries?
Maybe the Node.js Reference Architecture by IBM and Red Hat will help make a well-founded decision.
|
https://thebuildingcoder.typepad.com/blog/2022/03/purge-unused-and-the-autodesk-camel.html
|
CC-MAIN-2022-21
|
refinedweb
| 1,091
| 71.95
|
Processing Forum
Recent Topics
All Forums
Screen name:
jbeale1
jbeale1's Profile
4
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
what is wrong? parsing serial data with split()
[1 Reply]
06-Jan-2011 04:29 PM
Forum:
Programming Questions
I don't understand why split() is always setting the last data value read in to be zero. Can anyone advise?
EDIT: I do see the last value if I split to strings, instead of converting with int(). So the last string in the line contains a newline, and int() sees a non-numeric value and sets it to zero?
Here is the relevant section of my code:
import processing.serial.*; // serial library
Serial myPort; // The serial port
String inBuffer = null; // one line of data from serial port
void draw() {
int[] dat; // array of numbers read in on one line from serial port
if (inBuffer != null) { // wait for new data on the serial port
print("SERIAL:" + inBuffer); // show the line of serial input
dat = int(split(inBuffer, ',')); // parse comma-separated number string into numbers
println("DAT_IN:" + dat[0] + "," + dat[1] + "," + dat[2] + "," + dat[3] + "," + dat[4]);
println();
// [... plus other stuff ...]
}
}
void serialEvent(Serial p) {
inBuffer = p.readString(); // store serial port buffer in global var inBuffer
}
and here is a sample of the output I get. Note how the last number in the line, 125 or 123, always becomes 0.
SERIAL:0,0,1,629,125
DAT_IN:0,0,1,629,0
SERIAL:0,1,5,629,123
DAT_IN:0,1,5,629,0
WinXP: how to auto-start processing sketch on bootup?
[1 Reply]
05-Jan-2011 09:43 AM
Forum:
Processing with Other Languages
I am using a processing sketch to do a data acquisition task (data forwarded to pachube.com). This computer sometimes reboots for windows updates, etc. (I am running Windows XP SP3). How do I get my PachubeData.pde sketch to auto-run after the computer reboots?
If I simply double-click on the .pde filename, it launches the Processing edit window, but does not actually start the sketch. To have it run I have to separately click the "Run" button. So I presume dragging the link to the "Startup" folder will have the same effect (launch the Processing editor, but not the sketch itself). Any suggestions?
EDIT: OOops! Nevermind, I just discovered "File/Export Application" to create the standalone .exe file.
most simple possible audio output?
[3 Replies]
22-Nov-2010 11:48 AM
Forum:
General Discussion
I want to add very simple, real time audio output to my Processing program. Can someone suggest the easiest way? I checked the external sound libraries, there are nine different ones listed at
but they all appear to be focused on music composition, rather than simple low-level raw sound.
What I want is something like: beep(pitch, volume, duration) and I get a simple beep tone of that pitch, that many milliseconds long. No wavetable synthesis, scoring system etc.
The "SoundCipher" appears to be simple, because I can get one note played like this:
import arb.soundcipher.*; // simple audio library "SoundCipher" (tempo=120 bpm)
SoundCipher sc = new SoundCipher(this); // sound object for audio feedback
sc.playNote(60, 100, 1); // pitch number, volume, duration in beats
However this is a shaped note with an attack-decay-sustain-release volume envelope, which limits how fast I can make separate notes. I want a raw beep with no volume envelope. Is there a simple way to do this?
draw() loop execution time and frameRate()
[0 Replies]
09-Oct-2010 03:16 PM
Forum:
Programming Questions
I'm doing data acquisition with an Arduino and collecting the data (serial over USB) on the PC with a Processing 1.2.1 program. I am using a separate serialEvent() function to grab data into a buffer, which I guess is interrupt-driven(?).
Printing out the delta between millis() on each pass through draw(), it is usually 15 msec or 30 msec. Can I change that? Setting frameRate() doesn't seem to change anything.
UPDATE: I see that I can make it slower, by setting a lower number, for example with frameRate(5) I get about 200 msec per cycle as expected. So I guess this is a limitation of my computer speed (old Inspiron 9300 laptop).
«Prev
Moderate user : jbeale1
Forum
|
https://forum.processing.org/one/user/jbeale1.html
|
CC-MAIN-2021-39
|
refinedweb
| 741
| 63.7
|
On Wed, Oct 01, 2003 at 05:10:11PM +0200, J?rn Engel wrote:> > > --- a/include/linux/mm.h 28 Sep 2003 04:06:20 -0000 1.5> > > +++ b/include/linux/mm.h 1 Oct 2003 13:15:53 -0000> > > @@ -196,7 +196,7 @@ struct page {> > > #if defined(WANT_PAGE_VIRTUAL)> > > void *virtual; /* Kernel virtual address (NULL if> > > not kmapped, ie. highmem) */> > > -#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */> > > +#endif /* CONFIG_HIGHMEM || WANT_PAGE_VIRTUAL */> > > };> > > > This is broken, the CONFIG_HIG(H)MEM shouldn't be there at all. Look> > at the #if defined(...) line. [snipped] Looks like this patch made it past Linus's famous patch barriers andinto the bk tree after all. J?rn, I trust you'll send a patch torevert it? (Linus, if you want to fix it by hand, just deleted theCONFIG_HIGHMEM bit completely from the #endif line).-- Muli Ben-Yehuda[unhandled content-type:application/pgp-signature]
|
https://lkml.org/lkml/2003/10/1/256
|
CC-MAIN-2015-14
|
refinedweb
| 142
| 60.21
|
ImageEngine has a dedicated package for Angular projects. This package can be found on npmjs.org: @imageengine/angular
This article explains how to get started with the @imageengine/angular package based on the Angular sample app.
Preparations
If you havn't got your ImageEngine account yet, make sure to sign up on imageengine.io. When done, you'll get an ImageEngine delivery address which you'll need later.
Next, you'll need to have Node.js, NPM (that comes with node.js ), and Angular CLI installed.
With those installed, from the command line run, (answering "N" to the prompt for Angular Router and choosing CSS for the styles):
ng new ie-angular-sample
cd ie-angular-sample
At this stage we have an Angular sample app that can be viewed in the browser by starting a server locally on your computer by executing this command `ng serve` and head to in your browser.
Install the ImageEngine package
Back in the terminal, execute this command to download the ImageEngine package:
npm install @imageengine/angular
Next, edit
src/app/app.module.ts and make sure it looks like this:
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; import { NgxImageengineModule } from "@imageengine/angular"; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, NgxImageengineModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
The
NgxImageengineModule is the module exported from the
@imageengine/angular package. Now we're ready to use the image component in our app.
Integrate with your app
The implementation of this step is obviously highly dependent of how your app is laid out, so the following will demonstrate the basics which should be enough to understand how you best can make use of ImageEngine in your Angular app.
In the `src/app/app.component.html` file we can now add an image using the `<ngx-imageengine>`:
<ngx-imageengine
</ngx-imageengine>
Note that the `host` is the delivery address you obtained when signing up for ImageEngine.
`path` is the local path to the image at your origin.
Note that ImageEngine requires the origin image to be reachable from the internet, so an image stored on localhost will not work. The image must be stored and available in the origin you defined when setting up your ImageEngine delivery address.
Absolute image sources
If your app provide absolute image references, like ``, which is common when the app is built on top of a headless CMS for example, we need to strip off the host part of the image url. This can be done using the `strip_from_src` option:
<ngx-imageengine
</ngx-imageengine>
In the example above, the string `` will be stripped from the value of `path` so that the final image src will be a valid ImageEngine url: ``
Advanced use
The above is a very simple demonstration of how to get started with ImageEngine and Angular. For a full list of features please see the package documentation.
Further, the package @imageengine/imageengine-helpers may be of good help when utilizing the ImageEngine directives.
Please sign in to leave a comment.
|
https://support.imageengine.io/hc/en-us/articles/4408922345101-AngularJS-integration-guide
|
CC-MAIN-2021-39
|
refinedweb
| 506
| 51.68
|
The description field from AD is not working to pull into custom groups
16 Replies
Nov 3, 2009 at 11:43 UTC
Hi Laurie,
Could you give us more details on what problem you are having?
Are you having problems creating new groups, or would you like to see more information pulled with AD OUs?
Nov 3, 2009 at 11:52 UTC
Thanks Ben. I need more info. pulled with AD OUs. I put a description on the conputer then tried to match it in a custom group with description "starts with" or , "contains" or "equals" and it's not putting the pc into that group. The computer in questions is already in another group, so I know it's finding it.
Nov 3, 2009 at 12:39 UTC
Laurie,
The AD Description field is not pulled into Spiceworks - but this would be possible to build in to future releases of Spiceworks.
If you would like to see this feature added please check the Feature Requests forum, and spice up an existing thread, or if one does not exist create a new one.
Thanks for the feedback!
Nov 3, 2009 at 12:42 UTC
Thanks Ben. So what fields are exactly? What is that field "Description" referring to in custom groups?
Nov 3, 2009 at 1:54 UTC
Hi Laurie,
Great question! For a scannable Windows device the Description is populated with the results of this command:
C:\>wmic path win32_operatingsystem get description
Description
(this would be the description/returned value)
The above example would be the result of the command when run locally. You can also run it remotely (on devices that Windows devices that Spiceworks can scan) using the /node, /user, and /password switches.
If the device is not Windows based, or has some type of scan problems the Description is filled based on those dynamics. In some cases it reports scan errors, and kernel identifiers.
See the attached screenshot - I believe this is the "Description" we pull for Windows devices.
Nov 3, 2009 at 1:59 UTC
Thanks, so is there a list of explanations of each field you can base custom groups on?
Nov 3, 2009 at 2:07 UTC
Laurie,
A detailed list is not available, no. The custom groups documentation is here:
[http:/
But it does not have explanations for each of the filters. Were you wondering about any of the other filters?
Nov 3, 2009 at 2:11 UTC
how about the distinguished name?
Nov 3, 2009 at 2:19 UTC
nevermind I know what that is. I am trying to find a way to organize my users into cost centers and I don't see anything that comes close to working?
Nov 3, 2009 at 2:27 UTC
Hi Laurie,
This value will be pulled from the LDAP listing Spiceworks creates at the beginning of each scan.
C:\>wmic /namespace:\\root\directory\ldap path ds_computer get ds_distinguishedname
The above command will give you the entire listing of distinguished names.
Nov 3, 2009 at 2:34 UTC
Laurie,
Do you have any other means of identifying them by cost center (other than the AD Description value)?
What about device name, or AD OU? Location?
Also keep in mind that devices can be in multiple groups in Spiceworks.
Nov 3, 2009 at 2:37 UTC
yes, I love that they can be in more than 1 group. I dont see device name as an option?
Nov 3, 2009 at 5:20 UTC
Use Name, and potentially "starts with", depending on your naming scheme this might work.
Nov 4, 2009 at 9:41 UTC
Thanks Ben. Any chance more options coming in from AD will be in future versions?
Nov 4, 2009 at 10:52 UTC
Check out the Feature Requests forum and vote up/create requests - those "votes" are very influential in the future development of Spiceworks.
Nov 4, 2009 at 11:36 UTC
Thanks Ben, have a great day
|
https://community.spiceworks.com/topic/80989-the-description-field-is-not-working-in-custom-groups
|
CC-MAIN-2016-44
|
refinedweb
| 656
| 71.55
|
Metаdаtа is mаchine-reаdаble informаtion аbout а resource, or "dаtа аbout dаtа." Such informаtion might include detаils on content, formаt, size, or other chаrаcteristics of а dаtа source. In .NET, metаdаtа includes type definitions, version informаtion, externаl аssembly references, аnd other stаndаrdized informаtion.
In order for two systems, components, or objects to interoperаte with one аnother, аt leаst one must know something аbout the other. In COM, this "something" is аn interfаce specificаtion, which is implemented by а component provider аnd used by its consumers. The interfаce specificаtion contаins method prototypes with full signаtures, including the type definitions for аll pаrаmeters аnd return types.
Only C/C++ developers were аble to reаdily modify or use Interfаce Definition Lаnguаge (IDL) type definitionsnot so for VB or other developers, аnd more importаntly, not for tools or middlewаre. So Microsoft invented something other thаn IDL thаt everyone could use, cаlled а type librаry. In COM, type librаries аllow а development environment or tool to reаd, reverse engineer, аnd creаte wrаpper classes thаt аre most аppropriаte аnd convenient for the tаrget developer. Type librаries аlso аllow runtime engines, such аs the VB, COM, MTS, or COM+ runtime, to inspect types аt runtime аnd provide the necessаry plumbing or intermediаry support for аpplicаtions to use them. For exаmple, type librаries support dynаmic invocаtion аnd аllow the COM runtime to provide universаl mаrshаling[4] for cross-context invocаtions.
[4] In COM, universаl mаrshаling is а common wаy to mаrshаl аll dаtа types. A universаl mаrshаler cаn be used to mаrshаl аll types, so you don't hаve to provide your own proxy or stub code.
Type librаries аre extremely rich in COM, but mаny developers criticize them for their lаck of stаndаrdizаtion. The .NET teаm invented а new mechаnism for cаpturing type informаtion. Insteаd of using the term "type librаry," we cаll such type informаtion metаdаtа in .NET.
Just аs type librаries аre C++ heаder files on steroids, metаdаtа is а type librаry on steroids. In .NET, metаdаtа is а common mechаnism or diаlect thаt the .NET runtime, compilers, аnd tools cаn аll use. Microsoft .NET uses metаdаtа to describe аll types thаt аre used аnd exposed by а pаrticulаr .NET аssembly. In this sense, metаdаtа describes аn аssembly in detаil, including descriptions of its identity (а combinаtion of аn аssembly nаme, version, culture, аnd public key), the types thаt it references, the types thаt it exports, аnd the security requirements for execution. Much richer thаn а type librаry, metаdаtа includes descriptions of аn аssembly аnd modules, classes, interfаces, methods, properties, fields, events, globаl methods, аnd so forth.
Metаdаtа provides enough informаtion for аny runtime, tool, or progrаm to find out literаlly everything thаt is needed for component integrаtion. Let's tаke а look аt а short list of consumers thаt mаke intelligent use of metаdаtа in .NET, just to prove thаt metаdаtа is indeed like type librаries on steroids:
The CLR uses metаdаtа for verificаtion, security enforcement, cross- context mаrshаling, memory lаyout, аnd execution. The CLR relies heаvily on metаdаtа to support these runtime feаtures, which we will cover in а moment.
A component of the CLR, the class loаder uses metаdаtа to find аnd loаd .NET classes. This is becаuse metаdаtа records detаiled informаtion for а specific class аnd where the class is locаted, whether it is in the sаme аssembly, within or outside of а specific nаmespаce, or in а dependent аssembly somewhere on the network.
JIT compilers use metаdаtа to compile IL code. IL is аn intermediаte representаtion thаt contributes significаntly to lаnguаge-integrаtion support, but it is not VB code or bytecode, which must be interpreted. .NET JIT compiles IL into nаtive code prior to execution, аnd it does this using metаdаtа.
Tools use metаdаtа to support integrаtion. For exаmple, development tools cаn use metаdаtа to generаte cаllаble wrаppers thаt аllow .NET аnd COM components to intermingle. Tools such аs debuggers, profilers, аnd object browsers cаn use metаdаtа to provide richer development support. One exаmple of this is the IntelliSense feаtures thаt Microsoft Visuаl Studio .NET supports. As soon аs you hаve typed аn object аnd а dot, the tool displаys а list of methods аnd properties from which you cаn choose. This wаy, you don't hаve to seаrch heаder files or documentаtion to obtаin the exаct method or property nаmes аnd cаlling syntаx.
Like the CLR, аny аpplicаtion, tool, or utility thаt cаn reаd metаdаtа from а .NET аssembly cаn mаke use of thаt аssembly. You cаn use the .NET reflection classes to inspect а .NET PE file аnd know everything аbout the dаtа types thаt the аssembly uses аnd exposes. The CLR uses the sаme set of reflection classes to inspect аnd provide runtime feаtures, including memory mаnаgement, security mаnаgement, type checking, debugging, remoting, аnd so on.
Metаdаtа ensures lаnguаge interoperаbility, аn essentiаl element to .NET, since аll lаnguаges must use the sаme types in order to generаte а vаlid .NET PE file. The .NET runtime cаnnot support feаtures such аs memory mаnаgement, security mаnаgement, memory lаyout, type checking, debugging, аnd so on without the richness of metаdаtа. Therefore, metаdаtа is аn extremely importаnt pаrt of .NETso importаnt thаt we cаn sаfely sаy thаt there would be no .NET without metаdаtа.
At this point, we introduce аn importаnt .NET tool, the IL disаssembler (ildаsm.exe), which аllows you to view both the metаdаtа аnd IL code within а given .NET PE file. For exаmple, if you execute ildаsm.exe аnd open the hello.exe .NET PE file thаt you built eаrlier in this chаpter, you will see something similаr to Figure 2-3.
The ildаsm.exe tool displаys the metаdаtа for your .NET PE file in а tree view, so thаt you cаn eаsily drill down from the аssembly, to the classes, to the methods, аnd so on. To get full detаils on the contents of а .NET PE file, you cаn press Ctrl-D to dump the contents out into а text file.[5]
[5] The ildаsm.exe tool аlso supports а commаnd-line interfаce. You cаn execute ildаsm.exe /h to view the commаnd-line options. As а side note, if you wаnt to view exаctly which types аre defined аnd referenced, press Ctrl-M in the ildаsm.exe GUI, аnd it will show you further detаils.
Here's аn exаmple of аn ildаsm.exe dump, showing only the contents thаt аre relevаnt to the current discussion:
.аssembly extern mscorlib { } .аssembly hello { } .module hello.exe .class privаte аuto аnsi beforefieldinit MаinApp extends [mscorlib]System.Object { .method public hidebysig stаtic void Mаin( ) cil mаnаged { } // End of method MаinApp::Mаin .method public hidebysig speciаlnаme rtspeciаlnаme instаnce void .ctor( ) cil mаnаged { } // End of method MаinApp::.ctor } // End of class MаinApp
As you cаn see, this dump fully describes the type informаtion аnd dependencies in а .NET аssembly. While the first IL instruction, .аssembly extern, tells us thаt this PE file references (i.e., uses) аn externаl аssembly cаlled mscorlib, the second IL instruction describes our аssembly, the one thаt is cаlled hello. We will discuss the contents of the .аssembly blocks lаter, аs these аre collectively cаlled а mаnifest. Below the mаnifest, you see аn instruction thаt tells us the module nаme, hello.exe.
Next, you see а definition of а class in IL, stаrting with the .class IL instruction. Notice this class, MаinApp, derives from System.Object, the mother of аll classes in .NET. Although we didn't derive MаinApp from System.Object when we wrote this class eаrlier in Mаnаged C++, C#, J#, or VB.NET, the compiler аutomаticаlly аdded this specificаtion for us becаuse System.Object is the implicit pаrent of аll classes thаt omit the specificаtion of а bаse class.
Within this class, you see two methods. While the first method, Mаin( ), is а stаtic method thаt we wrote eаrlier, the second method, .ctor( ), is аutomаticаlly generаted. Mаin( ) serves аs the mаin entry point for our аpplicаtion, аnd .ctor( ) is the constructor thаt аllows аnyone to instаntiаte MаinApp.
As this exаmple illustrаtes, given а .NET PE file, we cаn exаmine аll the metаdаtа thаt is embedded within а PE file. The importаnt thing to keep in mind here is thаt we cаn do this without the need for source code or heаder files. If we cаn do this, imаgine the exciting feаtures thаt the CLR or а third-pаrty tool cаn offer by simply mаking intelligent use of metаdаtа. Of course, everyone cаn now see your code, unless you use different techniques (e.g., obfuscаtion аnd encryption) to protect your property rights.
To loаd аnd inspect а .NET аssembly to determine whаt types it supports, use а speciаl set of classes provided by the .NET Frаmework bаse class librаry. Unlike API functions, these classes encаpsulаte а number of methods to give you аn eаsy interfаce for inspecting аnd mаnipulаting metаdаtа. In .NET, these classes аre collectively cаlled the Reflection API, which includes classes from the System.Reflection аnd System.Reflection.Emit nаmespаces. The classes in the System.Reflection nаmespаce аllow you to inspect metаdаtа within а .NET аssembly, аs shown in the following exаmple:
using System; using System.IO; using System.Reflection; public class Metа { public stаtic int Mаin( ) { // First, loаd the аssembly. Assembly а = Assembly.LoаdFrom("hello.exe"); // Get аll the modules thаt the аssembly supports. Module[] m = а.GetModules( ); // Get аll the types in the first module. Type[] types = m[O].GetTypes( ); // Inspect the first type. Type type = types[O]; Console.WriteLine("Type [{O}] hаs these methods:", type.Nаme); // Inspect the methods supported by this type. MethodInfo[] mInfo = type.GetMethods( ); foreаch ( MethodInfo mi in mInfo ) { Console.WriteLine(" {O}", mi); } return O; } }
Looking аt this simple C# progrаm, you'll notice thаt we first tell the compiler thаt we wаnt to use the classes in the System.Reflection nаmespаce becаuse we wаnt to inspect metаdаtа. In Mаin( ), we loаd the аssembly by а physicаl nаme, hello.exe, so be sure thаt you hаve this PE file in the sаme directory when you run this progrаm. Next, we аsk the loаded аssembly object for аn аrrаy of modules thаt it contаins. From this аrrаy of modules, we pull off the аrrаy of types supported by the module, аnd from this аrrаy of types, we then pull off the first type. For hello.exe, the first аnd only type hаppens to be MаinApp. Once we hаve obtаined this type or class, we loop through the list of its exposed methods. If you compile аnd execute this simple progrаm, you see the following result:
Type [MаinApp] hаs these methods: Int32 GetHаshCode( ) Booleаn Equаls(System.Object) System.String ToString( ) Void Mаin( ) System.Type GetType( )
Although we've written only the Mаin( ) function, our class аctuаlly supports four other methods, аs is cleаrly illustrаted by this output. There's no mаgic here, becаuse MаinApp inherits these method implementаtions from System.Object, which once аgаin is the root of аll classes in .NET.
As you cаn see, the System.Reflection classes аllow you to inspect metаdаtа, аnd they аre reаlly eаsy to use. If you hаve used type librаry interfаces in COM before, you know thаt you cаn do this in COM, but with much more effort. However, whаt you cаn't do with the COM type librаry interfаces is creаte а COM component аt runtimeа missing feаture in COM but аn аwesome feаture in .NET. By using the System.Reflection.Emit classes, you cаn write а simple progrаm to generаte а .NET аssembly dynаmicаlly аt runtime. Given the existence of System.Reflection.Emit, аnyone cаn write а custom .NET compiler.
Becаuse it provides а common formаt for specifying types, metаdаtа аllows different components, tools, аnd runtimes to support interoperаbility. As demonstrаted eаrlier, you cаn inspect the metаdаtа of аny .NET аssembly. You cаn аlso аsk аn object аt runtime for its type, methods, properties, events, аnd so on. Tools cаn do the sаme. The Microsoft .NET SDK ships four importаnt tools thаt аssist interoperаbility, including the .NET аssembly registrаtion utility (RegAsm.exe), the type librаry exporter (tlbexp.exe), the type librаry importer (tlbimp.exe), аnd the XML schemа definition tool (xsd.exe).
You cаn use the .NET аssembly registrаtion utility to register а .NET аssembly into the registry so COM clients cаn mаke use of it. The type librаry exporter is а tool thаt generаtes а type librаry file (.tlb) when you pаss it а .NET аssembly. Once you hаve generаted а type librаry from а given .NET аssembly, you cаn import the type librаry into VC++ or VB аnd use the .NET аssembly in exаctly the sаme wаy аs if you were using а COM component. Simply put, the type librаry exporter mаkes а .NET аssembly look like а COM component. The following commаnd-line invocаtion generаtes а type librаry, cаlled hello.tlb:
tlbexp.exe hello.exe
Microsoft аlso ships а counterpаrt to tlbexp.exe, the type librаry importer; its job is to mаke а COM component аppeаr аs а .NET аssembly. So if you аre developing а .NET аpplicаtion аnd wаnt to mаke use of аn older COM component, use the type librаry importer to convert the type informаtion found in the COM component into .NET equivаlents. For exаmple, you cаn generаte а .NET PE аssembly using the following commаnd:
tlbimp.exe COMServer.tlb
Executing this commаnd will generаte а .NET аssembly in the form of а DLL (e.g., COMServer.dll). You cаn reference this DLL like аny other .NET аssembly in your .NET code. When your .NET code executes аt runtime, аll invocаtions of the methods or properties within this DLL аre directed to the originаl COM component.
Another impressive tool thаt ships with the .NET SDK is the XML schemа definition tool, which аllows you to convert аn XML schemа into а C# class, аnd vice versа. This XML schemа:
<schemа xmlns="а" tаrgetNаmespаce="urn:book:cаr" xmlns: <element nаme="cаr" type="t:CCаr"/> <complexType nаme="CCаr"> <аll> <element nаme="vin" type="string"/> <element nаme="mаke" type="string"/> <element nаme="model" type="string"/> <element nаme="yeаr" type="int"/> </аll> </complexType> </schemа>
represents а type cаlled CCаr. To convert this XML schemа into а C# class definition, execute the following:
xsd.exe /c cаr.xsd
The /c option tells the tool to generаte а class from the given XSD file. If you execute this commаnd, you get cаr.cs аs the output thаt contаins the C# code for this type.
The XML schemа definition tool cаn аlso tаke а .NET аssembly аnd generаte аn XSD file thаt contаins representаtions for the public types within the .NET аssembly. For exаmple, if you execute the following, you get аn XSD file аs output:
xsd.exe somefile.exe
Before we leаve this topic, we wаnt to remind you to try out these tools for yourself, becаuse they offer mаny impressive feаtures thаt we won't cover in this introductory book.
|
http://etutorials.org/Programming/.NET+Framework+Essentials/Chapter+2.+The+Common+Language+Runtime/2.3+Metadata/
|
crawl-001
|
refinedweb
| 2,482
| 67.15
|
Hello there,
I am making a two-dimensional array where you can input a maximum of 20 students and 7 grades, and am printing them out in a formatted table. The array calls for averaging each test's grades each student, giving an average of what the whole class scored on the test, needed to be printed bellow each column correctly. Then I must also be able to add information to the existing array, like adding more students. So far, I have gotten the enter of the information into the table format correct, but I can't find a way to do the last two requirements. I think I was on the verge of it, but it just errors.
Here's what I have:
Code :
import java.util.*; public class FormattedGradeArray { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner indata = new Scanner(System.in); // Establishes the rows and columns in the arrays, // along with the average grades. int students = 0, tests = 0; double sum = 0; // Establishes an array for student names, test grades and averages, and // the final letter grade. double[][] grade = new double[20][8]; String[] student = new String[20]; String[] letter = new String[20]; // This allows to set the number of students and test grades that you can enter. System.out.println("Please enter the number of students you want to enter(1-20): "); students = indata.nextInt(); System.out.println("Please enter the number of test grades (3-7): "); tests = indata.nextInt(); System.out.println(); // This allows you to enter the student name, and their test grades. for( int x = 0; x < students; x++){ System.out.println("Student Name: "); student[x] = indata.next(); for(int y = 0; y < tests; y++){ System.out.println("Test Grade " +(y + 1) +": "); grade[x][y] = indata.nextDouble(); sum += grade[x][y]; } // Determines grade letter from the average score of each student. grade[x][tests] = sum/tests; if((grade[x][tests] <= 100) && (grade[x][tests] >= 89.5)){ letter[x] = "A";} else if((grade[x][tests] <=89.5) && (grade[x][tests] >= 79.5)){ letter[x] = "B";} else if((grade[x][tests] <= 79.5) && (grade[x][tests] >= 69.5)){ letter[x] = "C";} else if((grade[x][tests] <= 69.5) && (grade[x][tests] >= 59.5)){ letter[x] = "D";} else if((grade[x][tests] <= 59.5) && (grade[x][tests] >= 0)){ letter[x] = "F";} sum = 0; System.out.println(); } // Output System.out.printf("%-10s","Student Name" + "\t"); for(int y = 0; y < tests; y++){ System.out.printf("%-10s", "Test " + (y + 1)); } System.out.println(" Average Letter"); for(int q = 0; q < students; q++){ System.out.printf("%-12s", student[q]); for(int w = 0; w < tests; w++){ System.out.printf("%10.2f", grade[q][w]); } System.out.printf("%12.2f", grade[q][tests]); System.out.printf("%13s", letter[q]); System.out.println(); } } }
Thank you in advance for your suggestions.
|
http://www.javaprogrammingforums.com/%20collections-generics/2688-grade-array-trouble-printingthethread.html
|
CC-MAIN-2014-15
|
refinedweb
| 475
| 61.43
|
[Solved] Has someone got an idea what has happened to my Lopy4?
I have a few lopys on expansion boards an I can connect to them via visual studio REPL.
For a day or so I cannot connect to the lopy4?
I can update the firmware on the board, the blue led blinks, I have done a factory reset +3.3v to G28 and it does the correct series of led blinks for factory reset.
links are all connected on the expansion board.
What can it be?
This thing about the solid green light on a Lopy4. I've been seeing that also. For me it first occurred after about a week of uptime of the LoPy4. I assume that some unobserved fatal error occurred which resulted in a watchdog reset and then a solid green light scenario manifested itself on the reboot. I pressed the reset button about 3 or 4 times, each time getting the solid green light. The next press of the reset button was followed by a normal boot and normal, expected behaviour of running code. I can't see this being a power supply issue, or an issue with file-system corruption.
Thats a winner! that works, thanks Sebastian.
Once it boots with the jumper can you run the following in the REPL:
import os os.mkfs('/flash')
This will format the device so it should be like a new one. Can you see if after this and a reset, it connects normally to putty? You should see a message like this:
@seb I could not connect with putty initially, but again if I placed the jumper +3.3v to G28 and press the reset button, then I can connect?
Is this starting to sound bad?
Can you try connecting with PuTTY instead of visual studio to try narrow down what's causing the issue here, is it a hardware issue or a pymakr issue. You will need to set the baud to 115200
@seb I am using windows 10. but I have had a development here, maybe you can add some light on this.
I have just managed to connect, by plugging the Lopy4 into the USB, some times I get a green led solid - possibly power requirements on the usb?
Then press the reset button (If the green LED is on)
wait until the blue LED flashes
then I jumper 3.3v to G28 and then
Press the reset button and wait - three orange flashes .. ..... until the blue led is flashing steadily
then I can connect .
remove the jumper, check I am still connected.
press reset try and connect again - no luck
power down try and connect - no luck
restart visual studio code and try and connect, just says 'connecting on com6.... ' and no luck?
Sounds like you have tried all the usual steps, just to clarify, you have made sure all the jumpers are correctly pushed in on the expansion board. Also is the module in the correct orientation?
|
https://forum.pycom.io/topic/3016/solved-has-someone-got-an-idea-what-has-happened-to-my-lopy4
|
CC-MAIN-2020-29
|
refinedweb
| 497
| 82.24
|
Recourse
Look at other dictionaries:
recourse — re·course / rē ˌkōrs, ri kōrs/ n 1 a: the act of turning to someone or something for assistance esp. in obtaining redress b: a means to a desired end esp. in the nature of a remedy or justice; also: the end itself 2: the right or ability to… … Law dictionary … The Collaborative International Dictionary of English — ► NOUN 1) a source of help in a difficult situation. 2) (recourse to) the use of (someone or something) as a recourse. ORIGIN Latin recursus, from cursus course, running … English terms dictionary
recourse — (n.) late 14c., from O.Fr. recours (13c.), from L. recursus return, retreat, lit. a running back, from stem of pp. of recurrere run back, return (see RECUR (Cf. recur)) … Etymology dictionary
recourse — [n] alternative aid, appeal, choice, expediency, expedient, help, makeshift, option, refuge, remedy, resort, resource, shift, stand by, stopgap, substitute, support, way out; concepts 693,712 … New thesaurus
recourse — Recourse, Recursus … Thresor de la langue françoyse
recourse — noun (formal) ADJECTIVE ▪ constant, frequent ▪ limited (esp. BrE), little ▪ Drivers have little recourse but to wait until the weather clears. ▪ no other … Collocations dictionary
|
http://en.academic.ru/dic.nsf/cide/145533/Recourse
|
CC-MAIN-2016-44
|
refinedweb
| 189
| 54.32
|
I have the following actionscript code:
package{
import flash.display.*;
import flash.geom.*
import flash.events.Event;
public class Particle extends Sprite {
private var _xpos:Number;
private var _ypos:Number;
private var _xvel:Number;
private var _yvel:Number;
private var _grav:Number;
public function Particle(xp:Number, yp:Number, xvel:Number, yvel:Number, grav:Number, col:uint) {
_xpos = xp;
_ypos = yp;
_xvel = xvel
_yvel = yvel
_grav = grav;
var ball:Sprite = new Ball();
addChild(ball);
x = _xpos;
y = _ypos;
alpha = .8;
scaleX = scaleY = Math.random() * 1.9 + .1;
addEventListener(Event.ENTER_FRAME, onRun, false, 0, true);
}
private function onRun(evt:Event):void {
_yvel += _grav;
_xpos += _xvel;
_ypos += _yvel;
x = _xpos;
y = _ypos;
if (_xpos < 0 || _ypos < 0 || _xpos > stage.stageWidth || _ypos > stage.stageHeight) {
removeEventListener(Event.ENTER_FRAME, onRun);
parent.removeChild(this);
}
}
}
}
I have this animation where a monster gets it's head cut off and I want to use this code for the blood. Is there a way I can take this and put it into my timeline. Right now it only plays in the file that calls it. I want to be able to place it in my timeline right where the monster is beheaded and on that point. Thanks!
it looks like you should create a Ball class movieclip (that will look like a blood drop) and then repeatedly call Particle to create the drop of blood. you'll need to add a parameter to pass Particle so you can add your drops to the displaylist.
|
https://forums.adobe.com/thread/473130
|
CC-MAIN-2018-34
|
refinedweb
| 245
| 61.97
|
y
ll? I jr M. .Wi ^
ititi*
LAURENS C. H., S. C., WEDNESDAY, AUGUST If), 1885.
NO. 3
After tho l'an of Troy.
Troy hu-* fallon; nnd never will bo
War Uko iii" war Hint WHS wnged form?.
Lo.tltl I hui huv I li? iso lon yours book iiKftln,
W Uh I ho love iiiH iii" glory, tho nlcnsuro like
?Mini,
Tho elfish of m u?s mid Ihr din ol thc ll?lit,
i in- feasting mid music, iii" color und hunt!
? et, mixed with ii nil, thoro Rounded to mo
liver a inonu from Ibo fur "ir s?'u.
TJicro still remains this fur nil time io bo:
I lie wnr of the worlil was I'miKlii ter ino.
? Ive them no pity who died for me lhere;
Mon cnn nevermore il lo tor u moo w> rn ir.
And winn dn. s it mutter ttint now thoy Ile,
t^ui'i mid silent, he non I li tho sky?
Iii member Mini nono ovornioro eau bo
Muck toe Hies" vein s tn Tiny with me.
-Flori ne" Peacock, tn Academy.
Under t he Simw.
.lillie, with Its roses, weill long llgO?
To-niirhl the eil rt ll fl lying deep linder the
RH? ? w ;
Hope's richest trensures, like roses of yore,
Are sotlttered iiml vanished, lo cuni?'-never*
more.
The brent li of thy blossoms, O, lovo-huunted
days '.
Tim soi ( Myhill- zephyrs, thy birds' teador
layp,
Thy fni.iiway skylnnds, so blue und so fnlr.
The mists oi thy mornings, rose-tinted mid
rare.
One voice linnie thy muslo, its silence lu pnlll|
Ono fuco mudo thy benn ty, "twill como iK'Vr
iigiiin.
While chill winds uro blowing I weep In my
woe
O cr thc lev?' Hint Iles burled deep under tho
simw.
-norton Transcript.
STOiiY or A it i :< IA si;.
In one of the mountainous dainties
of Wales there live?! for many years a
hermit, of whom no one hail anv knowl
edge.
ills abode was a eave, in a wild re
gion; and he never appeared among Iiis
fellow-beings except to ' blain snell llc
eessarios as his hermit life, required.
Ile would never, while living, reveal
his name, nor place of hirth, nor tho
cause which bad led him lo seclude him
self from the world.
One da\ a couple of travelers, passing
through thal region, visited tho eave,
and found thu hermit not only dead, lint
in a slato of decomposition.
The hotly, after an inquest, was
buried, and Miine garments and a few
trilles, which belonged to the deceased1,
wein deposited at the nearest magis
trate's o Alee, with a full statement af
thc facts.
In a pocket of one of these gai'lllOlltS
was found a manuscript, supposed to
have b.cit written by thc deceased, and
which, as il tells its own tory, we hero
transcribe without a word of comment:
I w as born in a yi ur I shall not re
cord, in a place I shall not reveal, ami
lintier a Ult ino 1 shall not disclose.
For many long years I have been
dead lo the world, and my desire now
is that the waves of oblivion shall roll
ov : 1110 and leave inc ns if I had never
bc. I
And yet there are some fai l-, in my
life w hich I wish lo set forth.
Win P
Well, I doubt if I could tell anyone
why. j
1 only know that thc impulse is on
mc to write them down, perhaps to tlc
stro\ the record when (haie.
My youth passed pleasantly.
I had Kimi. Indulgent, ami tuons pir
en ls, w ho sought lo nuiko my lifo a hap
py one.
I was sent to school at an carly ago,
and kept there till I had acquired a
good English ?ducation.
Then, at my ow n request. 1 became
an iindcrclcrk in tho large dry-goods es
tablishment of a prosperous merchant.
By strict Integrity and diligence I
gradually roso lo a Ural position.
At two-and-twonty I had'the confi
dence of un employer, and was often
Invited to Ids dwelling.
At lil'St this made mo very happy,
and as I looked forward thou, tho fu
turo seemed very bright. Hut, alas,
and alas! this was Ibo beginning of a
sorrow which will novel* end while 1 re
main on earth.
My employer had n daughter a kind,
gentle, lovell being w ho. to my en
raptured vision, scorned nu angel just
come down from Paradise
From tho moment I liest beheld hor
my wholo soul went ott! to her, and
from that time forth I could con. ive of
no enjoyment in which she had no part.
As I am confessing this to myself, or
to a world that will never know ino, I
will say that I loved her to a degree of
worship which made her a something;
above and beyond my reach; anil
though naturally easy and Huent in con
versation, I COtlld not speak to her with
out changing color and choking, and
appearing moro like an idiot than a
man of sense.
This made mo avoid meeting lier
when alone, or pressing forward to tako
my oh anco With those who were seeking
her at evcrv Opportunity) perhaps be
cause of a liking for herself, perhaps be
cause of a liking for tho money ?ho
Would inherit.
I do not think she ever .suspected mo
of having any regard for ber hoyond
that of her iH-ing tho daughtor of my
employer, whom 1 was in duly bound
to treat with respectful deference, and
certain I am that she had no conception
of tho holy love and worship I secretly
gave hor.
As I have said, I avoided as much ns
possible coming in contact with her
would have gone a mile out of my way
rather than speak to her, and yet lier
presence, in my company of which I
formeil a part, was a glowing joy, und
her absence a depressing void.
Among her numotfOUS Stilton was ?
fellow-clerk, who held a position of con
fidence under our employer similar to
HIV Own, and who, when we were alono
together, was always praising her sweet
ness and beauty, and proclaiming his
own undying love.
"Oh. inner the golden moment whim
I shall bo able to Olasi) her dear little
Ininti in mino, and call her by tho en
during name of wife!" Ito would some
times exclaim, or usc words of similar
Impott; and when I would as often turn
aside, lo con?cai the fooling! that would
nluio.it overpow er mo, ho would mis
take my action for a dislike on the sub
ject.
"Ah," ho ono day said to me, "I per
?oive my darling linds no favor in your
sight; and she knows you do not Uko
her; but for my sake, 1 trust you will
not lot her soo that you absolutely hate
tho sight of hor person, mid tho mention
of her name.
Thia to mo, whose excess of lovo for
the object in question was consuming
mo Uko an inward flrol
...Mun!" cried 1, turning upon bim
with tho glaring fury of a wild boast,
"if you loved that hoing with one ten th
of tho passion that is destroying me,
you would cut your wagging tongue
from your gaping mouth oro you would
permit so nippant a mention of so sacred
a name."
Ho st ar tod, und stared at me, while I
walked indignantly away.
Did ho understand my words? Did
ho comprohond them tn their breadth
and depth?
Only so far, perhaps, as a shallow
bram and a superficial feeding could
reach, for ho was ono entity, and I an
other.
From that moment, however, ho
ceased to speak of her in my pres? nee,
and I, feeling that sho was lost to ino
for ever, only secretly worshipped her
from afar.
t?o matters drifted on for a time, and
I became miserable over my solitary
brooding; anti while. I wished myself
far enough from the scone of a rival's
triumph, I shrank from tho thought ol
going where 1 .should never look upon
my idol again.
Ono niglit, having forgotten some
thing at tho store, I procured the key
from tho porter and entered the build
ing.
lo my surprise, I soon perceived tho
glimmer of iv light in the counting
room; ami on approaching it cautiously,
thinking thoro might ht; a burglar at
work, I was still moro surprised to see
tho safe-door ojien, and my rival seated
on tho tloor, apparently counting a
largo roll of bank-notes.
..Well, this hx>ks like singular night
work!" said I.
With a startled cry, he fairly leaped
to his feet, letting the money fall around
lum, and turned towards me one of the
most ghastly laces i ever behold.
After looking straight in my face for
a few moments, din ing willoh hu shook
and trembled, and his very lips quiver
ed, he stammered out:
"Wh-wh-wliy, is it you? Wha-wha
what tlo you waul?''
"Suppose in turn I ask you what you
aro doing with that open safe and
money at this untimely hour?"
"O?i, that?" he answered, glancing
down at tho scattered bank-notes, and
evidently recovering himself with an
oflbrb "Ha, ha!" he affected to laugh.
"Do you know, my dear fellow, I took
you for a burglar!"
"Instead of yourself, eh?"
"The fact is, you seo, my dear friem
"Suppose you leave tho 'dear friend
out?" I Interrupted.
"Well, then." ho coolly went on, "tin
fact is that, after going (ionic, tho ide:
caine into my head that I had mad?! ;
mistake in my money report; and Ol
tho governor, you know (moaning oui
employer), ia very particular nbou
trilles, and might discover it before
should got a chance to make a corree
tioil, 1 thought 1 had better attend to i
nt once."
"And doubtless you found an error
which you were about to*set right!"
said, with a sneer which ho seemed no
to notice.
"Oh, yes, I think there was an error
hut I am not quite sure, because of you
interruption, 1 shall have, to go al
over tho money again. And now that
have accounted for my presence hero
suppose you do the same," lie adde.il
giving nie a searching look.
"Well, I caine in togo!-" Here i
occurred to me that I, an honest man
was being interrogated by ono who wa
perhaps a thief, and I suddenly brok
Off and added: "That is my business.'
"Oho!" lie exclaimed with a peoulia
look and leer.
"And I carno in Iry the porter's key,'
I sharply continued.
"Aha! yes, yes. Just so!"
"And by what key did you como in?'
"I suppose you are not ignorant t
the fact that there is a private key?" h
answered.
"Which belongs to the. governor."
"And which his daughter could gc
for me."
..Having ovory confidence in your ir
togrlty."
"At least she ought to have in her fi
turo husband, you know."
This allusion to his coming marriag
with my worshiped angel nearly drov
mo wild.
I controlled myself as well as I coull
and merely said:
"1 hope you will find your money al
fair iftl correct, and not havo to tak
away or add anything!"
"Thank you! I hope I shall!" li
blandly answerod.
1 turned away abruptly to seek win
I came for and leave tho building.
As 1 was about to dopart, in no et
viable frame of mind, ho called out:
"1 suppose you will ro|>ort what yo
have discovered, and as much to my ii
jury as possible?"
'.Probably von aro now judging ni
h vourself, ' I angrily replied; "but
will thank you to understand that I ai
too much of a gentleman to bo a tal
bearer."
"All right, then, and good-night!" I
said.
Heilig too angry to respond I hurrie
out and locked tho door without sayin
another word.
I returned tho key to tho porter] but
did not mention to him, nor to anyon
else, thc faot of my having met my fe
low-elerk in tho building, under circun
stances so calculated to excito stlSploio
of his being there for an evil purpose.
In this I am now certain 1 did wronj
but I was yoting theft, without oxpet
onco in tho evil ways of mankind, strlc
ly honest um) honorable myself, an
posse.-.-.ed too Hinch pride to deie.ea
myself to thu low condition of a tal
boarer.
1 reasoned, too, that if my rival lin
originally designed to rob Iiis employe
ho would not iii) it after what hail o
curren, ami that I really had no right I
I Injure his reputation merely because I
bad boen chosen from all tiie world t
tho fatr bolng who was all tho world
mo.
It was something Uko a month aft
this event, that 1 was ono day fearful
startled and -.hocked at suddenly flndir
myself lintier arrest for stealing mom
from nv employer.
Nolv Phfltnniiing that I know myst
to be entirely innocent, tho very fa
that I should be suspected of such a ii
furious transaction nearly crushed i
with shame.
.fudge of my unbounded amazonio
and horror, then, on being assurod th
marked money had boon found in r
trunk, that Ih? amount of a thousand
pounds had hern abstracted within thc
last tow weeks, thal my fellow clerk ami
rival had suspected me ever since the
night (so he swore) he had (?con tue
coming out of the store, and that the
porter had already gi' en evidence of
my having hol lowed his key to enter
thc building at an unseasonable hour.
I comprehended at once that thia was
a most hondish plot of my rival to get
me out of tho way and shield his own
dishonesty, for he alone had robbed his
emplover, and profited by it.
What could I do?
My slaloment of the fact that 1 had
entered thc premises for another pur?
pose was not believed j and when I add
ed the whole truth of what 1 had soon
tltoro, I was simply regarded as a cold
blooded rascal, who was trying to in
volve an innocent young man in my
own ruin.
All my previous life of probity went
for nothing, or only stood out, white?
robed, lo make my later acts appear
more dark ami damning.
Well, to bo brief, ? was tried, and
convicted, and sent to penal servitude
for a term of years.
She, who was my idol, was present
when tho awful verdict "Guilty" was
pronounced by tho jury; and ? shall
never forget tho mournful look of pity
with which she regarded mo for the last
time, as she passed by hi the felon's
dock, leaning on thc ann of my wicked
rival and destroyer.
Well, I was, as I have said, convict
ed, and 1 served out my time; hut he
fore I left that pince of misery and de
gradation, 1 had the satisfaction of see
ing my haled rival lhere, in the convict
garb, justly brough! there by Iii? evil
deeds.
After my release I learned that his
angel wife, my worshipped love, had
diod of a broken heart.
That was tho end of life for ino.
All since then has been only the dull,
dreary round of a mechanical existent ,
with no hopes no fears, no passion .,
nothing but tho tired wailing herc till
the Master shall call me hem e.
I am ns one dead -I am as ?niebun,
-und the world ami all that live in the
. World are dead to me.
Why do 1 still exist':'
Booauso it would be verv sinful to lift
my hand against tho life the Master
gave me.
bet Him work His will, how and
when He will, and lol nie humbly how
before the awful mystery thal I cannot
understand,
He. who luis a purpose in all things,
placed inc here for a purpose, ntlllcted
mo for a purpose, and will work ot 11 a
purpose through my sufferings; hut
what that purpose was, or is, or is to he,
is known to Ililli alone.
1 only wait for tho end. ami resign
myself to say:
"God's will bo done on earth as in
heaven."
Pei Sandera.
Old man Tea Sanders is probably the
most notorious "moonshiner" in north
Georgia. Ho has been in Fulton
County jail eight times on thc same
charge.
We saw old man Tea on Saturday
night's north-hound train. He w as just
out of jail and oil lin wav homo,
The Toccoa people will appreciate the
old man's appearance when we say that
bo would remind you forcibly of "Grip
Scott."
With an old, llabby wool hat. rim
turned close against the corner on tho
left side and a kcoD, searching eve that
was never dazed during his 7l? years of
life, old man Poa is tho perfect image of
some civilized independence. Nothing
abashes him.
Ile is afraid of neither man, woman,
or beast. Ile ls an incessant talker and
loves to tell of his tricks on the revenue,
ofllcors.
His latest dodge. Just before his last
arrest an ofllcor got oil'thc train at Hel
ton, near which town he lives, and start
ed over to old Pea's house. I Io met an
old man in the road.
"Ohl man, do you know Pea San
ders?"
"O, yes; bought many cr gallon er
licker from him.'
"Where does he live? '
"Right down thar."
"Is he at honieP"
"Cuess so; if bc ain't the. old 'oman
is."
"Good day, sir," said tho ollleer.
"Good luck to ye," said the old man.
The ofllcor marched on to old man Pea's
house. Ohl man Sanders turned around
as thc officer went on and muttered to
himself: "Guess you won't lind him to
day, mister."
Wo said to the old man, "Mr. Sanders,
do you intend to keep on nioonshining?"
Said he: "Them fellers in Atlanta axed
me there and I told 'om I never mado
any rash promises."
"Guess, then, you mean to make some
more 'mountain dow.1 "
"Let 'oin provo it if I do."
Tho old man scorned very well satis
fied with his imprisonment and among
other things said he had been "boarding
at the United States hotol in Autlantcr.
They trentcd mo very well, but I like er
froze up in (hat cold spell."
A young Hour merchant from Atlanta
engaged him in conversation.
Said he: "Mr. Sanders, did you buy a
still before you left Atlanta?"
"Oh! when I want another one, I
thought I would como around and get
you to make it for me."
The old man's ticket gave out at
White Sulphur and the. conductor start
ed to put liim off. Col. K. Schafer, of
Toccoa, stepped forward and paiil tho
fare. Tho old fellow chuckling to him
self said: "Good friends is better than
monoy."-Toccoa ((/a.) News.
A six-year-old son of C. M. Khortt, of
Sugar Grove, N. Y., swallowed a toy
kmfo w hile using it as tho dart of a
blow-gun formed of a hollow metal pen
holder. Tho knife, which was open,
measurod an inch and live-eighths in
length, and went into tho stomach llan
illo first. As soon ns the boy's grand
father, Kairi Davis, hoard of the acci
dent he proHcrihod a diet of buckwheat,
having read Just tho night before how a
young Californian had got rid of a knifo
which he had swallowed by eating
heartily and frequently of half-cookod
buckwlieut. The lillie poy W?S given
all the buckwheat cakes he would cat
and no doctor WUK called in. Hu recov
ered.
DELICIOUS F. F. LS.
Tho .Inpaiicso M<HU> ol' Malon;; l^<> Sor- I
pentium Mili n Delightful Morsel.
A .Japan correspondent of tin: San
Francisco Chronicle wrilos: On? after
noon in April 1 wa> strolling about tho
.streets engaged in watching tho in
teresting occupations of iii opeople, when
I mot a young Japaneso who loni been
educated Ut Harvard, and who ap
preciated a slice oil' the breast of a cilll
Vtts-back duck and a tenderloin steak as
perfectly as "one of tho manner horn."
Having politely saluted mo, hu re
marked:
"I mn on my way to Mnnoki's.
Would you like to join 1110 ill a feast (d'
broiled eolsP Ii is said (hat this month
the iniagi is a lit morsel tor the god.*." |
I replied, with a somewhat dubious
shake of the head. "1 never was very
fond of those marino snaki s."
"Probably yon have never tasted thom
prepared by my countrymen." ho slyly
returned. "i remember once eating
some at Delmonico's (shuddering.)
They wert! sot!,' flavorless morsels, in
olosod in ti quivering jelly. Como along
with me."
"Are the eels good to-day?" patron
izingly inquired my friend of Ino pro
prietor. "1 have heard thal their Ila vol"
is not quito what it used lo bc. Do you
procure thom from the city canals, or
art! they from tho Sa?nala river'.'" The
proprietor bowed, then twitched tho left
corner of his mouth, after tho fashion of
a Japtllioso uttering a joke, and an
swered :
"Honorable sir, do yon fora moment
imagino 1 should ollercannl-hrcd eels lo
such a judge as yourself? No, no!
You know that 1 have a high reputation
and buy nothing bul (ho inosl'hcnutiful
eels thal come from llie Sumida, li -
momhor?ng thal I ho (imo was near for
you lo pay us a visit, I have saved some
of tho littest lish you ever saw'. Would
you like to como imo thc kitchen and
[lisped them?"
"Hal." gently added bis wife, who
had listened lo his speech with down
cast eyes, "lhal is so. Wo have gome
eels lit foi* a thiillllo."
"What do you say?" inquired my
companion. "Would you liku to visit
the culinary depart inoul ? '
"Not until I have ?lined," I answer? il
smiling suspiciously at the faint odor of
pickled radish thal issued from a rear
ilopartmonl. Tho waitress quickly ap
pen roil with some tray- containing
square, black, lacquered boxes, hearing
thc >igns of the house and a number.
Placing one before each of us, she re
moved tho lightly-lilting lid; and re*
Voa lett lilt! content-, which ware sec
tions of nicely-browned, broiled, split
eels, skewered together, that gave out a
most appetizing odor, l in- girl smiled
as shu watched my looks, and replen
ishing my salicor, placed it near me,
murmuring:
"I think you will lind the iniagi very
pleasing to \ ot:r taste."
1 look ni\ chop-ticks in n:v righi
hand, inserted Hie points in ilio Heall,
broke oil'a morsel and atc. Ye gods!
lt was delicious! rich, lender, delicately
Ihivored, and boneless! I drew my box
toward mo, nodded approvingly at tho
attendant, and enjoyed the delectable
food. The smiling girl brought ill box
after box, tho contents of each being
nicer than (ho last. I have partaken Of
fried oysters al home, broiled lish in all
countries, and tho delicacies of every
elimo, but have never moro I borough ly
enjoyed any dish than I did I lioso eels.
At hist 1 laid down my chopsticks, and,
glancing at my friend, exclaimed:
"You were right in saying thal ibis is
a dish for the gods. We ought to intro
duce it at home."
The waitress bowed in acknowledg
ment of my praise, and inquired if wo
would like lo cat sonie rice.
"Y<*^" nodded HIV companion, "1
think I could empty a bowl or two."
Away went the girl, who, aller a brief
delay, returned, bearing a large tray on
which was a covered wooden tub, con
taining hot rice, two lacquered bowls, a
teapot, and sonic liny cups.
I contrived to cat one portion ot thc
delicious, well-cooked cereal, then
lighted my pipe and watched 111} friend,
who hail his bowl refilled a dozen
times, and moistened his food by satur
ating it with lea.
"How do you contrive to n uder tho
skins of the lish so lender!" I asked tho
girl.
"1 do not know," she answered,
glancing timidly at the mats. "Tho
cooks never permit us lo learn their
secrets. If you like to visit tho kitchen
they will no doubt explain everything to
you."
"Now for the hill," said my compan
ion, relilling his pipe. "Altogether, you
have given us a very tolerable meal."
In a few moments she came back,
carrying a small scoop-like tray, in
w hich was placed a slip of paper con
taining a reckoning. This she pushed
along tho mal toward him; she. thou
bowed and remained willi her face (dose
to tho tloor, while ho minutely scruti
nized tho document. Taking lils purse
from his sleeve he dropped some money
into tho tray, and remarked in il low
tone:
"You may koop tho chango" (10
cents). His munificence almost over
powered thc uaitre.-s, who bowed re
peatedly, and gratefully murmured:
"Your gonoroslly resembles thal of a
foreigner. Anyone can soo that you
have traveled." After we had smoked
awhile he asked whether I would like lo
visit tho kitchen, and Oil my replying In
tho affirmative summoned the landlady,
who said: "You honor us too greatly.
My husband shall show you how wo
prepare the eels." Wo lo.-e, quitted thc
room and dcscoiltling the ladder-like
stairway, tho slops of whioh wem
polished smooth as glass, slipped on our
foot-oovcrings and entered the kitchen.
On the hard earthen floor wero rows of
little charcoal furnaces, provided with
iron rods that served as rests for tho
ski?werod cols. Maroki, whoso only
failing was a Weakness for bow ing and
politely sucking in his breath bet ween
Ilia speeches, led tho way, and was ex
ceedingly attentive. Pointing to a
rango of tubs containing Ano specimens
of fish, ho remarked:
"Those were caught this morning;
they aro the most expensive lish in tho
Nippon llashi market. Aro they not
worth looking atP"
"How do you contrive to so com
pletely extract tholr bones?" I de
manded. "Our cooks can not accom
plish that feat" Motioning a lightly
clad servant (<> approach him, lio said:
"Somo customer.-) have just como lu.
Preparo au eel hi tho prcsonco of those
gent lemon." Thc man, who ovidontly
took great pride in lils work, selected a
vigorously squirming lish, struck its
hoad smartly upon a wootton block
upon thu Hoor, ami kneeling by it
grasped tho creature's neck, inserted a
knife in the lett side of thc vertebra1,
ami dexterously ran it down to the tail;
then rapidly applied his instrument to
the Oilier side Ol tin; bai l.bone ami re
pealed Hie process, leaving tilt- eel split
open. Holding up thc head, to which
was attached tito vertchru? and lateral
bono inclosing the. intestines, he bowed
ami said:
"There is not a splinter left in the
fish."
"That is so," proudly remarked tho
proprietor. ?.! only employ tia; most
.skillful men timi cooks." 'The operator
washed down Ibo block, chopped tho
Mallem <! ell into three-Inch lengths, and
shouted I" ti cook, who advanced to re
move it on a .dish. Thc next process
wa s a mysterious ono a nd was performed
behind a sereu, from whence tho
platier of cols was presently handed out
to one of thu lioilcrs. M\ opinion is
that thc lish had simply been plunged
Into boiling water to make tho skins
tendel-.
We advanced to a rango and saw a
COOk skewering the pieces of eel on loll?
bamboo splinters. Then he placed
them on dui rods over tho glowing coula,
and win ?i one -?tlc was browned, dex
torously picked them up with a pair of
iron chopsticks and turned thurn. After
they w rc thoroughly cooke I hu seized
the lish with thc sanio instrument and
plunged ii into a vessel containing old
shoytl, wh'.'di was thick and dark as
molasses, Thu steaming unagi was
then drain '. placed in a lacquer box,
and sent up-stairs to thc customer.
A Chinese ?VIII I iona Iro.
Hu Ilsueh-ycn, thu groat Chin?se
banker ami millionaire of Hangchow,
is doad. In some respects, says tho
Shanghai A. he was one of the most
remarkable ni u hi his country. His
father wan a merchant, and bo himself
bogan lifo from a pn tty low rung on
the ladder, having buen originally a
simple clerk cir "purser," as tho Chinese
sometimes say, in a commercial hong.
Hut by dint of bis extraordinary talents
for business ho rose rapidly hi wealth
and fame, and for sonic voa rs past has
been recognized as thc loading mer
chant of t 'iiina thc representativo of
China's financial amt commercial inter
ests. To borrow a phruso mado familiar
to us i>\ Mr. Kdward Jenkins, Hu Tao
t'ai was, in no far-fetched sense, a true
Paladin of finance, and when he died
had already been honored by llio em
peror with a button of the first grade
(l'un p'iii tim/'Cui), a yellow riding
jacket, and (ho rank of provincial judge.
His beautiful palace at Hangchow was
ono of tho show places of China. The
Chincho say that lils career was scarcely
like one of real life it was a "spring
dream." Advancement from so low a
degree to tho high honors and unbound
ed woe Uh which ho afterward attained
is a phenomenon less common in China
Ilia i in Europe and America. There
have1 been many miners ami gulch la
horers in thc United states who have
risen to bo bonanza kings. Mr. Gilead
L\ Heck docs not stand alone in thc an
nals of tho far west. Hut in China such
freaks of fortune aro rare, and Hu Tao
t'ai may fairly claim a placo as a suc
ccssful merchant basilio T/.u Kung, tho
disciple of Confucius, who, when en
gaged in business, always made a
profit. In this, however, thc sage was
more fortunato than the millie nairo,
though he never amassed much wealth,
for tao losses sustained by Hu in lils
celebrated .silk speculation were simply
fabulous, and there were probably few
merchants in tho whole, of China who
ever owned tts much as was then sacri
iicod. Hu diod at midnight a few days
ago at Hangchow, ago something over
30 years. Ho w as not a particularly
cultured man, hui his influence was
great, and ho was renowned for the ex
tensiveness and liberality of his chari
ties. Tho Jiu Pao, in its obituary notice,
says: "Ho has saluted tho world; and,
now that bo has gone, having died in
impoverished circumstances, who is
there who will not look hack upon his
career and accord him a sigh of regret?"
A N'OVOI enterprise.
A Halifax, No a Scotia, correspon
dent of tho New York Evening Post
writes: B. 15. I>ai nhill, of .loggia's
Mines, Cumberland county, has under
construction an immense, raft for tho
purpose of carrying to Now York about
3,000,000 superficial feet of piles, logs,
spars, hardwood timber, and hoarus.
Its dimensions are, length -110 feet,
width 66 foot, depth 35 feet, and it will
draw 21 foot of water. Tho raft is be
ing built upon a well-constructed cradle,
which will bo launched with tho raft
and removed from it in tho water, leav
ing the raft with its chains and binders
lo support i* If. The structure is tor?
pcdo-sli: i at the bow and stern, and
a cri - tction nmidship will bo of tho
form of an ellipse. When completed it
will weigh 8,000 lons. Th,, weight is SO
distributed over the four set of launch
ways as tO exert a pressure of HO pounds
to tho square inch, which is about two
thirds of the pressure allowable on or
dinary launehways. About one-sixth of
tho < argo has been slowed. When com
pleted tho COSt will be about *-'0,000.
Tho raft is lo be towed to New York by
an "ocean tramp," or by two tugs, as
soon as launched, which will bo about
midsummer. Should Mr. BnmhlU's en
gineering skill prove equal to his enter
prise and courage in planning and un
dertaking so novel an operation ho will
have provided a cheap method of water
carriage for tho products of tho forest.
Many persons view tho scheme with in
credulity, and predict that it will be a
failure.
The annals of modern diplomacy de
scribe no event more important and
Unique than tho spectacle oiQuoon Vic
toria and Mn. Minister Phelps sit
ting in a co/\ room at Windsor Castle
drinking tea and comparing their ro
spOOtiva vlQJVS on establishing tho auto
nomy of raspberry iain. This occur
rence, says ino Philadelphia Press, can
not fall ti) draw tho two great English
speaking nations closer togcthor in the
bonds of common sisterhood.
A WIM) HOAR HUNT.
TH Animals li om tho Hart i Mountain?
?.<-t. 1.11 ?.-.<. on the HRS? brui Grounds ns
Targets for Sharpshooter**
(From the New Turk World.)
Never did a more amusing or excit
ing affair take place in New Jersey
than tlie groat boar Inuit which came
oil' at thc Elysian Fields, Hoboken,
on Monday afternoon. Thc German
steamship Eider last week brought
over from Germany two wild boars,
wiiich had been captured in tho Hartz
mountains by agents of Charles Heidie
tho collector of wild animals. When
thc boars arrived they were presented
by Mr. Reiche to Charles Kaegebahn,
<>f No. 31-1 Washington street, Hobo
ken. For several days ho was at a loss
what to do with them. Finally sonic
of his friends suggested that a grand
w ild boar hunt be given at thc Elysian
Fields.
The suggestion met with favor, and
tho hunt, was lixed for Monday after
noon. Invitations were issued to a
number of persons, but many more
people came than had been asked.
They swarmed over the fences of thc
baseball grounds, whore the hunt look
place, and crowded through tho gates
despite tho precaution of thc keepers.
Among those who caine were nearly
till thc eily officials of Hoboken, many
of those of Jersey City, besides hun
dreds of prominent citizens aiuPrlood
Iinns and street gamins.
Tho sharpshooters who bad boen
^elected to kill the brutes were Henry
A. (Jobie, It. Wclfolman, W. Hollister
Ward and George Brown. Only the
two latter appeared. W. Hollister
Wall is the editor of a Hobokon week
ly paper, and his father is a clergyman.
Ile learned to handle the rille carly in
Mle, and ls an expert shot. George
Brown is a colored man, and is in the
omplov of Mr. Reiche. He, too, is a
crack shot.
At .'5 o'clock the inclosed grounds
were crowded with spectators and thc
tops of the fences were lined with
people, while out of neighboring win
dows peered hundreds of laces. Half
an hour Inter the door of the pen was
thrown open, and as thc smaller of the
boars shot through those of the specta
tors who hail not already secured a
place beyond the reach of tho terrible
looking t ushes of tho wibi beast sought
safety in undignified Hight. A dozen
valiant policemen scampered with the
rest of thu crowd out of thc way,
while Chief Donovan and Mayor
Tinikcn vied with each other to reach
tho fence top. The obesity of the
mayor prevented a successful execu
tion of tho manouvre. The boar, an
undersized, yellowish brute, ran half
way across thc field, then he stopped
lo root with bis long snout in thc
spongy earth.
Sharpshooters Wall and Brown
edged carefully up, while the crowd
kept cautiously back. While the
boar had bis bead hall' Willied to thc
eyes in tho dirt, Brown drew a bead
on bim and tired. With a squeal of
agony the animal (urned ami ran willi
jaws widely extended towards Editor
Wall. That valiant huntsman ner
vously pulled up his parlor l ille and
pulled the trigger. The cap snapped,
but the gun failed to go off. The
boar, however, fell dead at his feet.
Then the oilier boar was released.
Ile was a lng follow and w s inclined
lo bo lazy until Kaegebah.i's big wolf
hound was let out. Thc dog walked
lip to him, smelled of him, and then
quickly proceeded to seize him by the
left car. The boar squealed, and the
dog ict go and gazed at t| \. Strange
quadrupod lu apparent astonishment.
He was much more astonished when
tho boar opened wida? bis tremendous
jaws ami made a side lunge at him.
Hail that blow bit thc dog, that dog
would have worried no more boars.
Luckily, however, for thc sport, thc
dog escaped, and then began the fun.
First tho d'g chased thc boar, and
Ilten thc boar chased the dog. The
(wo sportsmen got as close as the\
dareil, but could not get a good shot.
Suddenly tho boar started towards a
group of spectators and sent them
Hying in every direction. Mayor
Titnken got against thc fence, and
when the brute was olosc to him
kicked tremendously. His Honor's
feet looming up like a big stone wall
frightened the bog, and it ran towards
Cns Soldo, who tumbled over Bill
Wright, who in turn knocked down
Water Commissioner Winjos, who, in
falling, toppled over against Chief
Donovan, luau instant all was con
fusion, and ('harley Kaegebahn ran up
with a baseball bat anti beat the boar
over thc head until he ran towards
Brown, the colored sharpshooter, who
blazed away at him. His ball nearly
broke a foreleg. Thc dog kept snap
ping at the boar until Mr. McAncrny
told Mr. Kaegebahn to call him off or
thc sport must stop. Thc dog was
Immediately called ou".
Thc infuriated animal hail mean
time lunged towards Editor Wall,
who tired a big lille ball into his breast
and killed him. Carl Echcrt, Heritor's
expert butcher, ran out and with a big
Unite, cut the boar's throat. The two
boars were at once hung up and clean
ed, after which they were hooked to
the side of a big truck and paraded
through the streets.
- The Loyal Orange Institution of
England bas issued a manifesto de
nouncing Mr. Gladstone's proposed
Irish measures. It summons Orange
brethren everywhere to remember
their special and solemn obligations to
def md the Protestant succession, and
to make all ncccsary preparations to
prove their loyalty to Orango princi
ples.
-Thc Intended journey of tho Czar
to Nova Tschorkask, to present his son
to the Cossacks as their chief, has been
prevented by tho discovery of a dyna
mite plot to assassinate tho imperial
Early. A Cossack officer and his
rothcr, the lattor being a student in
St. Petersburg, have been arrested in
connection with tho crime. They are
believed to bo Nihilist agents.
-Tho Senate vory graciously passed
Mr. Edmunds's resolution for him and
then proceeded very graciously to con
firm Mr. Cleveland's appointments for
him. Tho United States Senate is a
very obliging assembly.
Trees About tho House.
Otu: good tree will oftoll redeem a
piuco from ugliness. Nothing else can
give ru much grace ami beauty to home
surroundings. A house standing in a
ard in which there arc no trees, always
as an air of hoing unprotected. No
matter how fino tho building may bc, it
looks desolate and cheerless. There is
something companionable in a good
tree, and tt gives a more homelike char
acter to home. Hut many make tho
mistake of planting too many trees.
When we set small trees wc forget what
they will be in a few years, and we are.
likely to plant them too close together.
Most kinds grow too rapidly, anti soon
wc arc in a thicket. We havotOO much
shade. When tin? question comes up wo
lind it difficult to decide on which ono
to cut down, ami very likely we allow
them all to stand awhile longer, wait
ing for circumstances to decide the mat
ter. When wc do get around to thc
removal of sonni of them, almost always
we lind that all of them have suffered
from crowding, and those we at last de
cide to leave aro far from being tho
Symmetrical trees they might have been
if they had been given more room.
Another mistake is in planting trees
too near thc house. Wo do not look
ahead far enough to see what tin y will
be in a few years, and the result is, in
many casi>s, that, our windows are ob?
?cured hy branches, ami thc sunshine is
barred out. lt is well enough to have
moderate shade about the house, in cer
tain places, but wo do not want it every
where, or so much of it as to make
a perpetual gloom about thc place.
Therefore, let us make allowance for
growth and development. Wo can put
shrubs between them to take away the
vacant look. Lot thc rule which gov
erns tho distance between the trees ap
ply to ibo distance from the house, lt
is never tho number of trees about a
house that attracts us, but thc beauty of
each tree. One good one is a valuable
possession, while a dozen poor ones aro
as bad ns none. - E. E. lidford, in (he
American Harden.
A $25,000 statue is to bc erected at
Toledo in honor of thc late General
James II. Steadman.
THE LAURENS HAR.
JOHN C. HASKELL, N. U. DIAL,
Columbia, S. C. Laurens, S. C.
HASKELL & DIAL,
A T T O It N E Y S AT L A W,
LAURENS 0. H., S. C.
J. T. JOHNSON. W. lt BICIIKY.
JOHNSON & RICHEY,
ATTORNEY'S AT LAW,
OFFICE- Fleming's Corner, Northwest
side of l'ublic Square.
LAURENS C. H., S. C.
.LC. OAKLINGTON,
A T T O R N E Y A T L A W,
LAURENS C. II., S. C.
Office over W. M. Garrett's Store.
W. 0. BENET, K. P, M'OOWAN,
Abbeville. Laurens.
BENET ?& MCGOWAN,
ATTORNEYS AT LAW,
LAURENS c. H., s. c.
J. W. FERGUSON. GEO. F. YOUNO.
FERGUSON & YOUNG,
ATTORNEYS AT LAW,
LAUREN8 C. H., S. C.
lt. I?. TODD. W. H. MARTIN.
TODD & MARTIN,
A T T O R N E Y S AT LA W,
LAURENS 0. II., S. C.
N. J. HOLMES. II. Y. SIMPSON?
HOLMES & SIMPSON,
ATT? it NEYS A T L A W,
LAU REN 8 0. II., s. C.
Dr. W. H. BALL,
DENTIST.
OFFICE OYER WILKES' HOOK
AND DRUG STORE.
Office days-Mondays and Tuesdays.
LAURENS C. H., S.C.
SAVE
YOUR, MONEY
Hy buying your Drugsgand Medicines,
Fino Colognes, Paper and Envelopes,
Memorandum Hooks, Face Powdors,
Tooth Powders, Hair Brushes, Shav
ing Brushes, Whisk Brushes, Blacking
Brushes, Blacking, Toilet and Latin*
dry Soaps, Tea, Spico, Pepper, Ginger,
Lamps and Lanterns, Cigars, Tobacco
and Snufl', Diamond Dyes, and other
articles too Humorous to mention, at
thc NEW DRUG STORE.
Also, Turo Wines and Liquors, lor
medical purposes.
No troublo to BIIOW goods.
Respectfully,
B. F. POSEY & BRO.,
Laurens C. H., S.C.
August ft, 188ft. 1 ly
CINCINNATI
TYPE?FOUNDRY
- AND
PRINTING MACHINE WORKS,
201 VIM Street, CINCINNATI, 0.
Tte typo used on th!? paper WM ea* by tte
?tere foran! ry .-KD.
xml | txt
|
http://chroniclingamerica.loc.gov/lccn/sn93067760/1886-04-21/ed-1/seq-1/ocr/
|
CC-MAIN-2014-10
|
refinedweb
| 7,334
| 80.21
|
.NET, code, personal thoughts
A friend of mine told me, "what you know and what seems to as trivial, might be completely new to someone else". So I am trying to remember this, and once again the simple life wisdom proved to be correct. One of our team members had to be away while the team was conquering T/BDD and unit testing. As a result, he stayed a little behind, and as catch up exercise, we pared on a very simple problem, Calculator, another version of the classical "Hello World". Maybe this will help someone someday.
Calculator is capable of adding to numbers and return the result. Each time calculator performs an operation like Add, it should log it. Lets break it down
Calculator is the contract we are defining for creation. The component that will implement it is going to be the system under test. There is exactly one specification at this point, that Calculator is performing Add operation. We also have a few observations, such as "should add two numbers together and return the result", and "should log the operation". Visually (personally, I am an extremely visual person and need to visualize a lot) it look like this:
Our contract is simple. Do I start implementation just because I know precisely how it's going to be implemented? No. Why not? What's so difficult about adding two numbers and giving back the result?! (Normally it will sound like you trying to insult a person who's supposed to follow these steps). But wait till the end, we'll come back to this again.
Lets start the test, shall we? The test will drive out everything. Prior to this, I would like to mention how we as a team setup our environment, so development is streamlined and templated (no unnecessary friction). Normally, there will be a Build project to contain any utilities, 3rd party components, tools, etc. The rest are the code projects. Ad a team, we concluded that having separate test projects adds too much of a maintenance and can be eliminated by keeping tests along with the tested code. To differentiate between production code and test code we use naming conventions that allow easy filtering at sooner time by automated build script. Specifications for a single component are all locked under the "hood" of a single file - CoponentName_Specs. This allows very quick visual separation between the test code and the 'normal' code. It's also allows a better association between what is tested and where are the tests reside.
In order to create tests with less friction, we have our "abstraction" of testing tools (using MbUnit, Rhino.Mocks). Normally those are grouped in a sub-folder under Infrastructure.
ConcernAttribute - used for documentation generation (specs extraction)
AssertionExtensions - abstraction of MbUnit (also syntactical sugar)
RhinoMocksExtensions - abstraction of Rhino.Mocks (similar to above)
StaticContextSpecification - base specification class to create a framework for all the tests
ContextSpecification - extension of StaticContextSpecification for Contract driven tests
TimeBomb - a necessary evil we had to have to postpone a test implementation till a certain date/time
TimeBomb_Specs - everything has to have a test...
Now that we have seen what the "framework is" we know it's no more than just a few things that will save us typing time. The most interesting ones are StaticContextSpecification and ContextSpecification.
1: [TestFixture]
2: public abstract class StaticContextSpecification
3: {
4: [SetUp]
5: public void setup()
6: {
7: establish_context();
8: because();
9: }
10:
11: [TearDown]
12: public void tear_down()
13: {
14: after_each_specification();
15: }
16:
17: protected abstract void because();
18: protected abstract void establish_context();
19: protected virtual void after_each_specification()
20: {
21: }
22:
23: protected InterfaceType dependency<InterfaceType>()
24: {
25: return MockRepository.GenerateStub<InterfaceType>();
26: }
27: }
Some use for dependency Mock, our team has reached the conclusion that by default we should be using Stub, and only in cases when it's really needed turn to Mock. See documentation provided by Oren Eini on this.
1: public abstract class ContextSpecification<SystemUnderTestType> : StaticContextSpecification
2: {
3: protected SystemUnderTestType system_under_test;
4:
5: protected abstract SystemUnderTestType create_system_under_test();
6: }
All the underscores is an adopted style quiet popular among TDD/BDD practitioners and frankly speaking feels extremely natural once you get used to the concept AND get to know about AutoHotKey utility and how to use it in conjunction with test-related names. Steven Harman has a good post about it. (Ismaël, hold on, I am almost done with the script for your name:)
Lets get to the business - specification for calculator. First - definition of concern. ReSharper is the tool you have to use. No ReSharper (R#), no deal. You can try something else, and if you find better, let me know. So far this is #1 for our team.
Remember we said that test will drive everything, even if it's a dead simple task - so it's happening. Since we specified the concern, R# will assist us to create it.
The testing framework we put in place will ensure that the contract for the component we are concerned about is generated as well, forcing the component to implement that specific contract.
This is great! Now system_under_test is always expressed by the contract. Anything we define/do on it, is affecting the contract, driving out the design of the component that implements it. I.e., we shape the contract to make it usable and well designed, and component is just the implementation of that contract.
Establishing context at this point is very simple. Though, this code smells a bit and it probably will be replicated multiple times for each specification. We will refactor it later, so this becomes an optionaltemplate method with default behavior to instantiate system_under_test.
Why we are going to have an observation? Because some behavior on system_under_test has happened. Again, Add behavior is not defined. We will add it leveraging R#, and this will go into the Contract, not the implementation. But contract will force implementer to have it as well.
And this is where it's shockingly simple and yet confusing a lot, we don't implement the behavior and let the exception be thrown. Why? The test should fail, then be fixed. Red-Green-Refactor. That's the rhythm, and it's good.
To someone who's not used to this it looks ridiculous. "Why would someone do this silly thing when I know exactly what to return - what's the point". The point that every complex thing starts from something simple. We are not just creating tests here, we are documenting the code, shaping our architecture, go through the issues from the user perspective (usability). It might look like a wasted effort at this point, but down the road it pays off big time. OK, lets refactor result to be a member field, rename the specification to something that is more meaningful than Calculator_Specs, such as "When_calculator_is_asked_to_add_two_numbers", and define an observation (Our team uses Gallio addon for Visual Studio.NET to run the tests and unfortunately, ObservationAttribute is not picked up by Gallio as we haven't found what in MbUnit v3 would be equivevalent to the TestPatternAttribute from MbUnit v2.4. In case you know the solution, would appreciate your help)
Lets run the test
It fails - good. What's good? Is that we need to 'fix' it, i.e. implement and bring to the green. We also keep in mind that we do the simplest thing to pass. This is so tough on people who are absolutely new to the testing, to the point where you sit in front of the line to implement, overwhelmed with all the going on, thinking that there must be a catch, it's not as simple as it seems. I loved this type of exercise JP gave at his course. BTW, if you haven't heard about Nothin But .NET bootcamp, you are living a life or a mort. Google it, save for it, and do it. Regardless of your skills level, you will NOT regret. And yes, you get your money back in a HUGE satisfaction after and a complete change in how you do things for better. Especially if you are getting tired of development because it just "doesn't do it to you" as it used before - get your second breath and self re-invention at his course. So simple thing first...
Run the test - green. Good. Is it? Let's break in the simplest possible way (not that it's hard).
Breaking. But wait a second, what is breaking? No, not the system_under_test, it's our test is wrong. The lesson is that tests have to be clean and simple, or they are not a tool to assist, but another impediment in the future, and eventually destined to be abandoned. How about extracting those magical numbers with constants?
Re-running the test will still be breaking, but now we are a 100% confident that this is the system_under_test that is breaking. Lets fix it.
Passing again and now we know it's not a hard-coded value, but actual calculation. This is our first observation for this specification that exercises state based testing of the component.
How about the second one, "Should_log_the_operation"? Now we getting more into Dependency Injection and interaction testing. We don't want to create the actual logger, but we want to shape and form the contract and verify our Calculator works with the logger the way we will design it. A mocking library is a must at this point. Logger is a dependency to the Calculator. We shall inject it upon creation of Calculator.
Once again, because we are doing this from test, we will be forced to define a contract for our logger, ISomeLogger, and refactor the constructor of Calculator to be able to accept it.
Again it seems obvious what has to be done, but fight the tempt of doing the evil, resist it and go back to the test. Why? Because we want to document, we want to make sure that it fails first and our implementation is based on the test, and not vice versa, to shape the logger contract before we anything else.
We also setup and expectation that logger will be used and it's Log method will be called with a parameter "add". This is probably the best documentation I, personally, have seen ever done for a code. This is one of so many reasons why you want to have the tests in place. So we run it and it fails. Why?
Error massage shows us that "System.InvalidOperationException: The object '' is not a mocked object." - Ops, right, we are passing in logger, into Calculator constructor, but it's nothing. It's our dependency, let's stub it.
Fails again, but now the error message gives us direction to the next step that we are supposed to take "Rhino.Mocks.Exceptions.ExpectationViolationException: Expected that ISomeLogger.Log("add"); would be called, but it was not found on the actual calls made on the mocked object.". Let's fix it and run the tests again.
This time the assertion passes and tests are all green.
This observation was an interaction based test. We were not trying to define how logger will get implemented, we deferred that till the last possible moment. Did just enough to get this going - a contract. Implementation will depend on actual requirements. Calculator is capable of logging, we ensured well enough that it's documented and traceable in case Calculator changes introduce some breaking code.
Now the problem of creating system_under_test and establishing context - that can be refactored to remove the smell and remove code duplication:
1: public abstract class context_for_calculator : ContextSpecification<ICalculator>
3: protected ISomeLogger logger;
5: protected override ICalculator create_system_under_test()
7: logger = dependency<ISomeLogger>();
8: return new Calculator(logger);
11: protected override void establish_context()
12: {
13: system_under_test = create_system_under_test();
14: }
15: }
17: [Concern(typeof(Calculator))]
18: public class When_calculator_is_asked_to_add_two_numbers : context_for_calculator
19: {
20: private const double first_number = 8.0;
21: private const double second_number = 3.0;
22: private const double sum_of_first_number_and_second_number = first_number + second_number;
23: private double result;
24:
25: protected override void because()
26: {
27: result = system_under_test.Add(first_number, second_number);
28: }
29:
30: [Test]//[Observation]
31: public void Should_return_the_sum_of_two_numbers()
32: {
33: result.should_be_equal_to(sum_of_first_number_and_second_number);
34: }
35:
36: [Test]//[Observation]
37: public void Should_log_the_operation()
38: {
39: logger.was_told_to(l => l.Log("add"));
40: }
41: }
Now another member of the team, Terry, looks at it and says "ahh, now it feels good".
I hope this was helpful to someone who's trying to make any sense out of testing. It is funny how I was telling my son again and again to my 5 years old son "do one thing at a time, but do it well", when myself was not following this basic rule. Test one thing at a time, and test it well. This will lead you to the system that is written in such a manner you will enjoy working with it, regardless how difficult the domain problem is.
Code for download
The Required Attribute is TestMethodPatternAttribute and can be found in the namespace Gallio.Framework.Pattern. You have to reference to the Gallio Assembly
@Rainer,
thank you for the tip. I tried that before, and it's not working. Gallio doesn't seem to like it (no icon on the left bar). I had to switch to TestDriven.NET in order to
A)have this going
B)run test(s) faster
More than a year ago, I have posted a blog entry related to what I was trying to implement in one of
|
http://weblogs.asp.net/sfeldman/archive/2008/12/12/quot-hello-world-quot-tdd-style.aspx
|
CC-MAIN-2013-20
|
refinedweb
| 2,253
| 55.03
|
Hello,
I'm having trouble decoding a base64 encoded string to an image in Swift. I've tried with a few different sets of data but they all don't seem to decode properly, as the results are always
nil.
After quite a bit of reasearch, I've concluded that the string needs to be decoded into
Data, create an image from that data and set a
UIImageView's image to it. Simple enough, right?
let base64String: String = ...let decodedData: Data = Data(base64Encoded: base64String, options: [])let decodedImage: UIImage = UIImage(data: decodedData)myImageView.image = decodedImage
However, after all my various attempts, the data ends up being
nil, and I'm unable to create the image.
I have a feeling it might be the data that I'm using, but online conversion tools seem to have no problem using it. See below for a sample of my data and a website that I use for conversion.
String example /Online converter / Actual image
I am trying to decode a value which is encoded in jsp using $base64.encode method. The encoded value is Sk9Tw4kgQ0FSTE9TIE1FTkRPWkEgSEVSTkFOREVasbdOOhVeI_I_ and I am using below code to decode
public class Test { private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray(); private static final int[] IA = new int[256]; static { Arrays.fill(IA, -1); for (int i = 0, iS = CA.length; i < iS; i++) IA[CA[i]] = i; IA['='] = 0; } public static void main(String[] args) { System.out.println(decode("Sk9Tw4kgQ0FSTE9TIE1FTkRPWkEgSEVSTkFOREVasbdOOhVeI_I_")); } public final static String decode(String str) { // Check special case int sLen = str != null ? str.length() : 0; if (sLen == 0) return null; //Remove last 12 characters str = str.substring(0, str.length()-12); sLen = str.length(); // Count illegal characters (including '\r', '\n') to know what size the returned array will be, // so we don't have to reallocate & copy it later. int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. if (IA[str.charAt(i)] < 0) sepCnt++; // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. if ((sLen - sepCnt) % 4 != 0){ return null; } // Count '=' at end int pad = 0; for (int i = sLen; i > 1 && IA[str.charAt(--i)] <= 0;) if (str.charAt(i) == '$') pad++; int len = ((sLen - sepCnt) * 6 >> 3) - pad; byte[] dArr = new byte[len]; // Preallocate byte[] of exact length for (int s = 0, d = 0; d < len;) { // Assemble three bytes into an int from four "valid" characters. int i = 0; for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. int c = IA[str.charAt(s++)]; if (c >= 0) i |= c << (18 - j * 6); else j--; } // Add the bytes dArr[d++] = (byte) (i >> 16); if (d < len) { dArr[d++]= (byte) (i >> 8); if (d < len) dArr[d++] = (byte) i; } } return new String(dArr); }}
The orginal value that I am encoding is JOSÉ CARLOS MENDOZA HERNANDEZ which has non printable character. when I use for decoding it produce the correct output but the above code generate JOSÉ CARLOS MENDOZA HERNANDEZ as output which is not correct please help thanks in advance
I am trying to first select pdf file, then encode it to base64 and save it to shared preference. After that, decode and save to pdf. And open that pdf to view.
When opening it displays message "This document cannot be opened". It looks like there was some problem on encoding/decoding part. I don't know where. So, if anyone has idea on it, It would be great help for me. Thanks,
My code is as follows:
Encoding :
public static String getBase64Pdf(String pdfFilePath){ try{ InputStream inputStream = new FileInputStream(pdfFilePath); byte[] byteArray = IOUtils.toByteArray(inputStream); String encodedPdfString = Base64.encodeToString(byteArray, Base64.DEFAULT); PrintLog.showTag(TAG,"pdf converted to string : " + encodedPdfString); return encodedPdfString; }catch (IOException e){ } return "";}
Decoding, saving to file and open pdf :
private void openPdfViewer(){ try{ PrintLog.showTag(TAG,"== opnPdfViewer & length of base64 string is ==" + sessionManager.getBase64ProofImage().length()); //== decode and write file here String base64pdf = sessionManager.getBase64ProofImage();//gets base64 from shared preference final File newFilePath = new File(getActivity().getFilesDir(), "warrantyProof.pdf"); byte[] pdfAsBytes = Base64.decode(base64pdf, Base64.NO_WRAP); FileOutputStream os; os = new FileOutputStream(newFilePath, false); os.write(pdfAsBytes); os.flush(); os.close(); //==== open pdf file here File file = new File(getActivity().getFilesDir(),"warrantyProof.pdf"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); }catch (IOException e){ PrintLog.showException(TAG,"IO exception saving pdf ",e); } catch (Exception e){ PrintLog.showException(TAG,"exception opening pdf",e); }}
There are many string to bytes conversion question about Python 3 on Stackoverflow, each one treating slightly different cases, and as I couldn't find this specific one, I'll answer my own question here.
Some fields of a webservice, e.g. those that transport files like a PDF document, may do that base64 encoded.
It Python 2 this did work:
with open(filepath, 'w') as file_: file_.write(my_content.decode('base64'))
Now, in Suds on Python 3 the equivalent would be:
from base64 import b64decodefile_.write(b64decode(my_content))
But this results in an error:
a bytes-like object is required, not 'Text'.
I need to decode a base64 encoded string.
I need to do it with PHP.
The
base64_decode() does not do the job.
I tried with:
base64_decode(strtr($data, '-_,', '+/='));
...it only works sometimes.
The same happens with:
base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
I really do not know how to approach this.
UPDATE:
The data comes from an attached file via GMAIL API.
I save it into the DB, utf8mb4 TEXT field.
I do
mysqli -> real_escape_string() before inserting.
Then I extract it from the DB as $data.
Σπίτι - Χάρτης - Μυστικότητα - Σύνδεσμοι - Copyright © 2017.
|
http://www.convertstring.com/el/EncodeDecode/Base64Decode
|
CC-MAIN-2017-47
|
refinedweb
| 972
| 58.58
|
On Sun, 26 Feb 2012 19:47:49 +1100, Ben Finney wrote: >> An integer variable is a variable holding an integer. A string variable >> is a variable holding a string. A list variable is a variable holding a >> list. > > And Python has none of those. Its references don't “hold” anything. Ah, but they do. Following the name binding: x = 1 the name "x" now holds a reference to an int, or if you want to cut out one layer of indirection, the name "x" holds an int. That is to say, the value associated with the name "x" is an int. I don't believe this is a troublesome concept. > I appreciate that you think “variable” is a useful term in Python, but > this kind of mangling of the concept convinces me that it's not worth > it. I'm not sure that there is any mangling here. Or at least, the concept is only mangled if you believe that Pascal- or C-like variables (named memory locations) are the one true definition of "variable". I do not believe this. Words vary in their meanings, pun not intended, and in the same way that the semantics of classes in (say) Java are not identical to the semantics of classes in Python, so I think that it is perfectly reasonable to talk about Python having variables, implemented using bindings to objects in a namespace, even though the semantics of Python variables is slightly different from that of C variables. Fundamentally, a variable is a name associated with a value which can vary. And Python name bindings meet that definition no less than C fixed memory locations. > Python doesn't have variables, and even if you want to say “variables” > when you mean “references”, there's no such thing as a “string variable” > etc. in Python. References don't have types, so its needlessly confusing > to perpetuate that kind of thinking. But objects have types, and it makes sense to state that the type of the name is the type of the object bound to that name, at least for the duration of the binding. That's exactly what we write in Python: type(x) tells us the type of x, whatever x happens to be. There's no implication that it is the type of the *name* x, since names are not typed. More importantly, while Python doesn't have static types, in real code, names generally are expected to be bound to objects of a particular type (perhaps a duck-type, but still a type). It is rare to have code including a name bound to *anything at all* -- the main counter-example I can think of is the id() function. Generally, names are expected to be bound to a specific kind of value: perhaps as specific as "a string", or as general as "an iterable", or "anything with a __add__ method", but nevertheless there is the expectation that if the name is bound to something else, you will get an error. A compile time error in C, a runtime error in Python, but either way, the expectation is that you get an error. In an example like this: def spam(some_string): return some_string.upper() + "###" I maintain that it is reasonable to say that "some_string is a string variable", since that expresses the programmer's intention that some_string should be bound to string objects (modulo duck-typing). If Python were statically typed, then passing some_string=42 would cause a compile-time error. In Python, you get a runtime error instead. I don't believe this invalidates the idea that some_string is intended to be a string. Or to make this painfully complete: some_string is a name linked to a value which can vary (hence a variable) intended to be limited to strings (hence a string variable). Python may not enforce this to the same extent as C or Haskell or Pascal, but the concept still holds. -- Steven
|
https://mail.python.org/pipermail/python-list/2012-February/620447.html
|
CC-MAIN-2019-51
|
refinedweb
| 658
| 68.3
|
This post is by Raymond Laghaeian, a Senior Program Manager on Microsoft Azure Machine Learning.
The support for R in Azure ML allows you to easily integrate existing R scripts into an experiment. From there, you are just a couple of clicks away to publishing your script as a web service. In this post, we walk you through the steps needed to accomplish that. We will then consume the resulting web service in an ASP.NET web application.
Create New Experiment
First, we create a new experiment by clicking on “+New” in the Azure ML Studio and selecting Blank Experiment. We then drag the Execute R module and add it to the experiment, as shown below:
Figure 1: Execute R module added to the experiment
Add the Script
We next click in the R Script Property in the right pane, delete the existing sample code, and paste the following script:
a = c("name", "Joe", "Lisa")
b = c("age", "20", "21")
c = c("married", TRUE, FALSE)
df = data.frame(a, b, c)
#Select the second row
data.set = df[2,]
# Return the selected row as output
maml.mapOutputPort("data.set");
The resulting experiment looks as follows:
Figure 2: Adding R script to the module
Publish the Web Service
To publish this as a web service, we drag the Web service output from the lower left pane and attach it to the right output of the Execute R Script module. You can use the Web Service view switch to toggle between experiment and web service flows.
Figure 3: Web Service Setup
We next click Run, and upon completion, click the Publish Web Service button when it becomes enabled (bottom of the screen). We next click Yes twice to publish the web service.
After the Web Service is published, its Dashboard will be displayed with the API Key and a Test link to call the Request Response Service (RRS):
Figure 4: Web Service Dashboard
Test the Web Service
To test the web service, we click on the Test link for the Request Response service, and on the checkmark on the dialog (“This web service does not require any input”).
Note the result on the bottom of the screen. Clicking the Details button will show the row we had selected in the dataset returned in the API response.
Figure 5: Web Service call result showing R script output
Create an ASP.Net Client
To consume the web service in an ASP.Net web application, we start Visual Studio and create a new ASP.Net Web Application (File -> New Project -> ASP.Net Web Application). In the Name field, we type in R Web Service Client.
Figure 6: Create an ASP.NET Web Application project
In the new ASP.NET Project window, we select Web Forms, then click OK.
Next, in the Solution Explorer window, we right click on the project name (R Web Service Client) and add a new Web Form. When prompted for the name, we name it CallR.
Set Up the UI
In CallR.aspx, we paste the following code in the <div> tag (between <div> and <div/>).
<h1>R Web Service client</h1>
<asp:Label</asp:Label><br />
<asp:Button<br />
<p />
<asp:Label</asp:Label>
Setup the Code to Call Your Web Service
The code for this section is copied from the C# sample code on the API help page for RRS (see Figure 4 above) with some modifications for ASP.NET. First, as described at the top of the sample C# code, we install Microsoft.AspNet.WebApi.Client. We then add the following “using” statements:
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
Next, in the code view of the page (CallR.aspx.cs), we add a button-click event:
protected void Button1_Click(object sender, EventArgs e)
{
InvokeRequestResponseService().Wait();
}
We next add the following method below the Button1_Click event.
async Task InvokeRequestResponseService()
{
using (var client = new HttpClient())
{
ScoreData scoreData = new ScoreData()
{
FeatureVector = new Dictionary<string, string>() {},
GlobalParameters = new Dictionary<string, string>(){}
};
ScoreRequest scoreRequest = new ScoreRequest()
{
Id = "score00001",
Instance = scoreData
};
//Set the API key (Use API key for your web service – see Firgure 4)
const string apiKey = "a4C/IkyCy6N4Gm80aF6A==";
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
client.BaseAddress = new Uri("");//Replace with your web service URL from C# Sample code of the API help page for RRS
HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
string result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Label1.Text = "Result: " + result;
}
else
{
Label1.Text = "Failed with status code: " + response.StatusCode;
}
}
}
Finally, add the following two classes after the Partial Class CallR.
public class ScoreData
{
public Dictionary<string, string> FeatureVector { get; set; }
public Dictionary<string, string> GlobalParameters { get; set; }
}
public class ScoreRequest
{
public string Id { get; set; }
public ScoreData Instance { get; set; }
}
The class should now look like this:
Run the Application
We then run the application (F5) and click on the Call Web Service button to get the results:
If you got this far, we hope you enjoyed reading this post! To quickly summarize, using Azure ML, it is easy to create a web service from an R script and consume it in an ASP.NET web application – just as this example demonstrated.
Raymond
Contact me on twitter. Get started with Azure ML at the Machine Learning Center.
This example would have been way more useful if it would have had an input
|
https://blogs.technet.microsoft.com/machinelearning/2015/02/12/building-web-services-with-r-and-azure-ml/
|
CC-MAIN-2019-22
|
refinedweb
| 904
| 64.3
|
--- Nicola Ken Barozzi <nicolaken@supereva.it> wrote:
>
> ----- Original Message -----
> From: "Giacomo Pati" <pati_giacomo@yahoo.com>
> To: <cocoon-dev@xml.apache.org>
> Sent: Thursday, September 07, 2000 8:48 AM
> Subject: Re: [Cocoon Devel] Re: [C2] UML Class Diagram for SiteMap
>
> > I've written a stylesheet that presents the sitemap as a html page.
> > I'll want to write an admin app (using C2 of course) for?
>
> Hmmm... In my Transformer (class) the namespaces are called correctly
> with
> Xerces 1.2 and with 1.1.3 are called but give an exception at the
> end, so
> I'm not sure it's the FileGenerator, maybe it's the Serializer that
> kicks them off.
You're right. I've used the LogTransformer now to see what the
FileGenerator outputs. And the output seems to be ok. But why does the
simple-sitemap2html.xsl not match _any_ template ???! Mail - Free email you can access from anywhere!
|
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200009.mbox/%3C20000907075203.23550.qmail@web6203.mail.yahoo.com%3E
|
CC-MAIN-2015-22
|
refinedweb
| 153
| 69.58
|
Author:?
A better question in the case of this book is, how is it different from the previous edition? The book has actually shrunk in number of pages and although it has exactly the same number of chapters they are now arranged in eight sections rather than the previous seven.
Let's account for the missing pages first. The previous edition had two appendixes, a 50-page one on Windows Forms and some 20 pages on Platform-Independent .NET Development with Mono. This material already had the status of something that didn't fit within the main body of the text and it's unlikely to be missed.
Looking at the revised structure, Troelsen has grouped four of the pre-existing chapters:
into a new Part III Object-Oriented Programming with C# but with very few changes to their content.
Two of the chapters in Part IV: Advanced C# Programming have seen extensive changes. Chapter 9: Collections and Generics now opens with an additional section explaining "the motivation of Collection classes" which looks at the System.Collections namespace. Chapter 11: Advanced C# Language Features has been slimmed down. For example, it no longer covers methods using the partial keyword. This seems a sensible simplification as this was never widely used.
Part V: Programming with .NET Assemblies and while its opening Chapter 14 has been re-tittled to "Building and Configuring Class Libraries" but otherwise has only a few changes. The rest of this part is virtually unchanged.
If you are looking for new inclusions, C# 5.0 introduced the async and await keywords and these are duly covered in Chapter 19: Multithreaded, Parallel, and Async Programming, which is at the start of Part VI: Introducing the .NET Base Class Libraries.
This encyclopedia tome isn't just on C# its also about the .NET Framework and another major new sections are in the chapter on Windows Workflow where there's a extended project to create an Activity Library. On the other hand the section of the book on Windows Presentation Foundation (Part VII) has been slimmed down by removing a project. The final part of the book is still on ASP.NET Web Forms and is pretty much unchanged.
Having examined the differences from the previous version what else do you need to know about this book?
While this isn't suitable for the complete beginner to programming it would make a good tutorial text for the novice C# programmer willing to learn the ideas and not just the how-tos.
Having covered the basics it goes into some esoteric topics concerned with deployment and packaging including cross-language programming, reflection and so on. It then explores CIL (Common Intermediate Language) and using the assembler and the disassembler; the .NET dynamic language runtime, threading and parallel programming using PLINQ. There are number of chapters on database both traditional ADO style and entity framework style, plus introductions to WCF (Windows Communication Foundation), WF (Windows Workflow Foundation and WPF (Windows Presentation Foundation). The final part of the book deals with ASP .NET and related web technologies and, given the size of the subject, provides a good introduction. These chapters are aimed at the expert C# programmer who isn't so expert at the technologies being discussed.
Troelsen has a tendency to explain things via examples rather than principles but as the examples are all fairly short and understandable this works quite well, especially as the source code for the book is available online and there are pointers to it included where appropriate.
This book's revised structure is an improvement but if you already have a copy of the previous edition, and it hasn't self-destructed due to the difficulties of handling such a huge tome, there's not enough new material to merit a new outlay.
If you don't own the previous edition, the summing up from our previous review still holds: doesn't.?
|
http://i-programmer.info/bookreviews/2-csharp/5504-pro-c-50-and-the-net-45-framework-.html
|
CC-MAIN-2015-35
|
refinedweb
| 654
| 53.21
|
Why Cypress
Cypress is a great E2E testing tool. Here are a few great reasons to consider it:
- Isolated installation possible.
- Ships with TypeScript definitions out of the box.
- Provides a nice interactive google chrome debug experience. This is very similar to how UI devs mostly work manually.
- Has command - execution seperation which allows for more powerfull).
Installation
The steps provided in this installation process will give you a nice
e2efolder that you can use as boiler plate for your organization. You can just copy paste this
e2efolder into any existing projects that you want to test with cypress.
Create an e2e directory and install cypress and its dependencies for TypeScript transpiling:
mkdir e2e cd e2e npm init -y npm install cypress webpack @cypress/webpack-preprocessor typescript ts-loader.
Setup TypeScript
tsconfig.json e.g.
{ "compilerOptions": { "strict": true, "sourceMap": true, "module": "commonjs", "target": "es5", "lib": [ "dom", "es6" ], "jsx": "react", "experimentalDecorators": true }, "compileOnSave": false }
Do a first dry run of cypress to prime the cypress folder structure. The Cypress IDE will open. You can close it after you see the welcome message.
npx cypress open
Setup cypress for transpiling typescript by editing
e2e/cypress/plugins/index.js to match the following:
const wp = require('@cypress/webpack-preprocessor') module.exports = (on) => { const options = { webpackOptions: { resolve: { extensions: [".ts", ".tsx", ".js"] }, module: { rules: [ { test: /\.tsx?$/, loader: "ts-loader", options: { transpileOnly: true } } ] } }, } on('file:preprocessor', wp(options)) }
Optionally add a few scripts to the
e2e/package.json file:
"scripts": { "cypress:open": "cypress open", "cypress:run": "cypress run" },
More description of key Files
Under the
e2e folder you now have these files:
/cypress.json: Configure cypress. The default is empty and that is all you need.
/cypressSubfolders:
/fixtures: Test fixtures
- Comes with
example.json. Feel free to delete it.
- You can create simple
.jsonfiles that can be used to provide sample data (aka fixtures) for usage across tests.
/integration: All your tests.
- Comes with an
examplesfolder. You can safely delete it.
- Name tests with
.spec.tse.g.
something.spec.ts.
- Feel free to create tests under subfolders for better organization e.g.
/someFeatureFolder/something.spec.ts.
First test
- create a file
/cypress/integration/first.spec.tswith the following contents:
/// <reference types="cypress"/> describe('google search', () => { it('should work', () => { cy.visit(''); cy.get('#lst-ib').type('Hello world{enter}') }); });
Running in development
Open the cypress IDE using the following command.
npm run cypress:open
And select a test to run.
Running on a build server
You can run cypress tests in ci mode using the following command.
npm run cypress:run
Tip: Sharing code between UI and test cy.get(`#${Ids.username}`) .type('john')
Tip: Creating Page Objects page.visit(); page.username.type('john');
Tip: Implicit assertion
Whenever a cypress command fails you get a nice error (instead of something like
null with many other frameworks) so you fail quickly and know exactly when a test fails e.g.
cy.get('#foo') // If there is no element with id #foo cypress will wait for 4 seconds automatically // If still not found you get an error here ^ // This \/ will not trigger till an element #foo is found .should('have.text', 'something')
Tip: Explicit assertion
Cypress ships with quite a few assertion helps for the web e.g. chai-jquery. You use them with
.should command passing in the chainer as a string e.g.
cy.get('#foo') .should('have.text', 'something')
Tip: Commands and Chaining
Every function call in a cypress chain is a
command. The
should command is an assertion. It is conventional to start distinct category of chains and actions seperately e.g.
// Don't do this cy.get(/**something*/) .should(/**something*/) .click() .should(/**something*/) .get(/**something else*/) .should(/**something*/) // Prefer seperating the two gets cy.get(/**something*/) .should(/**something*/) .click() .should(/**something*/) cy.get(/**something else*/) .should(/**something*/)
Some other libraries evaluate and run the code at the same time. Those libraries force you to have a single chain which can be nightmare to debug with selectors and assertions minggled in.
Cypress commands are essentially declarations to the cypress runtime to execute the commands later. Simple words: Cypress makes it easier.
Tip: Using
contains for easier querying
The following shows an example:
cy.get('#foo') // Once #foo is found the following: .contains('Submit') // ^ will continue to search for something that has text `Submit` and fail if it times out. .click() // ^ will trigger a click on the HTML Node that contained the text `Submit`.
Tip: Waiting for an HTTP request cy.visit('/') // wait for the call cy.wait('@load') // Now the data is loaded
Tip: Mocking an HTTP request response
You can also easily mock out a request response using
route:
cy.server() .route('POST', '', /* Example payload response */{success:true})
Tip: Mocking time');
Tip: Smart delays and retries
Cypress will automatically wait (and retry) for many async things e.g.
// If there is no request against the `foo` alias cypress will wait for 4 seconds automatically cy.wait('@foo') // If there is no element with id #foo cypress will wait for 4 seconds automatically and keep retrying cy.get('#foo')
This keeps you from having to constantly add arbitrary timeout (and retry) logic in your test code flow.
Tip: Unit testing application code
You can also use cypress to unit test your application code in isolation e.g.
import { once } from '../../../src/app/utils'; // Later it('should only call function once', () => { let called = 0; const callMe = once(()=>called++); callMe(); callMe(); expect(called).to.equal(1); });
Tip: Mocking in unit testing
If you are unit testing modules in your application you can provide mocks using
cy.stub e.g. if you want to ensure that
navigate is called in a function
foo:
foo.ts```ts import { navigate } from 'takeme';
export function foo() { navigate('/foo'); }
* You can do this as in `some.spec.ts`: ```ts /// <reference types="cypress"/> import { foo } from '../../../src/app/foo'; import * as takeme from 'takeme'; describe('should work', () => { it('should stub it', () => { cy.stub(takeme, 'navigate'); foo(); expect(takeme.navigate).to.have.been.calledWith('/foo'); }) });
Tip: Breakpointstatement in your application code and the test runner will stop on that just like standard web developement.
- Test code breakpoints: You can use the
.debug()command and cypress test execution will stop at it. Alternatively you can use a
debuggerstatement in a
.thencommandyou can click on the
getin the command log to automatically
console.logany information you might need about the
.get('#foo')command (and similarly for any other commands you want to debug).
Tip: Start server and test" } }
Resources
-):
|
https://basarat.gitbooks.io/typescript/content/docs/testing/cypress.html
|
CC-MAIN-2019-04
|
refinedweb
| 1,083
| 59.19
|
The structure of a C program is nothing but the way of framing the group of statements while writing a C program. We put the general structure of a C program first as shown below:
[preprocessor directives]
[global declarations]
returning_type main( )
{
[Declaration Section (local)]
[Executable Section]
}
[User defined functions]
Note : The bold faced characters such as main( ) in one line along with the left parenthesis '(' and the right parenthesis ')' should be typed as they are. The Declaration section and Executable section enclosed within '{' and '}' is called the body of the main function. The data or value returned by the function main( ) is indicated by' returning_type'. Normally main( ) doesn't return any value. So, the returning type void is used. The function main( ) can be preceded by global declarations and preprocessor directives.
Preprocessor directives : The preprocessor statements starts with '#' symbol. These statements instruct the compiler to include the specified file in the beginning of the program. One important point about preprocessor directives is that these statements are never terminated by ';' for example,
#include<stdio.h> /* Only one file is permitted for one #include */
#include<math.h>
are the files that the compiler includes into the user program. These two files "stdio.h" and "math.h" are called header files and hence the extension '.h' . Using the preprocessor directive the user can define the constant. For example,
#define SIZE 100 /*Only one constant can be defined using one #define */
#define N 50
Here , Size and N are called symbolic constants. Their value is not changed during program execution.
Global declarations: The variables that are declared before all the functions are called global variables. All the functions can access these variables. By default the global variables are initialized with '0'.
main( ) : Each and every C program should have a function main( ) and there should be one and only one function by name 'main( )' . This function is always executable first. The function main( ) may call other functions. The statements enclosed within left and right curly braces are called body of the function main( ).
Declaration section : The local variables that are to be used in the function main( ) should be declared in the declaration section. The variables declared are identified as identifiers by the C compiler. The variables can also be initialized. For example, consider the declarations shown below:
int sum=0 ; /* The declared variables is initialized to 0 */
int a; /* The declared variable contains garbage(unwanted) value */
float b,c,d; /* More than one variables can be declared by single statements */
Executable section : This section contains the building blocks of the program. The blocks containing executable statements represent the directions given to the processor to perform the task. A statements may represent an expression to be evaluated, input/output operation , assignment operation, etc. The statements may be even control statements such as if statements , for statement , while statement,do-while statement,etc. Each executable statement of a block should end with a ';' .The symbol ';' is also called as statement terminated or separator.
User defined functions: This is the last optional section of the program structure. The functions written by the user to perform particular or special task are called defined functions. These are called as sub-programs. the basic structure of the user defined function resembles that of the function main( ).
Now, let us write a small program to display the message " dotprogramming":
#include <stdio.h>
main( )
{
printf("dotprogramming");
}
|
https://dotprogramming.blogspot.com/2016/01/structure-of-c-program.html
|
CC-MAIN-2016-50
|
refinedweb
| 565
| 57.57
|
std::rand
Returns a pseudo-random integral value between 0 and RAND_MAX (0 and
RAND_MAX included). implementation-defined which functions do so.
It is implementation-defined whether
rand() is thread-safe.
[edit] Parameters
(none)
[edit] Return value
Pseudo-random integral value between 0 and RAND_MAX.
[edit])
[edit] Example
#include <cstdlib> #include <iostream> #include <ctime> int main() { std::srand(std::time(nullptr)); // use current time as seed for random generator int random_variable = std::rand(); std::cout << "Random value on [0 " << RAND_MAX << "]: " << random_variable << '\n'; // roll 6-sided dice 20 times for (int n=0; n != 20; ++n) { int x = 7; while(x > 6) x = 1 + std::rand()/((RAND_MAX + 1u)/6); // Note: 1+rand()%6 is biased std::cout << x << ' '; } }
Possible output:
Random value on [0 2147483647]: 726295113 6 3 6 2 6 5 6 3 1 1 1 6 6 6 4 1 3 6 4 2
|
https://en.cppreference.com/w/cpp/numeric/random/rand
|
CC-MAIN-2020-50
|
refinedweb
| 145
| 50.46
|
TypeScript is a new Microsoft offering that seeks to change the way we write JavaScript. As the name implies, TypeScript associates a strongly typed layer in conjunction with JavaScript. TypeScript also associates an object-oriented layer with JavaScript.
If you are experienced with JavaScript, you know that it is neither strongly typed nor object oriented. Rather, JavaScript is a dynamic language that is functional in nature. For the C# or Visual Basic Developer, there can be significant challenges with JavaScript such as defining interfaces and classes, declaring integers, strings, and other variables, and enforcing that integrity.
In JavaScript, you don’t define classes and interfaces. Rather, objects are declared and through prototyping, Object Oriented inheritance can be achieved. Every variable is defined with the var keyword. A variable can easily mutate from string to integer to date. In JavaScript, you can declare a function that does not take arguments and call that function with arguments.
None of this is to say that through JavaScript you can’t enforce rules via custom code. With TypeScript, you can write declarative code to enforce rules. For example, if a variable is supposed to be a string, you can declare it as such in TypeScript. There is no such strong typing with JavaScript. If your code attempts to assign an integer value to that same variable, the TypeScript Compiler catches and reports that error. That’s an experience C# and Visual Basic developers can relate to, where the compiler caught such type mismatch errors. Pure JavaScript does not catch such an error until the code is executed, (assuming the operation you were employing could only be performed on a string). In this article, I will introduce you to simple examples that will help you get started with TypeScript.
Do You Really Need TypeScript?
You may be thinking that TypeScript is just syntactic sugar that compiles to JavaScript and that you should just stick to and learn JavaScript. Remember: TypeScript IS NOT a replacement for JavaScript.
TypeScript compiles to pure JavaScript but that isn’t a license for ignorance of how JavaScript works. The code that ultimately runs is pure JavaScript, and for that reason, you still need to understand how JavaScript works. When you are ready to take the plunge, I highly recommend the book “Secrets of the JavaScript Ninja” by John Resig and Bear Bibeault from Manning Publications. Be forewarned, the book is not a light read. It’s an exhaustive study of what JavaScript really is and how it really works.
Getting back to the question of TypeScript, if you already know and are comfortable with JavaScript, do you need TypeScript? The answer is: No. The real question is whether you should use TypeScript? As is often the case, the answer is: It depends.
TypeScript affords you the opportunity to write less direct JavaScript code. TypeScript also affords you the opportunity to write code that is more easily understood by the JavaScript uninitiated. If you are leading a team, when considering tools like TypeScript, it may be more helpful to take yourself and your own preferences out of the equation. Simulating object orientation in JavaScript can involve writing more code. TypeScript can reduce that burden, because types can be declared in TypeScript; you don’t have to write specific JavaScript code to validate data types and to simulate class structures and inheritance.
With that in mind, although you may not need TypeScript, it may be well worth exploring because there may be benefits that accrue to the team as a whole. Chances are good that your team’s predominant language is either C# or Visual Basic, and JavaScript is quite different from those two environments. TypeScript is an attempt to bridge those differences without sacrificing JavaScript’s true power. TypeScript allows developers to use their object oriented programming skills directly to produce better JavaScript.
TypeScript allows developers to use their object oriented programming skills directly to produce better JavaScript.
Downloading and Installing TypeScript
The online home for TypeScript is typescriptlang.org. There, you will have ready access to tutorials, samples and downloads. If you are working in Visual Studio, the best option for you to install TypeScript is to download the plugin. Figure 1 illustrates the TypeScript Download Page, which offers several download options.
Once you have downloaded and installed TypeScript, you can verify your installation by opening the command prompt and typing tcs, which is the command to run the TypeScript ompiler. Figure 2 illustrates how your results should appear if you successfully installed TypeScript.
TypeScript allows developers to use their object oriented programming skills directly to produce better JavaScript.
Creating Your First TypeScript File
TypeScript source code files require either a .ts or a .d.ts extension. Here is the code for the first TypeScript file:
// setBackgroundColor.ts. function setBackgroundColor() { document.body.style.backgroundColor = "rgb(255,0,0)"; } setBackgroundColor();
It looks just like JavaScript. That’s because it is JavaScript! You might consider TypeScript to be a superset of JavaScript. That means you can include both pure JavaScript and the declarative features in TypeScript in your TypeScript files. In this example, the TypeScript file is named setBackgroundColor.ts.
Figure 3 illustrates how to compile the TypeScript file. The result is a JavaScript file with the same name, in this case setBackgroundColor.js.
/
The ts and js files are identical because the ts file was pure JavaScript without any specific TypeScript syntax. Figure 4 illustrates the ts and js files.
When your ts file is pure JavaScript, the resulting js file is identical to the ts file.
Would you ever want to just create TypeScript files and let the compiler create your js files? You may want to consider this, given the fact that your js file is the result of code compilation. Normally, we work directly with js files. Consider this invalid JavaScript:
function setBackgroundColor() { document.body.backgroundColor = "rgb(255,0,0)"; } setBackgroundColor();
There is no body property called backgroundColor. Granted, you could fiddle with the HTMLElement object’s prototype and create a custom property, but that is beyond the scope of this article. If you wrote it in JavaScript, assuming after you didn’t catch the mistake, you would have to run the code to see the error. Orerhaps you have a set of tests that validates your JavaScript code’s side effects. Or, you could use TypeScript. Figure 5 illustrates the compiler error.
Creating TypeScript Classes
With TypeScript, unlike native JavaScript, there is a native class keyword. The following snippet illustrates a simple TypesScript class definition:
class Person { fullname : string; constructor(public firstname, public middleinitial, public lastname) { this.fullname = firstname + " " + middleinitial + " " + lastname; } }
There is one public member, fullname, and there is a public constructor that accepts three arguments: first, middle and last name. Within that constructor, the arguments are assembled and the result is used to hydrate the public fullname member.
The compiled JavaScript looks a bit different:
var Person = (function () { function Person(firstname, middleinitial, lastname) { this.firstname = firstname; this.middleinitial = middleinitial; this.lastname = lastname; this.fullname = firstname + " " + middleinitial + " " + lastname; } return Person; })();
The resulting JavaScript listed immediately below is more verbose. Unlike what the TypeScript file specified, the JavaScript code creates a Person object with four public members, firstname, middlename, lastname and fullname. The resulting JavaScript could be simplified to:
var Person = (function () { function Person(firstname, middleinitial, lastname) { this.fullname = firstname + " " + middleinitial + " " + lastname; } return Person; })();
The TypeScript code articulates the code’s intent better than JavaScript. Couple that with the fact that the TypeScript compiler catches things that otherwise would only be caught at runtime, and TypeScript is starting to look very appealing.
Creating TypeScript Interfaces
The interface concept does not exist in JavaScript because JavaScript is a dynamic un-typed functional language. An interface specifies a contract, something that is at odds with a language like JavaScript. But just because a language doesn’t natively support the notion of classes, interfaces, and strong typing, it doesn’t mean that you don’t want your code to enforce such things as if these were native language features.
Continuing with our Person class, let’s expand the sample with a simple interface:
class Person { fullname : string; constructor(public firstname, public middlename, public lastname) { this.fullname = firstname + " " + middlename + " " + lastname; } } interface IPerson { fullname: string; } function displayPerson(person : IPerson) { return "Hello, " + person.fullname; }
In this example, an interface called IPerson has been created. IPerson has one public member: fullname. Notice that the function displayPerson is a single argument that is bound to the IPerson interface. If your code references any property on the Person argument other than what has been publically exposed in the IPerson interface, the TypeScript compiler reports an error. To illustrate, let’s assume that we modified the displayPerson function to display the first name:
function displayPerson(person : IPerson) { return "Hello, " + person.firstname; }
Figure 6 illustrates the compilation error that is encountered.
With TypeScript, you can also create variables based on the interfaces, just like in C#:
var myPerson : IPerson;
Working with Property Cccessors
In C# and Visual Basic, the concept of property getters and setters is well known and long established. In JavaScript, it is a new concept, introduced in ECMAScript 5. ECMAScript is the standard upon which JavaScript is based. (For more details on ECMA and the evolving standard, navigate to. )
To illustrate the property getters and setters, consider this slightly modified version of the Person Class:
class Person { private _fullname : string; constructor(public firstname, public middlename, public lastname) { this._fullname = firstname + " " + middlename + " " + lastname; } get fullname() { return this._fullname; } }
Instead of the fullname property being directly exposed, it is now exposed through a get function called fullname(). Because this feature must be targeted to ECMAScript 5-compliant code, you must supply the correct complier directive:
>tsc --target ES5 getterexample.ts
The following is the JavaScript produced:
var Person = (function () { function Person(firstname, middlename, lastname) { this.firstname = firstname; this.middlename = middlename; this.lastname = lastname; this._fullname = firstname + " " + middlename + " " + lastname; } Object.defineProperty(Person.prototype, "fullname", { get: function () { return this._fullname; }, enumerable: true, configurable: true }); return Person; })();
As previously observed, the TypeScript compiler creates firstname, middlename, and lastname members. These items can be safely removed. If, for some reason, there was TypeScript code that attempted to access the firstname, middlename, or lastname directly, TypeScript reports an error since there is no public interface for these properties.
Visual Studio Integration
Although the command prompt option is good to know, more than likely, you will interact with TypeScript in the Visual Studio IDE. From the IDE, the compilation of your TypeScript files can be automatic. In order to get the full experience, you need to make sure you have downloaded and installed the Web Essentials plug-in. Figure 7 illustrates the Extensions and Updates dialog from where the plug-in can be installed.
Once you have everything installed in Visual Studio, you can add a new TypeScript file. This step is illustrated in Figure 8.
The default TypeScript template, illustrated in Figure 9, contains sample code. For TypeScript files, there is a dual pane. The left pane is the TypeScript file. The right pane, which is read only, is the compiled JavaScript code. Note the Module keyword that translates into a JavaScript namespace. As you modify the TypeScript code, the JavaScript code is updated to reflect those changes. Also note that minified and non-minified JavaScript files are created.
Conclusion
This article only scratches the surface of what TypeScript offers. Nevertheless, you have a good basis to decide whether or not TypeScript is something you would want to implement in your personal development toolkit. Compiling JavaScript so that syntax errors can be caught before runtime is very appealing. This is a big benefit for an automated build and continuous integration environment. TypeScript allows developers to use C#-like syntax to allow you to interact with JavaScript in an OOP manner may make it easier for those with little JavaScript experience to embrace and adopt the language. Although TypeScript compiles to pure JavaScript, there is still an absolute requirement that if you are going to use JavaScript, you still need to learn how it works on its own terms.
|
http://www.codemag.com/article/1305051
|
CC-MAIN-2017-26
|
refinedweb
| 2,016
| 56.45
|
Note that 2.6.11-rc1 breaks on x86-64 NUMA systems.
Linus's BitKeeper repository contains, as of this writing, a fix for the page fault handler security hole, a fix for
the x86-64 NUMA problem, and a few other small patches.
The current prepatch from Andrew Morton is 2.6.10-mm2. Recent changes to -mm include
multiple AGP support and a number of fixes.
The current 2.4 prepatch is 2.4.29-rc2, released by Marcelo on January 12. The
-rc releases include a number of new security fixes and some driver
updates.
For 2.2 users, Marc-Christian Petersen has released 2.2.27-rc1 with the latest security fixes.
Kernel development news
-- William Lee Irwin III.
The code in question is the realtime security module, which was covered briefly here last September. This
module, when loaded, makes a simple change to the Linux protection
mechanism: any process running with a designated group ID is given the
CAP_SYS_NICE, CAP_IPC_LOCK, and CAP_SYS_RESOURCE
capabilities. Thus, any user who has membership in the special group can
raise priorities, lock pages into physical memory, and exceed resource
limits. With these capabilities, a suitably aware audio application can
ensure that it will be able to respond to events within the required time.
A couple of objections have been raised to the inclusion of the realtime
module. One is that it is a specialized hack for a specific set of users
which has no place in a general-purpose kernel. The GID-based mechanism is
seen as being ugly and hard to administer in the long term. A few kernel
hackers have been quite vocal in their opinion that, until these issues
have been addressed, this module should not be merged. They have been less
vocal, however, on just how audio users should satisfy their needs without
offending the sensibilities of the kernel community.
Nonetheless, some progress has been made. The memory locking issue has
been solved via the new resource limits which were added in 2.6.9. By
setting the limits appropriately, a system administrator can allow
otherwise unprivileged users to lock a bounded number of pages into
physical memory. A bit of PAM configuration work should suffice to deal
with that part of the problem.
The other issue, however, is response time from the CPU scheduler. Ingo
Molnar has noted that the kernel's handling
of regular "nice" levels is much improved in 2.6.10. Audio hacker Jack
O'Quin checked it out and found that things
had improved, though the maximum response time was still far worse than can
be had by running in the SCHED_FIFO class. The reasons for this
behavior are still being investigated; interference from high-priority
kernel threads may be part of the problem. Even if the response
were adequate, however, raising priorities is still a privileged operation.
That issue could, perhaps, be addressed via yet another resource limit
which would allow individual users to raise their priorities within an
administrator-set of bounds. If the remaining response time issues could be
addressed, this new limit could be part of the overall solution, though it
would take some time for updated utilities to get into the hands of the
users who need them.
Another approach which has been mentioned would be to generalize the
realtime module to address a wider range of needs. If it could be set up
to hand out any set of capabilities to given users or groups, it would at
least be useful to more people. It could, for example, replace the current group-based hack which gives access
to the "hugetlb" mechanism. It would still be setting policies in the
kernel by way of user and group IDs, which is not a popular idea, but it
would not be quite the niche tool that it is now. A first pass at such a
module has been posted by Olaf Dietsche; it
takes an interesting approach by having much of the relevant information
stored in the form of group ownership on sysfs attributes.
A more comprehensive solution would be to make capabilities work properly.
After all, that is what capabilities are supposed to be for: to allow
precisely-defined bits of privilege to be granted in the situations where
they are needed. The problems there are that Linux capabilities are currently
broken, fixing them is a tricky job that nobody seems to want to take
on at the moment, and, in any case, administering a truly capability-based
system is an exercise in complexity. Capabilities seem unlikely to be part
of the solution anytime soon.
One interesting aspect of the discussion is what has not been
mentioned. SELinux should be able to solve this problem; it exists to
provide ultimate control over what every user and program can do. Nobody,
however, has wanted to see what happens when musicians attempt to
administer SELinux, it would seem. The realtime preemption work has also
been strangely absent from the discussion - and from the kernel mailing
lists in general.
As of this writing, no real solution seems to have been found. There are
enough kernel hackers sympathetic to the needs of audio hackers, however,
that some sort of resolution should be possible. Linux should be the
ultimate playground for audio developers; it would be a shame if the kernel
continued to get in their way. (For more background, see this history of the realtime LSM by Jack
O'Quin).
files_lock is a spinlock used within the VFS layer;
set_fs_root() is used to change the root directory for (one
process's view of) a filesystem. They were used by IBM's MVFS to a novel
end: MVFS implements a revision control system internally, and allows each
process to see a different revision of the file tree. By using these
symbols, MVFS was able to make the filesystem behave differently for each
process. With 2.6.9, that worked great, but those symbols are no longer
exported in 2.6.10. Paul has asked that they be restored so that the MVFS
module can work again.
The export was removed because the kernel developers feel that no code
outside of the VFS layer should be making changes in the filesystem
namespace. The tricks that MVFS is performing with set_fs_root()
would be better done with bind mounts - in user space. It is also felt
that any code using set_fs_root() or files_lock can only
be a fundamental part of the kernel, and thus a derived product; there is
no legal way, according to the relevant kernel developers, that a
proprietary module can legally use them. For these reasons, the exports
were removed, and there is strong resistance to restoring them.
Nobody disagrees with the reasoning behind the change. Not everybody
thinks that it was appropriate to remove the symbols with no notice,
however. In particular, Linus thinks there was
no reason to break things so abruptly:
Andrew Morton also thinks the exports should be
restored for a period of time - a position which gained him an accusation of supporting IBM's position as a
payback for IBM's funding of OSDL. Despite Linus's and Andrew's position,
as of this writing, the exports of those symbols have not been restored.
This whole episode restarted the discussion of what the proper way is to
remove deprecated features when there is no unstable kernel series in
sight. Andrew proposed the creation of a
file (feature-removal-schedule.txt) in the Documentation
directory which would list things slated for removal, and the relevant
dates. That file has been created; as of
this writing it lists devfs and some CPU frequency files in
/proc. This file will be helpful for some users, but it probably
will not make life easier for people maintaining out-of-tree code;
Christoph Hellwig and others have made it clear that they will continue to
remove "unneeded" exports without notice as they are identified. Life will
continue to be difficult, it seems, for code maintained outside of the
mainline tree.
Patches and updates
Kernel trees
Core kernel code
Development tools
Device drivers
Documentation
Filesystems and block I/O
Janitorial
Memory management
Networking
Security-related
Miscellaneous
Page editor: Jonathan Corbet
Next page: Distributions>>
Linux is a registered trademark of Linus Torvalds
|
http://lwn.net/Articles/118052/
|
crawl-003
|
refinedweb
| 1,378
| 60.35
|
The finally block is used to ensure resources are recovered regardless of any problems that may occur.
There are several variations for using the finally block, according to how exceptions are handled. (See the excellent book The Java Programming Language by Arnold, Gosling, and Holmes for related information.)
If you're using JDK 7+, then most uses of the finally block can be eliminated, simply by using a try-with-resources statement. If a resource doesn't implement AutoCloseable, then a finally block will still be needed, even in JDK 7+. Two examples would be:
JDK < 7, and resources that aren't AutoCloseable
The following examples are appropriate for older versions of the JDK. They are also appropriate in JDK 7+, but only for resources that don't implement AutoCloseable.
Style 1
If a method throws all exceptions, then it may use a finally with no catch:
import java.io.*; /** Before JDK 7. */ public final class SimpleFinally { public static void main(String... aArgs) throws IOException { simpleFinally("C:\\Temp\\test.txt"); } private static void simpleFinally(String aFileName) throws IOException { //If this line throws an exception, then neither the try block //nor the finally block will execute. //That's a good thing, since reader would be null. BufferedReader reader = new BufferedReader(new FileReader(aFileName)); try { //Any exception in the try block will cause the finally block to execute String line = null; while ((line = reader.readLine()) != null) { //process the line... } } finally { //The reader object will never be null here. //This finally is only entered after the try block is //entered. But, it's NOT POSSIBLE to enter the try block //with a null reader object. reader.close(); } } }
Style 2
If a method handles all of the checked exceptions that may be thrown by its implementation,
then an interesting variation is to nest a
try..finally within a try..catch. This style is particularly useful when
the finally block throws the same exceptions as the rest of the code (which is common with
java.io operations.) Although this style may seem slightly complex, it appears
to be superior to alternative styles:
import java.io.*; import java.util.logging.*; /** Before JDK 7. */ public final class NestedFinally { public static void main(String... aArgs) { nestedFinally("C:\\Temp\\test.txt"); } private static void nestedFinally(String aFileName) { try { //If the constructor throws an exception, the finally block will NOT execute BufferedReader reader = new BufferedReader(new FileReader(aFileName)); try { String line = null; while ((line = reader.readLine()) != null) { //process the line... } } finally { //no need to check for null //any exceptions thrown here will be caught by //the outer catch block reader.close(); } } catch(IOException ex){ fLogger.severe("Problem occured : " + ex.getMessage()); } } private static final Logger fLogger = Logger.getLogger(NestedFinally.class.getPackage().getName()) ; }
Style 3
A more verbose style places a catch within the finally.
This style is likely the least desirable, since it has the most blocks:
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.logging.Logger; /** Before JDK 7. */ public final class CatchInsideFinally { public static void main(String... aArgs) { catchInsideFinally("C:\\Temp\\test.txt"); } private static void catchInsideFinally(String aFileName) { //Declared here to be visible from finally block BufferedReader reader = null; try { //if this line fails, finally will be executed, and reader will be null reader = new BufferedReader(new FileReader(aFileName)); String line = null; while ( (line = reader.readLine()) != null ) { //process the line... } } catch(IOException ex){ fLogger.severe("Problem occured : " + ex.getMessage()); } finally { try { //need to check for null if ( reader != null ) { reader.close(); } } catch(IOException ex){ fLogger.severe("Problem occured. Cannot close reader : " + ex.getMessage()); } } } private static final Logger fLogger = Logger.getLogger(CatchInsideFinally.class.getPackage().getName()) ; }
|
http://javapractices.com/topic/TopicAction.do?Id=25
|
CC-MAIN-2017-09
|
refinedweb
| 603
| 51.14
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.