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
In Java, how does one iterate over a list of pojos? I've found examples that show how to iterate over (and access the data in) a list of Strings or ints. But not a list of pojos List<Policy> myPolicies = new ArrayList<Policy>(); myPolicies.add(new Policy(232 , "name" + my232, "desc" + my232)); myPolicies.add(new Policy(233 , "name" + my233, "desc" + my233)); // This does not work for(int i = 0 ; i < policies.size(); i++ ) { log.debug("policy: " + myPolicies[i].id); } public class Policy { public int id; public String name; public String description; public Policy(int id, String name, String description) { this.id = id; this.name = name; this.description = description; } } You are mixing up arrays and lists (collections). The [] syntax only works for array types, such as Object arrayOfObjects[] = { new Object() }; Object someObject = arrayOfObjects[0]; Whereas List is an interface, actually a subinterface of Collection; and those work like: List<String> someStrings = new ArrayList<>(); someStrings.add("first"); String first = someStrings.get(0); The easiest way to iterate lists and arrays is the for-each loop. for (Policy policy : myPolicies) { ... there you go
https://codedump.io/share/3pSMqRjVdXBz/1/java-how-to-iterate-over-a-list-of-pojos-and-access-their-data
CC-MAIN-2017-13
refinedweb
181
52.56
28 April 2009 05:24 [Source: ICIS news] SINGAPORE (ICIS news)--Taiwan’s Formosa Petrochemical Corp (FPCC) secured higher discounts to get term naphtha for delivery over the third and fourth quarter of this year, trading sources said on Tuesday. FPCC got discounts of $5/tonne (€3.85/tonne) to ?xml:namespace> Last week tender had originally requested 25,000-225,000 tonnes to be delivered either July-September or July-December. The Asian naphtha market is under pressure from a glut in supplies from northwest Europe, Middle East and The freight costs between A total of 15 companies had submitted offers - ranging from discounts of $1.50/tonne to $5/tonne - for the tender and five were selected offering discounts of $5/tonne. Neteast was one of the winners of the tender, sources said. The company was a small entity backed by a major Middle Eastern producer, traders said. FPCC had last week purchased a 75,000 tonne cargo at a discount of $1.50/tonne to ($1 = €0
http://www.icis.com/Articles/2009/04/28/9211511/taiwans-formosa-gets-higher-discount-for-q3-q4-term-naphtha.html
CC-MAIN-2015-14
refinedweb
170
62.88
Firmware bugs considered enraging Part of our work to make it possible to use UEFI Secure Boot on Linux has been to improve our EFI variable support code. Right now this has a hardcoded assumption that variables are 1024 bytes or smaller, which was true in pre-1.0 versions of the EFI spec. Modern implementations allow the maximum variable size to be determined by the hardware, and with implementations using large key sizes and hashes 1024 bytes isn't really going to cut it. My first attempt at this was a little ugly but also fell foul of the fact that sysfs only allows writes of up to the size of a page - so 4KB on most of the platforms we're caring about. So I've now reimplemented it as a filesystem[1], which is trickier but avoids this problem nicely. Things were almost working fine - I could read variables of arbitrary sizes, and I could write to existing variables. I was just finishing hooking up new variable creation, but in the process accidentally set the contents of the Boot0002 variable to 0xffffffff 0xffffffff 0x00000000. Boot* variables provide the UEFI firmware with the different configured boot devices on the system - they can point either at a raw device or at a bootloader on a device, and they can do so using various different namespaces. They have a defined format, as documented in chapter 9 of the UEFI spec. At boot time the boot manager reads the variables and attempts to boot from them in a configured order as found in the BootOrder variable. Now, obviously, 0xffffffff 0x00000000 is unlikely to conform to the specification. And when I rebooted the machine, it gave me a flashing cursor and did nothing. Fair enough - I should be able to choose another boot path from the boot manager. Except the boot manager behaves identically, and I get a flashing cursor and nothing else. I reported this to the EDK2 development list, and Andrew Fish (who invented EFI back in the 90s) pointed me at the code that's probably responsible. It's in the BDS (Boot Device Selection) library that's part of the UEFI reference implementation from Intel, and you can find it here. The relevant function is BdsLibVariableToOption, which is as follows (with irrelevant bits elided): BdsLibVariableToOption ( IN OUT LIST_ENTRY *BdsCommonOptionList, IN CHAR16 *VariableName ) { UINT16 FilePathSize; UINT8 *Variable; UINT8 *TempPtr; UINTN VariableSize; VOID *LoadOptions; UINT32 LoadOptionsSize; CHAR16 *Description; // // Read the variable. We will never free this data. // Variable = BdsLibGetVariableAndSize ( VariableName, &gEfiGlobalVariableGuid, &VariableSize ); if (Variable == NULL) { return NULL; }So so far so good - we read the variable from flash and put it in Variable, Variable is now 0xffffffff 0xffffffff 0x00000000. If it hadn't existed we'd have skipped over and continued. VariableSize is 12. // // Get the option attribute // TempPtr = Variable; Attribute = *(UINT32 *) Variable; TempPtr += sizeof (UINT32);Attribute is now 0xffffffff and TempPtr points to Variable + 4. // // Get the option's device path size // FilePathSize = *(UINT16 *) TempPtr; TempPtr += sizeof (UINT16);FilePathSize is 0xffff, TempPtr points to Variable + 6. // // Get the option's description string size // TempPtr += StrSize ((CHAR16 *) TempPtr);TempPtr points to 0xffff 0x0000, so StrSize (which is basically strlen) will be 4. TempPtr now points to Variable + 10. // // Get the option's device path // DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr; TempPtr += FilePathSize;TempPtr now points to Variable + 65545 (FilePathSize is 0xffff). LoadOptions = TempPtr; LoadOptionsSize = (UINT32) (VariableSize - (UINTN) (TempPtr - Variable));LoadOptionsSize is now 12 - (Variable + 65545 - Variable), or 12 - 65545, or -65533. But it's cast to an unsigned 32 bit integer, so it's actually 4294901763. Option->LoadOptions = AllocateZeroPool (LoadOptionsSize); ASSERT(Option->LoadOptions != NULL);We attempt to allocate just under 4GB of RAM. This probably fails - if it does the boot manager exits. This probably means game over. But if it somehow succeeds: CopyMem (Option->LoadOptions, LoadOptions, LoadOptionsSize);we then proceed to read almost 4GB of content from uninitialised addresses, and since Variable was probably allocated below 4GB that almost certainly includes all of your PCI space (which is typically still below 4GB) and bits of your hardware probably generate very unhappy signals on the bus and you lose anyway. So now I have a machine that won't boot, and the clear CMOS jumper doesn't clear the flash contents so I have no idea how to recover from it. And because this code is present in the Intel reference implementation, doing the same thing on most other UEFI machines would probably have the same outcome. Thankfully, it's not something people are likely to do by accident - using any of the standard interfaces will always generate a valid entry, so you could only trigger this when modifying variables by hand. But now I need to set up another test machine. [1] All code in Linux will evolve until the point where it's implemented as a filesystem. Syndicated 2012-01-06 20:17:56 from Matthew Garrett
http://www.advogato.org/person/mjg59/diary/324.html
CC-MAIN-2014-52
refinedweb
816
51.68
Oxygen XML Developer uses the following search pattern when it tries to detect an XML schema: The schema has one of the following types: XML Schema, XML Schema with embedded Schematron rules, Relax NG (XML syntax or compact syntax), Relax NG (XML syntax) with embedded Schematron rules, Schematron, DTD, NVDL. The rules are applied in the order they appear in the table and take into account the local name of the root element, the default namespace and the file name of the document. The editor is creating the content completion lists by analysing the specified schema and the current context (the position in the editor). If you change the schema, then the list of tags to be inserted is updated. Content Completion Driven by DocBook DTD
http://www.oxygenxml.com/doc/ug-developer/topics/setting-a-default-schema.html
CC-MAIN-2014-15
refinedweb
126
54.36
On Tue, Aug 17, 2004 at 03:31:26PM -0400, jean-marc@spaggiari.org wrote: > > Please let me know how can I help you. Open source works pretty much the opposite of corporate development. You find something you want to do, then let us know how we can help you. That's pretty much it. Finding something to do is too easy: grab a scratch pad and start using Geronimo; write down everything that doesn't meet your expectations, didn't work, didn't work as you though, or generally needs work; pick the easiest thing on the list and do it. -David
http://mail-archives.apache.org/mod_mbox/geronimo-dev/200408.mbox/%3C20040818045703.GA31234@sweetums.ce1.client2.attbi.com%3E
CC-MAIN-2017-34
refinedweb
103
72.46
- none - minutes approved as posted - f2f meeting Chris: update on local details sent to local group - video con on all three days is available. want to keep number of video sites to a minimum. would like to know who are the video site hosts Herve: Canon should be able to host a video site although they might not allow others to attend Chris: please let us know so we can test the video link DavidF: it is critical that multiple people can attend a video site in western europe Herve will find out whether this is indeed ok StuartW: Hewlett-Packard has video facilities in Bristol (England), he is attending the f2f in Boston but can look into Bristol as an alternative DavidF: prefers Stuart to wait to see what Herve comes up with by end of week - Primer Nilo: no news to report - TBTF No report - Editors No report - ETF PaulC: ETF has been working on issue resolution, namely agenda item 6 on issue 1, and it is working on text to close issue 18 Hugo: received list of issues reassigned to editors from jacek, hugo will be co-ordinating that list - Conformance Hugo/Oisin: nothing to report, no constribution of tests, still need the official ok from microsoft for use of some tests. Hugo: The document needs to be updated, not sure how to get more contributions Henrik: is it true you still lack something from Microsoft? Hugo: has sent email (cc to PaulC and Henrik), awaiting official email from Microsoft PaulC: I will sort this out DavidF: how many tests are there, e.g. are we half the way there? Hugo: we are not very far, if we integrate soapbuilders' tests, we are maybe a quarter to third, but definitely not more than a half PaulC: we need more tests! DavidF: we could assign WG members to generate tests for sections of the spec Hugo: that would be great DavidF: in a previous telcon, someone noted that generating tests is a good way to understand the spec, although this cuts both ways PaulC: (tongue in cheek) given xml hack's commentes, need broad contributions, those who work for larges companies shouldn't have to produce the tests (???). In schema there is a race going on to generate tests, e.g. Microsoft donated 4500 tests. People who have implementations need to bring some tests to the table. DavidF: is anyone willing to volunteer to generate tests? Silence. PaulC: Suggest allocating time at the f2f to go into working groups and hammer out tests as a way to move forward DavidF: That's a good suggestion - Usage scenarios JohnI: received no comments on the posted version, I am planning to work more on them. I am hoping to create another revision in time for next weeks telcon. I would appreciate someone taking a look at them. - SOAP + Attachments DavidF: the assumption for this work is that we want to find a venue for working on S+A or S+A-like mechanism with the criteria that it happens relatively quickly, and some guarantee that it will indded happen. I have spent time at the AC meeting talking to people about making this happen. The current plan of action is to write a new charter for the next rev of the XMLP WG that will include a line item which includes a S+A mechanism. I need to run this by the XML CG many of whom are here at the AC meeting. They need to know such a proposal is coming. I need to put it on the XML CG agenda. With the people I have spoken to here, there appears to be agreement that this is a viable way forward. Chris: are you suggesting that the only venue for S+A is the next rev of the XMLP WG David: yes. I believe this is the fastest way to get it done outside this iteration of the WG. Does this answer your question? Chris: yes, but I am not happy Anish: how about a proposal to make a non-normative reference to S+A and say that this is one of the ways to package binary data. Is this still on the table? David: what does this mean? It is no different to the submitted note. If we get a new charter done soon, we can point to that as being en route and that is a clear enough signal. Chris: my concern is not beginning work on it until late, when would that be? David: we have a f2f in February that according to our schedule is between Last Call and Proposed Rec. MarcH: are we still on track for issuing last call after f2f? We have lots of issues. David: I am also worried about the number of issues remianing. MarcH: any slippage in schedule could cause S+A to be worked on much much later David: yes, I am afraid of slipping the schedule, I think this is a likely outcome Noah: there are two big issues on table, (i) what is the role of technologies like S+A and how do we deal with them, and then (ii) how do we get the core work in the charter done. On the one hand it is disappointing to delay S+A more than necessary, but if we are already over our heads,then the best thing for us to do is to get on with the core work we need to do for Last Call. I have no objection to people working on it, but the ante is going up. Should only work on this on the side. PaulC: I suggest we take this to email and get on and close some issues David: I have noted the concerns, please continue this discussion as need be in email David: ETF has proposed an algorithm to map applicaiton defined names to valid XML names, the question on the table is whether this is acceptable to the WG. Is there any discussion? PaulC: this algorithm is based on material from an ISO draft. Asir has done a good job factoring out the SQL specific terms, but he made one change to the algorithm. I recommend moving forward with his alg, subject to taking his proposed change back to the ISO people because we don't want any gratuitous differences. I should note that the ISO algorithm is used by a number of Microsoft products like Word, etc. I propose the algorithm get adopted subject to liaison with ISO. The specific difference is that the ISO algorithm is only XML 1.0, Asir uses XML 1.1/namespaces. There is probably no impact, but I'd like to take the algorithm back to ISO and check that its ok. I will take action item to double check it is indeed ok. David: point of clarification - the algorithm will be put inline in our spec and we will say that it is derived from an ISO working draft PaulC: yes, there is a reference to the ISO document in Asir's work, the ISO algorithm is a work in progress hence we use it by direct inclusion rather than reference, this is also easier for our readers without a SQL background Henrik: will the liaison continue so that there is no fork? PaulC: yes, I will provide this liason David: once the algorithm is inline, then surely we don't need to track the ISO version? PaulC: if it changes in the ISO forum becuase there is a mistake, then we would need to know David: so tracking should occur over the long term StuartW: what is the cycle time for first cut response? PaulC: there is a 4 hour ISO call next week, I will put it in front of them, although it may not get full attention. The group is SQLX. I am confident that we can get feedback in a reasonable time. Hugo: we need some examples, the algorithm is hairy! PaulC: we can provide these examples to the editors DavidF: the proposal is to adopt the proposal from ETF and to consider the issue closed unless we hear back negatively from the ISO group. PaulC will be taking an action to obtain feedback from the ISO group, and take on the long-term tracking. Are there any objections to this proposal? No objections raised. Proposal passes. Action on PaulC to email Eric Smith (issue originator) and xmlp-comment David: there should have been an action on me to corral all of the threads regarding issue 101, but I didn't get to do this because of travel so we must figure out the issue on this call instead. David: The issue - as written - concerns the special status of the Body. There has been lots of email on this subject, but how many issues actually are there? At least one aspect of the issue is considered editorial so need to find out which issue(s) are editorial and which involve more serioius design. Is there anyone who believes they can identify an issue out of the original 101 issue and start the discussion? Noah: should we relate such issues to existing numbered issues, or potential new issues? David: if issue 101 can be tied to existing that's good .... Noah: I can identify issues, but I can't relate them to existing ones David: that is a good enough start Noah: the text in the spec states that the body is syntactic sugar for a header, so we need to know if there is indeed a difference. There may be a difference of intent. Lexically, multiple body entries are allowed, but we need to clarify with regard blocks what has to be understood (in the sense of mustUnderstand [mU]) and processed. The body must be one clear unit of work. Streaming also presents issues. Headers may be short, whereas a body may be long because that is the main unit of work. There is a question of how you indicate that you have not understood the intent of one or more things in the body. The implicit mU suggests an mU fault to some people, others say some other fault should be generated. Noah: the notion of bodies as syntactically sugared headers unifies the processing model. If a processor doesn't understand body, then there's nothing there which states that headers should or should not be processed. If we say the body is a header then ???? Noah and David attempt to summarise: 4.3.1 is the section in the spec detailing the relationship between header/body block. Once we settle all the other things we have to go back and make sure that this section reflects what we mean. 1. is the body really a syntactically sugared header? 2. there is a question about what is processed as a block and how many things can be processed in the body - some say one unit, other say multiple. A combination of this and mU may make streaming more difficult. 3. if a body has children 'a' and 'b', does this imply two units of work, or is 'a' the unit of work and 'b' provides supporting data, or vice versa? 4. how to indicate that a part of the body has not been understood 5. if body parts are separate, and not like normal header blocks, then we have to look at the processing model and unify it David: it seems that depending on how we answer any one question, something else may crop up as an issue. Are there any more issues to be identified as related to 101? Dug: two things, (i) I am worried about implications for implementors of header==body , and (ii) headers are our the extension mechanism, but technically extensions can be placed in the body Chris: another aspect that concerns me is whether the anon actor in the header is the same thing that processes the body Henrik and Dug: that's a different issue. David determines that no-one has any more issues related to 101. He turns discussion back to those points already raised. Henrik: Dug has brought up the most straightforward answer; the body is equivalent to a header *block*, it must be understood, and it is for the end guy. This avoids the problem about faults; one must understand the body block, and so a mU fault does not get raised. This is straightforward because we have not seen a special use for blocks in the body -- ie multiple units of work in the body -- we can do that using headers. If we say the body is one block rather than a set of blocks the number of issues is reduced to just one. David: please restate this as a proposal Henrik: the body is the same as a header block, and with regard intent/boxcarring we need to express how the body is used, we need more guidelines. David: I would like feedback from Dug and Noah on this because what Henrik is saying may be a proposal to resolve the issues. Noah: some aspects of this are good, but there is part of it that doesn't click. If we say it is the body element *itself* that you have to understand there is no mU fault, but this seems silly. Let's say there is a purchase order in the body and I receive the message but I don't understand purchase order. What are the processing model rules? We understand body, and headers, so we start processing headers but then find out we don't understand purchase order. Nuts! I think the mU is on the *purchase order* which is the first child of the body. It is vital that no work gets done until the headers and the body are ready for understanding. David and Noah attempt to summarise: 2. With regard to understanding in the mU sense, it is the contents of the headers that have to be understood. We have to cover understanding of the body content. 1. Putting mU on body is asymmetric. We have to put it on envelope and everything ???? Henrik: it is a general client fault when there is something within a block that is not proceesed. If I know about it then I have to start processing it. There may be stuff in the content of the block that may call a fault. Nested faults let you say "this is a client fault" and "this is a purchase order fault" Henrik: mU says you have to understand the block, not that you will be able to process it successfully, as in the purchase order example you gave. Noah: what if weather service ???? ????: you could have processed headers when you find out that you don't do the body Dug: I like what Henrik said about the body being a single computational unit, maybe we should remove implicit mU on body. Regarding not being able to process the body after starting on the headers...headers are used for extending the body, make sure that you understand all of the headers then you can go look at the body. Noah: chapter 2 states that all headers must be checked for mU headers entries before any other processing, but having done that the processor is free to process headers and body in any order unless there is a header that imposes ordering Dug: I got lost there at the end Noah: to paraphrase "What kind of fault you generate is your business". Dug: I think that is the proposal being made .... Noah: I can live with it... PaulC: we should put strawman on the table to see how this solves the issues. It need to be written up. WG expresses general understanding and agreement Noah: I am a bit nervous about it but think can live with it David: we will take this discussion to email. Action to Dug/Noah/Henrik to craft the text for this proposal. Action to Oisin to get send the summaries to Noah before he starts travelling. Stuart: the issue arose because of discussion beyond issue 140. In particular, are the actor default actor, ultimate recipient synonymous? I think they are but they evoke different things to different people. Henrik: I think the question is not so much what the actor/destination means but how much we have to say about whether a message physically stops at that actor. In other words, who does what and how. Stuart: I have seen message paths with 3 anon actors which suggests the anon actor is not the ultimate recipient Henrik: looking at that scenario it could be right or wrong. There could be intermediaries at a higher level, we think it end ????, but really could be higher level intermediary Stuart: where does the soap message end? Noah: we need to clarify the text in places. It is not good to have mushy notions about a endpoint but the message keeps going. Whichever node decides to act as the anon actor is it. and the soap message path ends. If we go in another direction then need to change the paragraph Henrik: I am happy with this Noah: if I have a header with anon and I process it, then can i pass it on? The spec states that if you process anon actor header then that's it, you can't relay it Henrik: agrees. Chris: back to issue 101; if body blocks are syntactic sugar for header then with anon actor role then the body gets sucked out! Dug: I need a use case. If a header is targetted at the anon actor, how does the sender make a message... Noah: this is the mustHappen question, and it was decided in Rennes (a f2f meeting) Dug: I don't think so, I have to think about this. Chris: if the ultimate recipient is the next, default and any actor Dug: yes Chris: an intermediary can't be the default David: Noah, you were looking for a clarification on 2.5... Noah: concern was that we would change the rules then we would really have to re-work 2.5. but it does need a minor clarification - nodes which assume the role of anon actor must not relay the message David: Dug is that ok? Dug: yes, I would rather change the text, but if Henrik and Noah like it the it is ok Stuart: I make an editorial plea -- choose "default" or "anon" for the actor and stick with it. David: didn't we already decide to use only one term? Stuart: we use "anon actor" in section 2, and "default actor" in section 4 Hugo: We decided to use anonymous a few months back. The changelog of the spec reads: 20010615 JJM Renamed default actor to anonymous actor for now (to be consistent) Noah: there are still some occurrences of "defualt" in the text Action item on editors to ensure all "defaults" are changed to "anonymous" MarcH: issue 146 is indistinguishable from 140 David: we should then record that in the issue description text Hugo: I changed the issue text this afternoon David: if someone proposes text for 146, we can decide to close it Action item on Henrik to generate resolution text for 146 Hugo: there are 2 issues here. First, there is a piece of text in the spec saying that processors must discard messages having the incorrect namespace. The "must" used to be a "should", and although it had been proposed to use "must", the decision had not actually been made. Second, a message was sent to the list stating that it is inconsistent with the versioning model to say that a soap app 'must' discard messages that have incorrect namespaces, and it was proposed instead to point to the section on versioning. Henrik: did we talk about this already? MarcH: if a message does not have the right namespace, it is not a soap envelope Stuart: in the list email, it suggests striking the tail of the sentence, not a proposal gudge: strike discard? A few people said you cannot do that [ie substitute the correct ns] Chris: I agree with getting rid of discard Henrik: the right thing is to say that we must have the correct namespace on a soap message. If it has no ns then generate a versionmismatch fault Chris: we could replace the word 'incorrect' in the text with 'unsupported' which is more appropriate. Henrik: what about "if you don't see this ns ...." and provide a reference to the namespace in our spec Dug: if we support an old namespace then do you support its processing model PaulC: isn't that out of scope? Dug: versioning issues.. Henrik: special case for this - the 'other' namespace which is in the versioning section PaulC: do you want us to deal with this as part of a general versioning issue? Dug: yes, maybe, could live with it but feel weird about it David: do we accept the following proposal? 1. ratify the use of word 'must' in the spec 2. say explicitly that if you encounter an ns other than (reference to our namespace) then you send a version mismatch fault Chris: I disagree - this means it can't process it - which is what Dug says Henrik: no - you are not 1.1 Noah: new specs can almost always look after previous versions PaulC: extensions are out of scope for the specification, but not for implementations MartinG: make sure the 1.1 processor gets in first! Hugo: I posted an email detailing the different scenarios to xml-dist-app: Dug: OK, can live with it David: Chris can you live this? Chris: yes David: are there any objections to closing issue 135 with the proposal just described? No objections were raised. Action item on editors to make the change to the spec. Action item on Hugo to send resolution text to xmlp-comment
http://www.w3.org/2000/xp/Group/1/11/07-pminutes.html
CC-MAIN-2016-22
refinedweb
3,669
67.18
Opened 5 years ago Closed 19 months ago #16076 closed enhancement (wontfix) Python 3 preparation: Py3 has no more the special object-function "__nonzero__" Description (last modified by ) The tool 2to3 renames __nonzero__ to __bool__. But the code has to depend on the Python version! Note that this does not affect Cython extension types because Cython supports __nonzero__ and __bool__ independently of the Python version. There are 25 affected modules. This ticket is tracked as a dependency of meta-ticket ticket:16052. Change History (23) comment:1 Changed 5 years ago by - Milestone changed from sage-6.2 to sage-6.3 comment:2 Changed 5 years ago by - Milestone changed from sage-6.3 to sage-6.4 comment:3 Changed 3 years ago by comment:4 Changed 3 years ago by - Milestone changed from sage-6.4 to sage-7.5 comment:5 Changed 3 years ago by comment:6 Changed 3 years ago by comment:7 Changed 3 years ago by comment:8 Changed 3 years ago by - Milestone changed from sage-7.5 to sage-7.6 comment:9 Changed 2 years ago by - Branch set to u/chapoton/16076 - Commit set to fbf00d716c92c3f15ca9aed888817d5efa2b89b9 Here is a brute-force tentative - search and replace __nonzero__by __bool__ - remove the former lines that have become __bool__ = __bool__ Let us see what happens.. New commits: comment:10 Changed 2 years ago by ok, this was too brutal. comment:11 Changed 2 years ago by - Commit changed from fbf00d716c92c3f15ca9aed888817d5efa2b89b9 to d3182db09b24647c2bde5ae5cf459afdbd58828d Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits: comment:12 Changed 2 years ago by ok, still not subtle enough.. comment:13 follow-up: ↓ 21 Changed 2 years ago by__() comment:14 Changed 2 years ago by Hello Travis, if you feel like giving it a try, please do. There is an abstract method __nonzero__ somewhere, which is the last place where __nonzero__ is not an alias (in python files). comment:15 Changed 2 years ago by I think we should keep things as __nonzero__ for right now (up to having an explicit alias) for right now since we are in Python2 and to avoid the extra redirection. Although I guess to test how much this would cover things for Python3, it would have to be with a Python3 build. comment:16 Changed 2 years ago by - Branch u/chapoton/16076 deleted - Commit d3182db09b24647c2bde5ae5cf459afdbd58828d deleted - Milestone changed from sage-7.6 to sage-8.0 comment:17 Changed 20 months ago by - Milestone changed from sage-8.0 to sage-pending comment:18 Changed 20 months ago by why sage-pending ? comment:19 Changed 20 months ago by I might be misusing the milestone but this seems to be a very general task ticket not tied to a specific release milestone...? comment:20 follow-up: ↓ 22 Changed 20 months ago by - Cc embray added - Milestone changed from sage-pending to sage-duplicate/invalid/wontfix - Status changed from new to needs_review comment:21 in reply to: ↑ 13 Changed 20 months ago by - Status changed from needs_review to positive_review__() I know that this reply is pointless is now, but I guess that something like that would have worked :-) We are doing something similar for division in CategoryObject: from __future__ import division cdef class CategoryObject(SageObject): def __div__(self, other): return self / other comment:22 in reply to: ↑ 20 Changed 20 months ago by comment:23 Changed 19 months ago by - Resolution set to wontfix - Status changed from positive_review to closed one step done (for the rings folder) in #21887
https://trac.sagemath.org/ticket/16076
CC-MAIN-2019-30
refinedweb
595
69.11
Type: Posts; User: David Anton You're confusing the Button's DialogResult property with the Form's ShowDialog return value. The ShowDialog's return value will be the DialogResult of the Button clicked - if you clicked with the... There is absolutely no difference. Yes - the 'doInBackground' method has an extra closing brace. The 'while' loop is being closed twice. After each call to 'search', I would add: if (breaknow) break; The compiler error says it all - "a 'ref' or 'out' argument must be an assignable variable". ((int)'A').ToString("X") Certainly: Project -> Add Existing Item -> Add as Link (you have to click the button drop-down - a bad interface for sure). C++0x (or whatever they're calling it now): notifyIcon1::BalloonTipClosed += [&] () { delete notifyIcon1; }; C++/CLI: It's one of our converters (you can check out the link in my signature). I agree about the "Keys" enum - the problem was that without a "using System.Windows.Forms", the converter can't confirm that "Keys" refers to the enum and not some other class of that name. //.h file code: public ref class MyDataGrid : DataGridView { protected: virtual bool ProcessDialogKey(Keys ^keyData) override; }; //.cpp file code: As Ovidiu said, it's no picnic to convert to native C++, but if you are one of the handful of people in the world coding in C++/CLI, then you can use: public ref class MyDataGrid : DataGridView {... The converter should have changed "Information.IsDBNull" to "System.Convert.IsDBNull". Right you are (this is fixed in the next build). Your C++ code was not compilable - after correcting it and converting I get: private string computeChecksum_ascii_checksum = new string(new char[5]); private string[] computeChecksum(sbyte[]... Learn at least a little of both - it's easier to understand some concepts if you have experience with more than one language. e.g., it's easier to understand C# struct vs class when you understand... Just drop the 'RaiseEvent' keyword. Note that 'CallByName' is not available in C# unless you set a reference to the Microsoft.VisualBasic assembly. Both the syntax and the library dictate this requirement: 1. The syntax is a Microsoft-unique thing that never really caught on much. 2. The library used is .NET - the same as C#. It's C++/CLI code which requires Visual C++ 2005 or higher. It works just like C# code, so you will have nearly identical performance as C# (slower than native C++). Also, your users will need... If you want C++/CLI (using .NET), then it's fairly simple. It's probably not what you want, but just in case here it is: using namespace System; using namespace System::Collections::Generic;... <DllImport("coredll.dll")> Private Shared Function SystemParametersInfo(ByVal uiAction As UInteger, ByVal uiParam As UInteger, ByVal pvParam As StringBuilder, ByVal fWiniIni As UInteger) As Integer... (I realize that this conversion is not complete - you'll have to make some adjustments) using namespace System; private ref class Program { private: value class Point ToList is also available in C# - it's just that VB allowed you to drop the empty argument list: lds.Fields = fs.FieldAliases.Keys.ToList(); lds.Values = new List<List<object>>(); for (int... You've got something weird happening on your system or some bad locale setting. When I try the same code I get 169.65 assigned to 'a'. The dot is being remove some other way in your code. CDec and System.Convert.ToDecimal certainly do not remove the dot. If the string contains a valid decimal, then that decimal value is extracted...
http://forums.codeguru.com/search.php?s=b0bf6d8abe9a0bbc024b91127a848ac3&searchid=5599369
CC-MAIN-2014-49
refinedweb
587
57.87
Am 01.12.2008 um 16:49 schrieb Tres Seaver: > 'context' is the canonical name for the object through which a > script or > templated was acquired (its aq_parent, in fact); 'here' is a > long-deprecated alias for 'context'. 'context' is like the 'self' > binding of a normal Python method. > > Action expressions aren't scripts / templates, and don't have many of > the stock names ('context', 'container', 'template', 'script', > 'traverse_subpath', 'namespace', 'subpath', 'options', 'modules', > 'root') which scripts and templates offer; instead, they offer names > which are useful in writing action URLs (e.g., 'object_url', > 'folder_url', 'portal', 'user_id', etc.) Their 'self' / 'context' > would > logically be the ActionInformation object, rather than the "target" > for > which the URL / condition is being computed. > > >> And the proposal was to change the expression context for actions. >> What >> about CachingPolicyManager and DCWorkflow? > > Exactly. > > - -1 to the change from me. Writing TALES expressions involves > knowing > what the appropriate set of names are for the given usage. Tres, thanks very much for the explanation. I've probably missed it but my experience has been that Actions and Workflow are the most difficult parts of the CMF to work with because they don't conform entirely to the way PythonScripts or PageTemplates behave but I think this is largely down to a lack of user/developer documentation on what they are and how to use them. I recently encountered the problem that user defined action categories will be ignored by ListFilteredActionsFor(). Improving the documentation here would probably be the best solution.
https://www.mail-archive.com/zope-cmf@lists.zope.org/msg05734.html
CC-MAIN-2017-17
refinedweb
250
52.7
Hello guys, I am taking a summer java 1 course and I have no idea how to do one of the parts of my first project for the course. The assignment is to create a program that determines if a 5 digit number is a palindrome. I am not sure how to create a code that keeps asking the user to reenter a 5 digit number if they entered the wrong number. I am assuming that somehow I have to include a while loop in the code. I was testing the loop for one of the conditions and I was unable to have the loop ask the user for a new number. I could not find any information online on this specific problem. This is what I came up with. Thank you very much for the help. ( I tried using smaller numbers to test it) mport java.util.Scanner; public class Pelindrone { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input= new Scanner ( System.in); int num; System.out.println( "Please enter five digit number"); num = input.nextInt(); while (10 < num ) { System.out.println(" Enter new number number");} } }
http://www.javaprogrammingforums.com/loops-control-statements/37902-help-please.html
CC-MAIN-2016-07
refinedweb
192
75.2
. Setup from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_datasets as tfds tfds.disable_progress_bar() Using the Embedding layer Keras makes it easy to use word embeddings. Let'sding_layer =.030 simplest. The Text Classification with an RNN tutorial is a good next step. Learning embeddings from scratch In this tutorial you will train a sentiment classifier on IMDB movie reviews. In the process, the model will learn embeddings from scratch. We will use to a preprocessed dataset. To load a text dataset from scratch see the Loading text tutorial. (train_data, test_data), info = tfds.load( 'imdb_reviews/subwords8k', split = (tfds.Split.TRAIN, tfds.Split.TEST), with_info=True, as_supervised=True).text.SubwordTextEncoder), and have a quick look at the vocabulary. The "_" in the vocabulary represent spaces. Note how the vocabulary includes whole words (ending with "_") and partial words which it can use to build larger words: encoder = info.features['text'].encoder encoder.subwords[:20] ['the_', ', ', '. ', 'a_', 'and_', 'of_', 'to_', 's_', 'is_', 'br', 'in_', 'I_', 'that_', 'this_', 'it_', ' /><', ' />', 'was_', 'The_', 'as_'] Movie reviews can be different lengths. We will use the padded_batch method to standardize the lengths of the reviews., ..., 0, 0, 0]]) Create a simple model We will use the Keras Sequential API to define our model. In this case it is a "Continuous bag of words" style model. Next the Embedding layer takes the integer-encoded vocabulary and looks up the embedding vector for each word-index. These vectors are learned as the model trains. The vectors add a dimension to the output array. The resulting dimensions are: (batch, sequence, embedding). Next, a GlobalAveragePooling1) that the review is positive. embedding_dim=16 model = keras.Sequential([ layers.Embedding(encoder.vocab_size, embedding_dim), layers.GlobalAveragePooling1D(), layers.Dense) (8185, 16) We will now write the weights to disk. To use the Embedding Projector, we will upload two files in tab separated format: a file of vectors (containing the embedding), and a file of meta data (containing the words). encoder = info.features['text'].encoder import io encoder = info.features['text'].encoder out_v = io.open('vecs.tsv', 'w', encoding='utf-8') out_m = io.open('meta.tsv', 'w', encoding='utf-8') for num, word in enumerate(encoder.subwords): vec = weights[num+1] # skip 0, it's padding. out_m.write(word + "\n") out_v.write('\t'.join([str(x) for x in vec]) + " (this can also run in a local TensorBoard instance). Click on "Load data". Upload the two files learn about recurrent networks see the Keras RNN Guide. To learn more about text classification (including the overall workflow, and if you're curious about when to use embeddings vs one-hot encodings) we recommend this practical text classification guide.
https://www.tensorflow.org/tutorials/text/word_embeddings?hl=fi
CC-MAIN-2019-47
refinedweb
452
52.15
Finds a symbol in one of the currently loaded libraries, and returns both the symbol and the library in which it was found. Syntax #include <prlink.h> void* PR_FindSymbolAndLibrary ( const char *name, PRLibrary **lib); Parameters The function has these parameters: name - The textual representation of the symbol to locate. lib - A reference to a location at which the runtime will store the library in which the symbol was discovered. This location must be pre-allocated by the caller. Returns If successful, returns a non- NULL pointer to the found symbol, and stores a pointer to the library in which it was found at the location pointed to by lib. If the symbol could not be found, returns NULL. Description This function finds the specified symbol in one of the currently loaded libraries. It returns the address of the symbol. Upon return, the location pointed to by the parameter lib contains.
https://developer.cdn.mozilla.net/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_FindSymbolAndLibrary
CC-MAIN-2021-04
refinedweb
150
56.45
I've been working on an input handler, using SDL2 and C++. Right now I'm testing it with a Pong clone, but I want to be able to use it my next games. Right now it detects if a key is currently down or not, but I start running into issues when I try to see if a key was pressed or released that frame. I'm using two arrays, one for the current state and another for the state the previous frame. Every update, I use memcpy to copy the new state to the old state, and then use SDL_PumpEvents to update the current array. The issue is that this actually isn't keeping an array of the old keyboard state. Instead, the old and new arrays are always the same, so the keys are never able to be tagged as "pressed" or "released". (I did some debugging and can confirm that keyboardOld is changing) I'm sure this is an issue with memcpy and constant pointers and all of that fun stuff, I just don't have enough experience with them to figure out what's going wrong. So, why are keyboardOld and keyboardNew always the same, even though I copy New to Old before updating New, and how can I fix it? Thanks in advance! Here's the code: Input.h #ifndef Input_h #define Input_h #include <SDL.h> #include <cstring> #include <stdio.h> class Input{ public: enum keys{ A = SDL_SCANCODE_A, B = SDL_SCANCODE_B, C = SDL_SCANCODE_C, D = SDL_SCANCODE_D, E = SDL_SCANCODE_E, F = SDL_SCANCODE_F, G = SDL_SCANCODE_G, H = SDL_SCANCODE_H, I = SDL_SCANCODE_I, J = SDL_SCANCODE_J, K = SDL_SCANCODE_K, L = SDL_SCANCODE_L, M = SDL_SCANCODE_M, N = SDL_SCANCODE_N, O = SDL_SCANCODE_O, P = SDL_SCANCODE_P, Q = SDL_SCANCODE_Q, R = SDL_SCANCODE_R, S = SDL_SCANCODE_S, T = SDL_SCANCODE_T, U = SDL_SCANCODE_U, V = SDL_SCANCODE_V, W = SDL_SCANCODE_W, X = SDL_SCANCODE_X, Y = SDL_SCANCODE_Y, Z = SDL_SCANCODE_Z, UP = SDL_SCANCODE_UP, DOWN = SDL_SCANCODE_DOWN, LEFT = SDL_SCANCODE_LEFT, RIGHT = SDL_SCANCODE_RIGHT, }; void init(); void update(); void close(); //True if a key is pressed bool keyDown(int key); //True if the key was pressed this frame bool keyPressed(int key); //True if the key was released this frame bool keyReleased(int key); private: //Length of keyboard arrays (given by SDL_getKeyboardState) int length; //State of keyboard last frame Uint8* keyboardOld; //State of keyboard this frame const Uint8* keyboardNew; }; #endif Input.cpp #include "Input.h" void Input::init(){ keyboardNew = SDL_GetKeyboardState(&length); keyboardOld = new Uint8[length]; } void Input::update(){ std::memcpy(keyboardOld, keyboardNew, length); SDL_PumpEvents(); } void Input::close(){ delete keyboardOld; keyboardOld = nullptr; } //Returns true if the key is currently pressed bool Input::keyDown(int key){ return keyboardNew[key]; } //Returns true if the key was pressed this frame bool Input::keyPressed(int key){ return (keyboardNew[key] && !keyboardOld[key]); } //Returns true if the key was released this frame bool Input::keyReleased(int key){ return (!keyboardNew[key] && keyboardOld[key]); } And the relevant code from the main program: //Handle player input input.update(); if(input.keyPressed(input.UP)){ player->y -=50; } if(input.keyReleased(input.UP)){ player->y -=50; } if(input.keyDown(input.DOWN)){ player->y +=1; } if(input.keyDown(input.LEFT)){ player->x -=1; } if(input.keyDown(input.RIGHT)){ player->x +=1; }
https://www.gamedev.net/topic/658391-old-keyboard-state-in-input-handler/
CC-MAIN-2017-17
refinedweb
506
51.78
TODO: Add part numbers of known-good infrared LEDs and receivers. The LED in this photo is Lumex OED-EL-8L (Digikey 67-1000-ND) and the receiver is probably Sharp GP1UD281YK0F (now discontinued, Digikey 425-1987-ND). TODO: Test Vishay TSOP39338 receiver (Digikey 751-1390-5-ND). It's very likely to work. Update this photo. Maybe PJRC should sell a known-good LED & receiver pair? For transmitting, you must connect the LED to a specific pin. The receiver output may be connected to any pin. Create the receiver object, using a name of your choice. Begin the receiving process. This will enable the timer interrupt which consumes a small amount of CPU every 50 µ) results.bits: The number of bits used by this code results.rawbuf: An array of IR pulse times results.rawlen: The number of items stored in the array After receiving, this must be called to reset the receiver and prepare it to receive another code. Enable blinking the LED when during reception. Because you can't see infrared light, blinking the LED can be useful while troubleshooting, or just to give visual feedback. Create the transmit object. A fixed pin number is always used, depending on which timer the library is utilizing. Send a code in NEC format. Send a code in Sony format. Send a code in RC5 format. Send a code in RC6 Send a raw code. Normally you would obtain the contents of rawbuf and rawlen by using the receiver many times and averaging the results. Some adjustments may be necessary for best performance. The frequency is the expected bandpass filter frequency at the receiver, where 38 is the most commonly used. #include <IRremote.h> const int RECV_PIN = 6;.println(results.value, HEX); irrecv.resume(); // Receive the next value } } #include <IRremote.h> IRsend irsend; void setup() { } void loop() { irsend.sendSony(0x68B92, 20); delay(100); irsend.sendSony(0x68B92, 20); delay(100); irsend.sendSony(0x68B92, 20); delay(300000); }
https://www.pjrc.com/teensy/td_libs_IRremote.html
CC-MAIN-2022-40
refinedweb
326
70.6
view raw I'm now trying to make a function that allows users to access to the link of the file to download. The native link is but, it is only accessible by admin ( for sure ). If I have a user who is eligible to know this link, then I would love to allow this user to click some button to download the file. I am kind of bogged down when it comes to implementation. Because if I use the below code, it seems it stores data into the server. def self.dropbox_download contents, metadata = Drop_client.get_file_and_metadata('/lesson_id_12:user_id_7.mp3.mp3') begin File.open('filename.mp3', 'wb') do |file| file.write(contents) end rescue end end If you only need to allow other users to download this specific file (or some specific set of files), the easiest way is to just get a shared link to the relevant file(s): You can modify these shared links for different behaviors, e.g., for file downloads, as shown here: If you do need to get these links programmatically, you can use the shares method: You can then give the shared link to the user, e.g., as a link on a web page, or in an email, etc.
https://codedump.io/share/IPotlOSmm8e/1/how-to-make-users-to-download-files-in-dropbox-with-ruby
CC-MAIN-2017-22
refinedweb
206
70.73
30593/hyperledger-fabric-make-peer-make-rule-make-target-peer-stop When I try to make peer as the guide build.md ,it shows this error vagrant@ubuntu-1404:/opt/gopath/src/github.com/hyperledger/fabric/devenv$ make peer make: *** No rule to make target `peer'. Stop. How to solve this Problem? The peers communicate among them through the ...READ MORE There are two ways you can do ...READ MORE When you run the command: peer channel create ...READ MORE You can extend your /etc/hosts file and make orderer.example.com domain name ...READ MORE Summary: Both should provide similar reliability of ...READ MORE This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE To read and add data you can ...READ MORE I know it is a bit late ...READ MORE Open the hosts file: $ gedit /etc/hosts And add the IP ...READ MORE OR At least 1 upper-case and 1 lower-case letter Minimum 8 characters and Maximum 50 characters Already have an account? Sign in.
https://www.edureka.co/community/30593/hyperledger-fabric-make-peer-make-rule-make-target-peer-stop
CC-MAIN-2022-21
refinedweb
176
70.8
A channel for sending messages. More... #include <sender.hpp> A channel for sending messages. Open the sender. Open the sender. Unsettled API - Return all unused credit to the receiver in response to a drain request. Has no effect unless there has been a drain request and there is remaining credit to use or return. Close the endpoint. Suspend the link without closing it. A suspended link may be reopened with the same or different link options if supported by the peer. A suspended durable subscription becomes inactive without cancelling it. Unsettled API - True for a receiver if a drain cycle has been started and the corresponding on_receiver_drain_finish event is still pending. True for a sender if the receiver has requested a drain of credit and the sender has unused credit.
http://qpid.apache.org/releases/qpid-proton-0.21.0/proton/cpp/api/classproton_1_1sender.html
CC-MAIN-2018-26
refinedweb
130
68.97
- NAME - VERSION - Migration from Dancer 1 to Dancer2 - Launcher script - Configuration - Apps - Request - Plugins: plugin_setting - Routes - Route parameters - Tests - Exports: Tags - Engines - Configuration - Keywords - AUTHOR NAME Dancer2::Manual::Migration - Migrating from Dancer to Dancer2 VERSION version 0.208001 Migration from Dancer 1 to Dancer2 This document covers some changes that users will need to be aware of while upgrading from Dancer (version 1) to Dancer2. Launcher script The default launcher script bin/app.pl in Dancer looked like this: #!/usr/bin/env perl use Dancer; use MyApp; dance; In Dancer2 it is available as bin/app.psgi and looks like this: #!/usr/bin/env perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; use MyApp; MyApp->to_app; So you need to remove the use Dancer; part, replace the dance; command by MyApp->to_app; (where MyApp is the name of your application), and add the following lines: use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; There is a Dancer Advent Calendar article covering the to_app keyword and its usage. Configuration You specify a different location to the directory used for serving static (public) content by setting the public_dir option. In that case, you have to set static_handler option also. Apps 1. In Dancer2, each module is a separate application with its own namespace and variables. You can set the application name in each of your Dancer2 application modules. Different modules can be tied into the same app by setting the application name to the same value. For example, to set the appname directive explicitly: MyApp: package MyApp; use Dancer2; use MyApp::Admin hook before => sub { var db => 'Users'; }; get '/' => sub {...}; 1; MyApp::Admin: package MyApp::Admin; use Dancer2 appname => 'MyApp'; # use a lexical prefix so we don't override it globally prefix '/admin' => sub { get '/' => sub {...}; }; 1; Without the appname directive, MyApp::Admin would not have access to variable db. In fact, when accessing /admin, the before hook would not be executed. See Dancer2::Cookbook for details. 2. To speed up an app in Dancer2, install the recommended modules listed in the "Performance Improvements" in Dancer2::Manual::Deployment section. Request The request object (Dancer2::Core::Request) is now deferring much of its code to Plack::Request to be consistent with the known interface to PSGI requests. Currently the following attributes pass directly to Plack::Request: address, remote_host, protocol, port, method, user, request_uri, script_name, content_length, content_type, content_encoding, referer, and user_agent. If previous attributes returned undef for no value beforehand, they will return whatever Plack::Request defines now, which just might be an empty list. For example: my %data = ( referer => request->referer, user_agent => request->user_agent, ); should be replaced by: my %data = ( referer => request->referer || '', user_agent => request->user_agent || '', ); Plugins: plugin_setting plugin_setting returns the configuration of the plugin. It can only be called in register or on_plugin_import. Routes Dancer2 requires all routes defined via a string to begin with a leading slash /. For example: get '0' => sub { return "not gonna fly"; }; would return an error. The correct way to write this would be to use get '/0' Route parameters The params keyword which provides merged parameters used to allow body parameters to override route parameters. Now route parameters take precedence over query parameters and body parameters. We have introduced route_parameters to retrieve parameter values from the route matching. Please refer to Dancer2::Manual for more information. Tests Dancer2 recommends the use of Plack::Test. For example: use strict; use warnings; use Test::More tests => 2; use Plack::Test; use HTTP::Request::Common; { package App::Test; # or whatever you want to call it get '/' => sub { template 'index' }; } my $test = Plack::Test->create( App::Test->to_app ); my $res = $test->request( GET '/' ); ok( $res->is_success, '[GET /] Successful' ); like( $res->content, qr{<title>Test2</title>}, 'Correct title' ); Other modules that could be used for testing are: Logs The logger_format in the Logger role (Dancer2::Core::Role::Logger) is now log_format. read_logs can no longer be used, as with Dancer2::Test. Instead, Dancer2::Logger::Capture could be used for testing, to capture all logs to an object. For example: use strict; use warnings; use Test::More import => ['!pass']; use Plack::Test; use HTTP::Request::Common; use Ref::Util qw<is_coderef>; { package App; use Dancer2; set log => 'debug'; set logger => 'capture'; get '/' => sub { debug 'this is my debug message'; return 1; }; } my $app = Dancer2->psgi_app; ok( is_coderef($app), 'Got app' ); test_psgi $app, sub { my $cb = shift; my $res = $cb->( GET '/' ); is $res->code, 200; my $trap = App->dancer_app->logger_engine->trapper; is_deeply $trap->read, [ { level => 'debug', message => 'this is my debug message' } ]; }; Exports: Tags The following tags are not needed in Dancer2: use Dancer2 qw(:syntax); use Dancer2 qw(:tests); use Dancer2 qw(:script); The plackup command should be used instead. It provides a development server and reads the configuration options in your command line utilities. Engines Engines receive a logging callback Engines now receive a logging callback named log_cb. Engines can use it to log anything in run-time, without having to worry about what logging engine is used. This is provided as a callback because the logger might be changed in run-time and we want engines to be able to always reach the current one without having a reference back to the core application object. The logger engine doesn't have the attribute since it is the logger itself. Engines handle encoding consistently All engines are now expected to handle encoding on their own. User code is expected to be in internal Perl representation. Therefore, all serializers, for example, should deserialize to the Perl representation. Templates, in turn, encode to UTF-8 if requested by the user, or by default. One side-effect of this is that from_yamlwill call YAML's Loadfunction with decoded input. Templating engine changes Whereas in Dancer1, the following were equivalent for Template::Toolkit: template 'foo/bar' template '/foo/bar' In Dancer2, when using Dancer2::Template::TemplateToolkit, the version with the leading slash will try to locate /foo/bar relative to your filesystem root, not relative to your Dancer application directory. The Dancer2::Template::Simple engine is unchanged in this respect. Whereas in Dancer1, template engines have the methods: $template_engine->view('foo.tt') $template_engine->view_exists('foo.tt') In Dancer2, you should instead write: $template_engine->view_pathname('foo.tt') $template_engine->pathname_exists($full_path) You may not need these unless you are writing a templating engine. Serializers You no longer need to implement the loaded method. It is simply unnecessary. Sessions Now the Simple session engine is turned on by default, unless you specify a different one. Configuration public_dir You cannot set the public directory with setting now. Instead you will need to call config: # before setting( 'public_dir', 'new_path/' ); # after config->{'public_dir'} = 'new_path'; warnings The warnings configuration option, along with the environment variable DANCER_WARNINGS, have been removed and have no effect whatsoever. They were added when someone requested to be able to load Dancer without the warnings pragma, which it adds, just like Moose, Moo, and other modules provide. If you want this to happen now (which you probably shouldn't be doing), you can always control it lexically: use Dancer2; no warnings; You can also use Dancer2 within a narrower scope: { use Dancer2 } use strict; # warnings are not turned on However, having warnings turned it is very recommended. server_tokens The configuration server_tokens has been introduced in the reverse (but more sensible, and Plack-compatible) form as no_server_tokens. DANCER_SERVER_TOKENS changed to DANCER_NO_SERVER_TOKENS. engines If you want to use Template::Toolkit instead of the built-in simple templating engine you used to enable the following line in the config.yml file. template: "template_toolkit" That was enough to get started. The start_tag and end_tag it used were the same as in the simple template <% and %> respectively. If you wanted to further customize the Template::Toolkit you could also enable or add the following: engines: template_toolkit: encoding: 'utf8' start_tag: '[%' end_tag: '%]' In Dancer 2 you can also enable Template::Toolkit with the same configuration option: template: "template_toolkit" But the default start_tag and end_tag are now [% and %], so if you used the default in Dancer 1 now you will have to explicitly change the start_tag and end_tag values. The configuration also got an extral level of depth. Under the engine key there is a template key and the template_toolkit key comes below that. As in this example: engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' In a nutshell, if you used to have template: "template_toolkit" You need to replace it with template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' Session engine The session engine is configured in the engine section. session_namechanged to cookie_name. session_domainchanged to cookie_domain. session_expireschanged to cookie_duration. session_securechanged to is_secure. session_is_http_onlychanged to is_http_only. Dancer2 also adds two attributes for session: cookie_pathThe path of the cookie to create for storing the session key. Defaults to "/". session_durationDuration in seconds before sessions should expire, regardless of cookie expiration. If set, then SessionFactories should use this to enforce a limit on session validity. See Dancer2::Core::Role::SessionFactory for more detailed documentation for these options, or the particular session engine for other supported options. session: Simple engines: session: Simple: cookie_name: dance.set cookie_duration: '24 hours' is_secure: 1 is_http_only: 1 Plack Middleware In Dancer1 you could set up Plack Middleware using a plack_middlewares key in your config.yml file. Under Dancer2 you will instead need to invoke middleware using Plack::Builder, as demonstrated in Dancer2::Manual::Deployment. Keywords Calling Keywords Explicitly In Dancer1, keywords could be imported individually into a package: package MyApp; use Dancer qw< get post params session >; get '/foo' { ... }; Any keywords you did't export could be called explicitly: package MyApp; use Dancer qw< get post params session >; use List::Util qw< any >; Dancer::any sub { ... }; Dancer2's DSL is implemented differently. Keywords only exist in the namespace of the package which uses Dancer2, i.e. there is no Dancer2::any, only e.g. MyApp::any. If you only want individual keywords, you can write a shim as follows: package MyApp::DSL; use Dancer2 appname => 'MyApp'; use Exporter qw< import >; our @EXPORT = qw< get post ... > Then in other packages: package MyApp; use MyApp::DSL qw< get post >; MyApp::DSL::any sub { ... }; appdir This keyword does not exist in Dancer2. However, the same information can be found in config->{'appdir'}. load This keyword is no longer required. Dancer2 loads the environment automatically and will not reload any other environment when called with load. (It's a good thing.) param_array This keyword doesn't exist in Dancer2. session In Dancer a session was created and a cookie was sent just by rendering a page using the template function. In Dancer2 one needs to actually set a value in a session object using the session function in order to create the session and send the cookie. The session keyword has multiple states: No arguments Without any arguments, the session keyword returns a Dancer2::Core::Session object, which has methods for read, write, and delete. my $session = session; $session->read($key); $session->write( $key => $value ); $session->delete($key); Single argument (key) If a single argument is provided, it is treated as the key, and it will retrieve the value for it. my $value = session $key; Two arguments (key, value) If two arguments are provided, they are treated as a key and a value, in which case the session will assign the value to the key. session $key => $value; Two arguments (key, undef) If two arguments are provided, but the second is undef, the key will be deleted from the session. session $key => undef; In Dancer 1 it wasn't possible to delete a key, but in Dancer2 we can finally delete: # these two are equivalent session $key => undef; my $session = session; $session->delete($key); You can retrieve the whole session hash with the data method: $session->data; To destroy a session, instead of writing: session->destroy In Dancer2, we write: app->destroy_session if app->has_session If you make changes to the session in an after hook, your changes will not be written to storage, because writing sessions to storage also takes place in an (earlier) after hook. AUTHOR Dancer Core Developers This software is copyright (c) 2019 by Alexis Sukrieh. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
https://metacpan.org/pod/Dancer2::Manual::Migration
CC-MAIN-2019-43
refinedweb
2,038
52.6
One of my friends asked me how to rotate an image to a particular angle, so I just thought of writing an article about it. The following is the step-by-step process of how to use builtin functions for rotating and flipping an image.Step 1Create a blank Windows Forms application, as in:Step 2Add a pictureBox from the toolbox and add a source image to it.Now comes the real part, using Image.RotateFlip we can rotate the image by standard angles (90, 180 or preceding code will rotate the image in a pictureBox1 by an angle of 180 degrees.Step 3Now back to our code, add the namespaces to use as:using System.Drawing.Imaging;using System.Drawing.Drawing2D;Step 4We will make a function RotateImg with two arguments one is the Bitmap Image and the other is the float angle. The); tempImg.Dispose(); return newImg; }Step 5Now we have a function which will rotate an image to an arbitrary angle, I'm adding my code now to the form_load event so that as soon as the form loads my code is executed.Bitmap bitmap = (Bitmap)pictureBox1.Image;pictureBox1.Image = (Image)(RotateImg(bitmap, 30.0f));The preceding two lines of code will first convert the image in pictureBox1 to a Bitmap image and then it will call our function RotateImg to rotate the image 30 degrees (for example).Here is the snapshot of the output window: ©2014 C# Corner. All contents are copyright of their authors.
http://www.c-sharpcorner.com/UploadFile/shubham0987/rotate-and-flip-images-in-windows-form/
CC-MAIN-2014-35
refinedweb
249
62.48
On Tue, 10 Nov 2009 06:59:25 -0800, NickC <reply-to at works.fine.invalid> wrote: > I can't seem to find a way to do something that seems straighforward, so > I > must have a mental block. I want to reference an object indirectly > through a variable's value. > > Using a library that returns all sorts of information about "something", > I > want to provide the name of the "something" via a variable (command line > argument). The something is a class in the library and I want to > instantiate an object of the class so I can start querying it. I can't > figure out how to pass the name of the class to the library. > > Or, put another way, I can't figure out how to indirectly reference the > value of the command line argument to create the object. > > To make it clearer, it's roughly equivalent to this in bash: > Sun="1AU" ; body=Sun; echo ${!body} --> outputs "1AU". > > command line: > $ ./ephemeris.py Moon > > code: > import ephem > import optparse > > # various option parsing (left out for brevity), > # so variable options.body contains string "Moon", > # or even "Moon()" if that would make it easier. > > # Want to instantiate an object of class Moon. > # Direct way: > moon1 = ephem.Moon() > # Indirect way from command line with a quasi bashism that obviously > fails: > moon2 = ephem.${!options.body}() > > Can someone point me in the right direction here? > > (The library is PyEphem, an extraordinarily useful library for anyone > interested in astronomy.) > > Many thanks, > Since Python 'variables' are really keys in a namespace dictionary, it's fairly straightforward to get at them given a string value -- what you probably want in this case is the built-in function getattr() ()... So getattr(ephem, "Moon") should give you the class object ephem.Moon, which you can then instantiate... -- Rami Chowdhury "Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
https://mail.python.org/pipermail/python-list/2009-November/557589.html
CC-MAIN-2017-17
refinedweb
325
64.81
Hi, I have implemented an ensemble consisting of 3-layer MLPs with the following architecture: super(MLP, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.relu1 = torch.nn.ReLU() self.batch1 = torch.nn.BatchNorm1d(H) self.hidden1 = torch.nn.Linear(H, H) self.relu2 = torch.nn.ReLU() self.batch2 = torch.nn.BatchNorm1d(H) self.hidden2 = torch.nn.Linear(H, H) self.hidden3 = torch.nn.Linear(H, D_out) self.logSoftMax = torch.nn.LogSoftmax(dim=1) self.SoftMax = torch.nn.Softmax(dim=1) When testing the loss for the ensemble I don’t see the loss decreasing when the number of models is increased. For a single model, it starts out with a reasonable value and then as the ensemble increases it goes up and then down. I think it might be something wrong with how we add the predictions. This is how we are doing it: def avg_evaluate(models): loss_fn = torch.nn.NLLLoss() loss = 0 total = 0 for batch_idx, (data, target) in enumerate(test_loader): y_preds = [] for idx, model in enumerate(models): model = model.eval() data = data.view(data.shape[0], -1) y_pred, _ = model(data) y_preds.append(y_pred) loss = loss + loss_fn(torch.div(torch.stack(y_preds, dim=0).sum(dim=0), len(models)), target).item() print("Final loss") print(loss / len(test_loader)) loss = loss / len(test_loader) Does anyone have any idea of what could be wrong? Would appreciate any help! Thanks.
https://discuss.pytorch.org/t/ensemble-loss-not-going-down-proportionally/100637
CC-MAIN-2022-21
refinedweb
232
52.87
On Tue, 9 Jul 2002, Conor MacNeill wrote: >. Please don't :-) > >>.. Try looking at tomcat, xerces, xalan, axis - all very good and successfull projects. You'll find far more mess and complexity, far less documentation. I think this is a result of the simple core design in ant1, plus 2-3 years of refinement on the codebase. >. Adding namespace support in ant1 is perfectly possible, as you know. There is a working PluginHelper in proposals, that works with ant1.5. >.. > > :-) Only if you make it parallel with the ceiling. I've seen pools on non-horizontal surfaces, they look good. Costin -- To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
http://mail-archives.apache.org/mod_mbox/ant-dev/200207.mbox/%3CPine.LNX.4.44.0207090725230.1693-100000@costinm.sfo.covalent.net%3E
CC-MAIN-2016-30
refinedweb
124
60.92
The Above C# is correct, and I was wrong, it's down to the timing. I added a loop into that tries to set the permissions via AddAccessRule if it fails I set the thread to sleep for 50ms before trying again & so on until my timeout is reached or it's successful; in all cases it's been successful with 5 attempts. Actually,.)++. I tried to google for bash read command and got this link: -p prompt : Display prompt, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal. Apparently if input is coming from non terminal as in your example prompt is not shown. Your codes could be much more identical. I was wrong about that. ReadByte() actually returns byte. No, there is no principal difference between the two approaches. The extra Reader adds some buffering so you shouldn't mix them. But don't expect any significant performance differences, it's all dominated by the actual I/O. So, use a stream when you have (only) byte[] to move. As is common in a lot of streaming scenarios. use BinaryWriter and BinaryReader when you have any other basic type (including simple byte) of data to process. Their main purpose is conversion of the built-in framework types to byte[]. From the facebook sdk 3.0 documents you can not give the read and publish permission simultaniously. But once you open the session with read permission later you can update this session to publish permission, by UiLifecycleHelper class. Once the session state changes to SessionState.OPENED_TOKEN_UPDATED means session updated with publish permission. Here is sample code for you hope this help you. public class Example { private static final int REAUTH_ACTIVITY_CODE = 100; private static final List<String> PERMISSIONS = Arrays.asList("publish_actions", "publish_stream"); private static final String PENDING_PUBLISH_KEY = "pendingPublishReauthorization"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView I encountered that problem as well. It seems that pyusb by default opens devices read-write, while lsusb opens them read-only, as can be seen in this $ strace lsusb extract: ... open("/sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1:1.0/uevent", O_RDONLY|O_CLOEXEC) = 6 ... I solved the problem by making all usb devices world-read/writable, but that's definitely not optimal from a security standpoint (keyloggers, etc)... You can "init" your session with read permissions by calling the initWithPermissions: method. Then call openWithBehavior:completionHandler: which will do only 1 open call with the permissions you've already set. A file can be a lot of things in unix-like systems. It might, for example be a pipeline, where a user might submit data to, but not receive data from. So no, a write permission does not imply read. Another example might be a directory where the user can deposit data (potentially destroying existing data), but not read what others have deposited. The "problem" with your request is the read_friendlists permission, the guidelines in case of non-facebook login says: In this case, make sure that the only read permissions you request are public profile and friend list. Also the offline_access han been deprecated and not useful anymore So you should ask for read_friendlists in a separate request, the alert does not affect the functionality of the app but maybe it will affects other things like quota or apps store. Hope this helps Permissions for services is determined by the account that is set to run the service. For this issue, the account was set to LOCAL SERVICE. By changing to LOCAL SYSTEM, the issue was resolved. This can be accomplished by looking at this article and scrolling down to To create the installers for your service The LocalService account acts as a non-privileged user on the local computer, and presents anonymous credentials to any remote server. Use the other accounts with caution, as they run with higher privileges and increase your risk of attacks from malicious code.. There are two useful (almost necessary) extensions of Realm which are AuthenticatingRealm and AuthorizingRealm. They provide an interface for authentication and authorization services, respectively. AuthorizingRealm extends AuthenticatingRealm. You should extend AuthorizingRealm to implement your own authenticati You need to include Extended Permissions to be able to use "publish_actions". This guide explains how to set permissions and publish a post to a wall. Esentially, the required permission as stated earlier is included like so: private static final List<String> PERMISSIONS = Arrays.asList("publish_actions"); To publish a story, they have even provided the necessary code for you which also utilises the "publish_actions" permissions: private void publishStory() { Session session = Session.getActiveSession(); if (session != null){ // Check for publish permissions List<String> permissions = session.getPermissions(); if (!isSubsetOf(PERMISSIONS, permissions)) { pendingPublishReauthorization = true; Session.NewPermissionsRequest newPermissionsRequ. If you were using iOS SDK 3.0, then this was due to a bug in the SDK. See the bug report for more details. Symptom summary: After authorizing user with openActiveSessionWithPermissions method, the sessions variable in callback method contains extended permissions that were not allowed by a user. Note that this will only work on 32bits public static int ReadInt(long address, int[] offsets) { address = ReadInt(address); for (int i = 0; i < offsets.Length; i++) { address = ReadInt(address + (long)offsets[i]); } return (int)address; } You have offsets.Length + 1 ReadInt(s) to do, one without offset and offsets.Length with offset. Each one returns the address for the next one. The last one returns a value. Considering this will work only on 32 bits (because you are reading 32 bits and using them as a ptr), using long is useless. int is enough. See: How to spawn a process and capture its STDOUT in .NET? ProcessStartInfo.RedirectStandardOutput Code: serverProcess.StartInfo.RedirectStandardOutput = true; serverProcess.OutputDataReceived += (sender, args) => Console.WriteLine("received output: {0}", args.Data); serverProcess.Start(); serverProcess.BeginOutputReadLine(); Or: serverProcess.StartInfo.RedirectStandardOutput = true; var output = serverProcess.StandardOutput.ReadToEnd(); See also: ProcessStartInfo.RedirectStandardError serverProcess.StartInfo.RedirectStandardError = true; var error = serverProcess.StandardError.ReadToEnd(); It is likely chrome prevent you from writing to the cache file it is using. Try to make a copy of the cache file(with whatever tools(like cp command) you have at hand), and do the I/O with the replica. A possible explaination is that when chrome get the permisson for read, write and append access, simply opening the file with read permission, reading the bytes with seek operation behind the scene would mess your own reading content, so to be denied by the OS. To check read permission before you call the function open with a default read access, with os.stat(filepath).st_mode; to find if you have the read permisson. Only if it is comfirmed that you have no read permisson, we could go further to figure out why chrome block your access to cache file, but not that of ChromeCacheView. In general no. I just had to dump the complete memory of a process some days ago, and the first thing I did, was to suspend the process that should be dumped. As the stopped process has no control over its own restart, there is no guarantee that it can continue afterwards, so there is no way that it could reliable check whether it was dumped or not. There are several approaches that are used, esp in the copy-protection area, like crypting memory addresses, spawning several other process to guard the orignial process, and several other tricks but which are nothing more than that: tricks. As long as the hardware does not fully encrypt everything and does inside the cpu itself without anbybody else giving access to it the there is always a way to read the memory without letting the cpu know Me helped solution on: Solving-Problems-of-Monitoring-Standard-Output. Solution protect application from additional deadlocks that Microsoft does not mention in their documentation. Okay... I've managed to prevent the errors using different method, which is to call process->StandardOutput->ReadLine(); This way the async stream reading won't happen.); } Swap in your own executable in place of B that spawns B and sends its output two different places, more or less like the "tee" command does in *nix. (Good job swapping out the .exe -- didn't think of that!) Assuming you have all the files in one place: File dir = new File("path/to/files/"); for (File file : dir.listFiles()) { Scanner s = new Scanner(file); ... s.close(); } Note that if you have any files that you don't want to include, you can give listFiles() a FileFilter argument to filter them out. There are two possible problems here: 1) If the other process does not write whole lines, then there obviously will be no line to read from the input stream. In that case, the readLine method waits until it has a whole line (which may be true after the process has finished). 2) More likely: The other process writes into a buffered writer, but doesn't flush its content. That results in the buffere being flushed at the end of the process. If the other process is a Java process, then using a PrintWriter will be the best choice. That PrintWriter should be constructed this way: PrintWriter writer = new PrintWriter(..., true) The true argument enables the auto-flush behavior for this print writer. See PrintWriter documentation. EDIT I just saw the p.waitFor() call. This causes your thread OS error 3 means path not found. OS error 5 means access is denied. You must specify a UNC network share such as \computernamesnapshot rather than a local path when using pull subscriptions and/or a remote Distributor. This is covered in Secure the Snapshot Folder. After you have create a share for the snapshot folder and updated the distributor properties to reflect this you must assign appropriate permissions to the folder. The replication agent process account must have read permissions on the snapshot share along with the other permissions described in the section Permissions That Are Required by Agents in Replication Agent Security Mode. To create a share for the snapshot folder and grant appropriate permissions follow the tutorial in Lesson 2: Preparing the Snapshot Folder. If Sadly OleDB driver by default will open file exclusively then you can't open it when it's in use by someone else, even just for reading. Two considerations: Other application may finalize its work with the file within milliseconds so it's good to try again Driver will always open file locked for writing (so you can't open it twice via OleDB) but it's shared for reading (so you can copy it). That said I suggest you should first try to open it after a short pause, if it's still in use (and you can't wait more) then you can make a copy and open that. Let me assume you have your code in a HandlExcelFile() function: void HandleExcelFile(string path) { try { // Function will perform actual work HandleExcelFileCore(path); } catch (Exception) // Be more spec. xmlReaderForMemory from libxml2 seems a good one to me (but haven't used it so, I may be wrong) the char * buffer needs to point to a valid XML document (that can be a part of your entire XML file). This can be extracted reading in chuncks your file but obtaining a valid XML fragment. What's the structure of your XML file ? A root containing subsequent similar nodes or a fully fledged tree ? If I had an XML like this: <root> <node>...</node> <node>...</node> <node>...</node> </root> I'd read starting from the opening <node> till the closing </node> and then parse it with the xmlReaderForMemory function, do what I need to do, then go on with the next <node> node. Ofc if your <node> content is too complex/long, y Same reason as below, the logcat from other preccess can't be read. How can I get logcat on my device to show logs from all processes Why not run the master perl process via C#, and then get an array of System.Diagnostic.Process by searching for process on name, as they'll all be running as "perl" Process [] localByName = Process.GetProcessesByName("perl"); Then iterate through the array and use as a standard System.Diagnostic.Process to get the output. I think you are trying to access kernel land memory range and hence the exception. User land range is from 0x00000000 - 7FFFFFFF , so try accessing is this range, as anything above is kernel space. I am assuming you are on a 32 bit machine. Check this link - "Poison" patch should handle your case: Dirty pages in the swap cache are handled in a delayed fashion. The dirty flag is cleared for the page and the page swap cache entry is maintained. On a later page fault the associated application will be killed. You can integrate mysql with jbpm5 as shown here Also you can write java handlers to fetch data from files or databases and then use #{expression} to assign actor id dynamically. Comment if anything is not clear. You could try to find the Filemon tools from SysInternals. They offered the source for download back then, but it was removed. Might be that you can still find it via google. Basically this was done with a driver, so you would have to implement this as a device driver and use a filter driver on top of the file system. It was for NT/XP, but the basic idea should still work. It's not exactly trivial though, so I don't know if this is really what you want to do. I don't see a way to do this from user space, as this would be a big security risk if this can be easily done. The problem is that scan.next() returns a String not a Word object you can not assign it like that. Try this: while (scan.hasNext()) { Word word = new Word(scan.next()); //... } To do this, you need a constructor like that: public Word(String s){ //... } From what I've read, Microsoft's runas command launches a new terminal when invoked. There is no output piping from the new terminal back to the terminal which invoked it. The closest solution suggested is to include a pipe as part of the command for runas to invoke so that the output of the command run in the new terminal is written to a file. Following this notion, you could also have a flag/signal file written as the last thing before the runas terminal exits. This will be done in one line: runas /noprofile /user:dev /savecred /env "cmd.exe /c java -cp myProj.jar com.myComp.myProj.Main -libjardirs target/lib 2> cmd.log & echo about to close terminal>>cmd.log" Last portion & echo about to close terminal>>cmd.log uses & to issue a second command in the RunAs From the chmod(1) man page (relevant parts extracted): -R Change the modes of the file hierarchies rooted in the files instead of just the files themselves. And: The symbolic mode is described by the following grammar:: g The group permission bits in the original mode of the file. So for you: chmod -R o=g * Example: $ ls -l total 0 drwxr-x--- 2 carl staff 68 Jun 28 10:25 example.d -rw-r----- 1 carl staff 0 Jun 28 10
http://www.w3hello.com/questions/-ASP-NET-process-identity-does-not-have-read-permissions-to-the-GAC-
CC-MAIN-2018-17
refinedweb
2,565
64.1
I am trying to post a large video (nearly 1 GB). I am using FTP to send video to a server, but the upload stops after a while. On the server the video crashes, but I am able to upload a smaller sized video. I’ve also used HTTP to send video to the server, sent as a Base64 enoded string, but there is an out of memory exception while encoding. I’ve tried to upload the video as a file, but without success. What is the best way to upload a large video to a server? Use HTTP POST, and post content as Form-based File Upload (mime type: multipart/form-data). This system is standard on web for sending forms and/or uploading files. Use HTTP chunked post mode, so that size doesn’t need to be known beforehand, and you can stream any file in small parts. You still have to make some code on server (e.g. in PHP) to accept the file and do what is needed. Use HttpURLConnection to initiate connection. Then use my attached class to send the data. It will create proper headers, etc, and you’ll use it as OutputStream to write your raw data to it, then call close, and you’re done. You can overrite its onHandleResult to handle resulting error code. public class FormDataWriter extends FilterOutputStream{ private final HttpURLConnection con; /** * @param formName name of form in which data are sent * @param fileName * @param fileSize size of file, or -1 to use chunked encoding */ FormDataWriter(HttpURLConnection con, String formName, String fileName, long fileSize) throws IOException{ super(null); this.con = con; con.setDoOutput(true); String boundary = generateBoundary(); con.setRequestProperty(HTTP.CONTENT_TYPE, "multipart/form-data; charset=UTF-8; boundary="+boundary); { StringBuilder sb = new StringBuilder(); writePartHeader(boundary, formName, fileName==null ? null : "filename=\""+fileName+"\"", "application/octet-stream", sb); headerBytes = sb.toString().getBytes("UTF-8"); sb = new StringBuilder(); sb.append("\r\n"); sb.append("--"+boundary+"--\r\n"); footerBytes = sb.toString().getBytes(); } if(fileSize!=-1) { fileSize += headerBytes.length + footerBytes.length; con.setFixedLengthStreamingMode((int)fileSize); }else con.setChunkedStreamingMode(0x4000); out = con.getOutputStream(); } private byte[] headerBytes, footerBytes; private String generateBoundary() { StringBuilder sb = new StringBuilder(); Random rand = new Random(); int count = rand.nextInt(11) + 30; int N = 10+26+26; for(int i=0; i<count; i++) { int r = rand.nextInt(N); sb.append((char)(r<10 ? '0'+r : r<36 ? 'a'+r-10 : 'A'+r-36)); } return sb.toString(); } private void writePartHeader(String boundary, String name, String extraContentDispositions, String contentType, StringBuilder sb) { sb.append("--"+boundary+"\r\n"); sb.append("Content-Disposition: form-data; charset=UTF-8; name=\""+name+"\""); if(extraContentDispositions!=null) sb.append("; ").append(extraContentDispositions); sb.append("\r\n"); if(contentType!=null) sb.append("Content-Type: "+contentType+"\r\n"); sb.append("\r\n"); } @Override public void write(byte[] buffer, int offset, int length) throws IOException{ if(headerBytes!=null) { out.write(headerBytes); headerBytes = null; } out.write(buffer, offset, length); } @Override public void close() throws IOException{ flush(); if(footerBytes!=null) { out.write(footerBytes); footerBytes = null; } super.close(); int code = con.getResponseCode(); onHandleResult(code); } protected void onHandleResult(int code) throws IOException{ if(code!=200 && code!=201) throw new IOException("Upload error code: "+code); } } Answer: I guess it failed because of a timeout by the big size. Since Small size video uploaded successfully , My suggestion is - Split one big file to several small files. - Upload one by one or several together based on the condition of network. - Join all of parts (after all of those uploaded successfully) at server. - Because of small size, Re-upload failed part will be easy. Just a theroy. Added 08.01.2013 It has been a while, don’t know if you still need this. Anyway, I wrote some simple codes implement the theory above, because of interest mainly. Split one big file to several small files.Read the big file into several small parts. ByteBuffer bb = ByteBuffer.allocate(partSize); int bytesRead = fc.read(bb); if (bytesRead == -1) { break; } byte[] bytes = bb.array(); parts.put(new Part(createFileName(fileName, i), bytes)); Upload one by one or several together based on the condition of network. Part part = parts.take(); if (part == Part.NULL) { parts.add(Part.NULL);// notify others to stop. break; } else { uploader.upload(part); } Join all of parts (after all of those uploaded successfully) at server. Because it is via HTTP, so it can be in any language, such as Java, PHP, Python, etc. Here is a java example. ... try (FileOutputStream dest = new FileOutputStream(destFile, true)) { FileChannel dc = dest.getChannel();// the final big file. for (long i = 0; i < count; i++) { File partFile = new File(destFileName + "." + i);// every small parts. if (!partFile.exists()) { break; } try (FileInputStream part = new FileInputStream(partFile)) { FileChannel pc = part.getChannel(); pc.transferTo(0, pc.size(), dc);// combine. } partFile.delete(); } statusCode = OK;// set ok at last. } catch (Exception e) { log.error("combine failed.", e); } I put all codes on GitHub. And made a Android example too. Please have a look if you still need. Answer: private HttpsURLConnection conn = null; conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setChunkedStreamingMode(1024); Tags: androidandroid, post, video
https://exceptionshub.com/how-to-post-large-video-on-a-server-in-android.html
CC-MAIN-2020-40
refinedweb
843
53.27
AGIWiki/Creating an AGI Game NOTE: This text, originally by Rainer De Temple Part 1 Introduction By now no doubt you know what AGI is and you have downloaded AGI Studio by Peter Kelly. This tutorial or introduction to AGI game editing will show those who have little or no programming knowledge how to get started. First, you must familiarize yourself with AGI Studio and what each button and menu item represents. Take the time to explore and experiment with each. Resources AGI games consist of 4 file types, or resources, all combined together into one file called vol.0 (or vol.x for multi-disk games). These file types are PICTURE, VIEW, SOUND, and LOGIC. The maximum amount of these in any AGI game is 256. PICTURE These are the background images for the game. They don’t include anything that animates on the screen. The only time PICTURES are changed is when the room changes. You can create picture resources with Lance Ewing’s Picedit. The pictures are stored in vector format as opposed to bitmap format. This means that you can’t create your pictures in your favorite graphics editor, because instead of storing the pixel data for the picture, it stores the actions taken to draw it. This was done to save considerable space. For example, imagine the size of a picture with a single line in bitmap format - 160x168 which would equal 26880 bytes on the disk in bitmap form with no compression. But if we were to store it in vector form, like normal, it would only take roughly 7 bytes, because it only stored the action to draw a line. VIEW These are all of the animations or moving images in the game. They are generally small in dimensions, and unlike PICTURE resources, they are stored in bitmap form, with compression(RLE). They can have a maximum of sixteen colors from a fixed palette. One of these colors must be chosen to be transparent. When the VIEW is drawn in the game, it will only display the colors that aren’t transparent. The editing of VIEW resources is done with the VIEW editor built into AGI Studio. Each VIEW contains up to 32 loops. Each loop contains a single animation, hence the name loop. The loops can have up to 32 cells each. Important: It is important to know that when I mention bitmaps, I'm not referring to the Windows file type of BMP. Although BMP stands for bitmap, bitmap is a general term in graphics as well and describes the way an image is stored. SOUND These are the sounds you hear in the game including music and sound effects. Each sound has three tracks, which can all play sound at the same time. This means that if you were writing music for your game, you could only have three instruments playing at once. For more info on creating sound resources consult the AGI message board. LOGIC These are the heart of an AGI game. An AGI game depends on at least one LOGIC resource, numbered 0. Each game cycle(every frame of the game) it reads this resource(ie number 0) and follows the actions or commands contained in it. Peter Kelly’s Template game has the system set up slightly different. He has added LOGIC resources 90-95 and 98-99 which all handle different aspects of the game such as death, etc. These are all called each cycle from LOGIC 0, and return back to LOGIC 0 when finished. For a better understanding, it is best to examine the Template Game. Inside a LOGIC resource, there are many types which you may use, these are the most common: Variables (example v234 ) Variables may store a number up to 255. Variables v0 up to v26 are reserved. Flags (example f56 ) Flags can have two states, set or not set. To set a flag, use the command set(flag number). Objects (example o2 ) These are used to control animations on the screen. When a view is loaded, it is assigned to an object. To move the view around the screen, you must refer to the object number and not the view. Objects are not to be confused with Inventory items, which are completely different. Creating a new room from the Template Game Over the years I have followed AGI editing, a lot of the so-called demos that have been released have just been rehashes of the Template Game. They would only have one room, and one view - the player. This I believe is because it is very easy to work out how to print text, but these people couldn’t work out how to create a new room. Well, it is actually quite simple. - First you will have to create the PICTURE resource for the room. Once created, add this to the game using the menu RESOURCE-ADD. Browse to the PICTURE and press OK. Set the resource number to 3 and make sure that the resource type is PICTURE. - Now that this is done, all that we have to do is create the logic. The best thing to do is just copy and paste from LOGIC.002. So, double click on LOGIC.002 in AGI Studio. An editing screen will appear with the source code for room 2. Drag the mouse button from the top of the file to the bottom to select all of the text. From the edit menu, select COPY. Now close this file, and start a new one, by clicking on the button labeled Logic editor on the toolbar. Select PASTE from the edit menu. - At the top of the file are 5 comment lines. All comment lines begin with "//". You may delete these or change it to suit this new room(3). - Next, comes an if statement. This statement checks if we just entered the room. The flag new_room will be set if we did. Everything after the brace( { ) will be done until we get to the closing brace for the if statement ( } ). - First the picture of the room number is loaded into memory, using the load.pic(room_no) command. Keep in mind that every command has either a semi-colon(;) at the end or an opening brace. In this case, it’s a semi-colon. If you wish to change the number of the PICTURE resource which is loaded, you must first set a variable(say, v200) to that value and invoke the command like this: v200 = 4; load.pic(v200); - discard.pic(room_no) just rids the PICTURE from memory once it is drawn. - set.horizon(50) sets the screen horizon. When the player’s Y value is lower than this(ie is above the horizon), then a new room will begin. - As you can see from the next comment, the next six lines may be deleted because this isn’t the first room of the game. - Now if you wish you may reposition the player on the screen, by uncommenting(removing the //’s) the code. - draw(ego) and show.pic do exactly what they say. - The rest is mostly self-explanatory, where all you have to do is replace numbers to their appropriate values. That's basically how to create new rooms from the Template Game. Using this method you should be able to create as many rooms as you like. Part 2 Introduction Each part in this series will become more advanced. It is recommended you read part one before continuing. NOTE: The work in this part is all done in a new game based on the template. Creating room objects(animations) Creating an object to add to a room is very easy. First, you must understand that the AGI system needs to have a name for everything. In this case, it needs a name for your view. There are 256 names available from o0 to o255. When you end up having many objects in one room, it can become very confusing, which one is which. That is why we can define our own names for each object. You may have noticed already, that ego has been defined as o0. Many of the variables and flags have also been defined to have easier to remember names. Adding your object name definition So, to add your object definition, add this code to the room(in this case room 2 - LOGIC.002), just under the line: #include "defines.txt" add #define your_object_name_with_no_spaces o1 So it should read like this: #include "defines.txt" #define your_object_name_with_no_spaces o1 The reason we use o1, is because ego, is always o0. Initialising your object Now, in the initialisation section of the room, we decide which view we want to use for our object, and where we want to put it. The initialisation section is everything between if (new_room) { and } We want to add our code after the line: draw(ego); The code we will add here displays a view on the screen: animate.obj(object name); //this tells the interpreter, that we're using this object load.view(2); //load the view we want to use into memory set.view(object name,2); //this assigns the view to the object we've created set.loop(object name,0); //set the current loop in the view to this value set.cel(object name,0); //set the current cel in the view to this value position(object name,43,104); //where to position the view on the screen. set.priority(object name,11); //set the priority of the object(change accordingly) ignore.objs(object name); draw(object name); //finally, draw the view on the screen. Set.loop, set.cel, and set.priority aren't really necessary, but can be useful, if they need to be changed later on. Ignore.objs makes the object oblivious to other objects. If this is not set, then another object may stop if it hits this object when moving. That's basically all there is to add an on-screen object. Remember, when using object commands, always refer to your object's name, and not the view number. Creating Inventory Items An Inventory item is one of the key elements to your AGI game. So unless you know how to add them, your game will be a flop. There are many steps to adding an item to the game, and may seem daunting at first, but once you get the hang of it, it's very easy. Creating the views for the Item Each inventory item typically requires two views: - A view for the item on the screen - A view for viewing the item once acquired. When you have done this, save the on-screen view as VIEW.002 and the Inventory view as VIEW.220. The inventory view may also have a description added. Editing the OBJECT File For the item(object) to be viewed in your inventory, it must have it's name put in the OBJECT file(not to be confused with onscreen objects). Just change object 1 to the name of your item, and the room number to the room in which it is found(2 in this case). Putting the Item in the Room After you have completed the first two steps, you are ready to add your Item to the room. This is done with the following code, added to the room: In the defines section(after the #include line): #define item name o1 //replace item name with your own. animate.obj(item name); load.view(2); set.view(item name,2); set.loop(item name,0); set.cel(item name,0); position(item name,43,104); //use your own position and priority here. set.priority(item name,11); ignore.objs(item name); stop.cycling(item name); draw(item name); Modifying LOGIC.090 This logic, in the template game, handles non-room-specific functions, like get item and look item. Add this code under the section that says put various input responses here: if (said("look","your item name")) { // your item name must be replaced if (has("object name")) { // object name is the name you put in the OBJECT file show.obj(220); // 220 is the number of the view with the // close-up and description of your item. } else { reset(input_parsed); } } Also needing to be added is the code for getting the object: if (said("get","your item name")) { if (has("object name")) { print("You already have it."); } else { reset(input_parsed); } } Getting the item from the room The above code was necessary for looking at the item in your inventory, or trying to get it if you already have it, but it's not good enough for getting the item from the specific room it's in. Use this code for that: if (said("get","your item name")) { v255 = 2; //obj.in.room only accepts variables if (obj.in.room("object name",v255)) { //so we make v255 equal to 2(the room number). if (posn(ego,37,111,51,124)) { //substitute these values with your own. print("Ok."); erase(your item name); get("object name"); } else { print("You're not close enough."); } } else { reset(input_parsed); // let logic 90 take care of it } } Of course, we don't necesarily have to use v255, we can use any available Variable. The posn(ego,x1,y1,x2,y2) command, requires that x1,y1 is the top left corner of an imaginary box, and x2,y2 the lower right corner. Don't forget to enter the words you use into the WORDS.TOK file! This code is for looking at the item: if (said("look","your item name")) { v255 = 2; if (obj.in.room("object name",v255)) { print("Here is where you describe the item in the room."); } else { reset(input_parsed); // let logic 90 take care of it } } Finally, if you do not wish the item to be drawn when it isn't in the room(ie you have taken it), then replace the line above which said this: draw(your item name); to this: v255 = 2; if (obj.in.room("object name",v255)) { draw(your item name); }
https://wiki.scummvm.org/index.php?title=AGIWiki/Creating_an_AGI_Game&oldid=23357
CC-MAIN-2021-39
refinedweb
2,347
73.78
How to Program in C You might be thinking that you have learnt lot about C language background and now eagerly want to write your first program in C. To do so first of all you need a C compiler, I have been using Turbo C++ compiler for this purpose. Why Turbo C++ compiler why not Turbo C compiler? Because Turbo C++ compiler supports both C & C++ program and if you want to learn C++, you don’t need to change your compiler. One more thing, Turbo C++ compiler provides mouse support which Turbo C compiler doesn’t. I assume that you have installed C compiler in your PC and now want to try your first program. Here is an example of your first C program which has been developed using Turbo C++ compiler. How to Write Program in C #include <stdio.h> void main() { printf("Welcome to C"); } How to Compile and Run C Program Just type the above line in the C editor and press Alt + F9 to compile that program. If there is any mistakes, it will show “Error” message otherwise it will show “Success” message. Now press Ctrl + F9 to run compiled program and you will see similar output. If you cannot see anything then press Alt + F5 to see output window. Program Output how to program with c, an explanation Let’s understand each and every line of this program. The very first line #include <stdio.h> tells the compiler to include a header file “stdio.h” in the program. Header file in C is nothing but collection of various functions. Here we are using "printf()" library function from"stdio.h" header file. The next line is "void main()" which is the beginning of the program. Every program must have a "main()" because program starts execution from this function (read more about main function here). But what does the keyword void means before the main(). This means that main function will not return any value to the compiler. I know this is tough to understand now; these things will be discussed in detailed in function page. The curly open and close braces { } defines the scope of the “main()” function means “main()” function’s boundaries. The line between curly braces printf("Hello, World!"); is the one of function defined in stdio.h whose job is to print message specified in double quotation. At the end of the line there is a semicolon (;) which is the end of that statement. C statements always end with a semicolon (;). One thing you should keep in your mind that in C program, instructions declared in “main()”, are executed from top to bottom. To understand it better let’s extend the above program. C Language Books How to program in C books How to write program in c #include<stdio.h> #include<conio.h> void main() { clrscr(); printf("Welcome to C. "); printf("C is a Programming Language. "); printf("Hello! How are you?"); getch(); } C Program Output how to program with c, an extended explanation The top two lines include two header files “stdio.h” and “conio.h” respectively. The “stdio.h” header file contains “printf()” and “conio.h” file contains “clrscr()” and “getch()”. The “clrscr()” function clears the output screen, means any output shown by previously run program will be erased and that is why we always put them at the beginning. Next is three “printf()” statements which will print three different messages. The “getch()” waits for a keyboard input and if we press any key on keyboard the program exits. So we don’t need to press Alt + F5 to see the output as we did in above program. The uses of “getch()” function will be discussed later in detail. How to Program in C Language Poll. Did this help you to write your first C Program?See results without voting Programming in C tutorials links - The C Programming Language -... - - Arrays An array in C language is a collection of similar data-type, means an array can hold value of a particular data type for which it has been declared. Arrays can be created from any of the C data-types int,... - 2 Dimensional Array in C Programming Language We know how to work with an array (1D array) having one dimension. In C language it is possible to have more than one dimension in an array. In this tutorial we are going to learn how we can use two... - C Programming Lesson -... - C Programming Lesson - Multidimensional array (3D Array) C allows array of two or more dimensions and maximum numbers of dimension a C program can have is depend on the compiler we are using. Generally, an array having one dimension is called 1D array, array... Useful Links - What is LAN (Local Area Network) ? LAN is acronyms of Local Area Network. LAN is required everywhere, whether it is office home or somewhere else. LAN is a small computer network (small version of internet) covering a small area like home,... - Hack Google for Better Search Result Google, on internet, by far is the most popular search engine which is used by about 80 percent of total internet users. Googles this popularity is because of excellent search results with extensive range... - Extend Your Computers Life A computer is a complex electronic device which we own proudly. But to remain its proud owner we need to take care of it. To extend life of computer, it must be regularly examined as we do for various... More by this Author - 79 A discussion of arrays in C programming. This C tutorial will show you how to do array initialization and display value of array in C programming language. - 14 Call by value and call by reference is the most confusing concept among new C language programmer. I also struggled with this, the reason may be my teacher is not explaining it in simple words or I was dumb. Whatever... - 34 C allows array of two or more dimensions. More dimensions in an array means more data can be held. Cool Hub :)I really think C or C++ are some of the best first languages to learn. I started working through a C book and then switched to C++. By the time I started learning Java, it was really easy to apply what I had already learned to Java and quickly pick it up. how we understand program it is the most interesting site,which gives lots of information rgarding computer Another hello world, but there are quite a few links. ;-) i just love dis site GOOD Its very usefull hub.or we can call it as Knowledge Repository. eoooww!!!!mor power guys!!!god bless!b careful??.. its easy to understand this is useful for our study and proggramming ITS EASY FOR BEGINERS TO KNOW ABT :C" easy way to develop software skills this procedure very easy to understand.....thanks to hubpages yeah its easy 2 undrstnd...! Verry useful site,thanx the creater Easy to understand.....I like it. hi my prof asked me to do a program the out put is like this; 0 0 0 0 0 0 0 0 0 0 [1] Bottom [2] Top if u press 1 the output will be like this 0 0 0 0 0 0 0 0 0 1 [1] Bottom [2] Top then if u press 2 another out put will be like this 1 0 0 0 0 0 0 0 1 it is continues until it will be like this 1 1 1 1 1 1 1 1 1 1 thank you it helps me :) my output is more than one page long but i can see only one the last page ..how to view the other pages of my output Cool i am unable to run my program because i have written studio.h instead of stdio.h .After watching this i have run my program very usefull site nice.. this site could help me on my course (information technology) specially the programming languages God bless you rajkishor09 guys can you help me create a program that can compute for the percentage of a grade pleeeaaseee!.. thanks yeh i think it is the best language that i learn thanks its too easy to understand Hub ..... I really think C or C++ are some of the first languages to learn. Initially I started working with C book and then moved to C++. By the time I started learning Java, it was really easy to apply what I had already learned and quickly pick it up. Nice, Turbo C++ is old though, I would recommend at least using Codeblocks. cool Very useful I love the tutorial that you have written! 31
http://hubpages.com/technology/Your-First-C-Program
CC-MAIN-2016-40
refinedweb
1,448
72.97
Dart's double main limitation: sigh. I am thinking about how (and even if) to present reuse of Polymer in Patterns in Polymer. I think I already know how both the Dart and JavaScript versions of Polymer want me to do reuse, but my mind rebels. I don't want to use Dart Pub and Bower packages. I don't want to build pages that link these packages and some of their dependencies. I don't even want to initPolymer()inside the main()entry point of another Dart script. Due to Dart's double main limitation, which only allows one Dart script per page, I don't think I have a choice on that account (more on that in a second). What I really want is to add a <script>tag—either Dart or dart2jscompiled JavaScript—to a page and have it load everything about my Polymer. With that one <script>, the Polymer polyfills should be loaded, my individual Polymer (template and code) should be loaded, and the Polymer platform should be loaded. With that one <script>tag, I ought to be able to use an <x-pizza>Polymer anywhere and it just work™. I don't think that's even possible in JavaScript yet, but I would like to explore the idea in Dart tonight. The main problem that I have is that if I want to run a Dart application and Polymer, things break. Consider a page with: The problem is that both theThe problem is that both the <head> <title>Reusing Polymers</title> <!-- Load component(s) --> <link rel="import" href="packages/reuse/elements/hello-you.html"> <!-- Load Polymer --> <script type="application/dart"> export 'package:polymer/init.dart'; </script> <script type="application/dart" src="main.dart"></script> </head> <body> <div class="container"> <h1>Polymer Reuse</h1> <hello-you></hello-you> </div> </body> <script>around exportof Polymer's init.dartand the <script>that references main.dartconflict: Only one Dart script tag allowed per document warning: more than one Dart script tag in. Dartium currently only allows a single Dart script tag per document.In my mind, I would like the Polymer initialization and my application's main.dartto both run in separate isolates that share access to the page's DOM. That way Polymer could do its thing getting custom elements up and running while my application could do its thing setting up the application. That's just nonsense talk though. Isolates are small workers whose entire point is to share nothing, communicating only via message passing. As such, an isolate should not even have access to the web page—it should just be able to work on whatever messages are passed to it. I double check that by removing Polymer, and spawning an isolate in main.dart: import 'dart:isolate'; main() { ReceivePort receivePort = new ReceivePort(); receivePort.listen((msg) { print('Received from isolate: $msg'); }); Isolate.spawnUri('main2.dart', [], receivePort.sendPort). then((ret)=> print('isolate spawned')); }Then, in the main2.dartisolate, I send back the content of document.body: import 'dart:html'; import 'dart:isolate'; main(List<String> args, SendPort sendPort) { sendPort.send('hello'); sendPort.send(document.body.text); }That, of course, fails. Only the first message comes back and the isolate is never heard from again. So, am I out of luck here? Possibly, but I can get both the main.dart and the exported Polymer init.dart running at the same time. I just need to only use the dart2js compiled version on main.dart. That is, instead of relying on dart.jsto fallback to the compiled version of main.dart, I use it from the outset: With that, I get both my Polymer and my simpleWith that, I get both my Polymer and my simple <!-- Load component(s) --> <link rel="import" href="packages/reuse/elements/hello-you.html"> <!-- Load Polymer --> <script type="application/dart"> export 'package:polymer/init.dart'; </script> <script src="main.dart.js"></script> main.dartconsole output: Sure, that's cheating. I am not really running two different Dart scripts at the same time. But it seems to work. I may explore this a bit more tomorrow. Then again, the isolate exercise help solidify my thinking more than I care to admit. I did not expect it to work, but seeing it fail gave me more of an appreciation for the current zone approach in Polymer.dart. Or I may even give this a go in JavaScript. But first, I need to finish that Angular chapter in Patterns in Polymer... Day #1,018 Has this issue been resolved? Has this issue been resolved?
https://japhr.blogspot.com/2014/02/running-two-dart-scripts-from-same-page.html
CC-MAIN-2017-51
refinedweb
758
67.86
On 17/01/2006, at 5:07 PM, Joseph Barillari wrote: > On Tue, Jan 17, 2006 at 12:33:59AM -0500, Graham Dumpleton wrote: >> Luis M. Gonzalez wrote .. >>> Thank you Jim!! >>> >>> You were right. >>> Instead of saving the cart items into a cart instance, I did it >>> into a >>> simple dictionary. >>> I also saved the dict only once at the end the code block. >> >> To provide some background as to why saving class objects is not >> good, >> have a read of: >> >> > > Interesting. Is there any way to store a code object in a mod_python > session? From what I've read, that general technique lets you do some > neat tricks: > > Rather than storing in a session an actual function object, you can store the full path of the module and the name of the function. Ie., something like: def callback(): ... def handler(req): ... session["callback"] = (__file__,"callback") session.save() Later on when the session is restored and you need to call the function you can do something like: (file,function_name) = session["callback"] (directory,module_name) = os.path.split(file) module_name = os.path.splitext(module_name)[0] module = apache.import_module(module_name,path=[directory]) getattr(module,function_name)() In other words you just use a level of indirection and do the lookup of the module and function yourself, rather than pickle doing it for you. The restoration will hopefully be simpler in mod_python 3.3 if I my proposal for changes to apache.import_module() is accepted. There you will hopefully be able to also supply the full path to the module as first argument instead. Ie., (file,name) = session["callback"] module = apache.import_module(file) getattr(module,name)() Does this allow you to achieve what you want? PS, I haven't actually read the article you referenced yet as getting late at night and brain not able to comprehend it. Graham
http://modpython.org/pipermail/mod_python/2006-January/019994.html
CC-MAIN-2018-09
refinedweb
304
66.94
11710/python-convert-string-to-list i have a string like this : states = "Alaska Alabama Arkansas American Samoa Arizona California Colorado" and I want to split it into a list like this states = {Alaska, Alabama, Arkansas, American, Samoa, ....} states.split() will return ['Alaska', 'Alabama', 'Arkansas', 'American', 'Samoa', 'Arizona', 'California', 'Colorado'] If you need one random from them, then you have to use the random module: import random states = "... ..." random_state = random.choice(states.split()) try states.split() this would help. READ MORE Using list comprehensions: t2 = [map(int, list(l)) for ...READ MORE mylist = [1, 2, 3] ‘’.join(map(str, mylist)) ==> .. You know what has worked for me ...READ MORE >>> import datetime >>> datetime.datetime.now() datetime(2018, 25, ...READ MORE OR Already have an account? Sign in.
https://www.edureka.co/community/11710/python-convert-string-to-list?show=11717
CC-MAIN-2019-51
refinedweb
126
60.41
On Thu, 27 Jan 2000, Ethan Benson wrote: > I am wondering what different methods people here are using to filter > your mail? (ie each mailing list to its own mailbox or other such > techniques of dealing with several high volume lists) I fetch mail from my IP's POP3 mailserver using fetchmail. The fetched mail is then handed to Exim to filter and deliver. Simple and elegant. Here is my ~/.fetchmailrc poll pop.clara.net protocol pop3 username scgf is gsmh on this system password xxxxxxx Exim gets involved in filtering mail into folders because I have a ~/.forward file like this: # Exim filter <<== do not edit or remove this line! if error_message then finish endif logfile $home/eximfilter.log if $header_to: contains "sah1" then deliver scott elif $h_x-mailing-list matches "^<debian-(.*)@lists\\.debian\\.org>" then seen save $home/Mail/Debian elif $h_subject: contains "CLOS_Linux" then seen save $home/Mail/Corel elif $h_subject: contains "dvduk" then seen save $home/Mail/DVD elif $h_subject: contains "Debian-uk" then seen save $home/Mail/Debian elif $h_subject: contains "Pilot-Unix" then seen save $home/Mail/Pilot-Unix elif $h_subject: contains "AWL" then seen save $home/Mail/Applix endif The second rule is neat because it catches all the Debian mailing list messages. I used to use procmail to deliver mail, but I prefer the Exim approach. -- Phillip Deackes Debian Linux
https://lists.debian.org/debian-user/2000/01/msg03550.html
CC-MAIN-2015-32
refinedweb
228
55.64
Investors in Conagra Brands Inc (Symbol: CAG) saw new options begin trading today, for the July 15th expiration. At Stock Options Channel, our YieldBoost formula has looked up and down the CAG options chain for the new July 15th contracts and identified one put and one call contract of particular interest. The put contract at the $31.00 strike price has a current bid of $1.10. If an investor was to sell-to-open that put contract, they are committing to purchase the stock at $31.00, but will also collect the premium, putting the cost basis of the shares at $29.90 (before broker commissions). To an investor already interested in purchasing shares of CAG, that could represent an attractive alternative to paying $31.57 3.55% return on the cash commitment, or 22.72% annualized — at Stock Options Channel we call this the YieldBoost. Below is a chart showing the trailing twelve month trading history for Conagra Brands Inc, and highlighting in green where the $31.00 strike is located relative to that history: Turning to the calls side of the option chain, the call contract at the $32.00 strike price has a current bid of $1.25. If an investor was to purchase shares of CAG stock at the current price level of $31.57/share, and then sell-to-open that call contract as a "covered call," they are committing to sell the stock at $32.00. Considering the call seller will also collect the premium, that would drive a total return (excluding dividends, if any) of 5.32% if the stock gets called away at the July 15th expiration (before broker commissions). Of course, a lot of upside could potentially be left on the table if CAG shares really soar, which is why looking at the trailing twelve month trading history for Conagra Brands Inc, as well as studying the business fundamentals becomes important. Below is a chart showing CAG's trailing twelve month trading history, with the $32.00 strike highlighted in red: .35% annualized, which we refer to as the YieldBoost. Meanwhile, we calculate the actual trailing twelve month volatility (considering the last 253 trading day closing values as well as today's price of $31.57) to be 24%. For more put and call options contract ideas worth looking at, visit StockOptionsChannel.com. The views and opinions expressed herein are the views and opinions of the author and do not necessarily reflect those of Nasdaq, Inc.
https://www.nasdaq.com/articles/interesting-cag-put-and-call-options-for-july-15th
CC-MAIN-2022-27
refinedweb
416
64
Hash. When looking up by key, we very quickly determine bucket (using hashCode() modulo number_of_buckets) and our item is available at constant time. This should have already been known to you. You probably also know that hash collisions have disastrous impact on HashMap performance. When multiple hashCode() values end up in the same bucket, values are placed in an ad-hoc linked list. In worst case, when all keys are mapped to the same bucket, thus degenerating hash map to linked list – from O(1) to O(n) lookup time. Let’s first benchmark how HashMap behaves under normal circumstances in Java 7 (1.7.0_40) and Java 8 (1.8.0-b132). To have full control over hashCode() behaviour we define our custom Key class: class Key implements Comparable<Key> { private final int value; Key(int value) { this.value = value; } @Override public int compareTo(Key o) { return Integer.compare(this.value, o.value); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Key key = (Key) o; return value == key.value; } @Override public int hashCode() { return value; } } Key class is well-behaving: it overrides equals() and provides decent hashCode(). To avoid excessive GC I cache immutable Key instances rather than creating them from scratch over and over: public class Keys { public static final int MAX_KEY = 10_000_000; private static final Key[] KEYS_CACHE = new Key[MAX_KEY]; static { for (int i = 0; i < MAX_KEY; ++i) { KEYS_CACHE[i] = new Key(i); } } public static Key of(int value) { return KEYS_CACHE[value]; } } Now we are ready to experiment a little bit. Our benchmark will simply create HashMaps of different sizes (powers of 10, from 1 to 1 million) using continuous key space. In the benchmark itself we will lookup values by key and measure how long it takes, depending on the HashMap size: import com.google.caliper.Param; import com.google.caliper.Runner; import com.google.caliper.SimpleBenchmark; public class MapBenchmark extends SimpleBenchmark { private HashMap<Key, Integer> map; @Param private int mapSize; @Override protected void setUp() throws Exception { map = new HashMap<>(mapSize); for (int i = 0; i < mapSize; ++i) { map.put(Keys.of(i), i); } } public void timeMapGet(int reps) { for (int i = 0; i < reps; i++) { map.get(Keys.of(i % mapSize)); } } } The results confirm that HashMap.get() is indeed O(1): Interestingly Java 8 is on average 20% faster than Java 7 in simple HashMap.get(). The overall performance is equally interesting: even with one million entries in a HashMap a single lookup taken less than 10 nanoseconds, which means around 20 CPU cycles on my machine*. Pretty impressive! But that’s not what we were about to benchmark. Suppose that we have a very poor map key that always returns the same value. This is the worst case scenario that defeats the purpose of using HashMap altogether: class Key implements Comparable<Key> { //... @Override public int hashCode() { return 0; } } I used the exact same benchmark to see how it behaves for various map sizes (notice it’s a log-log scale): Results for Java 7 are to be expected. The cost of HashMap.get() grows proportionally to the size of the HashMap itself. Since all entries are in the same bucket in one huge linked list, looking up one requires traversing half of such list (of size n) on average. Thus O(n) complexity as visualized on the graph. But Java 8 performs so much better! It’s a log scale so we are actually talking about several orders of magnitude better. The same benchmark executed on JDK 8 yields O(logn) worst case performance in case of catastrophic hash collisions, as pictured better if JDK 8 is visualized alone on a log-linear scale: What is the reason behind such a tremendous performance improvement, even in terms of big-O notation? Well, this optimization is described in JEP-180. Basically when a bucket becomes too big (currently: TREEIFY_THRESHOLD = 8), HashMap dynamically replaces it with an ad-hoc implementation of tree map. This way rather than having pessimistic O(n) we get much better O(logn). How does it work? Well, previously entries with conflicting keys were simply appended to linked list, which later had to be traversed. Now HashMap promotes list into binary tree, using hash code as a branching variable. If two hashes are different but ended up in the same bucket, one is considered bigger and goes to the right. If hashes are equal (as in our case), HashMap hopes that the keys are Comparable, so that it can establish some order. This is not a requirement of HashMap keys, but apparently a good practice. If keys are not comparable, don’t expect any performance improvements in case of heavy hash collisions. Why is all of this so important? Malicious software, aware of hashing algorithm we use, might craft couple of thousand requests that will result in massive hash collisions. Repeatedly accessing such keys will significantly impact server performance, effectively resulting in denial-of-service attack. In JDK 8 an amazing jump from O(n) to O(logn) will prevent such attack vector, also making performance a little bit more predictive. I hope this will finally convince your boss to upgrade. *Benchmarks executed on Intel Core i7-3635QM @ 2.4 GHz, 8 GiB of RAM and SSD drive, running on 64-bit Windows 8.1 and default JVM settings. > even with one million entries in a HashMap a single lookup taken less than 10 nanoseconds, > which means around 20 CPU cycles on my machine Clearly the entire loop is being eliminated by the JVM. It’s called dead code elimination (DCE). Unless you use a micro benchmarking framework like JMH you will get these kinds of impossible results. People need to learn how to benchmark. If you want to see an example of a JMH-based benchmark see here: It is extremely trivial to run such a test using JMH. Hi Brett. I am aware of JMH but I was using similar tool called caliper from Google (read the article carefully). It detects dead code elimination during warm up and blows up. DCE is known to me and is well explained in caliper documentation. However in this case it does not occur because: (a) we would not see linear/logarithmic results but constant function all the way, (b) caliper would not ever run such benchmark, discovering DCE at work and (3) this loop is too complex for JVM to eliminate (?), especially polymorphic .get(). So don’t worry, the benchmarks are as legitimate as I could imagine. You can run them yourself. Now that’s a really interesting improvement and a great article! Thanks! I just wonder about a possible performance regression if your keys happened to have a slow implementation of the Comparable interface – eg. lazy-loaded JPA entities. That’s interesting! How about testing puts and random removals? In models where writes are more expensive than reads, results can make another surprise I guess. I haven’t tested it, but I believe in presence of strong hash collisions prior to Java 8 HashMap had to traverse linked list when inserting new element to avoid duplicates. Now it has to traverse tree, thus again we see improvement from O(n) to O(logn). Same story for removals. What I meant is if you count the amount of potential writes on removal or insertion in tree, it is O(logN), while in the LinkedList it is just O(1), so if writes are more expensive things could be not so bright. Inserting and removing from ordinary LinkedList is O(1). But in case of HashMap, both put() and remove() has to traverse the whole list to make sure we aren’t inserting duplicate or removing the correct entry. So O(k), where k is the number of entries in one bucket (on average should be very low). In Java 8 it’s O(logk). Nice article. The bottom line is Keys should implement Comparable interface in order to get this special performance in java 8? This is actually a tricky question. If we have hash collisions but the actual hash codes are different, tree is built using them, not Comparable. But in my scenario hash codes are always equal, so HashMap has to dynamically discover Comparable and use it instead. Long story short – implementing Comparable for custom keys is a good idea.
http://www.javacodegeeks.com/2014/04/hashmap-performance-improvements-in-java-8.html
CC-MAIN-2014-42
refinedweb
1,400
63.29
PkgPkg Development repository for Julia's package manager, shipped with Julia v1.0 and above. Using the development version of Pkg.jlUsing the development version of Pkg.jl If you want to develop this package do the following steps: - Clone the repo anywhere. - In line 2 of the Project.tomlfile (the line that begins with uuid = ...), modify the UUID, e.g. change the 44cto 54c. - Change the current directory to the Pkg repo you just cloned and start julia with julia --project. import Pkgwill now load the files in the cloned repo instead of the Pkg stdlib . - To test your changes, simply do include("test/runtests.jl"). If you need to build Julia from source with a git checkout of Pkg, then instead use make DEPS_GIT=Pkg when building Julia. The Pkg repo is in stdlib/Pkg, and created initially with a detached HEAD. If you're doing this from a pre-existing Julia repository, you may need to make clean beforehand. Synchronization with the Julia repoSynchronization with the Julia repo To check which commit julia master uses see JuliaLang/julia/stdlib/Pkg.version. To open a PR to update this to the latest commit the JuliaPackaging/BumpStdlibs.jl github actions bot is recommended.
https://juliapackages.com/p/pkg
CC-MAIN-2021-25
refinedweb
204
61.02
What are network namespaces Network Namespaces are a Linux feature, that allows different processes to have different views of the network. Aspects of networking that can be isolated between processes include: Interfaces Different processes can connect to addresses on different interfaces. Routes Since processes can see different addresses from different namespaces, they also need different routes to connect to networks on those interfaces. Firewall rules Firewalls are mostly out of scope for this article, but since firewall rules are dependant on the source or target interfaces, you need different firewall rules in different network namespaces. How do you manage network namespaces When a network namespace is created with the unshare(2) or clone(2) system calls, it is bound to the life of the current process, so if your process exits, the network namespace is removed. This is ideal for sandboxing processes, so that they have restricted access to the network, as the network namespaces are automatically cleaned up when the process they were isolating the network for no longer exists. A privileged process can make their network namespace persistent, which is useful for if the network namespace needs to exist when there are no processes in it. This is what the ip(8) command does when you run ip netns add NAME. The ip netns delete NAMEcommand undoes this, and allows the namespace to be removed when the last process using it leaves the namespace. ip netns listshows current namespaces. $ sudo ip netns add testns $ ip netns list testns $ sudo ip netns delete testns $ ip netns list A network namespace is of no use if it has no interfaces, so we can move an existing interface into it with the ip link set dev DEVICE netns NAMEcommand. $ ip link show dev usb0 5: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000 link/ether 02:5e:37:61:60:66 brd ff:ff:ff:ff:ff:ff $ sudo ip link set dev usb0 netns testns $ ip link show dev usb0 Device "usb0" does not exist. Network namespaces would be of limited use if we can't run a command in them. We can run a command in a namespace with the ip netns exec NAME COMMANDcommand. $ sudo ip netns exec testns ip link show dev usb0 5: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 02:5e:37:61:60:66 brd ff:ff:ff:ff:ff:ff5: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 02:5e:37:61:60:66 brd ff:ff:ff:ff:ff:ff There is no standard daemon to start persistent network namespaces on-boot, however, the PrivateNetwork= option to systemd service files can be used to start a process in a network namespace on boot. Uses of network namespaces Network namespaces can be used to sandbox processes, so that they can only connect through the interfaces provided. You could have a machine with two network interfaces, one which connects out to the internet, the other connected to your internal network. You could set up network namespaces such that you can run the ssh server on your internal network, and run a web server in a network namespace that has the internet-facing interface, so if your web server is compromised, it can't connect to your internal network. docker and systemd-nspawn combine network namespaces with other namespaces to provide containers. docker is primarily interested in application containers, while systemd-nspawn is more interested in system containers, though both technologies can be used for either. A more novel use of network namespaces is virtual routers, as implemented in OpenStack Neutron. Network namespaced routing We previously mentioned that routes were a property of network namespaces, that virtual ethernet devices have a pair of ends, and that we can move a network interface into another network namespace. By combining these features, we can construct a series of virtual computers and experiment with routing. Two node networking To start with we're going to add another virtual computer, start a simple echo server on it, and configure the network such that we can connect to it from our host computer. As we've done in previous articles, we're going to make the left and right virtual ethernet pair. $ sudo ip link add left type veth peer name right But to demonstrate routing to another machine we need to create one, so we're making another network namespace, as we only care about its networking. $ sudo ip netns add testns We're going to move one half of the virtual ethernet device pair into another namespace, to simulate a physical link between the two virtual computers. $ sudo ip link set dev right netns testns We're going to say that we connect to interfaces in the testns namespace by connecting to addresses in the 10.248.179.1/24 subnet. $ sudo ip address add 10.248.179.1/24 dev left $ sudo ip netns exec testns ip address add 10.248.179.2/24 dev right We're also going to say that there's another network in there on the 10.248.180.1/24 subnet. Rather than having any more complicated network interfaces, we assigning it to the loopback interface. $ sudo ip netns exec testns ip address add 10.248.180.1/24 dev lo Now that we've assigned addresses, we need to bring the interfaces up. $ sudo ip link set dev left up $ sudo ip netns exec testns ip link set dev right up $ sudo ip netns exec testns ip link set dev lo up This has created a chain of interfaces linking left → right → lo. Where left is in your namespace, and right is in testns with its own private lo. Now we can demonstrate sending messages through the network namespaces, by creating a server on the lo interface inside testns. Start an echo server in the test namespace by running this command in a new terminal. It is important to run this in another terminal, as if you background the process, netcat may decide it doesn't need to actively output data as it recieves it. $ sudo ip netns exec testns nc -l 10.248.180.1 12345 If we were to try to connect to it, we would not be able to send messages. $ nc -v 10.248.180.1 12345 nc: connect to 10.248.180.1 port 12345 (tcp) failed: Network is unreachable This is because your host namespace does not understand how to reach that address, since it is not an address in your network namespace, nor is it an address on any of the subnets in the namespace, and there are no defined rules for how to reach it. So let's add a rule! $ sudo ip route add 10.248.180.0/24 dev left via 10.248.179.2 This says that you can find the 10.248.180.0/24 subnet by sending packets to the 10.248.179.2 address through the left interface. You should now be able to type messages into the following netcat command, and see the result in your other terminal. $ nc -v 10.248.180.1 12345 Connection to 10.248.180.1 12345 port [tcp/*] succeeded! 3 namespaces This works fine, but in the wider internet you need to connect through long chains of computers before you reach your final destination, so we're going to use 3 network namespaces to represent a longer chain. We are going to have two extra network namespaces, called near and far. $ sudo ip netns add near $ sudo ip netns add far We are going to create a chain of network interfaces called one, two, three and four. $ sudo ip link add one type veth peer name two $ sudo ip link add three type veth peer name four one will be in our network namespace, connecting to two in the near namespace, and three will connect to four in the far namespace. $ sudo ip link set dev two netns near $ sudo ip link set dev three netns near $ sudo ip link set dev four netns far This produces a chain one → two → three → four. To speak to these interfaces, we need to assign address ranges, so for our host to near link we will use 10.248.1.0/24, for our near to far link we will use 10.248.2.0/24, and for our destination address we will use 10.248.3.1/24. $ sudo ip address add 10.248.1.1/24 dev one $ sudo ip netns exec near ip address add 10.248.1.2/24 dev two $ sudo ip netns exec near ip address add 10.248.2.1/24 dev three $ sudo ip netns exec far ip address add 10.248.2.2/24 dev four $ sudo ip netns exec far ip address add 10.248.3.1/24 dev lo We need to bring these interfaces up. $ sudo ip link set dev one up $ sudo ip netns exec near ip link set dev two up $ sudo ip netns exec near ip link set dev three up $ sudo ip netns exec far ip link set dev four up $ sudo ip netns exec far ip link set dev lo up Now let's this time start our server in the far namespace, so we can be sure that we can't connect to it directly from our namespace. As before, start this echo server in a new terminal. $ sudo ip netns exec far nc -l 10.248.3.1 12345 Now let's try to connect to it from our namespace. $ nc -v 10.248.3.1 12345 nc: connect to 10.248.3.1 port 12345 (tcp) failed: Network is unreachable If you try to send a message, it won't arrive. If you inspect the routing table with ip route, you will see that there is no match. The relevant routing rules are: $ ip route default via 192.168.1.1 dev wlan0 proto static 10.248.1.0/24 dev one proto kernel scope link src 10.248.1.1 This says that if you're broadcasting from 10.248.1.1 and going to anything in 10.248.1.0/24 then it goes to the one interface. However this doesn't match because we want to go to the four interface which has address 10.248.3.1. We can make this route to our near interface by adding a new rule. $ sudo ip route add 10.248.2.0/24 dev one via 10.248.1.2 We can prove this hop works by starting a server in the near namespace (again, in a separate terminal). $ sudo ip netns exec near nc -l 10.248.2.1 12345 We can try to talk to it: $ nc -v 10.248.2.2 12345 This doesn't yet work, because it's a bidirectional protocol, so the return route needs to work too. $ sudo ip netns exec near ip route change 10.248.1.0/24 dev two via 10.248.1.1 This still doesn't work, since while there's now routing rules, they aren't for any addresses which have desinations in the near network namespace, so by default they get dropped. To change this we can turn on ip forwarding with: sudo dd of=/proc/sys/net/ipv4/ip_forward <<<1 Now we can talk to the near namespace, but we can't yet talk to the far namespace. We need to add another routing rule for that. $ sudo ip route add 10.248.3.0/24 dev one via 10.248.1.2 As before, this means you can route to the near namespace. However, it doesn't know how to reach the far namespace from there, so we need to add another routing rule. $ sudo ip netns exec near ip route add 10.248.3.0/24 dev three via 10.248.2.2 Now you can reach the far namespace, but it's still not working. This is because tcp is a bidirectional communication protocol, and it doesn't know how to send the response to a message from 10.248.1.1, so we need to add another rule. $ sudo ip netns exec far ip route add 10.248.1.0/24 dev four via 10.248.2.1 Conclusion I think you will agree that it's far too much faff to set up this routing just to talk to a machine on another network. You are likely thinking that there must be a better way, and you are correct, there's a couple of ways, but we will cover those in later articles.
https://yakking.branchable.com/posts/networking-4-namespaces-and-multi-host-routing/
CC-MAIN-2019-18
refinedweb
2,140
70.53
Question: Basically, I'm passing a pointer to a character string into my constructor, which in turn initializes its base constructor when passing the string value in. For some reason strlen() is not working, so it does not go into the right if statement. I have checked to make sure that there is a value in the variable and there is. Here is my code, I've taken out all the irrelevant parts: Label class contents: Label(int row, int column, const char *s, int length = 0) : LField(row, column, length, s, false) { } Label (const Label &obj) : LField(obj)\ { } ~Label() { } Field *clone() const { return new Label(*this); } LField class contents: LField(int rowNumVal, int colNumVal, int widthVal, const char *valVal = "", bool canEditVal = true) { if(strlen(valVal) > 0) { } else { //This is where it jumps to, even though the value in //valVal is 'SFields:' val = NULL; } } Field *clone() const { return new LField(*this); } LField(const LField &clone) { delete[] val; val = new char[strlen(clone.val) + 1]; strcpy(val, clone.val); rowNum = clone.rowNum; colNum = clone.colNum; width = clone.width; canEdit = clone.canEdit; index = clone.index; } Screen class contents: class Screen { Field *fields[50]; int numOfFields; int currentField; public: Screen() { numOfFields = 0; currentField = 0; for(int i = 0; i < 50; i++) fields[i] = NULL; } ~Screen() { for (int i = 0; i < 50; i++) delete[] fields[i]; } int add(const Field &obj) { int returnVal = 0; if (currentField < 50) { delete[] fields[currentField]; fields[currentField] = obj.clone(); numOfFields += 1; currentField += 1; returnVal = numOfFields; } return returnVal; } Screen& operator+=(const Field &obj) { int temp = 0; temp = add(obj); return *this; } }; Main: int main () { Screen s1; s1 += Label(3, 3, "SFields:"); } Hopefully someone is able to see if I am doing something wrong. Solution:1 Marcin at this point the problem will come down to debugging, I copied your code with some minor omissions and got the correct result. Now it needs to be said, you should be using more C++ idiomatic code. For instance you should be using std::string instead of const char* and std::vector instead of your raw arrays. Here is an example of what the LField constructor would look like with std::string: #include <string> // header for string LField(int rowNumVal, int colNumVal, int widthVal, const std::string& valVal = "", bool canEditVal = true) { std::cout << valVal; if(valVal.length() > 0) { } else { //This is where it jumps to, even though the value in //valVal is 'SFields:' //val = NULL; } } Using these types will make your life considerably easier and if you make the change it may just fix your problem too. PREVIOUS: So you can be CERTAIN that the string is not being passed in correctly add a printline just before the strlen call. Once you do this work backward with printlines until you find where the string is not being set. This is a basic debugging technique. Label(int row, int column, const char *s, int length = 0) : LField(row, column, length, s, false) { } LField(int rowNumVal, int colNumVal, int widthVal, const char *valVal = "", bool canEditVal = true) { std::cout << valVal << std::endl; if(strlen(valVal) > 0) { } else { //This is where it jumps to, even though the value in //valVal is 'SFields:' val = NULL; } } Solution:2 <LANGUAGE FEATURE XXXX IS BROKEN>! ... No, it isn't. Just before measuring the string, write in a puts(valVal), to ensure you are not mistaken about the contents of that variable. Solution:3 Whenever there is strange behavior like this, memory getting screwed up is almost always the culprit. Never mix new with delete[] OR new[] with delete. The latter is slightly worse than the former but they are both bad news. delete[] should only be used in conjunction with new[]. Mixing these allocation/deallocation notations will result in undefined behavior. Since you are never using new[], replace all of your delete[] calls with delete. It is also good practice and good manners to set your pointers to NULL after you delete them. It is highly unlikely that you will be the only one debugging this code and it would be extremely annoying to debug your pointers thinking that there is valid memory there, when in fact there isn't. Mixing these notations inevitably lead to exploits and memory leaks. Solution:4 There is a problem here: LField(const LField &clone) { delete[] val; val = new char[strlen(clone.val) + 1]; val is uninitialized when the constructor is called, and you are deleting it. Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com EmoticonEmoticon
http://www.toontricks.com/2019/05/tutorial-strlen-not-working.html
CC-MAIN-2019-22
refinedweb
751
59.94
James Gosling On .NET And The Anti-Trust Trial 270 gwernol writes: "There's a short but interesting interview with James Gosling over on ComputerWorld. He talks about the differences between J2EE and .NET and also about the Microsoft anti-trust trial. Some interesting perspectives from the founder of Java." J2EE vs .NET (Score:5, Informative) "The experimental flaws of the Microsoft tests render the performance comparisons unusable. All tests must be run on the same test bed and a more suitable application must be chosen. J2EE and The For developers who are comfortable with limited choices, The Ultimate Linux Bookmark [monolinux.com] Re:J2EE vs .NET (Score:2) Re:J2EE vs .NET (Score:2, Redundant) comparison more illuminating than Gosling's off-the-cuff boosterism, referenced by this slashdot topic. Whether I agree or disagree with Gosling's opinions in the interview -- in fact, I mostly agree -- they remain just that, almost pure op ed, rather than substantive comment. That's not a criticism of Gosling's (presumed) honest expression of his opinions, just a comment on the practical usefulness of the article. Re:J2EE vs .NET (Score:2) Indeed. Perhaps that tool could be (to Mr. Gosling's dissapointment) Eclipse [eclipse.org] or one of the IBM Websphere Studio products based on it, like WS Application Developer. Re:J2EE vs .NET (Score:4, Interesting) Simply getting several 'products' from different groups (JBoss, Catalina/Tomcat, etc.) to work together as well as dealing with a seperate edit/compile environment (JBuilder6 - no choice here), AND having to modify no fewer than 4 files (two Java source files and two XML files) by hand to simply add one field to an EJB (in ADDITION to the code you have to write to support it), AND having to deploy the There are probably better ways to do it but we haven't found it yet. Re:J2EE vs .NET (Score:2) Second, does your application need to be a web service, or will some other IPC do? If it doesn't need to be a web service, you are going to a lot of extra trouble in the Java implementation. Re:J2EE vs .NET (Score:2, Informative) 1) Use Forte / Eclipse / Netbeans to build your app. 2) Download JBoss 2.4.4 with Tomcat. 3) type something like tar -zxvf jboss.tar.gz 4) type somthing like jboss/startup.sh 5) copy your 6) Browse to localhost/myapp It really isn't that hard. Come on people. Please quit bashing J2EE speading FUD about how difficult it is. It really isn't. Okay, I'll bite. (Score:5, Informative) - You have to edit four files to add a field to an EJB? Let me assume for a minute that you're using container managed persistence, which is the only scenario that would require such changes. Most tools will allow you to define the new field in your local interface, and will then propagate that field to your implementation class and your ejb-jar XML file. The second XML file, I will assume, is a custom deployment descriptor. Again, I would hope you're using a vendor's tool to manage this thing. But even if not, I find your indignaton towards all of this "work" somewhat amusing. To put this tremendous amount of work in context, how much work does it take to add a field to a regular database table wtih a SQL call in JDBC, or for that matter, ADO.NET? That would require: - doing a DML statement on the table to add the column at easiest. In some environments this may require several DML statements to create the new table, re-populate it with old data, populate it with the new column's data, then drop the old table and rename the new one. - changing 1-2 method call signatures to take in extra parameters for inserts and updates. - changing the JDBC code for reading, updating, and inserting to take the new field into account - possibly adding the field to a data object that holds the data in memory. Phew! I'm glad there's alternatives to EJB, it's so much easier without it. Now, on to the next cow: Deploying a JAR to two different places (jBoss and Tomcat). Firstly, I question what the problem is. You would deploy an EJB JAR to a jBoss instance and a WAR to tomcat, or you could just put it into one big EAR file and fo'gettaboutit. If you have two servers, then the ant optional tasks package could very easily do this work for you with approximately 3 lines of XML configuration. The best part about your post is that "there probably are better ways". Yes, there are. Hire a consultant for 3 or 4 hours to help you out, it will probably be worth the $1000+. If you're missing GUI tools for jBoss, that would be because it doesn't really have any. Use a commercial server if you're not willing to hand-craft your config & deployment. Mac user? (Score:4, Interesting) Re:Mac user? (Score:2) He runs alphas. There's always an alpha inside sun. Re:Mac user? (Score:2, Informative) Re:Mac user? (Score:2, Insightful) Who knows, maybe Apple could convince Sun to turn into a major customer now :-) Re:Mac user? (Score:2) You can take my multibutton mouse when you pry it out of my cold, dead fingers. Speaking of .NET... (Score:5, Informative) Re:Speaking of .NET... (Score:2) given that, how soon do you suppose we'll see a rogue port of Microsoft's CLR to Linux? Re:Speaking of .NET... (Score:2) whether we see them or not depends on who we know and how hard we look. Mono is the legit path. Talking out of one's posterior (Score:2, Informative) Re:Speaking of .NET... (Score:5, Informative) "It seems worth pointing out that it is "illegal" (in the sense that that Microsoft owns the law) to do this on Linux. Really. Not kidding. Read the license." Now, let's look at Microsoft's license. (original in italics, my comments. OK, so the license covers the software only, not works which take advantage of it. You can only use it for non-commercial purposes... well, the source code anyway.. OK, so I can make modifications to the software AND give them away, so long as I don't try and sublicense it or make the license terms broader than they already are. Fair enough? You may use any information in intangible form that you remember after accessing the Software. However, this right does not grant you a license to any of Microsoft's copyrights or patents for anything you might create using such information. Here is a very important point: Looking at this code does NOT in any way restrict your contribution to other Open Source projects or business use. The only thing is that it doesn't grant you use of their copyrights/patents, which you don't have in the first place. you cannot restrict yourself or generate any harm by looking at this source code. I know many of you are doing a double-take, but look at the license.. Microsoft reserves all rights not expressly granted to you in this license. OK, to sum up: You agree not to remove copyright notices. You also agree to distribute the license with any derivative products, etc. You agree not to distribute the software or modifications with a license that is broader or incompatible with this one. You must include a notice that your code is not Microsoft original code, and when it was modified. So far, that all sounds fairly reasonable to me. You also have to agree that Microsoft provides no warranties on the software, and that derivative works don't have any warranty (because that would make MS liable.) This is standard in the software industry, so no surprise there. An odd provision comes next: if you sue anyone over patents that you think apply to the software or anyone's use of it, you lose your license automatically. Basically, you can't sue anyone for using your patents related to this software or any modifications whatsoever. This doesn't really protect Microsoft, as you can still sue them, you just can't use their code. However, it does protect consumers of your modified code, in that you cannot come along a year later and sue them all saying your derivative includes software patents that you own and would now like to collect royalties on. Lastly, but not least, if you violate the license you lose it, and Microsoft reserves the right to kick you to the curb if they don't like you. Well, honestly... I don't know where the magic "you cannot use this sourcecode on linux or on/with any GPL stuff" phrase is, but perhaps I misread the license somehow. Re:Speaking of .NET... (Score:2) license that prohibited any use with virally licensed software, i.e. GPL. Oh my aching Karma:)) Sorry for the red herring. "Hi kettle, my name's pot!" (Score:5, Insightful). Then lying about it and criticising others... This man is obviously incapable of feeling shame. The worst part of it is that there are millions of "developers" out there who only know Java (or more often: switched to Java from Visual Basic) who simply accept Sun's marketing as fact. Re:"Hi kettle, my name's pot!" (Score:3, Interesting). The Java object model is a lot closer to the Simula object model which is much older and simpler than C++'s. I mean garbage collection is a pretty big part of the object model and Java has it and C++ doesn't. C++ has templates and Java doesn't. Re:"Hi kettle, my name's pot!" (Score:2) And Java does have templates. Check out JSR014 and the work done by the authors of Pizza [avayalabs.com] Re:"Hi kettle, my name's pot!" (Score:2) Here's a timeline: (Jamie Zawinski) Timeline [jwz.org] Enjoy ! Heh (Score:2) But no matter, it's all about pico. Java on OSX (Score:5, Insightful) This is very interesting and parallels what we and others have been experiencing. There is this slow but dramatic sea-change taking place in the community of scientific computation and programming communities. Folks that never before would even look at a Mac are moving to the platform for a variety of reasons including its UNIX core and ease of use. Additionaly it seems that Apple is actually listening to their users these days. They include features requested and the open source Darwin allows for significant development from the community (assuming you are old enough to sign the agreement Re:Java on OSX (Score:2) I'm beginning to find all this Mac activism annoying. I mean it was annoying with Linux, but at least I could understand that as it has an advertising budget of next to zero, so it relies purely on word of mouth to spread. But Apple spend so much on marketing that I can't walk down the street or turn on my TV without being told to think different. Please - feel free to promote the Mac, but at least in stories that have some relevance. I don't care what the java support on MacOS X is, if you use Sun's VM it's good on Windows, and ditto for Linux. So what? Re:Java on OSX (Score:2) Dude, deal with it. One of the reasons Slashdot is here in the first place is for Linux activism and promotion. it's been invaded by people who'll plug the Mac at any opportunity! Once you try OSX, you may never go back. It's a pretty sweet experience. I'm beginning to find all this Mac activism annoying. I mean it was annoying with Linux, Then why are you here? Please - feel free to promote the Mac, but at least in stories that have some relevance. I don't care what the java support on MacOS X is, if you use Sun's VM it's good on Windows, and ditto for Linux. So what? This does have relevance in that Microsoft has long since stopped supporting true Java in favor of a bastardized version that only works with Windows. The true beauty of the Java concept was that it is cross-platform. This means that we can use Java on Windows, Linux, Irix, Solaris and the Macintosh. If Microsoft has their way, Java in its true form will cease to exist and we will be stuck with C# that only works within the Windows paradigm thus handicapping many potential features and leaving innovation in the trash can. Interesting, how? (Score:5, Insightful) This is Sun propaganda pure and simple. I can't wait for a headline on the front page telling us that Coca-Cola says new Pepsi is disappointing. When Microsoft have made less-than-favorable remarks about Java in the past it has instantly been flagged as FUD. I suggest folks take Sun PR and Gosling's remarks with a grain of salt. Evaluate the technologies for yourselves and decide accordingly. Re:Interesting, how? (Score:3, Funny) Re:Interesting, how? (Score:2) "relieved that it wasn't creative" (Score:3, Interesting) I don't know what to make of this: Why would he be relieved that MS puts out mediocre stuff? I hate that the world is forced to use boring, insecure, ugly, embraced-and-extended software from MS. I want them to be creative. Personally, I think .NET is pretty good, technologically. I like C# + CLR a lot more than Java, and infinitely more than C++. But what troubles me is that it's got a Microsoft copyright on it, which is pretty much a guaranteed poison pill in my view, but that's another issue. On the whole, we should hope for Microsoft to be "creative", that's the whole point, the whole reason we don't like them. As Steve Jobs said, "they have no taste". Then again, I shouldn't expect unbaised answers from Gosling, eh? Re:"relieved that it wasn't creative" (Score:3, Funny) > mediocre stuff? Two words: "Stock options". Here's another, perhaps less mercenary, but also less rational, explanation: Many anarchists vote for the worst candidate, on the theory that when gov't becomes bad enough, it will be eliminated. Re:"relieved that it wasn't creative" (Score:4, Interesting) I think I understand why. It's because Microsoft in the Re:"relieved that it wasn't creative" (Score:5, Informative) I do find it obvious that there are some things in C# that are like Java. However, it seems to me that this is generally moot considering both languages where heavily inspired from C++. When you do your homework, you find that C# is actually quite different the Java: + C# is completely OO - even an Int32 is an Object. Java uses primitive types. + C# uses Delegates for Event Handling (think function pointers, but different). + C# supports the use of Properties instead of Getter and Setter methods. + C# supports Indexers which allow objects to be treated as Arrays. + C# forces explicit Method Overriding (via the virtual/override or new keywords). + C# supports namespaces. Unlike Java's packages, namespaces do not rely on a file/folder structure. + The C# Abstract or "Virtual Machine" (CLR) is not designed for C#, rather for language neutrality (to an extent). Java and the JVM, however, are closely tied. I could go on. Whethor or not you think that these differences are Good Things(tm), the point is, they are definitely different langauges. Although there may have been some inspiration from Java, I'd be hard pressed to call it a "Java Ripoff". Re:"relieved that it wasn't creative" (Score:2, Informative) That is flat out silly. Java provides object wrappers for it's primitive types. If you want to talk about non-OOP features, C# is full of them. Like structs for example. Who came up with that idea? And how about pointers? WTF? As far as Indexers go (and pretty much all the differences between Java and C#), they are just syntactic sugar that really just makes code confusing to read compared to Java. The C# Abstract or "Virtual Machine" (CLR) is not designed for C#, rather for language neutrality (to an extent). Java and the JVM, however, are closely tied.! There are many programming languages available for the JavaVM, including Lisp, Scheme, JavaScript, JPython, Prolog, and Eiffel. The fact is that the JVN is very little, if at all more language centric than is the CLR. Although there may have been some inspiration from Java, I'd be hard pressed to call it a "Java Ripoff". If it isn't a Java ripoff, then why is everyone comparing it to Java? The fact is that Microsoft never innovated anything - and C# is just another Microsoft clone of somebody else's real innovation, plus marketing spin. Re:"relieved that it wasn't creative" (Score:3, Interesting) If it isn't a Java ripoff, then why is everyone comparing it to Java? Maybe because Java is it's competitor? The fact is that Microsoft never innovated anything The fact is that you are so passionate about this personal conviction, that you could care less about any facts. Try to remain objective about this stuff - it's just technology! I've included an excerpt from John Gough, someone who's written a Component Pascal compiler for BOTH the JVM and CLR, and has written a book on the CLR (ISBN:013062296-6). [The CLR] "... like the JVM, is based on an abstract stack machine. Apart from this superficial level of commonality, the design of the two virtual machines is quite different." Of course, he's not in the middle of any debate, he's just giving some introductory history (from the P-Machine to Re:"relieved that it wasn't creative" (Score:2) The fact is that you are so passionate about this personal conviction, that you could care less about any facts. Try to remain objective about this stuff - it's just technology! Oh baloney. The FACT is that C# and Java are closer than any other two languages I have ever seen, in fact C# is closer to Java than versions of the SAME language in many cases (say FORTRAN 77 and FORTRAN 90 for example). The FACT is also that if you take a close, hard look at Microsoft products, you are going to have a HELL of a time finding any single product feature that wasn't done somewhere else first. [The CLR] "... like the JVM, is based on an abstract stack machine. Apart from this superficial level of commonality, the design of the two virtual machines is quite different." And the point of this is exactly what? The author of this statement is biased? How can you can possibly state the fact that underlying structure of both the JVM and CLR is an abstract state machine 'superficial'? This is in fact the most FUNDAMENTAL commonality that you could possibly have in such implementations. How can you not realize that? Re:"relieved that it wasn't creative" (Score:2) Does this lack make Java bad (no) Does this lack make Java non-innovative (nope) Does this make C#/.net innovative (I don't know, I have not decided yet) In software, innovation comes from the combination of known things, not something completely new (software patents bad, copyright good). Java was innovative because it combined a lot of features into a well-conceived whole. Even though Java started off as C++, it was developed into something much more interesting. C# steals most heavily from Java, Delphi, C++, big deal. Java stole most heavily from C++, big deal. Everything OO steals from SmallTalk, Simula. All of these stole from Algol and FORTRAN. For Gosling, C# is crufty because it allows you to break the rules (pointers, defeat the default garbage collection). For me C# is good because GC is the default, and you have to declare your intention to break the normal rules. Great poets break the rules of good English, but they learned the rules first, and then decided to break them for effect. For me, I've broken the rules when standard techniques don't work well. If you are a good programmer (a reasonable assumption) then you have probably broken the rules too. Elegance is often sacrificed on the alter of necessity. Seems to me that I recall Java allowing you to make calls to native code (JNI), mostly for the same reasons (flexibility & legacy code). I believe Gosling was being just a touch biased. I believe we are both smart enough to see that. And I'm certain we are both smart enough to see bias when one of the MS minions says something. AFAIK, there is something innovative in C#, feel free to correct me, I'm probably wrong. In that C# gives you the declaritive ability for unsafe coding techniques. Sounds wierd when I say it, but this seems innovative to me. I don't have to switch from Java to C (2nd language, somewhat clunky) in order to break the rules, yet I don't have a language (C/C++) where unsafe coding is in abundance. You might even note bias in what I have said. I prefer to think of myself as biased towards the truth -- an objective observer. You may perceive me to be a sycophant for MS. Really, it's OK by me. My self-perception does depend on your viewpoint. But, as we try to develop our own self-perception, it generally makes sense to listen to the viewpoints of others. Occasionally, someone else is right. Maybe even Microsoft -- even if so, good software does not imply righteous company. Where did you learn OO? (Score:5, Informative) Object wrappers for primitives is not the same as the primitives themselves being treated as objects. Anyone whose used a true OO language like Smalltalk cringes and the inconsistency in Java between primitives and objects. Even C++ tries to make them as interchangeable as possible especially with templates. For instance in Java there's no way to pass just a primitive like "5" or 2.6 to a method that takes an object while in C# and Smalltalk you can. If you want to talk about non-OOP features, C# is full of them. Like structs for example. Who came up with that idea? And how about pointers? WTF? The above comments how that you've somehow confused object oriented with Java which unfortunately are not the same thing. An object oriented system has 3 main qualities i) encapsulation or information hiding ii) inheritance and iii) polymporhism. All three of which can be done with C# structs (or value types). Secondl, I am immensely confused what the existence of an explicit pointer type has to do with whether a language is OO or not. As far as Indexers go (and pretty much all the differences between Java and C#), they are just syntactic sugar that really just makes code confusing to read compared to Java. Really? So is easier to read than On what planet?! The Java VM was designed to run Java while the CLR was designed to be language agnostic. The fact that C++ can run on the CLR is a testament to this fact. Re:Where did you learn OO? (Score:2) The CLR is *syntax* agnostic. Not really the same thing. Re:"relieved that it wasn't creative" (Score:3, Interesting) That is flat out silly. Java provides object wrappers for it's primitive types. That doesn't negate his point. After all it would take a monkey fifteen minutes to create those wrapper classes. But you can't add two float wrappers to each other or do a "++" on an integer wrapper can you? So eventually you need to deal with wrapping and unwrapping. That's just plain silly and the only excuse for it is performance. If .NET gets similar performance without the primitive type hack then Java has no excuse. If you want to talk about non-OOP features, C# is full of them. Like structs for example. Who came up with that idea? There is nothing wrong with a language having features that are not OOP. OOP is not a religion. The problem with non-object primitive types is that you need to deal with wrapping and unwrapping them. Anyhow, there is nothing non-OOP about structs either. OOP *allows* encapsulation, it does not *demand* it all of the time. As far as Indexers go (and pretty much all the differences between Java and C#), they are just syntactic sugar that really just makes code confusing to read compared to Java. That's weak. Any extra syntax taht C# adds, no matter how simple or readable is "confusing." Look, I think C# and Java are tweedledee and tweeldedum. I hate them both. I have no reason to defend one over the other. But you are so blatantly partisan that you refuse to look at the few, tiny things that C# got right with fresh eyes. That sort of thinking will hurt Java in the long run because it will blind Java's developers and users to good ideas from elsewhere. You should use the things that C# got right to pressure Java's developers to fix their mistakes. In particular, Java could use a strong dose of syntactic sugar. C# is a little better, but just a little. For starters, I'd suggest you look at Python handles iterators, indexers, generators, and dictionary and list initializers. There is nothing I hate more than switching from Python to Java and realizing that I could write half as much code and it could be clearer. Even ignoring the static type checking system, Java seems to go out of its way be verbose. That iterator class crap is just unbelievably ugly. Re:"relieved that it wasn't creative" (Score:2) + The C# Abstract or "Virtual Machine" (CLR) is not designed for C#, rather for language neutrality (to an extent). Java and the JVM, however, are closely tied. It will be years before we know whether non-Java-like languages actually run better on the .NET runtime than on the C# one. Don't believe Microsoft's PR. Re:"relieved that it wasn't creative" (Score:3, Insightful) Hmmm...given that only "managed*" code will run in the CLR, I don't think that non-Java like languages will ever run in *NOTE: I use the term "managed" here to refer to the fact that Microsoft has invented skinable languages. All CLR code must conform to certain rules before it will compile. This includes the single parent & no pointers stuff that keeps C/C++ from being used. This is also the reason that VB.Net is totally new and only looks like traditional VB. Basically, VB.Net is a skinned version of C#. Re:"relieved that it wasn't creative" (Score:2) Well, if that's the case, then it's a pretty ugly skin! Re:"relieved that it wasn't creative" (Score:2) Hmmm...given that only "managed*" code will run in the CLR, I don't think that non-Java like languages will ever run in .NET. The CLR can be used for both managed and unmanaged code. m [yasd.com] . And anyhow, other languages could be "managed." There is already a prototype of Python running on the CLR and there is no reason to believe that it could not be finished one day to be equivalent to Jython. And C++ runs on the CLR: already [microsoft.com]. Re:"relieved that it wasn't creative" (Score:2, Informative) Re:"relieved that it wasn't creative" (Score:2) It would be more accurate to say that Java has primitive types. If you want a primitive integer value, declare an "int". If you want an object, declare an "Integer". This is a curios statement, however. I was under the (false?) impression that the Integer object is simply an object that works with the int primitive. It's not really a language feature, but part of the Class Library. With C#, an int is just a syntactic representation of System.Int32, which ultimately inherits from System.Object. So, an int->System.Object where as in Java an Integer->int. Seems like a fundamental difference, although I could be completely wrong. Re:"relieved that it wasn't creative" (Score:2) Every now and then, a new 'language independent language' appears - an IDL, a VM, a higher-level 'scripting' system, X Schema - which then proves to be not so independent after all, in that it assumes and constrains too much. Gosling is relieved because there are lots of clever things that MS could have done given a blank sheet - support for logic/query programming, inbuilt databases, workflow systems, LISP-style programs-as-data etc. - but even with billions of R&D dollars at their disposal, they merely managed to clone Java. Unless you really believe that a DCE/CORBA-style common type system qualifies as innovation? Re:"relieved that it wasn't creative" (Score:2) Where do you get the dea that Microsoft has a "copyright" on .Net? They do own soe patents on the way the technologies work, but that is nowhere near a copyright. .Net has been submitted to the ECMA, and if M$ has it copyrighted projects like Mono, which already has a working C# compiler, wouldn't be able to exist. [go-mono.com] Re:"relieved that it wasn't creative" (Score:2) You can only copyright an implementation. The copyright is automatically granted by law on someone's work, so MS has the copyright on their implementation of Disappoining (Score:5, Funny) The funny thing is that he says 1) They copied everything from Java 2) They could add clever things to their language, but they didn't Well, at least, he's honest about Java Re:Disappoining (Score:2) the press. You don't talk *to* an interviewer, on their (how low can you go?) level. You talk *through* them, use them as a bully pulpit to reach your target audience. (Or perhaps he's a Kantian, and is obligated to treat all moral patients as ends rather than as means.) Re:Disappoining (Score:2, Insightful) Indeed. There is no doubt that Gosling is a very bright guy, and has a track record of interesting technologies. But all this interview proved is that even smart people can have blind spots and be stupid. I mean, he can't find ANYTHING positive to say about the technology? How about the multi-language support? And most of even the strident critics of Microsoft who are honest have to admit that there are some interesting ideas in C#. They might have done something creative around ... integrating business logic into the language ... Business logic in the language??? Hey Gosling -- that's the advantage of MULTI LANGUAGE SUPPORT. There's this language called COBOL. Maybe you've heard of it. It has PILES of business logic built into the language. And, I mean, the fact that the syntax [of C#] is so much -- is like exactly the same, or just about exactly the same [as that of Java]. That's such bullshit. Yeah, and I could also say that "... the syntax [of Java] is [...] just about exactly the same as that of C++". Their both C++ derived languages. Of course they're going to look similar. The difference is that C# has fixed some of Java's brain damage, one of which is the lack of an unsigned data type which is just unforgivable. All that proved to me is that Sun is really, really frightened about the potential of .NET. Java is an interesting platform, and an interesting language. But there's a huge opportunity for someone to come in with better solutions, and Sun knows it. Re:Disappoining (Score:2) I saw James Gosling speak here in Madrid not too long ago and I can say that I was completely disappointed. His answers to questions were blunt, uninteresting and usually condescending - sometimes even just repeating the question as an answer or just blowing it off entirely. From what he himself said, he seems to have not paid much attention to what's going on with the Java language since helping create it... That is to say, he put all his eggs in the Jini basket, and when that tech failed to catch on, he was lost. J2EE, web services and J2ME? Nada. It was obvious from his speech and answers to questions that he doesn't have a clue. The worst part was that he didn't seem very technical any more. He's into management and evangelism and all that and avoided specifics whenever possible. Thus, from now on I feel I can safely discount anything I read in the press from him because I know he's just bullshitting (which is obvious from this article too...) -Russ SUNW against the wall, this time for keeps (Score:5, Insightful) Linux is totally chewing up their low end. They don't want to admit it straight out - they have been playing nice with open source folks while quietly taking Cobalt off of the market and making it a bit player. Meanwhile IBM is taking it apart at the high end with a proposition that focuses as much on services as hardware and software..because IBM knows billable hours are where the real renewable revenue is. On the architecture side, Sun is pitting itself against an entire enconomy - Intel and Microsoft. Sun simply can't outresearch, outspend or outmarket either of these companies, let alone both of them and their attendent co-competitors (Dell, AMD, HP, etc). Once Microsoft gets Win2k up to par in every respect with Solaris (it will happen), they will start peeling high-price clients off of Sun with little contest (meanwhile linux will chew up Sun's low end more and more). On top of all of this, they're playing mindshare catch-up with the half-hearted JavaOne. Sorry James, MS beat you to the punch on webservices by a year. I just hope Java can't be opened up enough that it doesn't evaporate along with its owner. Re:SUNW against the wall, this time for keeps (Score:2) years. According to analyst reports, 40% of web services will be microsoft-owned over the next 5 years, 40% will be Java-backed SOAP/XML-RPC, and 20% will be also-ran. As regards Sun's stock values, while there is a correlation with server market share, it's really surprisingly low. Sun can save it's butt one of two (and probably by a mix of both) ways: The burgeoning embedded Java business, and putting out really butt-kicking CPUs and interconnects for their large SMP and NUMA boxes. The volumes on the first of those are huge, and the margins on the second of those are similarly huge. Sun looks bad right now because they were a primary bubble stock. In fact, their P/E ratios and prospectus are quite sane and robust now. Vitriol gets press. Vitriol directed at microsoft is also a moral imperative. Why tone it down? But it doesn't deserve a slashdot story, that's for sure. Re:SUNW against the wall, this time for keeps (Score:3, Insightful) I guess you missed the part where Sun announced that they'll be shipping Linux and supporting Linux sometime midyear. I'd say that amounts to "admitting it straight out". Once Microsoft gets Win2k up to par in every respect with Solaris (it will happen) By the time Win2k reaches Solaris 8/9 levels, Solaris will have moved on. They haven't caught Solaris yet; the only chance they have is if Sun just goes out of business. Re:SUNW against the wall, this time for keeps (Score:2) Then they just committed suicide. There is absolutely no compelling reason to use Sun hardware for linux. At the low end you can get better price performance. At the high end you can pop linux on an IBM mainframe and get not only the top end of hardware but a superior services force. Thats the crux of the issue for Sun - they're damned if they don't support linux, but doubly damned if they do - they're more or less endorsing commodity solutions, which will ultimately lead to commodity hardware. Re:SUNW against the wall, this time for keeps (Score:2) Right. You work for IBM and I work for Sun. Either that, or you've been doing some really heavy koolaid drinking. I do work for Sun. I have supported customers who went to Sun for database servers after IBM failed repeatedly to provide the "high end" solution they needed. I have had these same (very demanding) customers tell me that the reason they like Sun is that the field support organization blows the doors off of IBM's capabilities. I've also supported customers whose primary admin workforce were IBM Global Services people. With a few exceptions where IBMGS hired on staff that already worked at the site, IBMGS was difficult to work with, and frequently not very organized. I've seen cases where the customer specifically asked for something to be fixed and IBMGS stood directly in the way, insisting that it wouldn't work (it did in the end) or that since it violated some policy the fix just wasn't acceptable (let's see...fix a critical problem, or adhere to the letter of some bureaucratic policy created without this situation in mind?) Then there's this "linux on a mainframe" concept, which really doesn't make much sense. You've got Linus saying he doesn't care to make the kernel scale past 4 procs. Which isn't to say it never will, or that no one is working on it, but it sure doesn't speak well for the priority of making Linux well on big iron, no matter who the hardware vendor is. A dozen tiny little 1 - 4 CPU instances just aren't the right answer for a lot of classes of problems. Re:SUNW against the wall, this time for keeps (Score:3, Interesting) Furthermore, I think your assumption that MS will bring Win2K up to Solaris quality at the very high end is probably optimistic. Sun has breathed big server OSes for years, MS has failed miserably with datacenter approaches. They might pull it off, but this is an issue Sun has a long time to deal with. The other question is what box are you going to put MS on in the datacenter? Itanium? That's flopped so far, but it will be interesting to see if it improves. While Sun may be outmarketted by MS, they have an odd ally. IBM is also a Java fan and does have the budget to go head to head with Wintel. While their R&D budget might be relatively small, they can focus on building a scaleable kick butt architecture while Intel has to try and build big servers and compete with AMD in the $600 computer market. With the Alpha engineers Sun swiped from a disarrayed HP-paq, they should be able to make it interesting. I don't think they are really playing too much of catch up on the mindshare front either. I would imagine if you counted the number of Java developers and the number or Yeah, Sun is in a tough spot, but historically that's when it has done its best work. I've become a big sun fan of late, and am really interested to see where they will go. The company needs to reinvent itself somewhat (mostly to kick butt in software and storage) but it has done that often enough before. It should be fun. Sun's an aggressive enough company that it won't go down without a fight, so again, it'll be fun to watch. Re:SUNW against the wall, this time for keeps (Score:2) Huh? McNealy is pushing this model as strong as Gates is. Microsoft can talk about their "freedom to innovate" all they want, but they have come to a place where they have innovated or stolen just about everything worthwhile already. 90% of the people in the city morgue had the right of way. So what? What matters is who is left standing. Linux will be left standing because it doesn't need to make money to be succesful. Microsoft, Intel and IBM will be left standing be left standing because they will own the respective markets for software, CPUs and services. Moral legitimacy means zilch. Re:SUNW against the wall, this time for keeps (Score:2) Other than (among others) invading the game console market, eroding Oracle's share in databases, smoking past lycos and yahoo on the mediametrix charts with MSN, spinning off expedia, or gunning up their licensing fees? People have been saying "Microsoft is over" for at least five years now, but they keep moving into new markets. Re:SUNW against the wall, this time for keeps (Score:5, Insightful) That's perceptive, but Microsoft (M$)is not a business (like IBM, say) that makes money and pays dividends to stockholders. M$ pays zero dividends but pays a substantial portion of employee compensation in the form of stock options (which it _doesn't_ expense against revenue but _does_ write off for tax purposes). M$'s employees exercise their stock options and take profits because the stock price is higher than the options' strike prices. This works because the market perceives that M$ will continue to expand and grow, thus its stock price remains high. Mutual funds and ordinary investors buy M$ stock from M$ insiders based upon an unrealistic belief in Microsoft's perpetual growth. M$ is a very sophisticated pyramid scheme, but it is _just_ a pyramid scheme. They hide revenue and income in good quarters in order to prop up the numbers in poor quarters, thus creating the illusion of financial stability (and the SEC is investigating this). In prior years, M$ made nearly 10% of total revenues from selling Puts on its own stock (knowing that it could manage its numbers to keep the stock price high enough to make those Puts expire worthless or at least worth less than they were paid for them). In fact, M$ would have _lost_ money in all of the past several years if they'd had to expense their stock option grants to employees! That's why M$ is a pyramid scheme. Still with me? M$ doesn't just need to make money to survive - they need to _grow_ to survive. Once their growth flattens for a few quarters, the big mutual funds will notice the lack of dividends and start selling their stock. Financial reform laws relative to employee stock option grants moving through the US Congress and likely to pass, post-Enron, will further depress M$ financial results. One of these quarters, M$ will have to pay off on all those Puts they sold, also cutting net income. The fall of Microsoft will be truly spectacular, although in slow motion like Enron, but much larger. Mutual funds, 401k plans, and individual investors who don't get out early will lose billions of dollars. Microsoft's current market capitalization - the total value of all stock outstanding - is over $325 billion; in contrast, IBM's market cap is only about $17.9 billion, but IBM annual revenues and profits are about 10 times Microsoft's. Begin to see the problem? This explains a lot about Microsoft's savage actions. Balogna! (Score:2, Troll) Balance Sheet Cash Flow Note: 2.1 Billion incoming cash. 5.2 Billion Cash on Hand. I think MSFT is solid. I mean use a little intuition. Every beige box sold means $40 in revenue from windows. What's the Marginal Cost of another copy of windows $2? Now add in Office or Works. Then add all the copies of NT server that are sold, all the CAL's. All the Exchange servers, all the Exchaneg CALS. All the SQL servers, all the SQL CALs. Thats a honkin lot of revenue, and very little marginal cost. MS in making money hand over fist. That's what monopolies do, maximise the difference between marginal revenue and marginal cost. MS can keep cranking out licences and were stuck buying them. MS growth may slow, (although one could argue that vast international markets lay untapped), but they aren't about to colapse Enron style. Re:Balogna! (Score:2) The extent to which Microsoft escapes its current antitrust case with a slap-on-the-wrist penalty will likely be inversely proportional to the number of major corporate customers' defections from their new annual "software rental" product licensing schemes. I stand by my analysis. We're _not_ stuck buying Microsoft's inferior OS and applications software - there are alternatives springing up all around us - and smart CIOs, CTOs, and even business PHBs _will_ migrate to them for competitive advantages. Microsoft's days are numbered, but we just don't know that number yet. If you'd like to read the best independent analysis of Microsoft's financial fraud, go here [billparish.com]. Meanwhile, sell your Microsoft stock because its about as high as it's going to go on the way down. Re:Balogna! (Score:2) Question: - which anyone except a self deluded clueless business major could answer correctly - "Why would they be doing that if the stock were as solid as you imply?" Of course there are PHB style answers to that question: "They want to increase there own personal liquidity" etc. But those type of answers are exactly the "self deluded clueless business major" sort of answer I meant. Gates himself has warned many times that someone could come up with a technological innovation that could make Microsoft obsolete overnight - Microsoft investors don't seem to think that is possible but he does, and I suspect that he has a much better grasp of that than all of the clueless investors do. Why do you think that Gates has a trust fund set up to pay the taxes on his house? Answer: He knows it could all go away as quickly as it came. Any company which really doesn't produce anything tangible is a bubble waiting to burst; and ones and zeroes are not tangible. Other than their cash reserves Microsoft has very few tangible assets. If their source code goes obsolete they are gone. I intend to double check and make sure that my managed 401K hasn't got one dime invested in Microsoft stock. The original poster in this thread is correct; Microsoft's collapse will be Enron style and spectacular. Re:SUNW against the wall, this time for keeps (Score:3, Interesting) The fall of Microsoft will be truly spectacular... First, people have been making this statement for years for all the reason you gave and more. In all those years, people who continued to invest in Microsoft made money on the stock. In the stock market there's no skill in simply predicting a stock will fall. The trick is predicting when. There's no reason why Microsoft won't continue to defy the fundamentals for years. Second, you seem to be equating the value of the stock with the stability of the company. Microsoft is a profitable company with a solid customer base. It in no way resembles Enron. In fact, M$ would have _lost_ money in all of the past several years if they'd had to expense their stock option grants to employees! So what? If the accounting rules had been different, presumably Microsoft wouldn't have used this loophole as a way to compensate its employees. Using tax laws and regulations effectively is a sign of good management, not bad management. Re:SUNW against the wall, this time for keeps (Score:3, Insightful) Microsoft resembles IBM, not Enron. Microsoft resembles the IBM of old in size and market dominance but not in weaknesses. IBM's fall came about because its core business was undermined by microprocessors. Despite open source, Microsoft faces no such threat. It is continuing to enhance and expand its product line and adapt to new trends as they arise. But I do not believe that they are going to be number one for more than a few more years And who will replace them? There's no single company that can duplicate Microsoft's complete product line, certainly not in a few years. One can imagine a number of vendors replacing individual products but could any of them, or instance, exterminate Word the way Word exterminated WordPerfect? The history of business is one of industrial giants falling and even disappearing altogether. Presumably Microsoft's turn will come as well. However, consider General Electric [fortune.com]. It was one of the original Dow Jones Industrials [invest-faq.com] over a hundred years ago and it is still there today. Like Microsoft, it glommed onto a fundamental industry (electricity) and rode out the ups and downs of the business cycles, diversified, and marketed itself well. When you look at Microsoft's strengths (astute management, large cash reserves, overwhelming market dominance, diverse product line, brandname recognition) and the fact its market is still growing, it's hard to imagine it losing its number one spot in our lifetime. The most likely scenario is that it will use its huge cash reserve to diversity like GE and become even bigger, although perhaps not as a software vendor. Re:SUNW against the wall, this time for keeps (Score:2, Insightful) He doesn't understand them that well. Bigger is not always better. Anyway, IBM's revenue and profit are NOT 10x that of MS. Focus on the top-line numbers. IBM's annual revenue in 2001 was 85.9b, Microsoft's was 25.3 (Note: MS's financial year ends June 30), about 3.5x. Since IBM sells a lot of hardware that is expensive to build, though, their cost of sales was 54.1b, vs. just 3.5b over at MS, leaving gross profit at 31.8b at IBM, 21.8b at MS. Now why is MS stock so much higher? Stock price is all about growth. MS's gross profit is 116% higher than it was 4 years ago. IBM's has grown just 3% in that same time period. And the fact that MS has $40b in short-term assets, just $11 in short-term debt, and NO long-tem debt, makes portfolio managers sleep soundly at night. I'm not knocking IBM... it's a great company, but that's the benchmark you chose to compare to Microsoft. And IBM reported net income at $7.7b in 2001, vs. $7.3 at MS. So please explain where the 10x figure you stated comes from. Re:SUNW against the wall, this time for keeps (Score:2) If only that were true. Unfortunately, it isn't. Java, like Microsoft Windows, is really the product of only one company, Sun, although a number of other companies (IBM, Apple) are reselling it with some modifications. Microsoft can't spend more money in .NET and C# than the community spends in Java. What makes you think Microsoft is going it alone? The usual suspects are investing in C# and .NET. And C#/.NET isn't even going for the same people as Java--it will find acceptance quickly among Microsoft's current VC++ and VB programmers, because it's a whole lot better than what they have right now. Microsoft trying to lure people away from Java. (Score:5, Informative) Re:Microsoft trying to lure people away from Java. (Score:2) Fortunatley, you are wrong. .Net code runs on FreeBSD, using M$'s own implimentation. And come soon, it will run on virtually any platform, using Mono [go-mono.com]. I read the article.. (Score:3) I personally doubt In the same way that if Java was horrible no one would have made third-party JVMs, like Kaffee (sp?). But, that's just me I could be wrong (and wouldn't that be tragic?) "imitation" flows in both directions (Score:5, Interesting) While I have great respect for Mr. Gosling's prolific contributions, clearly this imitation goes both ways. For example: Microsoft Transaction Server 1.0, shipped 12/96 * automatic transactions for objects, including Java objects * ObjectContexts for automatic services on behalf of objects * declarative transaction requirements e.g. Transaction Requires New * declarative, automatic role-based security, and IObjectContext::IsCallerInRole() * etc. Enterprise Java Beans, 1.0 final spec shipped 1Q98(?) * automatic transactions for Java objects * SessionContexts for automatic services on behalf of objects * declarative transaction requirements e.g. TX_REQUIRES_NEW * declarative, automatic role-based security, and EJBContext.isCallerInRole() * etc. The provenance of the ideas behind EJB/J2EE, arguably Sun's most commercially important Java technology, would seem to be revealed in its choice of identifier names. -- an ex-Microsoft software developer Re:"imitation" flows in both directions (Score:2) And just like the folks pointing out that similarities between the languages are likely due to their common heritage (C++), it's probably worth pointing out that the similarities here have to do with the attempt to solve the same problems. Yee haw. Ain't this fun? Re:"imitation" flows in both directions (Score:2) After five years, Java's inroads in business application development finally persuaded Microsoft to abandon COM. They didn't want to become just another Java vendor, so they cloned Java and gave their version some marketing spin to try to lure people back to a single vendor solution. J2EE != EJB (Score:2) On the EJB hand, you're quite right, they borrowed heavily from MTS. But I would claim that MTS was beta-quality software until at least 2.0, and didn't support object pooling until COM+'s release. EJB 1.0 servers were doing that around the same time, and while many were crappy, there were production quality ones out by late 1998 (WL 4.5, Gemstone, Persistence, etc). In the story of MTS vs. EJB, it really was a story of execution. MTS and COM+ were slow to mature, and didn't take off at all. Which is one of the driving factors behind Re:"imitation" flows in both directions (Score:2) JDBC vs. ODBC would probably be a better example of J2EE borrowing vs. 'research' (i.e. borrowing from more than one source). Despite the resemblances, I still don't think that MS deserves much credit as an innovator. To take a current example, MS is borrowing from object/relational mapping products to create a Dotnet addition called ObjectSpaces - an extraordinarily conservative approach when you consider that MS owns both the database it is mapping to and the development language and environment it is mapping from. It's almost as though Redmond wants to be the EPCOT Center version of the larger software world outside, obliged to reproduce in detail all its variety and arbitrariness internally. However, I will give them some credit if they manage to get 'Longhorn' out - the OS with SQL Server as the file system - but last I heard, things weren't looking that positive. This article (Score:4, Insightful) Slashdot should really try to find some better quality articles if they want to have a content rich site. Re:This article (Score:2) There are many reasons why an article can be "news for nerds" and/or "stuff that matters". It can be as much for what isn't said as for what is. similarities (Score:4, Funny) Re:similarities (Score:2) Both langauges have a common heritage, which results in some similarities. But take a program that's a million lines and you'll spend more time rewriting then starting from scratch, no matter which direction you go. (of course you can compile java the language to the CLR, so why rewrite?) Gosling's and Sun's markting fluff (Score:4, Interesting) There is nothing wrong with the C#/CLR "memory model". By default, it is safe, just as in Java. If you write an unsafe model, the memory model is unsafe, just like it is in Java. Oh, you say, Java doesn't have unsafe modules. But it does. They are called "JNI". The only difference to C#'s unsafe modules is that JNI is less efficient and harder to program. (Both Java's and C#'s security models label unsafe code as such.) I guess one of my pet areas is scientific computation. They might have done something creative to make that easier. This is adding insult to injury. C# has value classes, operators, multidimensional arrays, and easy and efficient interfaces to native code. Sun and Gosling have been promising some of those features for years and failed to deliver on even the simplest of them. The best we are getting is a cumbersome proposal from IBM for multidimensional arrays that most implementations will probably not even bother to optimize. And, I mean, the fact that the syntax [of C#] is so much -- is like exactly the same, or just about exactly the same [as that of Java]. Well, gee, what a coincidence. Microsoft thought Java was a great idea, but they wanted to have their own libraries. Sun sues them. So, they did the next best thing: they cloned Java as much as they could, fixed a bunch of small things Sun has been promising to fix for years, and called it C#. What does Gosling expect Microsoft to do? Just roll over and die? And Sun really has a double standard there: when Apple exposes all their native platform APIs to Java, that's fine. It's just not fine when Microsoft does it. Who's going to get sued next? What can open source developers do with Java before Sun is going to try and sue them? I am no friend of Microsoft, and I won't use a Microsoft-only platform. But I am really getting tired of the marketing fluff coming out of Sun. When Java originally came out, Sun was promising a well-defined, open, standardized, and efficient platform. Today, it's a huge system with incompletely specified APIs, lousy support for high-performance computations, and no independent third party implementations (all compliant Java2 implementations depend to a large degree on Sun's source code). Sun has dropped out of every standardization process around, and they have been threatening others with lawsuits left and right. I don't want to be tied to either a litigious Sun Java monopoly nor to a bundling Microsoft .NET monopoly. If Sun doesn't clean up its act quickly, after seven years of lobbying for Java and using it for lots of software, I'm dropping it. And I suspect others are getting similarly annoyed with Sun. Re:Gosling's and Sun's markting fluff (gets worse! (Score:2) Gosling is fat. Also, Java has serious issues itself when it comes to scientific computing. Please see this paper [berkeley.edu] for further information. Funny he should mention that as one of .Net's shortcomings.... Also he feels "ripped off"? Sure, C# is an awful lot like Java, but then Java was an awful lot like C++. Borrowing good features from past languages isn't robbery, its just smart. In short, shut up fatty! Re:Gosling's and Sun's markting fluff (gets worse! (Score:2) However, this is much more of an indictment of C# than Java - Java's innovation was in the VM, not the syntax, which was deliberately conservative. Despite a huge R&D program, MS has not managed even to synthesise ideas from even two significantly different languages/VMs, let alone attempt to bring together best practice from industry and academia. Gosling's 'rip-off' charge looks pretty solid to me. Re:Gosling's and Sun's markting fluff (Score:3, Insightful) And Sun really has a double standard there: when Apple exposes all their native platform APIs to Java, that's fine. It's just not fine when Microsoft does it. Uff, how many times must this be explained - it's ok to expose any API to Java code - it's not ok to put that API in the java.* libraries fooling developers into thinking their code is pure Java when it isn't. Imagine someone adding their own functions to the C standard library and advertising them as standard, portable C. How would you feel then? Re:Gosling's and Sun's markting fluff (Score:2) Apple doesn't have a monopoly, Microsoft does. Apple allowing you to code native applications for the Mac in Java doesn't hurt Java in the same way that Microsoft was trying to change Java. Re:Gosling's and Sun's markting fluff (Score:3, Informative) JDK 1.5 is going to include autoboxing of primitives. Operators aren't going to happen, by design. Multi-dim arrays, not really important to those outside of high-performance computation. Easy trap-doors to native code is a plus for C#, yes. And Sun really has a double standard there: when Apple exposes all their native platform APIs to Java, that's fine. It's just not fine when Microsoft does it You're ignoring some proven facts here, such as smoking gun memo's from Microsoft executives ordering the "pollution of Java". Adding keywords & extensions were not violations of the contract -- breaking RMI and JNI, and not supporting JFC/Swing were violations. Apple didn't break compatibility; Microsoft did. What can open source developers do with Java before Sun is going to try and sue them? What can Slashdot readers do when someone who's on a rant starts spouting FUD? Drop the drama, please. Today, it's a huge system with incompletely specified APIs, lousy support for high-performance computations, and no independent third party implementations (all compliant Java2 implementations depend to a large degree on Sun's source code). How are the API's incompletely specified? How is high performance computation support "lousy" when most studies to this effect show that it's getting better every JDK release? And IBM's JDK is *not* dependent on any Sun code. If Sun doesn't clean up its act quickly, after seven years of lobbying for Java and using it for lots of software, I'm dropping it. It's one thing to be objectively critical of Sun's complex behavior. It's another to be venting frustration unobjectively. Guess which of the two you're doing. MS Stuff (Score:2, Insightful) #1: To the person talking about financials and MS being a "pyramid scheme." In a way this is true, but this is common practice today. If you look at a company like Cisco, if you count stock options they lose huge amounts of money, but if you don't count them they make money. Stock options are very easy to abuse from a financial reporting standpoint. The key is, when people cash in those options the company has to either buy them back at the market price, or must simply have the options on hand, when they could have sold the shares for much more. Paying someone in options is like paying Hershey's employees in candy bars - in the end it's still money spent. #2: What Gosling was saying about C# being a rip-off is true. Java may not have done anything new but it at least combined some syntax and pieces in a new way. C# is a straight port of Java for the most part. Java is NOT a copy of C++, it is a copy of a hodgepodge of things. Whereas C# really is just a copy of Java. #3: Safe vs. unsafe code. People are being very naive about this. How many web pages do you go to that give you the warning "this page blah blah unsafe..." Yet you still enter that credit card number. Marking code as "safe" or "unsafe" is irrelevant. This is what will happen: people will write unsafe code, and it will be common enough so that end users will have to use it. The same thing happens with ActiveX controls. How many people honesty won't run an unsafe ActiveX control? Or a program that uses unsafe Word macros? The other day I had to change my security level in word so I could use a documentation tool - and I went right ahead and did it, and so will everyone else! The fact is, if it's easy to write unsafe code, people will write it, and then users will have to run it if they want to use that product or service. Marking it safe or unsafe makes no difference at all, the typical user will run unsafe code. #4: Sun really does need to get it's act together. Good god there are so many Sun products, so many APIs and old APIs and new APIs and different "initiatives" it's impossible to tell what's what. For example JavaOne, how many people can figure out what actually is in there and what it does? #5: #6: MS has been found guilty of anti-trust violations multiple times. And they still get worse even as the trials go on! If I were a judge I would say "stop mocking these proceedings or I'll throw your ass in jail!" Most people who are for another weak settlement are people who just make vague arguments against the entire notion of anti-trust, something like "they're just trying to do what every company wants to do and be the leader. Stop whining!" Well, we *have* antitrust laws! And we have them for a reason. And if they apply to ANYONE, they apply to MS. MS protests that a harsh penalty could destroy the company? Well, when you get arrested for murder and put in jail for life that pretty much destroys whatever you had going at the time. It's called "punishment." That's the point! If you can't stand the punishment, don't commit the crime, not once, but twice even! That logic is akin to saying "I can't go to jail because jail is a nasty place." MS was found guilty, they didn't stop, in fact they got worse. A breakup to me is the only logical thing to do, they've shown they can't play by the rules. Yeah, that's "harsh." But, there is a simple way to avoid penalty: don't break the law! Yes Virginia, it really is that easy! Re:MS Stuff (Score:2) Sure, you are not going to see this issue listed on a web page. But it is a big issue when people choose how they are going to implement a project. Some of the corporations I deal with are rejecting C# right now because, and this is a direct quote, "C# is just Java except it's not portable and it's not secure". : people will write unsafe code, and it will be common enough so that end users will have to use it. The same thing happens with ActiveX controls. How many people honesty won't run an unsafe ActiveX control? A lot of the corporations I deal with won't let Active X controls through their firewalls. Or a program that uses unsafe Word macros? The other day I had to change my security level in word so I could use a documentation tool - and I went right ahead and did it, and so will everyone else! Two months ago I installed a mail filter for one of my clients that bounces any email with an attached Word macro. The fact is this is a real issue, and it is going to become more important over time. Re:MS Stuff (Score:2) I'm afraid you're mixing some stuff up. In this context, safe vs unsafe is referring to memory management, not security. Safe means that the code cannot access memory directly, instead it must do it via references that are automatically updated by the memory management system/garbage collector. Unsafe means you get direct pointers, that are not tied to the memory manager. Java does not allow unsafe code (unless you go via the JNI) but .NET/C# allow both types to be mixed freely with a few caveats. The pros/cons of this decision are something I won't go into here, but there is are a couple of interesting articles on MSDN about safe vs unsafe. Re:I liked this bit best... (Score:4, Interesting) Q: But isn't imitation also the sincerest form of mockery? ___ Re:I liked this bit best... (Score:3, Funny) Re:I liked this bit best... (Score:2, Funny) a) buy the company or b) come up with something extremely similar. Re:I liked this bit best... (Score:2) Java was not a particularly innovative language. Interpreted byte code has been arround since the p-system. There were many cleaned up object orented extensions to C, such as Objective C. Sun's Java vision is based arround a particular goal of processor independence that is practically irrelevant in mainstream computing, particularly with the SPARC chips lagging behind Intel in performance. Re:interesting quotes.. (Score:4, Funny) { assert(1>2); } exit(0); Using business logic this program will successfully complete? Re:interesting quotes.. (Score:2) if (required) { assert (2 + 2 == 5); } Relieved? Not Hardly. (Score:2, Insightful) The answer was too obvious, but too often ignored and the question, if not met with an informed response soon enough would have painted us into a corner. We have to support users on a variety of platfroms, hence Java, or simple HTML forms with asp or servlets on a server will accomplish our goals. Writing client apps in .net means we can only support that portion of our customers who use a current enough OS to support .net Yeah, looks pretty until you start looking at the fact there's a few million legacy computers and macs in the world you won't be able to do squat with. No thanks. .net is dead and buried for now and I mean to keep it that way. Microsoft's damnable marketing buzz is dangerous, because too many people hear it and just leap at it, because it sounds like a great solution. Too few stop to think things through, often those who know too little about their whole market and end users. Now this isn't necessarily a Java good, .net bad, thing, it's more of a 'don't jump on the latest bandwagon' thing. For my 2, though I'd be happy with J2EE because it's established, which .net is far from and risky because of it. Re:Relieved? Not Hardly. (Score:2) Based on what you said, why would asp.net, using one a Java based You stated ".net is dead I'm agnostic about such issues (made money, slept well at night, and helped customers programming for Apple, MS-DOS, Windows16/32, various Unix platforms). But assuming you have a good reason, what is it? Short term, stated reasons are obviously valid (compared to VB6), but for the future, why not (again, compared to VB6 which apparently has little future)? Re:I don't understand all you closed-minded idots. (Score:2) Well I love Delphi and use it all the time, but comparing the two is inaccurate. They -are- pretty different. Does anyone remember how much Java 1.0 sucked compared to the Java of today? I sure do, because I was one of them! Does ANYONE get version 1.0 perfect? So why do we expect this from Microsoft? Yes, they're bugs are more public because more people use Windows than there are Christians on this planet, but everyone else's 1.0 products are the same! Security? Please! UNIX had 30 years to improve security. My dad tells me horror stories of all the security bugs in the original systems he'd worked on at Bell Labs! True to some extent but consider Apache. It has a higher market share than IIS but where is the Apache version of Code Red? I seem to recall IIS in on version 6, or is it 7? I can't remember. But Apache is just about to reach v2. Gosling is a joke if he thinks he's anyting special. He got his "fellow" status because of Java, but only once it took off. Other than that, he'd be pretty obscure. Is there anything innovative anymore? Everything is a culmination of ideas. It's like evolution, new species don't just appear, they're based on previous ideas. So why did Java take off in such a big way and Smalltalk didn't? Don't believe it was just marketing, because it wasn't. The fact is, that Java was the right product at the right time. There are languages out there that are so "innovative" they are barely usable for real world projects. So it didn't include hundreds of good ideas - but it did combine those ideas in a way that had mass appeal. I consider that innovative in a way.
https://slashdot.org/story/02/03/30/0055212/james-gosling-on-net-and-the-anti-trust-trial
CC-MAIN-2018-13
refinedweb
12,305
73.17
JavaFX Script tip: The Single Assignment per Method rule (and more) Property binding is a great feature of JavaFX Script, but it's not without its issues, limitations or risks as you can see in recent posts. But even if perfect, no programming language feature exempts the programmer from learning how to use it optimally. There is an important rule that you must follow for binding. Check this code (simplified, from the JavaFX Balls benchmark): public function move () { this._x += this._vx; if (this._x < model.walls.minX) { this._vx = -this._vx; this._x += this._vx; } else if (this._x > model.walls.maxX - this._d) { this._vx = -this._vx; this._x += this._vx; } // Similar code for _y, _vy } What's wrong here? I didn't write the original version, but when I changed it (and introduced the problem), I was not fully aware of the consequences. The problem is that the properties _x and _y are assigned multiple times in the method. This is bad because these properties are bound elsewhere in the code: function newBall () { def ball = Ball{}; ball.view = ImageView { translateX: bind ball._x translateY: bind ball._y image: image }; ball.initialize(); ball } When move() is invoked for some ball, the first thing it does is updating the _x and _y coordinates. These updates trigger binding notifications that force those bound expressions to be recomputed, changing the state of the ImageView nodes that are created by newBall() and included in the animation. But if the ball "hits" any border of the window, one or more of move()'s if statements will execute extra code that "bounces" the ball. The original code only changed the velocity variables _vx and _vy, but I decided to also adjust the coordinates so the balls wouldn't be positioned in irregular positions (like negative coordinates) even for a single frame. But when move() executes a second assignment to _x, for example, all properties that are bound to _x will be notified and evaluated again. This is duplicate work that surely costs some CPU cycles. The solution is very simple: I only need to make sure that properties subject to binding are only assigned to at most once per method - the Single Assignment per Method (SAM) rule. This is easy to do with extra local variables: public function move () { var newX = this._x + this._vx; if (newX < model.walls.minX) { this._vx = -this._vx; newX += this._vx; } else if (newX > model.walls.maxX - this._d) { this._vx = -this._vx; newX += this._vx; } this._x = newX; // Similar code for _y (with a temp newY), _vy } In the new code, binding notifications and updates will only be triggered at the end, when the properties _x, _y are sync'ed with the temp variables newX, newY. The SAM rule is not really a new idea; it's not even specific to JavaFX Script. I do this a lot in Java due to concurrency, to guarantee both consistency and performance: if I have to assign new values to shared fields and this is expensive enough so I don't want to do everything in a big synchronized block, then I build the new values using temporary variables, and in the end I just assign the result to the field. With the extra bonus that, if it's a single field to update (or there are no ordering issues), I don't even need to synchronize the assignment step, so the code has zero locking overhead. I also follow the SAM rule for volatile fields even when the value computation is not expensive, because volatile writes are expensive. For really performance-critical stuff, I often obey the SAM rule even for common fields, because writing to any field is more expensive than to local variables, for two reasons: (a) local vars are typically allocated in registers so writes don't require memory stores, (b) for reference-type fields, most modern GCs impose "write barriers" - extra code that must be executed when any heap pointer is updated. Last but not least, the SAM rule gives me a warm and fuzzy feeling of writing code closer to a "functional style", because even when I have to program with mutable state, at least I avoid temporary states (that may even be invalid). I prefer that objects transition from a canonical state A (a method's pre-condition) to a canonical state B (a method's post-condition) in a single shot, without any intermediary states. This is also good for concurrent code in situations where eventual races can be tolerated, except if they'd cause an exception or other misbehavior due to a thread using an object that is in an invalid, intermediary state. Is the SAM rule good enough? Now let's go back to my example. Pondering it more thoroughly, I could certainly make extra enhancements. For one thing, I could store _x and _y in a Point2D object, say _pos, then move() would end with a single field update"... but my first instinct screamed: Don't do that, because this would impose an extra object allocation per call to move(), and JavaFX Balls is a cross-language benchmark, and I don't want to add any overheads (however small) that competing Bubblemark programs are not paying"... but, would this change really make the program slower? The extra allocation surely has some cost, but on the other hand, I'm coalescing binding notifications. If I have a single _pos property to change, its update will produce a single binding notification that will "fix" the values of both the translateX and translateY properties from in the ball nodes. The reduced effort of binding propagation may save enough CPU cycles to compensate the extra allocation - or even more, resulting in a net optimization. This leads to a second rule, now specific to JavaFX Script: Minimize Updates to "˜Bindable' Properties. The article Performance Improvement Techniques for JavaFX Applications already offers a short tip "Avoid Unreasonable Bindings", and other authors have also warned against binding-happy code. So I'm just being more specific: binding is a great tool, and sometimes you can't avoid it, but you can do make it lighter, e.g. by grouping a set of bindable properties in a single object that is updated wholesale and generates a single round of updates to bound properties. [P.S.: I haven't yet validated the claim that this behavior will be any faster, or enough faster to compensate for some extra allocation - in JavaFX Balls those binding events are just insignificant to appear in the performance profile. Asserting this would require a special microbenchmark, maybe I'll write it eventually.] I agree with others who pointed as a problem that in JavaFX Script, all visible properties are bindable; we could use a modifier like Fabrizio's suggested unbindable that disallows binding to a specific property, or some other form of control. Even good IDE support would help - I'd love a code editor that could flag, with special syntax highlight, properties that are being used in some binding expression; a browsing operation to navigate from a property to all expressions bound to it; or special performance warnings (in a tool like Checkstyle or even in javafxc) for methods that break the SAM rule, or (horror!!) update bindable properties inside a loop. Such tools would easily flag the most severe, binding-related, performance bugs in JavaFX apps. An unbindable property could be compiled into leaner code, without the wrapper "location" objects introduced by javafxc. With the current language, my property declared as public var _x = 0.0 (with static type Float determined by inference) is compiled to a FloatVariable object (plus significant wrapping code for get/set and other things). This overhead apparently doesn't exist for local variables, non-public variables that are not bound, and constants declared by def. Still, it's significant overhead for all public var fields in your whole program; even in a best-case scenario where HotSpot optimizes out all boilerplate, the cost of extra memory allocation remains. So, a binding modifier would be a important optimization"... even if it's an "ugly" low-level optimization, much in the spirit of Java's final modifier. But when a language moves two steps forward in abstraction, it's often important to give developers some way to make at least one step backward in performance-critical code. There are also semantically valid usages of unbindable. Besides the problem discussed by Fabrizio's blog, an API provider may want to enforce "binding direction" in complex object graphs where developers could easily get confused and bind things the wrong way"... binding doesn't tolerate cycles, try this code: var x:Integer = bind y; var y = bind x. . - Printer-friendly version - opinali's blog - 2878.
https://weblogs.java.net/blog/opinali/archive/2009/06/17/javafx-script-tip-single-assignment-method-rule-and-more
CC-MAIN-2015-27
refinedweb
1,464
58.42
13 March 2013 15:16 [Source: ICIS news] By Mark Yost HOUSTON (ICIS)--Some US BD buyers and sellers were asking themselves on Wednesday, “Where is the lunar new year pop?” the uptick in demand (and sometimes prices) that has historically followed the Asian holiday. The short answer seems to be: “There is none.” More importantly, support for the 84 cent/lb ($1,850/tonne, €1,425/tonne) March US Gulf BD contract price seems to be eroding. “Forget the lunar new year ,” one trader said. “I was looking for a correction because the fundamentals aren’t there to support 84 cents.” A buyer speculated that, if the April US BD contract were to be negotiated today, it would be 80-82 cents/lb. Another said that, based on today’s market conditions, April contract prices would either roll over or “drop slightly, perhaps a penny.” One thing the US BD market does seem to agree on is the woes of the tyre business. “The tyre companies are starting to watch inventories,” one buyer said. “That tells me that demand is still not where we’d like it to be.” One producer was a little more optimistic about the broader BD market. “If you’re just talking to the tyre makers, there is no demand,” a market source said. “But the rest of the market is seeing some demand. Minimal, but some.” Yes, minimal, but no pop. In fact, some market sources said the so-called lunar new year pop is a thing of the past. “Once upon a time there was indeed a post-lunar new year pop, but not any more,” a market source said. The Chinese producers are more sophisticated now, the source said. “They have realised that such behaviour is counter-productive and simply adds to cost.” Maybe so, but it’s also clear that there are fundamental problems with downstream demand in ?xml:namespace> “Pop or no pop, things are not picking up as fast as people had expected,” one
http://www.icis.com/Articles/2013/03/13/9649430/us-bd-market-sees-prices-softening-with-no-lunar-new-year-pop.html
CC-MAIN-2014-41
refinedweb
335
73.78
System Administration Commands - Part 1 hal-find-by-capability(1M) System Administration Commands - Part 2 System Administration Commands - Part 3 - start the Sun WBEM CIM WorkShop application /usr/sadm/bin/cimworkshop The cimworkshop command starts Sun WBEM CIM WorkShop, a graphical user interface that enables you to create, modify, and view the classes and instances that describe the managed resources on your system. Managed resources are described using a standard information model called Common Information Model (CIM). A CIM class is a computer representation, or model, of a type of managed resource, such as a printer, disk drive, or CPU. A CIM instance is a particular managed resource that belongs to a particular class. Instances contain actual data. Objects can be shared by any WBEM-enabled system, device, or application. CIM objects are grouped into meaningful collections called schema. One or more schemas can be stored in directory-like structures called namespaces. The CIM WorkShop application displays a Login dialog box. Context help is displayed on the left side of the CIM WorkShop dialog boxes. When you click on a field, the help content changes to describe the selected field. By default, CIM WorkShop uses the RMI protocol to connect to the CIM Object Manager on the local host, in the default namespace, root\cimv2. You can select HTTP if you want to communicate to a CIM Object Manager using the standard XML/HTTP protocol from the Desktop Management Task Force. When a connection is established, all classes contained in the default namespace are displayed in the left side of the CIM WorkShop window. The name of the current namespace is listed in the tool bar. All programming operations are performed within a namespace. Four namespaces are created in a root namespace during installation: Contains the default CIM classes that represent managed resources on your system. Contains the security classes used by the CIM Object Manager to represent access rights for users and namespaces. Contains properties for configuring the CIM Object Manager. Contains pre-defined SNMP-related classes and all SNMP MOF files that are compiled. The cimworkshop application allows you to perform the following tasks: Use the CIM WorkShop application to view all namespaces. A namespace is a directory-like structure that can store CIM classes and instances. You cannot modify the unique attributes of the classes that make up the CIM and Solaris Schema. You can create a new instance or subclass of the class and modify the desired attributes in that instance or subclass. You can add instances to a class and modify its inherited properties or create new properties. You can also change the property values of a CIM instance. You can set input values for a parameter of a method and invoke the method. When CIM WorkShop connects to the CIM Object Manager in a particular namespace, all subsequent operations occur within that namespace. When you connect to a namespace, you can access the classes and instances in that namespace (if they exist) and in any namespaces contained in that namespace. When you use CIM WorkShop to view CIM data, the WBEM system validates your login information on the current host. By default, a validated WBEM user is granted read access to the CIM Schema. The CIM Schema describes managed objects on your system in a standard format that all WBEM-enabled systems and applications can interpret. Allows read-only access to CIM Schema objects. Users with this privilege can retrieve instances and classes, but cannot create, delete, or modify CIM objects. Allows full read, write, and delete access to all CIM classes and instances. Allows write and delete, but not read access to all CIM classes and instances. Allows no access to CIM classes and instances. The cimworkshop command is not a tool for a distributed environment. Rather, this command is used for local administration on the machine on which the CIM Object Manager is running. The cimworkshop utility terminates with exit status 0. See attributes(5) for descriptions of the following attributes: mofcomp(1M), wbemlogviewer(1M), init.wbem(1M), attributes(5)
http://docs.oracle.com/cd/E23824_01/html/821-1462/cimworkshop-1m.html
CC-MAIN-2014-52
refinedweb
678
55.24
Hi, I'm working my way through the book C++ Without Fear, after reading the recommendation for it on this site. However, one of the programs doesn't work. Basically it prompts the user to enter a filename, then it creates a file input stream. It then checks to see if that file input stream has a NULL value before continuing. However, for some reason, the check always comes back negative. Can anyone help me out? Here is the code. Running the program should make it pretty obvious where the problem is because it seems like it's probably something simple. Thanks guys. Code:#include <iostream> #include <fstream> using namespace std; int main() { int c; // input character int i; // loop counter char filename[81]; char input_line[81]; << endl; } if (file_in.eof()) break; cout << "More? (Press 'Q' and ENTER to quit.)"; cin.getline(input_line, 80); c = input_line[0]; if (c == 'Q' || c == 'q') break; } return 0; }
http://cboard.cprogramming.com/cplusplus-programming/115368-cplusplus-without-fear-example-won%27t-work.html
CC-MAIN-2014-41
refinedweb
155
76.11
12 July 2012 22:11 [Source: ICIS news] MIAMI, Florida (ICIS)--US polyethylene terephthalate (PET) prices in July will likely fall because of lower feedstock costs, although buyers and sellers disagree on the extent of the drop, sources said on Thursday. A major producer said PET prices could fall by 1.50 cents/lb ($33/tonne, €27/tonne). However, a buyer anticipated that prices could drop by 4.00-5.00 cents/lb. According to the producer, the amount by which PET prices will drop in July depends on the settlement of the July PX contract, which remains unsettled globally. Last week, a buyer said the PET drop in July will be following continued weak demand. Meanwhile, June PET domestic prices are assessed by ICIS at 78.00-83.00 cents/lb ?xml:namespace> PET producers in
http://www.icis.com/Articles/2012/07/12/9578020/us-july-pet-will-likely-fall-on-declining-feedstock.html
CC-MAIN-2014-52
refinedweb
137
64.41
Opened 11 years ago Closed 11 years ago Last modified 11 years ago #17421 closed Uncategorized (invalid) ./manage.py test trips when unit tests assume a database. Description problem statement: - my dev setup uses 'sqlite3' backend with ':memory:' as a database - my unit tests assume a database is setup / post_sync signals are done - e.g. using fixtures with ContentType settings: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } I get the following error: return Database.Cursor.execute(self, query, params) django.db.utils.DatabaseError: no such table: django_content_type it trips on the fixture using contenttypes, from django.contrib.contenttypes.models import ContentType from fixture import DataSet, DjangoFixture #... class Resource(DataSet): class Meta(object): django_model = 'resource.Resource' class host1: id = 1 resource_type = ContentType.objects.get(model='host') resource_id = Host.host1.id fix: def run_tests(self, test_labels, extra_tests=None, **kwargs): """ Run the unit tests for all the test labels in the provided list. Labels must be of the form: - app.TestClass.test_method Run a single specific test method - app.TestClass Run all the test methods in a given class - app Search for doctests and unittests in the named application. When looking for tests, the test runner will look in the models and tests modules for the application. A list of 'extra' tests may also be provided; these tests will be added to the test suite. Returns the number of tests that failed. """ self.setup_test_environment() - suite = self.build_suite(test_labels, extra_tests) old_config = self.setup_databases() + suite = self.build_suite(test_labels, extra_tests) result = self.run_suite(suite) self.teardown_databases(old_config) self.teardown_test_environment() return self.suite_result(suite, result) Change History (3) comment:1 Changed 11 years ago by comment:2 Changed 11 years ago by Your code is doing ORM queries (which translate to SQL queries) at compile time. You shouldn't do that. You can't assume that the database is synchronized at compile time. Even if the import sequence made it work by accident, it would be very unreliable. A quick way to make the call to the ORM lazy would be: @property def resource_type(self): return ContentType.objects.get(model='host') (A better solution may exist — I've never tried the fixture library you're using.) comment:3 Changed 11 years ago by thanks. I was wondering why the db setup and building the suites were inverted, but this explains it all: """ When looking for tests, the test runner will look in the models and tests modules for the application. """ fix for people having this issue:
https://code.djangoproject.com/ticket/17421
CC-MAIN-2022-27
refinedweb
411
51.65
I have some problems regarding utf8 decoding in some pluglins (modific, rsub, ...). When the plugin read a file or a socket show a error like: raceback (most recent call last): File "X/socketserver.py", line 610, in process_request_thread File "X/socketserver.py", line 345, in finish_request File "X/socketserver.py", line 666, in __init__ File "/Users/sbarex/Library/Application Support/Sublime Text 3/Packages/rsub/rsub.py", line 143, in handle line = socket_fd.readline() File "X/encodings/ascii.py", line 26, in decode UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1836: ordinal not in range(128) in the console I type: import locale locale.getpreferredencoding() the output is 'US-ASCII' and not 'utf-8'. I think this is the problem but I don't know how resolve it. I'm on OSX 10.8. thanks
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=13753
CC-MAIN-2015-48
refinedweb
138
61.12
so i'm just a noob in python and i was doing this exercise: "." I was able to do it here is my code : def translate (var1): vaw = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'] var1 = list(var1) for string in var1: if string == string in vaw: var1[var1.index(string)] = string + 'o' + string print ''.join(var1) I was wondering if this is correct or if there's another way to do it with less code? def translate(s): consonants = 'bcdfghjklmnpqrstvwxz' return ''.join(l + 'o' + l if l in consonants else l for l in s) print(translate("this is fun")) regex is a good solution >>> import re >>> print re.sub(r"([bcdfghjklmnpqrstvwxyz])",r"\1o\1","this is fun") tothohisos isos fofunon First, you don't need to do this: vaw = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'] … to get a sequence of characters. A string is already a sequence of characters. (The same is true for var1, but there, your code is requiring a mutable sequence of characters, where you can replace any character with a longer string, so you do need a list.) Also, your code doesn't actually work, because string == string in vaw is the same as True in vaw, which is always false. I think you meant if string in vaw. While we're at it, I wouldn't call a variable string, because that's the name of a built-in module. And you can save a few keystrokes by not adding extra whitespace in places where standard Python style (PEP8) says not to. :) So: def translate(var1): vaw = 'bcdfghjklmnpqrstvwxz' var1 = list(var1) for s in var1: if s in vaw: var1[var1.index(s)] = s + 'o' + s print ''.join(var1) Next, if you want the index of each element in var1, you don't want to throw it away, and then find it again with index. Besides being more code and slower, it's also going to give you the wrong answer for any element that appears more than once. So: def translate(var1): vaw = 'bcdfghjklmnpqrstvwxz' var1 = list(var1) for i, s in enumerate(var1): if s in vaw: var1[i] = s + 'o' + s print ''.join(var1) This is about as far as you can go if you want to mutate the var list in-place. You could change it to do var1[i+1:i+1] = 'o' + s, to insert the new elements after the existing one, but then you have to iterate over a copy of var1 (you can't change the shape of anything while iterating over it), and you have to keep track of how your indexes shifted, and so on. It's usually a lot simpler to just build a new structure than to modify the old one in place. That's what list comprehensions, generator expressions, map, filter, etc. are there for. For each element s of the original list, you want s + 'o' + s if it's in vaw, just s otherwise, right? You can translate that right into Python: def translate (var1): vaw = 'bcdfghjklmnpqrstvwxz' new_var1 = (s + 'o' + s if s in vaw else s for s in var1) return ''.join(new_var1)
http://m.dlxedu.com/m/askdetail/3/09ac9695bbb2a0ca48d4146e7b78d923.html
CC-MAIN-2019-30
refinedweb
552
77.87
About Adding an Alternate UPN Suffix to a Domain UPN suffix is the name of the domain that is added after the ‘@’ sign when a domain user account is created. An example of a UPN suffix can be ‘mydomain.com’. When a domain user account is created, the complete domain account comprises of a user logon name followed by @ and the name of the domain. For example, a complete domain user account named ‘user01’ in the domain ‘mydomain.com’ would be ‘myaccount@mydoman.com’, where ‘mydomain.com’ is the UPN suffix for ‘user01’ domain user account. According to the DNS namespace conventions, every time a child domain is created inside a parent domain, the name of the parent domain is automatically suffixed to the child domain name. For example, if a child domain named ‘yourdomain’ is created under ‘mydomain.com’ domain, and ‘user02’ domain user account is created in the ‘yourdomain’ child domain, UPN suffix of ‘user02’ domain user account would be ‘yourdomain.mydomain.com’, and the complete domain user account would be written and used as ‘user02@yourdomain.mydomain.com’. Since a DNS namespace can have several child domains, in large scale industries it is likely that the UPN suffix for a domain user that belongs to third or fourth level of child domain would be practically impossible for general non-technical users to remember and use. To avoid such situations, most administrators in the organizations create alternate UPN suffix that is quite small in length (reduced characters). Alternate UPN suffix makes it easier for the users to memorize and use the lengthy domain user accounts by replacing their original suffix with the alternate one. Moreover, when alternate UPN suffix is added to a domain user account, the user needs not to be aware of the actual domain name and its level in the entire DNS namespace. Considering the above discussed example of ‘user02@yourdomain.mydomain.com’, if an alternate UPN suffix named ‘domain.com’ is created and added to the ‘user02’ account, the user can then use ‘user02@domain.com’ to log on to the domain instead of using ‘user02@yourdomain.mydomain.com’. Alternate UPN suffix for a domain user can be defined either at the time of the domain user account creation, or administrators can also do so after they have created the domain user account. Nonetheless, alternate UPN suffix must be created in the domain before it can be suffixed to the domain user accounts. Create Alternate UPN Suffix for a Domain To create an alternate UPN suffice in a domain, administrators must follow the steps given as below: - Log on to Windows Server 2008 R2 domain controller with domain admin or enterprise admin account credentials. - From the desktop screen, click Start. - From the Start menu, go to Administrative Tools > Active Directory Domains and Trusts. - On Active Directory Domains and Trusts snap-in, from the console tree in the left pane, right-click Active Directory Domains and Trusts [computername.domainname] (‘srv2k8r2-dc01.mydomain.com’ in this demonstration). - From the displayed context menu, click Properties. - On the properties box that appears, in the Alternative UPN suffixes field, specify the desired alternate UPN suffix for the domain and click Add. - Once added, click OK to save the settings. - Close Active Directory Domains and Trusts snap-in when done. Add Alternate UPN Suffix for an Existing Domain User Account To add alternate UPN suffix to an existing domain user account in Microsoft Windows server 2008 R2, administrators must follow the steps given as below: - Log on to Windows Server 2008 R2 domain controller with domain admin or enterprise admin account credentials. - From the desktop screen, click Start. - From the Start menu, go to Administrative Tools > Active Directory Users and Computers. - On Active Directory Users and Computers snap-in, from the console tree in the left pane, double-click to expand the domain name. - From the displayed list, click to select Users container. - In the right pane, right-click the user for which alternate UPN suffix is to be added. - From the displayed context menu, click Properties. - On the opened properties box, go to Account tab. - On the selected tab, under User logon name section, choose the alternate UPN suffix from the drop-down list that was created earlier in Active Directory Domains and Trusts snap-in. - Once selected, click OK to save the modified settings. - Close Active Directory Users and Computers snap-in when done.
http://www.tutorialspoint.com/shorttutorials/adding-alternate-upn-suffix-to-active-directory-domain
CC-MAIN-2014-42
refinedweb
736
54.12
Initial foothold After running our normal scan: `scanit $(boxip)` we get two ports open. The custom chat program looks interesting, let’s netcat to it. We get presented with a usage prompt. Let’s try the [REPORT] function first. Hmm, interesting, Mozzie-jpg, let’s search for that git user to see the code as mentioned. We find this repo: in there a single python file with two interesting lines of code. Both look injectible. I sent a random string for good measure, a command, then echo to complete the line as it is in the code, this might not be necessary but I do it just in case so I don’t break anything. Here I tried one command on the name and another on the report, both worked. User We got command execution. Let’s get a shell. Shell popped. We can grab user.txt flag. Root sudo -l Is the first thing I try. class compare: def Str(self, x, y,): import os os.system('/bin/bash -p') We should get a root terminal when a string is compared. So lets try: Bingo.
https://insec.life/tryhackme-jpgchat/
CC-MAIN-2022-40
refinedweb
186
85.79
What is Sealed Class? Answers (2)Add Answer Sealed classes are used to restrict the users from inheriting the class. A class can be sealed by using the sealed keyword. Once a class is defined as a sealed class, this class cannot be inherited. A method can also declared as sealed in that case it can not be override. Example: using System; sealed class SealedClass { public int Multiply(int a, int b) { return a * b; } } class Program { static void Main(string[] args) { SealedClass slc = new SealedClass(); int total = slc.Multiply(10, 15); Console.WriteLine("Total = " + total.ToString()); } } Output: Total = 150. Example using System; sealed class SealedClass { // Calling Function public int Addition(int a, int b) { return a + b; } } class Program { static void Main(string[] args) { // Creating an object of Sealed Class SealedClass slc = new SealedClass(); // Performing Addition operation int total = slc.Addition(5, 5); Console.WriteLine("Total = " + total.ToString()); } } - You can inherit the sealed class it gives an error. using System; // Creating a sealed class sealed class SealedClass { } // Inheriting the Sealed Class class Example : SealedClass { } // Driver Class class Program { // Main Method static void Main() { } } It gives an error
https://www.thecodehubs.com/question/what-is-sealed-class/
CC-MAIN-2022-21
refinedweb
188
56.86
Hi, gzip.NO_TIMESTAMP sounds like a good idea. But I'm not sure about changing the default behavior. I would prefer to leave it unchanged. I guess that your problem is that you don't access gzip directly, but uses a higher level API which doesn't give access to the timestamp parameter, like the tarfile module? If your usecase is reproducible build, you may follow py_compile behavior: the default behavior depends if the SOURCE_DATE_EPOCH environment variable is set or not: def _get_default_invalidation_mode(): if os.environ.get('SOURCE_DATE_EPOCH'): return PycInvalidationMode.CHECKED_HASH else: return PycInvalidationMode.TIMESTAMP Victor On Wed, Apr 14, 2021 at 6:34 PM Joachim Wuttke j.wuttke@fz-juelich.de wrote: gzip compression, using class GzipFile from gzip.py, by default inserts a timestamp to the compressed stream. If the optional argument `mtime` is absent or None, then the current time is used [1]. This makes outputs non-deterministic, which can badly confuse unsuspecting users: If you run "diff" over two outputs to see whether they are unaffected by changes in your application, then you would not expect that the *.gz binaries differ just because they were created at different times. I'd propose to introduce a new constant `NO_TIMESTAMP` as possible value of `mtime`. Furthermore, if policy about API changes allows, I'd suggest that `NO_TIMESTAMP` become the new default value for `mtime`. How to proceed from here? Is this the kind of proposals that has to go through a PEP? - Joachim [1]... Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org Message archived at... Code of Conduct:
https://mail.python.org/archives/list/python-dev@python.org/message/5FLBLVY3DJFGIBMED57SASLS5ASZ65KF/
CC-MAIN-2021-43
refinedweb
271
59.6
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video. Templates9:51 with Kenneth Love Views that return plain text are fine, but eventually we're going to want some fancy HTML. App-specific templates are best kept in a structure like app_name/templates/app_name because Django looks in app directories for a directory named templates and makes those templates automatically available. {{ and }} are used to mark a variable you want printed out. {% and %} mark template tags, or special bits of Python that Django's template engine knows how to run. Unlike Jinja2 templates, you can't just run arbitrary Python in a template. render() turns a request object, a template, and an optional context dictionary into a generated string. More about render. - 0:00 [MUSIC] - 0:03 [SOUND] >> Templates in Django are a lot like - 0:06 templates in Flask. - 0:07 If you're not familiar with the idea of a templating system, - 0:10 it usually involves a few parts. - 0:12 Templates are usually HTML that has special tags or commands in it. - 0:16 These tags let you print out data, create loops and conditionals, - 0:19 and perform other programming constructs. - 0:22 Templates are also often inheritable, or extendable. - 0:25 So you can write small templates that fit into larger ones to save yourself trouble. - 0:29 In Django, templates can be any language that you want. - 0:32 HTML, JSON, XML, or something else entirely, they just have to be text. - 0:37 We're gonna be creating HTML templates though, - 0:39 because we want to give our users pages to look at in their browsers. - 0:42 So the first template that I want to make is one for - 0:45 the course list view that we just made. - 0:47 You remember looking over here in views.py. - 0:51 What we have right now is fine, I mean, it lists out the names. - 0:55 But, it's not really useful. - 0:57 So, let's fix that. - 0:58 Now, by default, Django looks for - 1:00 a templates directory inside of your app directory. - 1:04 And we don't have one so we need to make one. - 1:07 So here in courses we're gonna make a new folder, and we're gonna call it templates. - 1:14 Now, it also expects inside templates that you'll have a folder or - 1:19 directory with the same name as your app. - 1:22 So, New Folder, courses. - 1:27 So we have courses > templates > courses. - 1:31 Now the reason that we do this is so that we have all of - 1:34 our app-specific templates inside this namespaced directory, courses. - 1:39 And then if we need to let people override them, - 1:43 they just make their own template directory named courses. - 1:45 Or, if we want to have templates that are for - 1:48 multiple sections, we could name them different names, whatever. - 1:52 Anyway though, it's a really nicely done namespaced way of handling templates. - 1:57 Okay, so now, inside courses > templates > courses, I'm gonna make a new file - 2:03 that is named course_list.html, because it's the list of courses. - 2:08 Now of course, it doesn't have to have the same name as our view, it just happens to. - 2:13 And I kind of like for them to have the same name so - 2:15 that I know this template goes to this view. - 2:18 And I like my names to be done like this, course_list, - 2:21 because I know that it's a list of courses. - 2:24 So kind of two ways for me to go, okay, that's what this thing is for. - 2:28 Now if we were doing one that was only gonna show a single course, - 2:30 then we might call it course_detail. - 2:32 Or maybe it was a form for creating new courses, - 2:35 maybe it's course_create or course_form, something like that. - 2:39 But like this, we know that it's a list of courses. - 2:42 Cool. - 2:43 Obviously, by default, since we just created a file, our template is blank. - 2:48 So let's put in just a little bit so we can see the titles and - 2:51 the descriptions of our courses. - 2:53 We'll decide here that we're gonna provide a list to our template, and - 2:57 that list will have all the courses. - 2:59 Django let's us do for loops in our templates, so let's see by doing that. - 3:04 So we can do for course in courses, and - 3:08 then we have to end our for loop with the endfor tag. - 3:13 So now anything that we have in here will get done once for - 3:17 every course that's in our courses list. - 3:21 Template tags are the things that let us use little bits of Python in - 3:24 our templates. - 3:25 And they always start and end with a pair of characters, - 3:29 which is the curly brace and the percent sign. - 3:33 Django's template engine isn't quite as free-form as the Jinja2 template system - 3:37 that we've used in the Flask course, but you can still do a lot with it. - 3:41 And actually in Django 1.8 it's also possible to use Jinja2 for - 3:45 rendering your templates. - 3:46 But we're not gonna cover that in this course, - 3:48 we're gonna stick with Django's template renderer for this course. - 3:51 Okay, so inside this loop we want to print out the title of the course and - 3:55 the description of the course. - 3:57 We use two curly braces to print out a variable. - 3:59 So let's make an h2, and inside of the h2 we'll print course.title, - 4:05 and then below that we'll print out course.description. - 4:09 Now since the fields belong to the model instance as attributes, - 4:13 we access them with the dot, just like we would if we were looking at an object in, - 4:17 like our shell. - 4:19 And then we have to end our for loop, which we've already done. - 4:20 All right, so let's go make our view use our template. - 4:27 So this is our template. - 4:28 For course in courses, print out the title, print out the description. - 4:31 Done, all right, views.py. - 4:33 What we're gonna do is we're gonna get rid of most of this work. - 4:37 We don't need this output, and we don't need this return. - 4:40 So let's get rid of those. - 4:42 And we're gonna return a new thing, we're gonna return the render function. - 4:46 And look at that, we've already got it imported. - 4:48 And so this takes three arguments that we need to give it right now. - 4:53 So first of all it takes the request object, - 4:55 this thing that comes in right here. - 4:58 So it takes that, and then it takes the template to render. - 5:02 Now, we're going to say 'courses/course_list.html'. - 5:07 And then, optionally, it takes a dictionary. - 5:12 We call this dictionary a context dictionary, - 5:15 because it's the context with which the template will be rendered. - 5:20 And we're going to provide it a key named courses, and - 5:23 it's going to be our thing we picked up earlier named courses. - 5:29 This right here, it's all of our courses. - 5:31 So, we've got all this stuff. - 5:34 There are some other arguments that render can take, - 5:37 I'll link to more information in the teacher's notes. - 5:39 But for here though we're just handling this fairly simple, straightforward use. - 5:45 So we need to run our server. - 5:56 If your server is already running, you won't have to do that. - 5:58 Mine died, so I had to restart it. - 6:01 And then if I come back over here and I look at courses, check that out. - 6:07 That looks, well, maybe not great, but it looks okay. - 6:10 So, this covers, I mean this is creating a template for - 6:14 an app, that's fairly straightforward. - 6:16 But what if I wanted to have a layout for - 6:17 the homepage, the page that we made, let's go look at it here. - 6:23 Page that we made over here, this hello_world. - 6:26 The one that we get by just going to forward slash. - 6:29 What if I want a template for this page? - 6:30 Its view doesn't live inside of an app. - 6:33 So we can't just add a template's directory to an app and be done with it. - 6:36 We could have template for it to our courses app, but that doesn't make a lot - 6:41 of sense because that page may not come with our courses app. - 6:45 So, how do we handle this? - 6:46 Well, what we're gonna do is we're going to add a directory. - 6:49 Let's close this stuff up here. - 6:51 We're gonna add a directory into our outermost learning site here, and - 6:55 we're gonna name this directory templates. - 7:00 And we have to go do one more thing. - 7:03 So we have to go change our settings. - 7:05 So let's go look at our settings. - 7:08 Here's our settings, and we're gonna come down here, and we've got templates. - 7:15 And then we've got this list here called DIRS. - 7:18 So this templates thing here is a list, and each item on the list is a dictionary, - 7:25 and each of those dictionaries describes one way of rendering templates. - 7:32 So for instance, this one is the BACKEND that renders Django templates, - 7:35 this is just the Django templates renderer. - 7:38 This is where we had change to like the Jinja2 template renderer. - 7:41 And this APP_DIRS directory here is the one that says look for - 7:45 templates directories inside of apps. - 7:47 That's what lets us do the templates courses thing, so that's pretty cool. - 7:51 Options, these are just different things that you can configure per template - 7:55 renderer. - 7:56 Some of them you don't want to have debugged, maybe you don't want to have - 7:58 the request object, maybe you don't want to have messages, whatever. - 8:02 What we care about though, is this DIRS list. - 8:05 So this DIRS list lets us specify other - 8:09 directories that we want included for it to go look for templates in. - 8:14 So, this actually works from the root of the site. - 8:17 So this is the root of our site. - 8:20 So how do we find in here the directory? - 8:22 Well, we named the directory templates, so let's just add in the string, templates. - 8:27 And I'll put a comma in there because that's a good habit. - 8:30 Okay, so now we need to create our template, and our view, - 8:33 and change our view. - 8:35 So let's make a new file here, and we'll call it, - 8:37 say, home.html, since it's the homepage. - 8:42 And then, inside here I'm gonna put an h1 and it's just gonna say welcome. - 8:46 And I think that's good enough for now. - 8:48 So it just says welcome. - 8:49 I mean, right now, it says, Hello World, we'll say, welcome. - 8:53 So, now let's go back and edit our views. - 8:56 So here's our views. - 8:58 And what we need to do is we need to change this to shortcuts, and render. - 9:06 And then we're going to return render (request, - 9:11 and our template is 'home.html'). - 9:15 And we don't have to give a directory on this one because it doesn't live inside - 9:18 of another directory. - 9:19 We could have added say, default or basic or whatever, but - 9:24 this one doesn't live inside anything. - 9:27 And then we don't have to include the context directory, or - 9:30 dictionary because there's no context. - 9:33 Okay, so let's refresh this. - 9:36 And we get our Welcome, great. - 9:38 You might want to change the view name from, hello_world, to, home or home_page. - 9:43 Be sure you change the URL too, since it has the view name in it. - 9:46 In our next video, - 9:47 we'll look at the other important part of a templating system, template inheritance.
https://teamtreehouse.com/library/django-basics/django-templates/templates
CC-MAIN-2019-43
refinedweb
2,273
81.93
The binding generator is part of the gcc compiler and can be invoked via the -fdump-ada-spec switch, which will generate Ada spec files for the header files specified on the command line, and all header files needed by these files transitively. For example: $ g++ -c -fdump-ada-spec -C /usr/include/time.h $ gcc -c -gnat05 *.ads will generate, under GNU/Linux, the following files: time_h.ads, bits_time_h.ads, stddef_h.ads, bits_types_h.ads which correspond to the files /usr/include/time.h, /usr/include/bits/time.h, etc..., and will then compile in Ada 2005 mode these Ada specs. The -C switch tells gcc to extract comments from headers, and will attempt to generate corresponding Ada comments. If you want to generate a single Ada file and not the transitive closure, you can use instead the -fdump-ada-spec-slim switch. Note that we recommend when possible to use the g++ driver to generate bindings, even for most C headers, since this will in general generate better Ada specs. For generating bindings for C++ headers, it is mandatory to use the g++ command, or gcc -x c++ which is equivalent in this case. If g++ cannot work on your C headers because of incompatibilities between C and C++, then you can fallback to a generic: procedure foo (param1 : int); with the C++ front-end, the name is available, and we generate: procedure foo (variable : int); In some cases, the generated bindings will be more complete or more meaningful when defining some need to first include stdio.h, so you can create a file with the following two lines in e.g. readline1.h: #include <stdio.h> #include <readline/readline.h> and then generate Ada bindings from this file: $ g++ -c -fdump-ada-spec readline1.h
http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gnat_ugn_unw/Running-the-binding-generator.html
CC-MAIN-2015-14
refinedweb
297
61.97
Python 3.5 will add support for coroutines with async and await syntax, according to Python Enhancement Proposal (PEP) #0492. The proposal aims at making coroutines a native Python language feature and to "establish a common, easily approachable, mental model of asynchronous programming." The new proposed syntax to declare a coroutine is the following: async def read_data(db): pass Specifically, async is the keyword that makes a function to behave as a coroutine, even if it does not contain await expressions. Such a function will return a coroutine object when executed. Inside of a coroutine body, the await keyword can be used to make an expression suspend the execution of the coroutine and wait for some processing to complete: async def read_data(db): data = await db.fetch('SELECT ...') ... A form of coroutines has long been available in Python thanks to enhanced generators, i.e. Python generators that are treated as coroutines when the yield or yield from statements appear in their body. This is an example of how a generator-based coroutine can be used: >>> def createGenerator(): ... mylist = range(3) ... for i in mylist: ... yield i*i ... >>> mygenerator = createGenerator() >>> for i in mygenerator: ... print(i) 0 1 4 In the code above, each time the generator is called in the for loop, a new value from the generator for loop is returned. More examples of await use can be found in the mentioned PEP #0492. The new proposal for coroutines has the goal to clearly separate generators from coroutines, with the following expected benefits: - make it easier for new developers to handle the two concepts, since they would not share the same syntax; - remove the cause for "unobvious errors" due to the yieldstatement being inadvertently removed from a coroutine while refactoring, thus making the coroutine to be treated as a generator. The async/await syntax allows developers to write code as if it were sequential, but the compiler will implement it through a sequence of coroutines, thus making it effectively concurrent. Going back to the previous example, async/await makes it possible to write multiple await statements sequentially, as if each statement would block and wait for the result to be available, but this would not cause any actual block: async def read_data(db): data = await db.fetch('SELECT ...') if (data...) await api.send(data ...') Community comments Nice, but will take years for PyPy to catch up! by Nikolay Kolev, Nice, but will take years for PyPy to catch up! by Nikolay Kolev, Your message is awaiting moderation. Thank you for participating in the discussion. Given PyPy3 supports just 3.2.5 today, I can imagine taking them at 2 years after 3.5 release to catch up.
https://www.infoq.com/news/2015/05/python-async-await/?itm_source=presentations_about_Asynchronous&itm_medium=link&itm_campaign=Asynchronous
CC-MAIN-2021-43
refinedweb
448
51.68
Whats the advantage of a library project over having an external source folder that you share bewteen projects? if you have a library project it compiles to a swc rather than swf. if other projects link to the swc (rather than 'raw' .as or .mxml files as in an external source folder) then development is quicker because the library stuff is already compiled rather than being recompiled every time you test/run/publish your main project You can also define namespaces and design-view specifications in the a manifest file of a library. Most of the advantage however comes from enterprise level development. It's a lot easier to manage continuous integration with specifically versioned libraries. Of course you can just "say" that code is compatible against revision number in source, but it's more easily enforced through the distribution of compiled libraries.
https://forums.adobe.com/thread/760945
CC-MAIN-2017-51
refinedweb
143
51.48
Is it possible to determine if the current script is running inside a virtualenv environment? AFAIK the most reliable way to check for this (and the way that is used internally in virtualenv and in pip) is to check for the existence of sys.real_prefix: import sys if hasattr(sys, 'real_prefix'): #... Inside a virtualenv, sys.prefix points to the virtualenv directory, and sys.real_prefix points to the "real" prefix of the system Python (often /usr or /usr/local or some such). Outside a virtualenv, sys.real_prefix should not exist. Using the VIRTUAL_ENV environment variable is not reliable. It is set by the virtualenv activate shell script, but a virtualenv can be used without activation by directly running an executable from the virtualenv's bin/ (or Scripts) directory, in which case $VIRTUAL_ENV will not be set.
https://codedump.io/share/YhMvgh4578Hk/1/python-determine-if-running-inside-virtualenv
CC-MAIN-2018-05
refinedweb
135
58.48
>> I'm using what MS called the Development Environment 2003. You are using .Net 1.1 but OpenTK requires .Net 2.0, as documented here. This translates into Visual Studio 2005 or higher. You can download the free edition of Visual Studio 2010 from. Once you have that, OpenTK will be listed as a .Net reference that you can add to your VB.Net project. Note that Tao also requires .Net 2.0. Re: Visual Basic .NET Not to sound rude but.. there is a real lack of Examples of working with OpenTK. There needs to be a site created by the Authors of OpenTK .. where people can contribute Examples. It took me hours of messing with with code to switch back and forth from Perspective and Ortho. All the examples are done in Ortho and useless for actual 3D work. I'll post some stuff I use below. I'm using OpenTK with VS 2008... VB.NET You need to at least get the new express version of VB to use OpenTK. In order to use anything in OpenTK, you need to add a reference to the .DLLs that are needed. OpenTK.DLL and OpenTK.GLControl and the Platform. (Windows XP Pro is my OS) When you install OpenTK.. these files are place in your 'My Documents' folder under OpenTK. Navigate to the Sub folder named 'Bin' and in there you will find the DLLs you need. You will need to add the 'Import" directive to the top of each .VB file thats going to use OpenTK. Also, to use the OpenTK.Control on a form, you will need to add this control to the list of controls that you can drop in to a form window. Just right click on the list of controls in some blank area and pick 'Choose Items...'. After, browse to the location I described above and add the OpenTK.GLControl. It should now show up on the list of controls you can add to a form. Once this GLControl is added, you can use any of the events it fires. The most important is the Resize.. Why is explained below. I still cant figure out how to change any parameters in the GLControl. Z Depth-- Colors... WHERE ARE THE EXAMPLES ON THIS!!!???? So.. heres the steps. 1. Add the DLL references. 2. Add the OpenTK.GLControl to your list of Controls 3. Drag the OpenTK.GLControl on to your form and set its Size and Anchor..... I usually just dock it to fill the entire window. 4. Add the Imports to your program's head. 5. Write the code. You must NEVER use the GLControl before it is actually created! I use a Global variable named _STARTED as Boolean = False In any sub/function thats going to use the GLControl, add this at the top. If Not _STARTED Then Return In the GLControls Paint Event it needs to look like this Heres the code for the ResizeGL If you want to auto update the screen, us a timer or create a thread that loops for ever (I have not tried this yet). This can get very tricky. From my experience, Every thing has to be created in this same thread. VBOs CallLists.. all of that. If you just want to Update the GLGLControl... Use: OpenTK.GLControl.Invalidate. This will force it to redraw. OK.. the general rule of 3D is, anytime you switch to Perspective.. You MUST set the Camera and LookAt locations. These NOT Modal and are lost when the Identity is loaded! Heres the code to switch to Ortho: Heres my code to set the cam position. Not that the variables are the rotations in the axis of Z and X. ROT_X is the x,y or rotating around the Z axis and ROT_Y is rotating around the X axis. A bit confusing I'm sure. Oh and look_radius is how far from the eye position you are. This transform will keep the camera looking at the same point, regardless of rotation angles or the distance of look_radius. You must note here that I have the lookup vector set to Z. NOT Y!!!! So your draw sub might look like this: So.. you might be wondering why I use Z as the UP vector. This is how I work in the real world. Z is always up/down. I hope this helps.. if not you.. maybe some one :) --Mike O P.S. About your comment that VB Sucks... To make things clear... There is NO difference between the speed of a C# or VB.NET app. They both are complied at 'Run TIme' and produce exactly the same code. They run at the exact same speed. I actually prefer VB.NET over C#... Its way easier to create forms and such. This does NOT include C or C++.. they are a different animal all together. Here again tho, from what I have read on line, you will see only around a 2% drop in speed using .NET. There is also Assembly Code... It don't get any faster then this but is also, a real pain in the butt to master!. too funny... And here I was thinking I was being helpful. Re: Visual Basic .NET I think you were helpful, yes. But the "there's not enough tutorials about non-ortho rendering" is not true. Re: Visual Basic .NET Im sorry if I upset you.. Im not dizzing this site. I just know that I cant find what I need here usually. My idea is to get an actual place setup just to list tuts at. Can this be done? Maybe break it in to a few catagories like the GLControl and the GameWindow tools. Maybe combine this in to the documents area? These are just ideas and I have lots of them. Re: Visual Basic .NET Have you checked the Example Browser that is installed along with OpenTK? It has tutorials on OpenTK (GameWindow, GLControl), OpenGL and OpenAL. It has examples for ortho and 3d projections, shaders, vertex buffer objects, texture compression, complete with (C#) source code. Re: Visual Basic .NET Thanks Mike for the help. I was able to add GLControl to the toolbox and I added the GLControl onto my window. I also added Imports OpenTK Imports OpenTK.GLControl Imports OpenTK.Platform I added a handle for Resize just like you have done but it can't recognize some stuff. Private Sub ResizeGL() GL.Viewport(0, 0, GlControl1.Width, GlControl1.Height) GL.MatrixMode(MatrixMode.Projection) ' Select The Projection Matrix GL.MatrixMode(MatrixMode.Modelview) ' Select The Modelview Matrix GL.LoadIdentity() ' Reset The Modelview Matrix End Sub Error 1 'GL' is not declared. It may be inaccessible due to its protection level. C:\Users\vrej\documents\visual studio 2010\Projects\WindowsApplication1\WindowsApplication1\Form1.vb 16 9 WindowsApplication1 and there are other similar errors. I assume I have to allocate a GL? This is what I need information on. How to setup for VB .NET. Do I have to choose a pixel format? Do I have to SetPixelFormat, and create a context? Where to destroy the context. I will try to get some feedback from people over at and if they agree, I'll add it to the Wiki (). Re: Visual Basic .NET You are missing an import: Re: Visual Basic .NET Thanks Fiddler. Now for rendering a triangle. I added a little bit of code but it doesn't recognize SwapBuffers() I guess I need to import it with that "Imports" thing? I tried "Imports System" but that's not it. I'm also checking out those .cs examples but it has using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading;
http://www.opentk.com/node/2221?%24Version=1&%24Path=/
CC-MAIN-2015-27
refinedweb
1,298
79.36
Each Answer to this Q is separated by one/two green lines. I’m 90% sure there is a built in function that does this. I need to find the position of a character in an alphabet. So the character “b” is position 1 (counting from 0), etc. Does anyone know what the function is called? Thanks in advance! EDIT: What i’m trying to do is to send all the characters X amount of “steps” back in the alpha bet, so if i have a string with “hi” it would be “gh” if i sent it back one step. There might be a better way of doing it, any tips? It is called index. For e.g. >>> import string >>> string.lowercase.index('b') 1 >>> Note: in Python 3, string.lowercase has been renamed to string.ascii_lowercase. Without the import def char_position(letter): return ord(letter) - 97 def pos_to_char(pos): return chr(pos + 97) You can use ord() to get a character’s ASCII position, and chr() to convert a ASCII position into a character. EDIT: Updated to wrap alphabet so a-1 maps to z and z+1 maps to a For example: my_string = "zebra" difference = -1 new_string = ''.join((chr(97+(ord(letter)-97+difference) % 26) for letter in my_string)) This will create a string with all the characters moved one space backwards in the alphabet (‘ydaqz’). It will only work for lowercase words. # define an alphabet alfa = "abcdefghijklmnopqrstuvwxyz" # define reverse lookup dict rdict = dict([ (x[1],x[0]) for x in enumerate(alfa) ]) print alfa[1] # should print b print rdict["b"] # should print 1 rdict is a dictionary that is created by stepping through the alphabet, one character at a time. The enumerate function returns a tuple with the list index, and the character. We reverse the order by creating a new tuple with this code: ( x[1], x[0]) and then turn the list of tuples into a dictionary. Since a dictionary is a hash table (key, value) data structure, we can now look up the index of any alphabet character. However, that is not what you want to solve your problem, and if this is a class assignment you would probably get 0 for plagiarism if you submit it. For encoding the strings, first create a SECOND alphabet that is organised so that alfa2[n] is the encoded form of alfa[n]. In your example, the second alphabet would be just shifted by two characters but you could also randomly shuffle the characters or use some other pattern to order them. All of this would continue to work with other alphabets such as Greek, Cyrillic, etc. I’ve only just started learning Python, so I have no idea how efficient this is compared to the other methods, but it works. Also, it doesn’t matter whether the text is upper case, lower case or if there is any punctuation etc. If you want to change all letters: from string import maketrans textin = "abcdefghijklmnopqrstuvwxyz" textout = "cdefghijklmnopqrstuvwxyzab" texttrans = maketrans(textin, textout) text = "qcc, gr umpiq" print text.translate(texttrans) Also works to change some characters: from string import maketrans textin = "81972" textout = "Seios" texttrans = maketrans(textin, textout) text = "811, 9t w7rk2" print text.translate(texttrans) Here’s a catch all method that might be useful for someone… def alphabet(arg, return_lower=True): """ Indexing the english alphabet consisting of 26 letters. Note: zero indexed example usage: alphabet('a') >> 0 alphabet(25, return_lower=False) >> 'Z' :param arg: Either type int or type chr specifying the \ index of desired letter or ther letter at \ the desired index respectivley. :param return_lower: If index is passes, returns letter \ with corresponding case. Default is \ set to True (lower case returned). :returns: integer representing index of passed character \ or character at passed index. """ arg = str(arg) assert arg.isdigit() or arg.isalpha() if arg.isdigit(): if return_lower: return chr(int(arg) + 97).lower() return chr(int(arg) + 97).upper() return ord(arg.lower()) - 97 Equivalent of COLUMN function in excel def position(word): if len(word)>1: pos = 0 for idx, letter in enumerate(word[::-1]): pos += (position(letter)+(1 if idx!=0 else 0))*26**(idx) return pos return ord(word.lower()) - 97 print(position("A")) --> 0 print(position("AA")) --> 26 print(position("AZ")) --> 51
https://techstalking.com/programming/python/get-character-position-in-alphabet/
CC-MAIN-2022-40
refinedweb
712
64.61
Here’s an example: from robot import * import time R = Robot() # motor board 0, channel 0 to full power forward R.motors[0].m0.power = 70 # motor board 1, channel 0 to full power reverse R.motors[1].m0.power = -70 # motor board 0, channel 1 to half power forward R.motors[0].m1.power = 45 # motor board 1, channel 0 stopped R.motors[1].m0.power = 0 # the following will put motor board 0, channel 1 at half power (backwards) for 2.5 seconds: R.motors[0].m1.power = -45 70 for a second, then stop immediately molly.power = 70 time.sleep(1) molly.power = 0
http://hr-robocon.org/docs/motors
CC-MAIN-2018-09
refinedweb
107
61.22
In today’s Programming Praxis exercise, our goal is to write a program that allows children to test their arithmetic skill. Let’s get started, shall we? First, some imports. import Control.Monad import System.Random import Text.Printf All we need for a new sum are two random numbers. drill :: Maybe Int -> IO () drill n = play n =<< liftM2 (,) rnd rnd where rnd = randomRIO (1, maybe 10 id n) Processing input isn’t too difficult. Just print the appropriate response and repeat the same sum if the answer is wrong or start a new one when the correct answer is given or requested. Since getLine produces an error when an end-of-file character is encountered we have to use catch to deal with it. play :: Maybe Int -> (Int, Int) -> IO () play n (a,b) = printf "%d + %> drill n else putStrLn "Wrong, try again!" >> play n (a,b) All that’s left to do is to start the program. main :: IO () main = drill Nothing Tags: arithmetic, bonsai, code, Haskell, kata, praxis, programming
http://bonsaicode.wordpress.com/2010/12/31/programming-praxis-arithmetic-drill/
CC-MAIN-2014-42
refinedweb
172
74.79
Hello. I am trying to write the content of a class array to a file but I keep getting this error: no operator "<<" mathces these operands. This is where im getting the error: Why am I getting this error?Why am I getting this error?Code:#include <iostream> #include <fstream> #include <string> using namespace std; #include "Node.h" #include "Stock.h" #include "BinarySearchTree.h" int main() { BinarySearchTree<Stock> tree; Stock company[23]; ifstream file; string name, symbol; double price = 0; file.open("data.txt"); if (!file) cout << "Can not open file.\n"; //read data from file and store into class object, then store into binary search tree while (!file.eof()) { for (int i = 0; i < 20; i++) { getline(file, line, '\n'); company[i].setName(line); getline(file, line, '\n'); company[i].setSymbol(line); file >> dbline; company[i].setPrice(dbline); file.get(); } } file.close(); //other code blah doesn't matter //now this is where i get the error else if (choice == QUIT) { cout << endl; cout << "Now write data to file...\n"; file.open("data.txt", ios::out); for (int i = 0; i < 23; i++) { file << company[i].getName(); //i get the error one these 3 lines file << company[i].getSymbol(); file << company[i].getPrice(); } file.close(); cout << "Goodbye.\n"; } } I also overloaded the << operator: In main(), in the loop to write data to the file, i tried just writingIn main(), in the loop to write data to the file, i tried just writingCode:ostream &operator<<(ostream& os, const Stock& s) { os << s.compName << endl << s.compSymbol << endl << s.compPrice << endl; return os; }but i still got the same error message.but i still got the same error message.Code:file << company[i] I also have another question just out of curiosity. If I wanted to store the contents of the binary search tree instead of the class array into the file, how could I go about doing that instead?
https://cboard.cprogramming.com/cplusplus-programming/179750-how-write-class-array-file-post1298899.html?s=412968d641da7e1e438b66e8b99ff34a
CC-MAIN-2021-21
refinedweb
318
68.57
Subject: Re: [boost] Boost policy for putting headers in boost/ Was: #3541Support <boost/ptr_map.hpp> From: Joel de Guzman (joel_at_[hidden]) Date: 2009-10-29 21:32:38 David Abrahams wrote: > on Thu Oct 29 2009, Joel de Guzman <joel-AT-boost-consulting.com> wrote: > >>> So +1 for a mpl/type_traits style of organization from me too, >> For the record, I am not against this. It is in IMO the logical >> choice for most libraries. What I am saying is that for bigger >> libraries, it is logical to organize in modules. > > As I've been saying, that practice doesn't have to be incompatible with > the mpl/type_traits style of organization > >> When you have >> modules then that flat organization will start to break. E.g. >> if "x.hpp" is a header of module "foo" of library "lib", then, >> the logical structure is: >> >> boost/ >> lib/ >> foo/ >> a.hpp >> foo.hpp >> lib.hpp >> >> Notice that the header for module has the correct header: >> >> <boost/lib/foo.hpp> > > I don't even see x.hpp there. Ooops. I meant a.hpp, of course :) >> However, components of foo (a.hpp) cannot be hoisted outside >> its module. Thus, in this case, this is wrong: >> >> <boost/lib/a.hpp> >> >> Your example is a prime symptom of the breakage: >> "That said there may be a case to be made for splitting >> into sub-libraries - we did that with Boost.Math to avoid >> confusion between a distribution called X and a special >> function called X.". > >> When a library is modular, clashes are typical, e.g.: >> >> boost/ >> lib/ >> foo/ >> a.hpp >> bar/ >> a.hpp >> foo.hpp >> bar.hpp >> lib.hpp >> >> So, now you have two headers "a.hpp" under different modules, >> sharing the same name. It then becomes obvious why this is >> wrong: >> >> <boost/lib/a.hpp> > > There are several ways to deal with that. Aside from renaming one of > the submodules, you could also have boost/lib/a.hpp #include > boost/lib/foo/a.hpp and boost/lib/bar/a.hpp. It's not aesthetically > ideal, but it's consistent and easier for users. Those who want to be > more selective can still always reach for boost/lib/bar/a.hpp, for > example. > > Have you actually got a name clash situation like that one, BTW? Yes. Spirit2 includes both "classic" and "qi" in there as well as "karma". There are lots of similar names such as rule.hpp, grammar.hpp that are found in each of the modules. In our flat include, we have to prepend them with "classic", "qi" and "karma" to disambiguate. Compare these (flat vs. modular) files for instance: #include <boost/spirit/qi/nonterminal/grammar.hpp> #include <boost/spirit/include/qi_grammar.hpp> And this: #include <boost/spirit/karma/nonterminal/grammar.hpp> #include <boost/spirit/include/karma_grammar.hpp> Such a workaround is reminiscent of pre namespace C++. John Maddock hints at a similar scenario that prompted them to make Boost.Math modular "to avoid confusion between a distribution called X and a special function called X". The same underlying reasons why we use namespaces apply to header files. IMHO, it is for the best interest of Boost to evolve from being flat to being more modular. I am lobbying for that. It's just the "right" way to go! :-) Regards, -- Joel de Guzman Meet me at BoostCon Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2009/10/157688.php
CC-MAIN-2021-39
refinedweb
573
61.43
what i’m trying to do is I have a midi keyboard with the C,E and G keys assigned as int 255 each, to make a coloured ellipse, what I’d like is that when the keys are released to then remove that color value so the RGB values can be changed and not just ultimately create a white ellipse…? import themidibus.*; MidiBus myBus; int Ckey; int Ekey; int Gkey; boolean noteOn ; boolean noteOff ; int pitch; void noteOn(int channel, int pitch, int velocity) { if (channel == 0 && pitch == 60) { Ckey = 255; } if (channel == 0 && pitch == 64) { Ekey = 255; } if (channel == 0 && pitch == 67) { Gkey = 255; } println("C: " + channel + " P: " + pitch + " V: " + velocity); } void setup () { size (400, 400); background (255); MidiBus.list(); myBus = new MidiBus(this, 0, 3); } void draw () { fill (Ckey, Ekey, Gkey); ellipse (200, 200, 200, 200); }
https://discourse.processing.org/t/getting-sketch-to-reset-using-midi/11078
CC-MAIN-2022-27
refinedweb
139
52.2
How to Validate a phone number in C++? In this tutorial, we are going to learn how to Validate a phone number in C++. As you know area codes and phone numbers length are different for different regions, so we will try to Validate a number whose area code length is 3 and the length of number is 8. So let us move to our code implementation. Validate a phone number in C++ C++ source code: // Validate a phone number in C++ #include<bits/stdc++.h> using namespace std; int main() { string areacode; string phone_number; cout<<"Enter your area code: "; cin>>areacode; int flag1=0; cout<<"Validating your area code.....\n"; // Checking if area code is correct for(int i=0;i<areacode.length();i++) { if(areacode[i]-48>=0 && areacode[i]-48<=9) { flag1=1; continue; } else { flag1=0; break; } } if(flag1==1 && areacode.length()==3) { cout<<"You have entered right area code.\n"; } else if(flag1==0) { cout<<"You have entered wrong area code.\n"; } else if(areacode.length()!=3) { cout<<"You have entered wrong area code.\n"; } cout<<"Enter your phone number: "; cin>>phone_number; int flag2=0; cout<<"Validating your phone number.....\n"; // Checking if number is correct for(int i=0;i<phone_number.length();i++) { if(phone_number[i]-48>=0 && phone_number[i]-48<=9) { flag2=1; continue; } else { flag2=0; break; } } if(flag2==1 && phone_number.length()==8) { cout<<"You have entered right number.\n"; } else if(flag2==0) { cout<<"You have entered wrong number.\n"; } else if(phone_number.length()!=8) { cout<<"You have entered wrong number.\n"; } return 0; } Output: Enter your area code: 011 Validating your area code..... You have entered right area code. Enter your phone number: 24242424 Validating your phone number..... You have entered right number. -------------------------------- Process exited after 5.362 seconds with return value 0 Press any key to continue . . . Explanation of Code: In the code, we are checking if all entered characters are digits or not if they are digits and their length are as equal as they are mentioned correct output is printed. We are converting all character values into integers by using ASCII values. After converting if they lie between o and 9 inclusive we will print right output. One can use own length of area codes and numbers according to their region. If you have any query regarding the code do let me know in the comments section. You can also learn, Validating phone numbers in JavaScript
https://www.codespeedy.com/validate-a-phone-number-in-cpp/
CC-MAIN-2020-45
refinedweb
409
68.97
March 24, 2008 Anti-Ajax FUD Anti-Ajax FUD: There's a very strange article at ComputerWorld today, which describes a pay-to-read report from Forrester Research. The strangeness starts at the intro [paraphrased]: "Ajax can be slow, so Forrester recommends AIR or Silverlight". The Adobe Integrated Runtime is not an in-browser technology, and the shipping version of Microsoft's Silverlight browser plugin relies on the browser's JavaScript for any interactivity... the recommendation makes zero sense. An anecdote says the initial rendering time was slower for an Ajax rewrite of a Visual Basic app, but Visual Basic lives on the local machine, while Ajax is transferred from a centralized machine... hard to compare the two. You can have both local and remote validation of user inputs... different needs. The Tamarin efficiencies in logic-processing are already available on 95% of consumer machines, within the Adobe Flash Player... works reliably the same regardless of browser brand, browser version, or common operating system details. The article makes me want to read the original Forrester report, to learn directly what the authors might have tried to say. Silverlight shouldn't be mentioned in this article at all (at least until Microsoft ships a full 1.0!), and Flex development (with SWF delivery) would be a more appropriate parallel to Ajax than AIR. The article disparages JavaScript-based apps, but for unsound reasons. Posted by JohnDowdell at 01:08 PM | Comments (2) | TrackBack March 20, 2008 The Web, pre-Web The Web, pre-Web: Andy Baio did a great thing here: ...." Lots of the early Web has disappeared, so we all owe Andy a debt of thanks for capturing what was found of it on videotapes.... ;-) Posted by JohnDowdell at 02:36 PM | Comments (0) | TrackBack March 19, 2008 Adobe Developer Week Adobe Developer Week: This has gotten some attention in weblogs, but may have gotten buried in the rush of non-news... starting next Monday there will be twenty online classes, which will be recorded and available for subsequent viewing. I don't know group size, standby lists, or differences between live participation and recorded viewing. Posted by JohnDowdell at 01:35 PM | Comments (0) | TrackBack February 22, 2008 MS, developers, experiences MS, developers, experiences: Sometimes the pioneers explore a new frontier, and then others really develop its popularity. Sometimes. Macromedia may have pioneered the ideas of cross-platform distribution of richer, more interactive experiences, but Microsoft has always had a strong presence within corporate intranets and other closed environments -- that's a lot of developer power! It's a good thing overall that your local IT desk has the capability to use color, motion and sound... beats having them making text interfaces with funny buttons, or having them demand you change your browser to do your business. It's a good and necessary thing to bring the trailing edge along. I've been reading a lot more of these threads, and thinking about how things sometimes turn out, after reading some of these articles on the web today.... ;-) Posted by JohnDowdell at 02:21 PM | Comments (3) | TrackBack February 21, 2008 SF meet tonight SF meet tonight: I haven't seen this in the aggregators yet today... if you're in San Francisco then there's a meeting: "The San Flashcisco user group aims to promote understandings of Flash Platform technologies within and around the San Francisco area with emphasis on learning, fun and networking." (nb: I do call it "Frisco" on occasion, but I'm still a little uneasy with "Flashcisco".... ;-) Posted by JohnDowdell at 09:39 AM | Comments (0) | TrackBack February 19, 2008 Binary vs text Binary vs text: Joel Spolsky looks at the recent documentation for Microsoft Office native file formats, and asks "Why are the Microsoft Office file formats so complicated?" Fortunately he answers the question -- these binary file formats grew up with use of the tools, and had to solve an ongoing series of problems, and weren't designed for direct manipulation by others. Plausible, useful perspective here. Towards the end he outlines ways to solve problems by using the current functionality of the tools themselves, rather than writing new code to digest the old formats. This doesn't explain why the more recent XML formats for Microsoft Office are so remarkably complex, however... an XML format seems like it should be able to be implemented by others, particularly if it is proposed as a common standard. Efficient binary formats have different priorities than open text formats... different types of beasts. Posted by JohnDowdell at 09:41 AM | Comments (0) | TrackBack January 26, 2008 QuickTime 7.4 QuickTime 7.4: In case you hadn't seen the news, you might want to hold off on updating QuickTime for a bit, in two specific situations: exporting QuickTime from Adobe Premiere Pro or After Effects; or inspecting system calls with the UNIX-based DTrace on your Mac. The QT7.4 update adds Apple iStore functionality, as announced at Macworld Expo, so adoption rates are likely pretty significant. The issue arose in the Adobe Discussion Forums last week, and staffer Michael Coleman had an advisory up Monday morning. But no chance to try to address it in After Effects 8.02 update, published Tuesday. (I don't know much about DTrace; discussion here.) This is a showstopper issue for videographers, and even though Apple rarely gives guidance, I suspect it's on a fast-track for a fix. Anyway, if you know friends who do video work, or who rely on DTrace, then making sure they know of QT7.4 could help them, thanks. Posted by JohnDowdell at 03:20 PM | Comments (0) | TrackBack October 07, 2007 Some bumps Some bumps: Tinic Uro helped me understand the Hydra initiative... Narciso Jaramillo made Thermo a lot clearer for me. (I'm also happy about the ambient computing being done by Fernando Florez, and agree with Dan Florio on the serendipity of conference connections.) Posted by JohnDowdell at 07:53 AM | Comments (0) | TrackBack October 05, 2007 Hello, I Must Be Going Hello, I Must Be Going: There won't be much happening on this weblog the next few weeks, because I'll be spending time in China instead of San Francisco. Adobe is one of the few companies to have a sabbatical policy, and I'm grandfather'd in on a lengthier Macromedia-style sabbatical. I'll be three weeks in Beijing, two in Shanghai, mostly to see how people are coping with the sudden changes and the new technologies. In my own life exposure to technical change has been gradual and incremental, but in these two cities the meeting has been abrupt, the results vibrant. I want to learn how other people see the new digital realities -- they'll predict how we'll all deal with the ever-accelerating change. I'll have computer and camera, but am unsure of connectivity and workflow... more likely to be on Twitter and my personal blog. Zai jian, ya'll! [I'm updating the publishing date on this item to keep it on the top of the stack... originally appeared on Oct 5.] Posted by JohnDowdell at 06:52 AM | Comments (5) | TrackBack September 25, 2007 Uninstalling iHacks Uninstalling iHacks: Erica Sadun of The Unofficial Apple Weblog has the best summary I've seen yet of what we know about reversing the various iPhone unlock hacks circulated last month. Good to read, but no rush to action: "If you haven't tried relocking yet, do yourself a favor and just wait until we figure out why some relocks are going wrong." Apple's situation seems to be that they're not in a position to test and reverse the various hacks themselves... the Apple updaters are designed and tested upon an Apple configuration, not a hybrid. Who bears the responsibility for an uninstaller...? Posted by JohnDowdell at 07:51 AM | Comments (0) | TrackBack 08:22 AM | Comments (6) | TrackBack September 04, 2007 iCar designs iCar designs: Tom Spring of PCWorld has a nice collection of links here: "With reports Apple and Volkswagen are in cahoots to build an iCar who can resist pondering what an iCar might look like. Lucky for me there is no shortage of imaginative Apple designers -- with apparently time to burn -- dreaming what an iCar might look like. This is what I found...." Nothing profound, but some nice eye-candy here. Posted by JohnDowdell at 01:55 PM | Comments (0) | TrackBack August 17, 2007 Gear on the go Gear on the go: Awesome collection of photos and text at Lifehacker, showing how various people pack for computing on the go. Most of these are daybag contents, but there are two travel vest descriptions as well. I don't see any mentions of utility belts yet, but Lifehacker is accepting submissions for another week. How do you go, when you're on the go...? Posted by JohnDowdell at 09:14 AM | Comments (0) | TrackBack August 14, 2007 Game manuals Game manuals: Seems to be a very useful resource, if you need to check how someone else actually handled a problem years ago: ...." [via Jason Scott, via Andy Baio] Posted by JohnDowdell at 03:32 PM | Comments (0) | TrackBack 03:23 PM | Comments (1) | TrackBack 3D Mouse 3D Mouse: Mac-only. 3Dconnexion, a Logitech company, adds 3D manipulation for models rendered by Adobe Acrobat 8, in addition to its prior 3D manipulation in Adobe Photoshop CS3 Extended. Posted by JohnDowdell at 11:53 AM | Comments (1) | TrackBack August 10, 2007 Lots of links Lots of links: Looking for some weekend reading? Here's a bunch of pages open in my browser the past few days, some techy, some not.... Chicago Tribune goes all punny with a story about traffic violations with the Oscar Meyer Weinermobile. Microsoft offers miraculous image-editing. Aral Balkan tested the Nokia N800 Tablet with Adobe Flash Player 9, and many things worked on the new form-factor, but not all. Unlike Anil Dash, I'm still a little peeved that Daniel Lyons berated anonymity while exploiting it himself. Night & Day couldn't have been a standard, it had a 48-bar structure.... Beer bubbles at SIGGRAPH.... Draw Anywhere is SWF which offers flowchart drawing in the browser. Kyle Hayes ran comparisons of Google Websearch queries for ColdFusion and ActionScript... I was most impressed by the regional distinctions which showed up for these and other terms. A corporate blogging article turns into a CEO-blogging article, but has some valid observations on how open communications can help in a variety of ways. Spoilers for life, and I thought it was funny too. Steve Webster has info on a conference presentation on Flash, Yahoo, standards. Newspapers use movie footage to illustrate breaking news. Forrester Research: "Ninety-seven percent of the 1,000-plus corporate Web sites that Forrester Research has evaluated received failing grades... Manning says that there's no perfect Web site on the Internet. Forced to choose one, he picks Adobe.com, which he says is easy to read and full of useful information." Eve Lee had a post-mortem on the Acrobat/Kinko issue, which doesn't focus on mom&pop printers like the mainstream press did, but which does address the under-reported intranet aspects. ".'" Drew McLellan has been strategizing how to scale PHP work. John Gruber notes UI changes in new Apple keyboards. Apple has an extremely centralized glory structure. Kuler now accepts color themes in URLs... Scott Fegette has more. Posted by JohnDowdell at 03:13 PM | Comments (3) | TrackBack July 26, 2007 PCs running cars? PCs running cars? Apparently the number of computers running Windows will continue to exceed the number of autombiles running Windows, at least for the forseeable future... Mary Jo Foley transcribes a Steve Ballmer quote: "'There will be more PCs running Windows than automobiles at that point [June 2008], Ballmer told attendees.'" Or maybe he meant using Windows will continue to be more popular than having your car run your computer. But that doesn't make much sense. Or maybe... oh, I get it, he says there will be more PCs than cars by next year... that's plausible, considering that quick web searches show 66 million automobiles produced in 2005, and 240 million computers produced in 2007. More of them will run Player and Reader than Windows however, even though they all have windows... oh stop it John, stop teasing the poor man. ;-) Mary Jo also adds: "I thought it interesting that Ballmer emphasized repeatedly that Microsoft now sees itself as an advertising company. When identifying the four primary areas where Microsoft sees itself competing, advertising was one of those. (The other three: Commercial software, open source, consumer electronics.)" Posted by JohnDowdell at 12:18 PM | Comments (1) | TrackBack Flash Player, Yahoo Toolbar Flash Player, Yahoo Toolbar: It's not fair to spring this on me before I have my morning coffee. Google News showed the following story in a newspaper: "How can I install Adobe Flash Player without also getting that nasty Yahoo toolbar?" The answer describes how to visit the Adobe site and uncheck the toolbar offer before installing. The wacky thing is that Adobe doesn't offer the Yahoo Toolbar to people in Microsoft Internet Explorer who actually visit the Adobe site to install instead of using the normal background ActiveX process -- that offer switched to Google Toolbar awhile ago, as Emmy Huang and the FAQ show. It's still true that unchecking offers doesn't offer them, and still true that it's only IE/Win which sees this offer, and only if you're one of the minority who visit the Adobe site to install. (Making such offers of separate downloads on the Adobe site has paid for much of the engineering work on the Player -- it's advantageous to all.) Newspapers can be tricky; it felt like I had wandered down a time tunnel during the night, let me finish off this cup of coffee before instructing me on the evil of Scooter Libby or whatever's next, okay...? ;-) Posted by JohnDowdell at 07:05 AM | Comments (4) | Track 12:08 PM | Comments (2) | TrackBack July 08, 2007 Offline a bit Offline a bit: Blogging should be light for me this week... going to take a few days, enjoy the summer. See ya! Posted by JohnDowdell at 11:23 AM | Comments (0) | TrackBack July 07, 2007 sense of the ambience. Posted by JohnDowdell at 08:39 PM | Comments (2) | TrackBack BSD thread BSD thread: Over the last week someone who wants Adobe Flash Player for BSD Unix has been posting in various weblog items here. I've moved them all into this thread, in hopes of (a) helping him make a better case; and (b) removing off-topic material from other weblog items. Feel free to add to it. Current laptop ports are listed here. ----- Posted to Corporate honesty: adobe corporate culture is hardly a model for openness and communication is it ? [jd sez: I don't know who is a model for whom, but I do know that we disclose our affiliations.] they use code from the (genuinely) free OS's but then barely acknowledge their existence, and lock them out of the www. refusing to supply the free BSD's with flashplayer has made a complete mockery of open web standards. what good are standards compliant web browsers when there's barely a page that will render as intended by the designer, and many *many* sites that can't be used at all ? why does nobody at adobe even acknowledge this ? not a comment on the thousands of sigs on the petitions, or the flashplayer request forms, the requests made in the forums. this sorry state of affairs is even mentioned in the flashplayer wikipedia page. like the thousands of others, I am a little tired of being ignored, this has been going on for years. why won't you comment JD ? hello ? [jd sez: You're posting anonymously. *You* won't disclose. (I think the core of your plaint is "I want Adobe's source code because I choose an ultra-minority platform.")] Posted by: paul at July 7, 2007 03:52 AM I'm not posting anonymously JD, my name *is* paul. you also have my email address, what more info would you like ? and no, I do not want the source code, that's yours. what I want is for someone to respond to the thousands of requests with *something*. I want to be treated the same as everybody else. as to ultra-minority, check netcrafts figures. you'll be surprised. and yet again you haven't answered ANY of the points I've raised JD. what's the matter, cat got your tongue ? -PAUL (yes, PAUL, honestly) Posted by: paul at July 7, 2007 07:31 AM Paul of Saul? Paul of Abbey Road? Paul Allen, protecting his portfolio? Probably some other kind of "Paul", I suppose.... If you won't bet on your own words, why should others invest their time in reading them? I'm in a bit of a dilemma here, because I try to keep this weblog respectful of the reader's time, and you've been spinning your wheels on "no respect for BSDs" on a few threads here. I should just remove such words which add little, considering you can publish your own blog yourself. I'm always loathe to do, on the offchance that the other party might sometime start actually communicating. Posted by: John Dowdell at July 7, 2007 07:54 AM my name is paul jd. I've continued to post this stuff because I get nothing but deaf ears. you can call me anything you like, but I would prefer just paul. you still haven't responded, and you are of course free to censor me, just as I am free to state the facts anywhere that will allow me to do so. the fact that you think the BSDs are ultra-minority speaks volumes. before hotmail was bought out by MS, it was freebsd, yahoo is freebsd, many many millions of webservers run freebsd. gregs book sold more copies than some of the platforms you support. it's a minority only in the sense that it's not in the top 3 platforms on the 'net. (unless you include the juniper kit etc) and has been crippled on the desktop by the lack of flashplayer. check netcrafts figures, I can't fnd recent stats there but here's one from waay back in 2004 how large an installed base would be necessary for adobe to come to a decision ? I don't enjoy trying to ambush you on your blog, but it's a little annoying to be ignored for sooo long. -paul. Posted by: paul at July 7, 2007 08:11 AM How is the number of servers running BSD relevant to a discussion on the lack of client-side technology for the platform? According to, Linux hovers around 3.5%. I won't pretend to know jack about *nix, but if Linux as a whole is 3.5% (which Adobe provides a player for the majority of, right?), what is BSD on the whole? 1%? I would certainly consider that an ultra-minority. Posted by: Ben at July 7, 2007 09:31 AM personally, I think I'd consider 3.5% as an ultra-minority, it's an ultra-vocal minority though. the BSDs don't get used much on the desktop, I'm a staunch supporter of course, but it's painful to web browse without flash, it really is that much of a big deal. I'm sat here running win32 right now purely because of that. you may think I'm exagerating, but I know for certain that a lot of freebsd/openbsd/netbsd/etc users dual-boot or have another system running just for that purpose. it's good to have the desktop running the same OS you're developing for, or admin'ing. everything else is in place, mplayer, vlc, java, openoffice, all that jazz, all run the same as they do on other platforms, it's pretty much flash that's the killer now, the only bit of client side technology lacking. of course silverlight may add to the misery. if the BSD's are 1%, (that's probably a generous guesstimate) then maybe they'd approach 2% with flashplayer. surely, approaching 100% market penetration is something worth expending the effort over ? PC-BSD is looking quite attractive as a desktop, and 1-2% is a hell of a lot of users, no ? I can't see how it would be a huge effort to port to say freebsd, as pretty much all the opensource multimedia apps build and run without any drama, mplayer and vlc are monsters. same compiler, same complete toolchain pretty much. also, as mac OSX userland is pretty much FreeBSD, it's an environment that may seem oddly familiar to a porting team. as you mentioned linux "as a whole" it's probably worth saying that there's no such fracturing and forking of the userbase, e.g. there's one freebsd, -stable and a -current (dev) branch. this uniformity is a big deal, it cuts down support dramatically. so, when you look at desktop browser fiigures, I guess ultra-minority is pretty fair. however, given a little nurturing that would surely increase. anyway, guess I'm really asking, why not ? it's worth much kudos , good PR, and brownie-points to adobe if nothing else. -paul Posted by: paul at July 7, 2007 10:34 AM ----- Posted to Chocolate confirmation: why's there no flashplayer for the free BSD's ? some of their code is in it, do the right thing, not the absolute minimum the licence dictates! Posted by: paul at July 5, 2007 11:43 AM ----- Posted to Nokia N800 tablet, Adobe Flash Player: why's there no flashplayer for the free BSD's ? some of their code is in it, do the right thing, not the absolute minimum the licence dictates! Posted by: paulh at July 6, 2007 10:11 AM ----- Posted to Happy Bday, Player 9: one year since 9 release and still no hint of a port to the OS's you're effectively locking out of the www. (despite the petitions and begging messages) [jd sez: Hi, I'm not sure why you feel the need to speak anonymously. If you're asking "Is there any guidance for porting to 64-bit architectures?" then here is a good starting point.] according to your eulas there's openbsd and lots of other genuinely free (non-viral) code in flashplayer 9, so why haven't you "done the right thing" and ported the thing to the platforms that gift you this code ? freebsd, dragonflybsd, netbsd, openbsd etc. it really should be pretty trivial given past experience, if you need help I'm sure it would be forthcoming immediately. [jd sez: Standardizing high-level rich-media support across operating systems which currently lack even low-level standardized support is usually non-trivial.] nobody is asking for support, just a binary, this worked well for netscape and was much appreciated. really does seem that all this talk of supporting opensource by adobe is just that, talk. only the commercial and market-viable platforms are catered for, nobody else matters, right ? if anybody does condescend to reply to this, don't bother telling me "we have no plans now but that may change" or "the linux binary runs". the former seems to be flannel and the latter is untrue. a year's long enough to let your intentions be known, you've pissed everybody right off. (even leaving acroread and flash 7 out of the equation) if this sounds bitter then you're just getting a hint of the vitriol taste you've left in my mouth because of this. at least you know where you stand with microsoft. - Posted by: bitter&twisted at July 2, 2007 08:47 AM didn't realise I hadn't filled in a name, however although I am by no means a spokesman for any of these projects, you can take it as read that I was summing up the feelings I have and those I've heard expressed by others. if you doubt this then you could always ask on irc, examine the petitions, actually ask people. I didn't mention 64bit port at all, the 32bit x86 machines running these OS have no player either. SDL, OSS, the various X dri and fb schemes all seem to work nicely cross platform. (even svgalib where applicable oddly enough) vlc, mplayer, firefox, *etc*, hugely complex apps with a lot of dependencies don't appear to have huge problems supporting multiple *nix platforms, so what's the specific problem flashplayer has ? I'd be surprised if it's anything that can't be overcome, these other apps manage it without much in the way of drama. your response was made to sound like there's a lot of work involved. I have no idea what your build infrastructure is like, and it may well be the case that it's a lot of effort to kickstart something like this. however.. as to any difficulties porting the code, you'll never know until you actually try. Posted by: paul at July 2, 2007 12:35 PM no response. fine. just remember that every time you slap yourself on the back over this, you're also slapping some of us in the face. Posted by: paul at July 3, 2007 07:24 PM ----- Posted by JohnDowdell at 12:46 PM | Comments (7) | TrackBack June 22, 2007 iPhone features iPhone features: Looks like The Onion has a startling exclusive yet again.... ;-) Posted by JohnDowdell at 03:23 PM | Comments (0) | TrackBack 07:08 AM | Comments (5) | TrackBack June 06, 2007 Specific solutions vs general solutions Specific solutions vs general solutions: Yesterday Steve Cutter covered a debate about JavaScript libraries in ColdFusion being larger than needed for a specific use... today Dare Obasanjo suggests that Google Gears may be useless because there isn't an out-of-the-box data synchronization feature. I think both discussions may miss that it's cheaper to build a solution for a specific problem, than it is to build a general solution which can be applied to an entire class of similar problems. It's easier to hack a particular solution than it is to architect a general solution. And once a general solution architecture is available, there's always the question of it being better to use the general solution (with benefits in development time, testing, and maintainence), or bang out a one-time solution for the particular problem at hand (with benefits in codesize and customization). I think it's okay that the current Google Gears doesn't try for a universal solution to data synch -- as their architecture docs show, there's great variance in current applications even without the problem of synchronization, and today even a particular synch solution would be tricky, much less an early attempt at a general solution. Summary: It's easy to build a fishing pole from a stick, a string and a pin, but that doesn't mean that modern fishing-pole factories are bloated or useless... agree, disagree, other...? Posted by JohnDowdell at 07:26 AM | Comments (0) | TrackBack June 02, 2007 Webware 100 Webware 100: I don't usually feel comfortable pointing to online polls, because of the way ballot-stuffing often works online, but in this case CNET's bodytext says "Are you a finalist in the Webware 100? Download a 'vote for me' button to put on your site!", so I guess they're encouraging fan votes. And anyway, I learned of it through a Microsoft staff posting.... ;-) I'm not sure if "Adobe Flash" here means the Player, the visual authoring tool, or the entirely platform -- it's lumped in with Drupal, WordPress, and Silverlight -- but I voted for "Adobe Flash" anyway, and for a few other favorite tools on other pages. Your call. Posted by JohnDowdell at 09:46 AM | Comments (0) | TrackBack May 31, 2007 At least capitalize the F? At least capitalize the F? I don't understand non-interactive weblogs, which lock out comments even when not highly-trafficked... here, a Microsoft staffer takes the time to tell the world: "I always felt that multimedia apps (like flash) were too lightweight, too scripty and not robust enough for serious data centric development. Well, with Silverlight that's all changing." It's like he's walking around with toilet paper stuck to his shoe or something, how can other people politely help...? Posted by JohnDowdell at 09:28 AM | Comments (10) | TrackBack May 21, 2007 Sequential art Sequential art: Two links here... the first one goes to "The Mystery of Picasso", a 1956 film that I hadn't seen until last night... Picasso paints on a back-filmed canvas, so all you see is the painting gradually appear. At first this was great, because I could see how he blocked out the painting in his mind, could see it step by step instead of a final finished flat thing. But in some of these paintings Picasso started seeing the filming as performance, changing the art as he went along, making a little story out of it. MetaFilter had more discussion and some video clips of it. The other link is to news that Frank Miller will be writing and directing "The Spirit". Will Eisner's Comics and Sequential Art was one of the first to seriously examine the craft of drawing in time, and Miller's Daredevil and Dark Knight work innovated in sheer emotional impact. Unfolding flat paintings into time-based experiences, and a connection between two of the innovators in sequential storytelling... now all we need is Picasso holed up in a hidden crypt in Wildwood Cemetery and the cycle would be complete.... Posted by JohnDowdell at 05:47 PM | Comments (1) | TrackBack Cutty Sark, London to Shanghai Cutty Sark, London to Shanghai: Off-topic, but shows how far we've come... historic sailing vessel Cutty Sark caught on fire yesterday... this part in the BBC's report struck me: ." And the Cutty Sark had no WiFi either, so you could imagine how much email you'd have to catch up on after the 100-day voyage, were you one of the wealthy few who could afford to travel back then.... Posted by JohnDowdell at 09:53 AM | Comments (1) | TrackBack 01:55 PM | Comments (2) | TrackBack 07:33 AM | Comments (22) | TrackBack Old apps, new OS Old apps, new OS: Minor story-correction here... a nameless writer at PC Advisor starts out: "Adobe recently announced that it wouldn't release Vista-compatible updates to current versions of many of its products." Adobe Creative Suite 3 is the current version, and it was specifically designed and tested against Windows changes introduced in Microsoft Vista. Some of the older Adobe/Macromedia applications aren't significantly affected by Vista changes; others have already received updaters to address small changes in functionality under the new OS. But not all existing applications will run under the recent OS, as Microsoft's pre-purchase information should reveal. (Adobe has also brought together the info about Microsoft's release, in the PDF Vista FAQ.) I'm not sure whether CS3 has yet surpassed the Vista installed base, so the author might just as usefully have wondered whether the slow Vista adoption was in part due to its changes upon the functionality of existing software purchases. (Ya'll know all this stuff already... I just came upon the incorrect pro tech punditry in a news search, and felt the obligation to repeat the basics of how "new software supports old".) Posted by JohnDowdell at 07:19 AM | Comments (0) | TrackBack April 20, 2007 WinXP vs Vista WinXP vs Vista: Dell Computer stopped selling Microsoft Windows XP as an operating system when Vista arrived in January, but added it back this week in response to strong customer demand. Nothing in Dell press releases yet, but BBC has context, and Techmeme has commentary. I don't remember such a thing happening before. Posted by JohnDowdell at 05:20 PM | Comments (0) | TrackBack April 17, 2007 WMP in FF/Vis WMP in FF/Vis: Many commercial websites use Microsoft Windows Media Player, to ensure that their copy is not ripped off for ad revenue by others. If you're in a recent Microsoft OS, but prefer not to use Microsoft's browser, then WMP has again been packaged into Netscape Plugin format, so that such protected video can be viewed in the Mozilla Firefox browser. Posted by JohnDowdell at 09:59 AM | Comments (0) | TrackBack April 15, 2007 NAB news NAB news: There's a whole bunch of announcements coming out of the big Las Vegas video show right now. Some of these are for near-term deliverables; others are statement-of-intent to be delivered later. I don't have additional info beyond what's in the public record. But if you're awake and are reading now, then there's a lot of stuff going on.... Posted by JohnDowdell at 09:08 PM | Comments (12) | TrackBack April 12, 2007 The 7 Flash Experts The 7 Flash Experts: Tom Foremski profiles MixerCast, and includes this arresting line: "Ms Cooper is keen to point out that MixerCast has two of the top experts in Adobe Flash -- out of only seven worldwide." Now I've got all these Kurosawa parallels running around in my head... who's the Toshiro Mifune of SWF work, who's the archer Seiji Miyaguchi, the soulful Takashi Shimura and the rest? Or maybe I should be thinking of Steve McQueen metaphors instead...? ;-) Posted by JohnDowdell at 10:19 AM | Comments (14) | TrackBack Windows Update amenity Windows Update amenity: Ever do a Windows Update process through Internet Explorer, and then have the "Reboot Later" dialog keep popping up every few minutes? This article contains the path to resetting the timeout period. [via Dan Wilson and Jim Priest] Posted by JohnDowdell at 09:29 AM | Comments (0) | TrackBack April 07, 2007 FOSS CS3 FOSS CS3: Caught this while net-trawling... Shahid Shah compiles a list of various free-of-cost tools for media editing, categorized along the functional roles played by Photoshop, Dreamweaver, etc. Some include source code, some have an open coding community, but all can be used without cash. Posted by JohnDowdell at 05:00 PM | Comments (2) | TrackBack Diggable Digg church sites... retro brick phones with extended battery life, larger antenna and speaker... Japan limits political videos, Thailand limits humor videos, but in 1747 the bagpipe ban was evaded by lower-tech means... opensource licenses have difficulties too... ten Photoshop masters, five annoying ads, twenty-one tech flops, and a whole bunch of effective logos... research into recognizing images and not recognizing people... Quicksilver tips for Macintosh... a cheatsheet to English punctuation for internet writers. (And yes, I'm stuck inside the house today, how'd you guess...? ;-) Posted by JohnDowdell at 12:06 PM | Comments (0) | TrackBack April 05, 2007 Understanding Flash Smack Understanding Flash Smack: Ever since Ryan Stewart pointed to the notes by Ben Galbraith of a presentation by two Microsoft staffers, I've been trying to understand the quotes "flash is evil", "we are going to win" and so on. This report by David Malouf may help... he describes attending a Microsoft bootcamp as a potential staffer, and sees a disconnect from the real world: "It seems that from querying people related to the product that MS is not completely familiar with all that is going on with Adobe as they still think of Flash as a gaming and animation environment and they think of PDF as a static environment. Both statements have not been true for quite some time 07:01 AM | Comments (7) | TrackBack March 30, 2007 "Spring ahead", redux "Spring ahead", redux: Watch the time this weekend... some devices and services may have been manually switched to the new US timezones three weeks ago, and could toggle over again this weekend if their timing routines weren't updated at the same time their time was. (Or something like that, you know what I'm trying to say.... ;-) Posted by JohnDowdell at 01:32 PM | Comments (0) | TrackBack March 08, 2007 PS development technique PS development technique: Russell Williams describes how Adobe Photoshop CS3 was constructed. A sample: "The change we made was going from a traditional waterfall method to an incremental development model. Before, we would specify features up front, work on features until a 'feature complete' date, and then (supposedly) revise the features based on alpha and beta testing and fix bugs... [Now] the goal is to always have the product in a state where we could say 'pencils down. You have x weeks to fix the remaining bugs and ship it'." Lots more, not about imaging, but about major application development. Interesting: the PS CS3 preview on Labs had several hundred thousand downloads, but only resulted in 25 new bugs. Update: Product Manager John Nack has additional information on how this development methodology affected the overall release cycle. Posted by JohnDowdell at 08:45 AM | Comments (0) | TrackBack March 01, 2007 My status My status: I've been out-of-office this week, nursing a strained quadriceps, and suspect I'll be off my feet through the weekend. If so, then I won't have access to internal email until Monday. That CNET story on "photoshop online in six months" has gotten picked up on Slashdot as well as Techmeme, but the more I read the original article the more I wonder about it... the Google angle in the lede does not seem suggested by the parts of the transcript we're allowed to read... I'm not sure how much is Bruce, how much is Martin. There's also a hit on "Adobe Remix" now, which I suspect is just the Googlebombing effect, but I don't have additional info on either of these discussions yet. I'll be on the web, although at limited effectiveness until next week. Posted by JohnDowdell at 05:46 AM | Comments (2) | TrackBack February 27, 2007 Sidelined Sidelined: I took a spill on a San Francisco hill yesterday -- got a strained left quadriceps and can't walk well. But I was looking forward to meeting a score of techbloggers visiting Adobe today for new tool presentations, early advisory-board projects, and reality checks on how well these new technologies will be understood by the blogosphere. Lots of people I've been reading for years, and today was the chance to see how they think, the people behind the words, away from the bustle of a large conference -- and my leg won't let me go. Bummer. Fortunately the presentations will be in the public record, and I'll start a separate item here linking to their live reporting from the event. I was really looking forward to the interactions, though. More notes in the extended entry here on San Francisco topography, recuperation and preventative techniques. The following has no direct tech content, but considering how much time most of us spend sitting these days, some of the notes may help in reducing downtime in the future. I usually walk from Cole Valley in the Haight-Ashbury, up over 17th & Clayton, then down to 7th & Townsend... just over three miles, takes less than an hour at a moderate pace, lets me listen to Chinese lessons, smoke a pipe, think through the day's work. There was a light rain yesterday, and coming down Roosevelt and approaching Corona Heights, at about a 10% grade, there's been a set of plywood boards over a Department of Public Works sidewalk-improvement the last few months. Yesterday it was wet and I stepped on a leaf on the plywood -- whoosh my legs flew out and my body came down, and my left knee was doubled under my body. It took a moment to catch my breath, and when I got up my left leg couldn't support any weight... if I locked the knee it was fine, no pain, but any bend in the left knee and it would just give way. The quadriceps are those big muscles across the front of the thigh. When my body slammed down atop the bent knee the muscles were stretched beyond their usual range, at great speed and with pressure. The muscles are still attached to the bone, but they're damaged, and will take some time to repair. Cabbies take Roosevelt, and I managed to flag one down and get over to the office. I was able to get an icepack and some compression, but there were no crutches or canes to take the load off the injured leg. After two hours I just chalked it up and went home, where I could keep the leg elevated. The first-aid treatment for such injuries is called RICE, for Rest, Ice, Compression and Elevation. Ice and compression help slow the bio-activity levels in the injured area, reducing damage and pain. Ibuprofen helps. I've also been doing regular gentle stretching and massage... there's a risk that other parts of the body can get tight as they compensate for the injured area. But I was lucky, my body was loose -- I had my usual stretching and flexing while getting ready to leave the house, and I also had a good workout that morning too. My quadriceps were stretched beyond their usual range during the fall, but if I hadn't been investing time in increasing their flexibility and strength then the muscles might well have sheared from the bone, requiring surgery to repair. A fall like that, anyone could take. The only thing we can change is how well we're prepared for it. Technology professionals are particularly at risk, because we sit so much, use just a small range of postures. I think we've got to put extra attention into maintaining flexibility, and maintaining enough strength to resist injury. Making such investments cheap enough to be sustainable, that's the tricky part. o Hand-weights were a revelation for me... strap them on while doing housework and you're strengthening the abdomen and back, not just the arms... even an extra two pounds per hand during daily chores gives perceptible results, at almost no extra cost. o Doorframes can be a great stretching tool, whether hanging by the upper molding, or twisting laterally within them, or hanging forward or back to stretch leg and back muscles. Even ten seconds helps. o Time spent brushing teeth can easily be double-purposed for stretching and flexing, going into a catcher's squat. o Why bend when you can squat? It took some conscious effort for me to change habits, but once you decide you're no longer going to bend over to pick something up, it's an easy change to make. o A weird little New Years Resolution for me is working out well... putting on my socks standing up. No sitting, no leaning against a wall... just focusing on balance while putting on socks. Sounds silly, but I've noticed an improvement in my overall balance since doing so. I was lucky, with the fall I took -- no back strain, no ligament or bone damage -- just a hyperextended leg muscle to deal with. But slips and falls cause 10% of all injuries, 15% of all accidental deaths -- and those of us who work at computers are more vulnerable than people with more active daily lives. Finding ways to build protection within daily routines seems like a very important thing to do. Posted by JohnDowdell at 08:21 AM | Comments (8) | TrackBack February 15, 2007 Gartenberg at Microsoft Gartenberg at Microsoft: Microsoft hires an industry analyst as "Enthusiast Evangelist". It's good that he believes in what he does: ." Me, I think that we'll find a variety of technologies which work together to bring about such a future... Microsoft remains an immense power, but the entirety is more than any one player. (I'm not keen on the martial metaphors either, for similar reason.) Posted by JohnDowdell at 09:11 PM | Comments (3) | TrackBack February 04, 2007 January picks January picks: Important Adobe releases this past month... Flex 2.01 signifies more than a .01 might suggest... PDF 1.7 and beyond will be determined by International Organization for Standardization (ISO)... Adobe Flash Player 9 for Linux is released (and here's my obligatory 64-bit link ;-) There was also continuing guidance on new projects, and hints on things beyond that. Microsoft launches its new operating system, and compatibility questions can now be addressed, while Microsoft itself is likely to start reprioritizing for its next phase. Worrisome stat: Vint Cerf estimates that one computer in five today is under remote control, as part of a zombie botnet... when the network itself is compromised, what happens to Web 2.0? Posted by JohnDowdell at 10:11 PM | Comments (0) | TrackBack January 08, 2007 Printing metal Printing metal: Off-topic, but I haven't been able to get these out of my mind since seeing the link at Cool Tools last week. Bathsheba Grossman draws sculpture and mathematical models in CAD software, then uses a metallic deposition printer with laser binding before the final baking and a bath in molten bronze. It looks like they'd be fun to hold, but they're very compelling to just look at too.... Posted by JohnDowdell at 03:23 PM | Comments (0) | TrackBack December 17, 2006 Binary ISO-Latin 1 in desuetude Binary ISO-Latin 1 in desuetude: US Federal Communications Commision drops Morse Code from its testing requirements. Jeff Pulver has perspective. There was a time when we didn't have even 8-bits to handle simple English text -- only the ability to turn a signal on or off. Now we have YouTube. Progress, true, but.... Posted by JohnDowdell at 06:06 PM | Comments (0) | TrackBack 08:16 PM | Comments (3) | TrackBack Me on Digg Me on Digg: No news here... just some policy background I'd like to get into the public record. I've read Digg for awhile, but refrained from joining because identity is not assured, and the service is vulnerable to gaming... I don't want Adobe to be accused of astroturfing Digg. But last week I finally did join, under my own name and address, with the intent of doing regular outbound-support work in comments. I do not plan on introducing articles to Digg, or voting articles up or down... my plan is to only do support work in comments. Let me know if you see any problems or risks with this plan, thanks. Posted by JohnDowdell at 03:11 PM | Comments (1) | TrackBack December 03, 2006 November picks November picks: I'm looking back over the last month of entries on this weblog, pulling out some them seem to have long-term significance. The Tamarin donation may have been the biggest thing, showing how high-performance, platform-neutral logic-processing will soon be available to JavaScript developers as well as ActionScript developers, changing the dynamics of application delivery. This is part of a number of Adobe initiatives with opensource and platform-neutral work, and people are starting to see how this new company may evolve. Flash Video won an Emmy, even as it adds immersive viewing, very rapid audience adoption, and people show where the new interactive video might grow further. Search engines evolve towards author-controlled hinting, and Flex components add spatial navigation of datsets, while the Apollo project is firming up in its details. Meanwhile, Adobe document technology becomes more essential to more vertical markets, and Adobe imaging is working on even stronger basic science. One thing we've still got to do, though, is reach outside our traditional base to the wider tech audience. There's much work yet to be done, but this past month we've seen a wider outline of near-term improvements. Posted by JohnDowdell at 07:53 PM | Comments (1) | TrackBack November 30, 2006 Lots of links Lots of links: Science toys, mobile web video, spammers suing citizens... some little links here, which stayed in my browser over the past few days. American Science Surplus has lots of cheap nerdy gift ideas. Sample text: !" Like Archie McPhee, but in the Advanced Placement class. Here's a 5-minute YouTube intro to the new interface in Adobe Acrobat 8 Professional interface. Brian Fling writes "10 Things I Learned at Mobile 2.0", from an HTML/mobile perspective. This CNET article disturbs me... it's about someone who was spammed, and called out the spammer by name, and was then sued and was financially ruined by the spammer. The fault seems to lay in dysfunctional laws crafted by politicians. ".'" Jason Kottke notes how social dynamics change within a group over time... the Flickr folk nursed along the conversational group in its early days, until it took on a self-fulfilling strength. TechCrunch covered Stickis, a webpage annotation system which offers choice of RSS feeds for comments, so that you're not locked into a single universal pool of ocmmenters... feels like a good approach. Wunderground Trip Planner is a handy way to check historical weather records for a particular city during a particular time... look how it lays out Shanghai in early December, for instance. The YouTube publishing system is being used to increase the world's lockpicking skills... there's some commentary at TechMeme... I wouldn't feel right about banning content, but it doesn't feel right that YouTube allows its publishing to be used to hurt others either... strange story, I'm not sure what to think yet. There's a long discussion in Microsoft's Channel 9 forums about the ethics of Microsoft staff providing a tool to make it easy to take vector artwork out of a SWF. (More here.) I'm not able to translate licensing materials into English... that's outside my range... I do see that people have a variety of strong opinions on the subject, though. Ed Foster uses the new Vista activation system to publish reader comments about the Adobe License Manager, but I don't think all commenters read what ALM actually does... it's an administration tool which does let you know if your intranet is using fewer resources than purchased, for instance. I appreciate the nameless reader who took the time to detail his own personal experience with Adobe License Manager. Tim Walling thinks we should be seeing more action with URLKit, considering how often there's conversation about maintaining application state within an URL. Posted by JohnDowdell at 02:03 PM | Comments (0) | TrackBack November 22, 2006 Lots of links Lots of links: Offices in the US will be closed the next few days, but I've found a number of interesting sites this week, quick links in the extended entry. Mitchell from Mozilla talks about how the recent Firefox Summit focused a lot more on user experience, and not just the delights of implementing. Niall Kennedy reports on social gaming mechanisms: "I spent the last few days among webmasters at the PubCon conference, where most conversations were focused on marketing yourself online to humans and search engines. The 2000 attendees focused on ranking themselves as high as possible in search engine result pages and driving site traffic. Methods of achieving these goals cover a full spectrum of white hat to black." More comment via TechMeme. Alan Musselman pointed out WhatTheFont, where you upload an image of a typeface and the system tells you what its name is. Video scares are lurking: "'Old video files were just sets of frames you could view and create video applications [with]... Now you can insert all kinds of things into a video file: information about it, external links, etc. That presents more possibilities for exploitation... YouTube is a prime candidate for attack, as well as other multimedia sites. Arbor's Zielinski says all it would take is an attacker downloading a video from YouTube, injecting his exploit, and re-uploading it, and then anyone who viewed it would get infected. 'If there were 20,000 people viewing a popular video, they would get [infected].'" YouTube delivers their interactive SWF skin, and various non-interactive FLV files which YouTube transcoded from members' source files. There may be a situation where someone can upload their own FLV, but YouTube does not host strangers' SWF. John Gruber likes Kuler. Steve Rubel and Robert Scoble are still seeking ways to believe the net, instead of being skeptical of the net. (I've got comments in both, but neither responded to the questions.) Sean Tierney notes how many business processes are self-contradicting, when you actually try to follow their interfaces as advised. Mike Potter describes how the sourcecode used in Adobe Photoshop's slideshows has been released for public use. Robert Scoble has been collaborating in a series of Photoshop video interviews. Kristofer Strom produced an inspiring, four-minute long stop-motion animation with a whiteboard, drawing pens and eraser. [via Todd Dominey] Cameron Moll tests projects' validity by whether they can be functionally summarized in a single sentence. I like it. (oops, that's two... now, three... oh, well.... ;-) Scott Fulton of BetaNews debunked the wild headlines sparked by a seven-sentence Reuters parsing of an (unlinked!) article in a German newspaper which probably translated Chizen's remarks into German before the Reuters writer translated them back again. Scott went to actual source interview and found the news professionals were bogus: ." Another example of professional news services behaving unprofessionally: a photographer in the Mideast tells how Newsweek and TIME put patently false captions on his photos, in an attempt to extinguish Israel. Mike Heck from InfoWorld tests out the content protection mechanisms of Adobe LiveCycle Policy Server and concludes: "Offered as software or hosted service, Adobe's rights management ensures sensitive information isn't disclosed and provides detailed audits for regulatory compliance. Currently, it only protects a few file types. Nonetheless, usability and cross-platform support make this a sensible enterprise DRM solution." Roger Johansson summarizes the three types of ways that existing sites break when viewed in Microsoft Internet Explorer 7. The headline for this Fortune article seems to diverge from the bodytext which follows: "The race to create a 'smart' Google: Everything you buy online says a little bit about you. And if all those bits get put into one big trove of data about you and your tastes? Marketer's heaven." (The rest of the article focuses on recommendation systems, instead of the business opportunities of tracking aggregate audience choice.) I don't remember where I found this anti-telemarketer tactic, but listening to the audio of a real sales call was hilarious.... ;-) Posted by JohnDowdell at 03:23 PM | Comments (0) | TrackBack November 17, 2006 Lots of links Lots of links: When I have so many browser windows and tabs open it's time to harvest some... here are some links I've found this week that I found interesting, and you may too. Google Maps has historical overlays, and Middle Earth... no satellite imagery on the latter yet, though. Confabb is a meta-conference planner... goal sounds good: ." "Turing Test Proves 2-Year-Olds Not Human". Christina Wodtke rants on certitude, in a very useful and positive way: ." JavaScript frameworks: Easier to create than to use...? Jason Kottke urges "skip intro" for "podcast" and "vlogging"... Gabe Rivera urges the same consideration of reader costs for text. Good Flex validation... some are now trying to replicate this development style and user experience in clientside Java. (Whether or not they can reach it doesn't matter so much as Flex's success has now become the new benchmark.) Kurt Foss summarizes how to handle version-to-version changes between Adobe Acrobat Professional, Standard, 3D and Reader... because of connections to system printing mechanisms, it's better to uninstall old stuff *before*, rather than after, doing a new installation. Kurt also points to a five-minute video intro of the new interface. Microsoft efficiency tips for JavaScript, in IE7 and other environments... lots of this material revolves around clientside interpretation and untyped variables. Yahoo Maps goes beyond beta, and has secured the rights to mapping data for much of Europe, as well. Yahoo Maps may be the most widely-used Flex 1.5 app at this point. Java comments: GPL is counter to freedom... a very foul mouth but a wicked sense of humor at Bileblog... URL parameters for the Google FLV controller... there are a couple of different player skins available, you can set autoplay and loop from the linking URL, etc. FlashForward track at MacWorld Expo this January. Microsoft WPF/e makes a reappearance from its apparent slumber, as lead Joe Steggman says "is not 'me too'!" Stefan Richter had asked "What does WPF/e give me that I don't already have in Flash?" and Joe points out that Microsoft needs a complement to its "works best in windows" theme, so a new plugin addresses different needs. (It looks like Sparkle got a refresh and another name (don't bother to thank me ;-) , and that they'll make announcements after Thanksgiving, but before Christmas holidays kick in.) WIRED has an overview of how different restrictive governments are dealing with citizens' new abilities to communicate with the world. University of Michigan has an article summarizing health effects of chocolate, part of a series of articles they have on foods you may already enjoy. Posted by JohnDowdell at 01:53 PM | Comments (3) | TrackBack November 16, 2006 Chris Pirillo, Bob Dobbs Chris Pirillo, Bob Dobbs: Off-topic, but when I first saw Chris Pirillo's little cartoon portrait I had thought it was homage to Bob Dobbs... but now it looks like Chris was a pink boy here, and has not yet understood about pulling the wool over his own eyes. Wikipedia has a good overview. Is this set of websites new to you too...? Posted by JohnDowdell at 02:27 PM | Comments (0) | TrackBack November 02, 2006 October picks October picks: I went through the last month's posts here, and picked out some which seem to have longterm significance. SAP, Salesforce and Oracle come out for Flex, even though we're still early in adoption ramp-up... Adobe Flash Player adds browserless viewing and goes 9.0 on Linux, although the latter seem more aware of watching video than making apps... Adobe Digital Editions shows PDF ebooks in a 2.5M download with better reading experience, while Adobe Reader now renders XML documents... Tom Green's article "The Rise of Flash Video" drew significant attention (see part 2)... Adobe is adding new expertise for the new workflows under development... Christina Wodtke writes of how true design work satisfies audience & client needs, and isn't just extravagant self-expression... Two new browsers during peak buying season is a still-unfolding story... Google acknowledges the usefulness of richer media over text, even as it seems to be moving towards correcting your writing... Charlie Arehart is putting together a portal of Adobe-related technical videos, similar to how others are developing linksites of recommended topical videos... Lots and lots and lots and lots of stats about browser adoption and audience size, while the AS3 VM in Adobe Flash Player 9 surpasses them all in improving Other Peoples Machines... Even though Apollo drew the biggest crowds at MAX, the long-awaited availability of Flash Lite in North America will rival it for improving the world's computing experience: one of the desktop, the other in the pocket. (My top MAX thoughts are here, although I'd like to update it this weekend after digesting the changes.) Posted by JohnDowdell at 10:44 AM | Comments (0) | TrackBack November 01, 2006 You & hardware migration You & hardware migration: Last week's preview of Adobe Soundbooth drew a lot of positive attention... see Hart Shafer for links. But, as a new project which likely won't reach 1.0 until mid-2007, and whose functions require much processor-specific code, the current builds are for Windows XP and Intel-based Macs, not older Macs. This created a lot of blogosphere heat. I think this may be because Soundbooth is one of the first Intel-only Mac apps, and so it's triggering people to analyze their system plans, when they'll update what, and so on. There's a good amount of angst in that. But here's what I'm hoping you can help me with... I'd like to understand how you regard your own system update plans, whether for Vista, or MacTel, or whatever. I want to make sure various Adobe teams have the best grounding possible when they bring forth both updates and entirely new projects in the future, so anecdotes about how you go about decision-making can be of great help. For instance, my cube-mate Scott Fegette and I were both shopping new notebooks late last year... I went with a Motorola-based Powerbook, while he went straight for Intel... I think he's having more fun with his machine, but I just wanted less hassle with applications, fewer system updates. How do you balance the situation of moving to new hardware? Personal anecdotes appreciated, thanks. (Disclaimer: This is about you, not Adobe or what the company "should" do, so I'll edit or delete comments which talk about Adobe instead of your own priorities, your own decisionmaking style.) Thanks! Update: On Fri Nov 2 I see that my post here is linked at TechMeme to a post from John Gruber (Daring Fireball). I don't know why, but in case you're coming here from TechMeme, then I've given John's essay a few tries but haven't made it through yet, and can't even restate his case succinctly, much less comment on it. Here I'm focused on how you approach architecture migrations, so we can see the range of different situations, and the strategies different people use. Update II: I've opened a new topic here for discussion of Friday's Daring Fireball essay. Posted by JohnDowdell at 12:44 PM | Comments (6) | TrackBack 02:52 PM | Comments (2) | TrackBack Soundbooth painpoints Soundbooth painpoints: I hate blog commenting systems which don't tell you upfront that they'll send a confirmation email to you... third time this weekend that I had a comment go up in smoke. (Jason Calcanis had a notorious "podcast" which I asked him to textually summarize.... some other thing on the Weblogs Inc network too.) Here at "DV Guru" Ajit Anthony ranted today on what Adobe "should" do, and I tried to find out what really mattered to him, not what he thought everyone else's marching orders should be. (I was more polite a few minutes ago than I am now.) Anyway, Ajit, if you happen to be engaged enough in the blogosphere to catch my response here, below in the extended entry was my earlier attempt at finding out more of what you need.... Hi, could you give me a little more insight into the most painful part for you? Not "what others should do", but more "what makes this matter to me". Which is it closest to? (a) "I can see my old computer's value diminishing now." (b) "I need to use Soundbooth today and cannot." (c) "I'm concerned that this means I won't be able to upgrade to the next Photoshop." (d) "I work on multiple Macs, of differing architecture, and see future difficulty in coordinating my work among them. (e) Something else.... Could you give me an idea about what gives *you* the most personal concern here, please? Thanks! jd/adobe Posted by JohnDowdell at 07:00 AM | Comments (4) | TrackBack October 29, 2006 Microsoft Firefox 2007 Microsoft Firefox 2007: It's a joke site, but cute. Features "Microsoft's AKobe Phlash(TM) Plugin (lawsuit pending)". [via Steve Bass] Posted by JohnDowdell at 10:47 AM | Comments (4) | TrackBack Don't think of a white bear Don't think of a white bear: Off-topic, but I still don't quite get this angle of the media biz. This link goes to UK newspaper Daily Mail, about cartoon series South Park's poor taste in using the recently-deceased star of "Crocodile Hunter" as a character -- the family is grieving, experts provide concerned quotes, and so on. And then the newspaper shows a big JPG of Steve Irwin with a stingray stuck in his bleeding chest. I mean, if the story's basis is that Parker&Stone had Bad Thoughts, isn't the newspaper spreading them further? If the goal is to be sensitive to others and not inflame their sensibilities, then why would the newspaper itself try to push such an image into people's heads? The Mail's readers comment that South Park should be cancelled, but none of them question the newspaper drawing ad revenue and sustained readership from its programming of offensive content. Can you explain to me how the audience doesn't see what's being done to them...? Posted by JohnDowdell at 07:39 AM | Comments (3) | TrackBack October 28, 2006 Travel tips Travel tips: I heard a lot of people talking about the need for Chapstick this week, and many told me during parties "Ah, I wish I brought earplugs like you did". In the extended entry are some of the techniques which have improved my travel lately... if you can add to these tips in comments then we'll have a better resource, thanks. Chapstick is just a little tube of petroleum jelly, but it comes in handy in many ways. Prevents dried lips in desert air of course, but it also protects the nostrils when it's cold or windy. It keeps a papercut or hangnail protected from bacteria, and comes in handy for blisters or chafing. A pair of foam earplugs in a plastic minibag squishes to nothing in your pocket, yet can cut decibel levels by 29 to 36db. More people suffer from hearing loss than secondhand smoke, yet ambient volume levels can still be ridiculously stupid. Don't let the morons hurt you -- carry earplugs, control your own environment. Colds and flu have increased with worldwide travel. The Adobe Mobile team travels a lot, and I heard many testimonials to the PAZ approach: - Purell or other hand sanitizers to clean hands, disinfect airplane surfaces, refresh the back of the neck, ears, and face; - Airborne or Vitamin C to increase resistance before entering crowded areas; - Zinc, either dietary or aerosol, at the first sign of nose or throat tickles... a pocket Zircam mister is $13 but dramatically reduces frequency & duration of colds. Speaking of drugs: - Caffeine tablets are widely available, dosed at one tablet equivalent to "two cups of coffee" (whatever that means), and help avoid the scheduling problems of bad in-room coffee, help provide that extra burst when you need it. - When travel gets tough, a bar of good chocolate can do wonders... there's always one in my computer bag now. - I used to carry 6-8 aspirin in a pocket plastic minibag, but now I also just take a 50-tab jar in the travel kit... somebody else always needs aspirin. ;-) - A two-ounce flask of Jameson's Irish Whiskey in the suitcase handles all other emergencies, and is particularly useful if I'm too wound up to sleep. Socks... I could use some tips on socks. Sometimes I travel with lots of cotton socks, other times I use two washable synthetic liners and two thicker wool outers... excuse me for getting personal, but when you'll be gone for four days or two weeks, how do you plan out your socks...? Even more personal, I've got enough to carry, and don't want to haul around yesterday's lunch with me. I've been eating a lot lighter recently, particularly on the first few days of a trip, and a light laxative the first few days helps reduce bloating from travel nerves. Staying a little hungry at the start of a trip has made a big difference in my energy levels and ability to move around. A pair of packable shoes sounds like an indulgence, but even if they're only worn once they give the main shoes a chance to breathe, and make a big difference. My bags mostly contain other bags these days... my suitcase and computer bag had over two dozen Eagle Creek quartercubes, Outdoor Research stuffsacks, Clic zip envelopes and Ziploc sandwich bags within them. On longer trips the suitcase holds a daybag which holds other bags. I check luggage for the flight, because I won't travel without my pocket tools. It's also helpful for tech conferences, where everybody flies out at the same time and they're always trying to stuff their computers and suitcases into the overhead bins. I used to skimp on sleepwear, but room thermostats sometimes don't work, and frequently have wonky interfaces... it sounds silly, but polypropylene longjohns and a pair of soft wool socks let me control my own environment, and make a big difference in how I feel the next day. I still bring a book, but somehow never read it.... ;-) You have travel tips? What has surprised you lately, with how well it has worked out for you...? Posted by JohnDowdell at 07:17 AM | Comments (9) | TrackBack October 24, 2006 Best error message Best error message: I used to answer the tech support phones for many years, and just thinking of trying to handle a call on a string like this makes me feel very uneasy: "Error Message: Your Password Must Be at Least 18770 Characters and Cannot Repeat Any of Your Previous 30689 Passwords." I mean, where could you start with something like this...!? [via Victor Mitnick on the Dreamweaver team, who doesn't seem to have much of a Google footprint, but who I bet could write a fun weblog.... ;-) ] (btw, I just got over a temporary connectivity disruption, and am behind on my reading, but this item in internal email was too much fun to not share.) Posted by JohnDowdell at 01:59 PM | Comments (0) | TrackBack October 20, 2006 Lots of links Lots of links: It's been a wild week, and I'm behind in reading and writing... here's a bunch of stuff which caught my eye the last few days.... Virtual communities are being investigated for contributing to The Tax Effort.... Washington Post describes how mobile phones are improving the situation for fishers in India. Mobile phone in India grew from 1.6 million in 2000 to 125 million today, outnumbering landline phones 3:1. (If the Washington Post link rots, try a news search with term "pallipuram 'kevin sullivan'".) Yahoo User Interface course, in video format... I haven't had time to sit through realtime speech, and so can't evaluate it yet. (The video UI has worked for me sometimes, not other times... may be a Flashblock timing issue.) Bruce Schneir understands that distributed access to technology means that everybody gets to play Big Brother, it isn't limited to the central authorities... what he misses is that much of the intentional damage today is being done by unsourced leaks... "How do you know what you say you know?" is the vital question we're not consistently asking yet. Laws may help, but don't have a good history... self-protection practices and skepticism help more than paternalism. San Francisco's wifi deal got tangled up in San Francisco obstructionist politics: ." John Gilmore has a comment there noting that Google could track people's locations by their telephone pole repeaters, which is true, but if John doesn't wish to use the service then he shouldn't prevent others from doing so. San Francisco's moral elite can be pretty paternalistic. (Then again, later on in the comments, my friend Sasha Magee says that some of the reporting was inaccurate... me, I'm still not sure why The City "owns" telephone poles in the first place, and why this has to be a centrlized political discussion.) More on technology, governments, and individual choices... China apparently will be imposing penalties on those found spreading "internet rumors"... France has already brought legal proceedings against a website which "insulted" state TV with inconvenient questions... European Union is considering content regulations on videoblogs... a Candian Member of Parliament was kicked out of his party for things he wrote on his weblog. Mike Potter has a tip if your IE7 foobars your debugger Player. I really liked the Claude Monet animation here... looks like the brushstrokes were also used to deform the geometry, but there's so much non-photorealistic stuff going on that it's just a wonder to behold. There are also links for DaVinci animations and more open in my browser right now... I think I got them from a Digg conversation. Brendan Eich writes: ." Niall Kennedy compares "the current state of video search". Marshall Kirkpatrick of TechCrunch summarizes things to watch for in the Firefox 2.0 release. Vista's graphics will apparently impose too much of a battery drain for many current notebooks. Two articles which concern me more when they're combined: software piracy in the Philippines, and the evolution of zombie networks. Brian Ferris made an Emmy speech on being aggregated into MXNA. Bert Monroy talks about creating photorealistic Photoshop work, in downloadable audio format. Michael Arrington cites history in trusting all your data to Google. Posted by JohnDowdell at 02:43 PM | Comments (0) | TrackBack October 18, 2006 Technophile felines Technophile felines: One more thing I wouldn't have expected from new technology... there's a subculture on YouTube of cats on exercise treadmills. Oddly fascinating, because the cats show confusion at why they're not walking anywhere, but they don't give up, they keep on walking. We humans do better with new options... well, maybe not all of us, but we generally adapt a little more quickly than those cats do.... ;-) Posted by JohnDowdell at 03:44 PM | Comments (0) | TrackBack 03:49 PM | Comments (1) | TrackBack 04:10 PM | Comments (5) | TrackBack October 09, 2006 Lots of links Lots of links: It's Monday, but my browser still has lots of interesting material from last week... short links here, on a variety of subjects. Steve Webster notes that some Firefox don't transfer requests from Adobe Flash Player to text-to-speech assistive technology (JAWS, eg), when the Player does not render directly to screen (WMODE parameter). Related: Andrew Kirkpatrick on how various browsers affect accessibility with different markup styles (Aug 05), and Geoff Stearns amassed lengthy comments on other squirrelly behavior from browsers (March 05). You can pipe the messages from the debug version of Adobe Flash Player into a Firefox panel with this FlashTracer extension for Firefox. Most weeks the newspapers carry stories about "iPod DRM" -- New York Times has one today -- when recorded music first became popular phonographs and records were sold by furniture companies, oddly enough -- this was even after the recording industry finally converged on a format. Radio sparked massive evolution too, as forgotton stories of the Petrillo ban attest. Another interesting look at the actual history of the music business comes from studying Ralph Peer. Speaking of which, Mike Masnick has some thoughts on Tower Records being liquidated. I moved to San Francisco in 1976, and Tower Records was very impressive then. But later, at Amoeba Records, I bought some Japanese DVDs which were incomplete Chinese knockoffs. Tricky stuff, that music business.... ;-) One more music link: 100 popular classical ringtones... if you play, then the Hal-Leonard Real Little Classical Fakebook gives melody and harmonization. Gregg Wygonik has a new version of his Flash component to produce PDF files. Adrian Cummings is describing how Adobe Flash Lite looks to a J2ME developer, at Mobile Games Blog. For MacTel ports, some folks still haven't heard what Adobe execs have been advising for over a year. Next-generation androids functioning as booth babes in Japan... spooky video on this one. Looks like major media companies are accepting the flow of their low-res content to sites like YouTube. I don't know how I got to this page, but it's a good collection of classic putdowns... Mark Twain is quoted as "Why do you sit there looking like an envelope without any address on it?" (Maybe it was the way he told it.... ;-) Nice interview with Robert Scoble here, about how his role interacted with Microsoft, but it's still strange that the pre-weblog, pre-ClueTrain conversations are off-the-radar for these folks. New paperlike screens are increasing in area, decreasing in thickness, increasing in colors, but latency is still a problem. Near as I can tell from reading 'way too much, this Attention Computing stuff might be about working while standing, "ten-HUT!" kind of stuff, I'm not sure what else they might be talking about here.... :( Lots of bad news in the world today... children assaulted for not being of the correct tribe in Glasgow and Lyons... women accused of adultery still being stoned to death... Internet cafes attacked for indecency, journalists murdered, and very odd people with nuclear tests. Sometimes it seems like the work we do doesn't make enough of a difference in stopping the sick and counterproductive things, but twenty years ago we wouldn't even have known of some of the bad things going on in the world.... Posted by JohnDowdell at 02:03 PM | Comments (1) | TrackBack: "Tech folks often use terms that imply we're part of some secret club. It's as if we're saying, 'We can speak in a code that those other people can't understand.' It's a way to build a wall that separates us from them. It's a form of exclusion. You don't need to build walls or exclude people when you're confident in your message though. When you're confident in your message, you want everyone to understand. 10:11 AM | Comments (4) | TrackBack September Picks September Picks: I went through the last month's posts here, and picked out some which seem to have longterm significance. Adobe Flash Player 9 and its new high-performance virtual machine are being installed by consumers at record rates... Macromedia Breeze becomes Adobe Acrobat Connect, combining Acrobat's archivable collaboration with realtime communication... Gapminder combines great data with great interactive control; it's a really inspiring way to understand global trends... the Web itself is becoming more and more a global medium, and within five years I think we'll have a very different understanding of the implications... the Silicon Valley blogosphere still regularly has its attention directed by social pressure... browser reach and predictability are still open issues, even as we're starting to evolve beyond... not only developers and designers, but also consumers and enterprise are pulling the Adobe technology infrastructure along. Posted by JohnDowdell at 06:26 AM | Comments (0) | TrackBack September 28, 2006 Google Maps bug Google Maps bug: Looks big. Apparently caused by some maintainence problems during publishing. Thanks to Slashdot for the tip. Shades of Grace Hopper! Posted by JohnDowdell at 05:09 PM | Comments (0) | TrackBack September 27, 2006 Infini-D mailing list Infini-D mailing list: No news here, I'm just logging this in the blog for easy retrieval later. Specular Infini-D, the Macintosh 3D authoring tool, still has a mailing list archive online. This list has root connections to the whole pre-blogging, pre-Cluetrain graphics conversation. Lots of that material has disappeared from the Web, some of it never made it to the Web. The technology conversations have gone on for longer than many people might think. (If you know of similar historical resources, please feel free to log them in comments here, thanks!) (And btw, I'm sure there must be some embarrassing material here.... ;-) Posted by JohnDowdell at 10:43 AM | Comments (1) | TrackBack September 24, 2006 Quick links Quick links: Lots of good stuff in the aggregators today... conference tips, surprising uses of bitmap manipulations, three or four more articles I particularly enjoyed reading today. Aral Balkan has a great list of what a modern audience needs from a conference presentation. Benjamin Doubler made a standalone which was "counter to YouTube's terms of service"... we're all still feeling our way towards using remote services within quickly-evolving interfaces. Tim O'Reilly republishes a great summary from Stewart Brand on Orville Schell's understanding of the dynamics in China today. Andrew Trice has an extensive collection of the different user needs which the pixel-manipulating abilities of Adobe Flash Player can now address (source code, presentations included). Esther Dyson also agrees that Google must shape up in making sure their AdSense revenue-sharing partners are legit. Los Angeles Times writers react to the recent Hewlett-Packard controversy by noting the greater dangers to individual privacy... we're all still trying to figure out ethical, sustainable ways of harnessing the new information deluge. Posted by JohnDowdell at 01:42 PM | Comments (0) | TrackBack 04:56 PM | Comments (3) | TrackBack 11:30 AM | Comments (1) | TrackBack September 14, 2006 Cagle on SVG Cagle on SVG: Kurt Cagle has 35 paragraphs here... I see ideas like "Canvas vs SVG in W3C", "CSS vs SVG", personality clashes in the various "standards" campaigns... not sure I can summarize his main point, but he has a lot of tidbits here. On the SVG mailing list there's lots of discussion about "Which renderer should we move to now?", but others think this is an opportunity to move away from a focus on engines, to a focus on the file format. At Macromedia we always focused on deploying capabilities to consumer machines... lots of the other plugin developers instead focused more on their implementation, not taking the extra step to deployment... much SVG evangelism seemed to focus on the format, which preceded any implementation, which then preceded any deployment... completely different focus. I still can't figure out why they ignore Claus Wahler's work here... if they actually want to render SVG instructions on client machines, then it's odd that these machine's actual current capabilities lie unused. Posted by JohnDowdell at 04:36 PM | Comments (2) | TrackBack 03:44 PM | Comments (5) | TrackBack September 09, 2006 Bodywaxing mobiles Bodywaxing mobiles: Want a sleek feel and appearance? Engadget says sugarcubes are abrasive enough to remove logos on phones, yet soft enough to leave the case's finish unaffected. Over to you, Scott Fegette.... Posted by JohnDowdell at 02:11 PM | Comments (0) | TrackBack Faster XP startup Faster XP startup: Great tips here, that I haven't come across before... a single registry setting can turn off prefetching older applications when the system is trying to start, for instance, and there are some network operations (finding old drives, printers) which can be toggled off to speed system starts too. (btw, I liked Ted Patrick's tip this week on minimizing Eclipse to regain Windows memory.) Update: Thanks to Jay Greer for a tip in the comments here. Ed Bott says the above info is wrong. I'm not sure he makes the best case though. As I read the original article, the goal was to stop prefetching apps installed long ago and no longer used, and Ed cites documentation that says app data is not loaded at system start anyway. At worst it seems the first tip would be neutral (with a slight negative at first app activation), rather than having a negative effect worth warning about, as the critique implies. A better rebuttal might be a stronger description of why operating systems slow with age, and effective app-removal & registry-cleansing techniques... the reason the meme spreads is because many want to speed their system starts. Posted by JohnDowdell at 02:02 PM | Comments (2) | TrackBack September 08, 2006 PD parks icons PD parks icons: US National Park Service provides icons and textures used in their wilderness maps for free public reuse. Artwork is vector, in Adobe Illustrator format. [via Peter Merholz, who also links to a good discussion on data visualization] Posted by JohnDowdell at 03:24 PM | Comments (1) | TrackBack Free iRiver Free iRiver: If you're going to MAX in Las Vegas, and have a weblog, then my Ottawan friend Ben Watson may have a free iRiver device for you. I'm not sure which model he's offering, but he's hunting for projects to demo on the conference show floor, and he's soliciting weblog testimonials to pick the winners. I'm bumping the offer up here in case it flew by you in the aggregators. (By the way, the Adobe MAX conference in Las Vegas in October is not the only MAX event this year... I know there are parallel events throughout Asia, for example... check out the localized versions of the Adobe sites for various events closer to where you might be.) Posted by JohnDowdell at 02:26 PM | Comments (0) | TrackBack September 04, 2006 Eating beats hunger Eating beats hunger: An overwrought conference covered by the AP includes a very telling stat: "Zimmet, a diabetes expert at Australia's Monash University, said there are now more overweight people in the world than the undernourished, who number about 600 million." We humans passed through millennia of hunting, hungry, dying young. All of a sudden the past few decades, we can produce and distribute enough food to enough people that the main problem now is eating too much of it. Wild. If it takes us a few decades more for family structures to learn to teach eating to replace just what you burn, it'll be a huge step forward for life on this planet. (I read the conference as "overwrought" because of reliance on BMI stats, calls for more laws to make a growth trade out of redefining "junk food", terms like "pandemic" used for the concept of "social infectiousness", etc... might have been just the reporting slant, though.) Good news hidden in there: now the bigger problem is learning how to handle food, not just to find it. Posted by JohnDowdell at 07:00 PM | Comments (2) | TrackBack August 24, 2006 Language courseware Language courseware: Free courseware for human language, not computer. This volunteer effort has been creating PDF and MP3 files of the language-learning materials produced by the US Foreign Service Institute. This public-domain material has also been repackaged by Barron's, Audio Forum, others. It's '60s-style courseware, drills and sit-down-and-studyware, but it's a massive resource, very useful. Why the link here? Because I believe that it's advantageous for native English speakers to reach out to varied regions and cultures: English is where the world meets, a hub language -- those already at the hub have an easier time reaching out to varied spokes than it is to jump from spoke to spoke. Anyway, these US government materials are thorough, and free to use -- my thanks to those volunteers doing the digitizing -- more free online language-learning resources here... discussion of the Mandarin courseware here. Posted by JohnDowdell at 07:19 AM | Comments (0) | TrackBack August 21, 2006 Illustrator history Illustrator history: Macintalk has screenshots and context today for Adobe Illustrator 1.1, released in March 1987. More history links for Flash, ColdFusion, FreeHand, Pagemaker, Photoshop here. Posted by JohnDowdell at 02:26 PM | Comments (0) | TrackBack August 15, 2006 Lotsa links Lotsa links: There's a potluck here of recent articles I've found interesting, but where I didn't have enough original content to enter as a top-level weblog item, mostly from outside-of-MXNA sources. Wharton offers some reporting on the recent Supernova conference, with a bit on the Apollo rationale by Kevin Lynch, but mostly whether consumers will have rights-management abilities of their cross-device personal data. Richard MacManus writes on "Web 2.0" technologies (blogs, audio and such) and their use in e-learning. Drew McLellan is joining Yahoo: "...Yahoo! is apparently trying to hire most of the UK standards-aware development community." Peter Warner at InfoWorld compares six "AJAX toolkits": Dojo, Google, Atlas, Rico, Yahoo, Zimbra. (There are "screencasts" available, but in QuickTime format, and it will not play as-is on my machine, missing a component or some such.) Reuters ran a weblog entry on fauxtrography and what Reuters considers acceptable... "if we could do it pre-digital then it's acceptable today" seems to be the summary. Good two-way conversation in the comments, a rare achievement with such a hot issue, although the tone does get more divisive towards the later comments. Related: John Nack talks about research Adobe science is doing on detection of image edits, and closes with a line with which I quite agree: "A lack of context and clarification may be ultimately more damaging than faked pixels, given that it's subjective & maybe impossible to prove. Technology may help sniff out forgeries, but it has to go hand in hand with the audience seeking out multiple, diverse sources of news." At ComputerWorld, Dan Tennant interviews Martin Newell and Dave Story of Adobe, on the way that advanced science is integrated into the applications. Sample quote: Hypothetical: You're given the opportunity to develop a single piece of technology to incorporate into Adobe's product line in one day -- no work, no pain, no cost. What would you develop? Newell: I would like a product out there which is able to, from a single image of an everyday scene, completely understand and recognize everything in that scene, a product that could tell me everything about all the objects, including the people and who they are, so that the necessity of tagging faces in photographs becomes obsolete. All the things that a 10-year-old would be able to tell me, I want the computer to tell me. John Battelle analyzes how Google is handling its clickfraud issue. InterAKT has released the MX Ajax Toolkit: "a Dreamweaver extension that enables AJAX development in Dreamweaver. Not only it has a perfect integration with Dreamweaver, but it is also based on one of the most revolutionary AJAX platforms, supporting features like degradability, web services and implementing lots of useful controls and widgets." Denise Caruso, a technology analyst since the Seybold days, has a weblog. (In answer to her "telcos astroturf net neutrality but our side wouldn't, would we?", you really need to look into the role played by Fenton Communications -- they successfully program the public through media placement of remarkably counterfactual stories.) It's Torvalds vs Stallman on how the GNU Public License specifies what hardware it can run on. The article doesn't seem to succinctly explain its apparent favored position, however... sample: "...The use of DRM to disallow freedoms (c) and (d) is what FSF doesn't like. Richard Stallman (RMS), founder of the FSF, calls this situation Tivoization. The term originates from TiVo...." (I like solutions which work in wide variety of combination, and am not drawn so much to the drive-towards-omnipotence sometimes seen in the MS and FSF approaches.) The Calcanis weblogs are refactoring... Flash Insider and Unofficial Photoshop blogs are no longer receiving investment there. Mark Niemann-Ross is soliciting redesigns of the Adobe DevNet site. He also mentions a plugin summit for traditional Adobe applications this autumn. Breeze is getting further business partnerships, this time with the SumTotal learning system. Jakob Nielsen has a great point about how a hand-drawn map may be better than a generic Web2.0 map. He makes an interesting assertion with "Therefore, interaction techniques like drag-and-drop should almost never be used on web sites"... I know that I've been surprised by seeing drag'n'drop in WWW pages, but I'm not sure yet that this will never work. Funniest bit: "The." Betcha he wouldn't say the same if he had been born with the name "Rock Hudson" or "Clint Eastwood"... or "We'd have less linkrot today if only it hadn't been called 'World Wide *Web*', which doomed it to a musty, dusty, uncleaned existence...." Adam Engst at Tidbits is searching for some collaborative writing software, and here he explains why several current solutions (Contribute, Web20 stuff) don't quite fit for him yet. The Guardian has a piece on "15 websites which changed the world"... sort of what you'd expect, but this article does pull together founding details of many of today's top sites. SWF Guardian seems an easy way to eliminate many cases of unauthorized SWF reuse, although in this age of decompilers I expect we'd need a server component to proof against more theft. (Related: The new Protect PDF Online service uses Adobe LiveCycle Policy Server on the backend to offer ongoing permissions for ability to read a file.) Here's another example of how Adobe authentication technologies are helping with document authenticity, in this case ensuring that documents are not altered after initial distribution. Josh Tynjala investigates varying degrees of separation of content from presentation in Flex work. A. Bertocci compares Adobe Photoshop with Photoshop Elements, and the distinct audiences for each. His parallel article on Adobe Premiere seems like it was written a few years ago, though... response seems quite different to the Premiere Pro line today. I liked this Flex business perspective from Yakov Fain. Peter Bell writes of his competitive advantage when using the higher-level abilities in ColdFusion to quickly develop iterative apps, rather than ones which start with a full functional specification. Computer donations end up going to scammers who punish their benefactors by restoring hard drive data. Kim Cavanaugh achieved the impossible and made me want to attend a Dave Matthews concert.... ;-) Posted by JohnDowdell at 01:25 PM | Comments (1) | TrackBack August 14, 2006 "No military" GPL "No military" GPL: This is an odd wrinkle in an "open source" license... they say they only like it when people who aren't in the military use it. Does this mean that armed combatants who are not in any declared military are okay? Or that only those in countries with fair legal systems cannot use it for defense? What would FSF do if an autocracy's military used this code? I don't see a way this could be sustainably enforced -- the only people who would respect it are those you wouldn't need to worry about anyway. (Asimov's First Law of Robotics adds additionally knotty questions, with its "nor through inaction" clause.) Posted by JohnDowdell at 05:28 PM | Comments (0) | TrackBack August 09, 2006 whether computers or Xacto knives are involved.... ;-) Posted by JohnDowdell at 04:45 PM | Comments (0) | TrackBack July 27, 2006 Quick links Quick links: I came across lots of interesting articles today, but don't have enough original content on each to make them top-level blog items (and risk flooding the aggregators)... new Adobe FAQs and forum changes... firefighting robot snakes and carpets that guess your age... lists of commercial video sites and Rupert Murdoch on global MySpace... if you're looking for some reading for a lazy summer evening then you may find it here (and, for my Aussie friends, you know you can read whatever you want in whatever season you want.... ;-) Adobe has a FAQ on "Adobe solutions for technical communications", with questions like "What are Adobe's plans for RoboHelp? Framemaker?", "How do these work with Captivate?", and answers like "New versions of FrameMaker, Acrobat, RoboHelp, and Captivate are currently in development and will be released over the next 12 months." Roland Piquepaille has an interesting article about a giant robotic firefighting snake last week. !" Dan Zambonini nailed how to boost weblog stats -- say something so controversial that half the audience will rush to correct you. (There used to be a Usenet trick to get replies... just say something was impossible and you'd draw more suggestions of implementations than if you merely asked how to do it.) Speaking of controversy, Ryan Stewart pointed to a Tara Hunt essays about "the browser is dead". I think document browsers are just as useful as they were yesterday, and are by no means "dead", although this essay could be useful in reorienting those who had thought WWW browsers would be able to do everything we want from the Internet. Spry:Patches is a list of changes to the Spry framework, contributed by Doug Nourse. (Spry makes it easy for an HTML page to manipulate XML-formatted data with JavaScript.) Ryan Mattes offers encryption functions for SWF and more. A discussion of ways to do serverside transcoding of AVI to FLV without spending any money. Web Standards Group interviews David Storey at Opera... one of David's work items right now is to contact websites when their implementation of "web standards" don't match Opera's. Real World Flex Seminar in New York City Aug 14... lots of good speakers here, and I think that an intensive like this may be the easiest way to pick up how easy Flex actually is. Julian on Software had an essay last week on "The Fat Client: A Brief History of Flash, Flex, RIAs and What Else Is Up"... a current overview from a Java veteran. I like the essay from Jared Rypka-Hauer about how it's easy to lose the sense of the miraculous about what we do every day. Recent interviews with David Mendels and Kevin Lynch about Adobe directions. (More.) New sensors: license plate scanning (not tracking) is automated so that a scanning vehicle can report to a central server about nearby traffic... new carpets not only have built-in weight sensors, but can also accurately estimate age (how, I don't know), and can also estimate gender with 75% accuracy. We're going to need good interfaces to handle the explosion of new data people can access.... Google Maps is tied with news services to create a geographic UI to the Iranian attacks on Israel... seems useful, but the scrolling gets a little wonky. The Adobe User-to-User web forums, previously powered by WebCrossing (I think), are now moving to ColdFusion. Jeff Pulver has a big list of commercial television programming on the internet. I clicked through about half of the 80 sites listed here... most used Flash, and runner-up was Windows Media Player when the shows were being sold for viewing. Interesting interview with Rupert Murdoch on how he sees the globalization of MySpace, use of video on the net, more. Boing Boing has a wacky story on how the French court has ordered Greenpeace to stop using Google's mapping service to identify where "genetically modified" plants are grown, presumably to mark targets for violence while maintaining plausible deniability. (More on net threats here.) I really liked this Flash 9 synthesizer from Andre Michelle. Posted by JohnDowdell at 04:30 PM | Comments (1) | TrackBack "Ripeness" sticker "Ripeness" sticker: Off-topic, but I've got to get this off my chest. A researcher invents stickers for food (like the little stickers you see on bananas or apples) which react to ethylene gas -- the invention is billed as being able to "tell consumers if a fruit or vegetable is ripe." All it would tell you was if the sticker was exposed to ethylene. Different plant products respond to ethylene gas in different ways, and ripeness has little to do these days with when something is picked. Mass-market apples, for instance, are usually picked early with low sugar content for sturdiness, then held in vast nitrogen-flushed containers for months until being shipped to retail. It doesn't matter if they release a little ethylene while on the produce rack, because they were picked before peak flavor could be developed on the tree. Matter of fact, with an apple in that condition, ethylene exposure would hasten mealiness and loss of texture -- it's hard to work an early-picked apple. Tomatoes are a more dramatic example -- during winter they're picked full-green and are exposed to ethylene gas during transit north to change color and texture, but they sure as heck aren't "ripe" just because a sticker detects that one-time ethylene hit -- a ripe-picked tomato kept ventilated might even indicate as "less ripe" with such a sticker test. Retail produce markets usually "cool" or "cook" dozens of 40-lb boxes of bananas every week, either opening them up to air or sealing them in plastic to concentrate the natural ethylene release, even storing them with ethylene-releasing fruits like citrus to hasten ripening for a yellow skin when on the stand. Stone fruit, like peaches? Don't ask... you could never sell ripe nectarines in most markets because you'd lose over half to on-display spoilage, people squeezing the fruit. Harold McGee's "On Food and Cooking" is still one of the best books on the science of food, and yes, I worked with fresh produce in a prior life. The story got published in USA Today and lots of people blogged it, but there story doesn't hold up to what I've seen myself about how produce, ripening, and ethylene interact. There, now I can get back to work.... ;-) Posted by JohnDowdell at 03:29 PM | Comments (2) | TrackBack July 24, 2006 Lots of links Lots of links: Lots of interesting tidbits from last week here in the extended entry... mostly from outside of MXNA, stuff I didn't have much to say about, but which seemed too interesting to just close out of the browser without logging.... Marco Casario pointed to an article on how Opera tested across all the various Java mobile implementations. Photoshop tutorial for "sparklines", simple, uncluttered data-fed inline graphics. [via Jason Kottke] Also see prior entries here on sparklines. Extreme Tech had info on a tipster program: "The Business Software Alliance (BSA) doled out a total of $15,500 in reward money on Tuesday to three individuals who came forward to report that their ex-employers used pirated software in the workplace." Microsoft staff talk of exec changes: "There was allot of press over the last few weeks about the sudden 'vaporization' of Martin Taylor. I've had several questions about what this means as Martin as influential in Microsoft strategy and close to Steve Ballmer...." MS staff talk on "rich vs reach" still seems to me to be more about arguing over label definitions than about saying anything... this writer seems to posit an equivalence between "user experience" and system calls... I'm more concerned about how easily a new person can approach an interface, the number of people able to approach that interface (whether by physical capabilities or language barriers or system requirements), how secure they are in using that service... system calls are just one small part which may affect other parts of user experience, and lines like this don't scan for me: "But the reach client in the browser does provide a restricted application environment, so there is a cost -- decreased user experience." Jeffrey Zeldman wrote last week of dissatisfaction among "web standards" folks with the World Wide Web Consortium. But my current understanding of his stance seems along the lines of "Everything would be better if we just changed the people at the top," where I've always been more along the lines of "What *actually* happens when you have a committee deliberate over how others should act, compared to when you let people act and see what works?" (That probably didn't come across, but that assumption that starting with a spec and encouraging multiple implementations seemed to me to handle some needs, but not all needs.) Interesting situation; I just hope it evolves usefully. Yahoo is soliciting video advertisements from customers... if you've got a flair with a FLV then this may be a good way to get more prominence. Mike Potter offers a populated JamJar space to play in... all you need is an adobe.com user name. Ryan Stewart wrote last week that "Adobe Needs a Scoble" ("anybody who didn't do X should be fired!"?), but he's actually looking for video viewing of people inside Adobe, going about creating the software understructure for creative expression. The more I thought about such videos over the week, though, the more I saw conversations between staff & customers as the key interest, rather than just staffers sitting around in cubicles talking to ourselves. Focusing just on staffers seems short-handed to me, doesn't give the full flavor of how things get done. I'm still thinking about this, though.... A list of video funding, of new webtv businesses which have received venture capital investment. Adobe's main offices in San Jose were the first offices to be awarded the highest level of certification from the Green Building Council... more info here on the smarter lighting systems, the use of remote weather services to influence irrigation cycles... PDF itself is helping to reduce the paper impact of voluminous building permits and documents. Wil Shipley offers a bet at good odds to Bill Gates, after he said "...there was an 80 percent chance the company's next-generation operating system, Vista, would be ready in January." Digg discusses stats on how a few of its superusers carry disproportionate influence on the site. The orienting quote at SEOMoz: ." Swarm is a SWF display of the web pages its members are currently viewing. You can become a member by installing a Firefox extension which sends your viewing info to Swarm. John Dvorak pulls the troll-trip, this time on CSS: ?" Posted by JohnDowdell at 12:34 PM | Comments (1) | TrackBack July 19, 2006 Google News operators Google News operators: Off-topic, but it came through MXNA... Jon Udell of InfoWorld tries "site:infoworld.com" searches on Google News. I don't think that engine uses the "site:" operator... if you do a regular search on text "infoworld" then articles come up... Google News uses a "source:" operator instead, with a private syntax naming each news service (example). Here's a Google News search to find recent InfoWorld articles on Vista. Summary: Google News uses slightly different advanced search operators than Google websearch... GoogleGuide.com has a useful comparison listing of the advanced operators used in various Google search engines. (Jon's main point, about "How does Google News decides who's an authoritative news source?", remains a live and vibrant question, however... sites have been blacklisted due to complaints from others, and I'm glad I'm not the editor on that one.... ;-) Posted by JohnDowdell at 11:38 AM | Comments (2) | TrackBack July 11, 2006 Windows vs Flash Windows vs Flash: No particular point here, just something I've been curious about after hearing "browser plugins should be included in the OS" in the weblogs. The Windows release dates below come from the incredible chart from Eric Levenez, and the Flash dates come from the Wikipedia article (which is still attracting someone obsessed with United Virtualities' PIE). Windows 3.1 (1992), Windows 95 (1995), Windows NT 4.0 (1996), Windows 98 (1998), Windows 2000 (2000), Windows XP (2001). Flash 2 (June 1997), Flash 3 (May 1998), Flash 4 (June 1999), Flash 5 (Aug 2000), Flash MX (Mar 2002), Flash MX04 (Sept 2003), Flash 8 (Sept 2005), Player 9 (June 2006). During the eight generations of Macromedia Flash Player, we've seen three major releases of Windows. The smaller thing evolves faster than the bigger thing. Fortunately, it gets adopted much faster and more widely, too. Posted by JohnDowdell at 01:00 PM | Comments (3) | TrackBack July 08, 2006 Richer than Rockefeller Richer than Rockefeller: A bit off-topic, but I wanted to get this link in 'cause it's hard to search for this argument. Working in technology does provide long-term benefits to everyone: ." Sometimes it's easy to focus on incremental income differences today, but I think that improving things for everyone has the bigger longterm impact. Posted by John Dowdell at 08:48 AM | Comments (0) | TrackBack June 26, 2006 WeFeelFine.org WeFeelFine.org: This is a Java applet, not a SWF, but the interface and data resources are interesting... they mine the blogosphere for strings like "I feel" and "I am feeling", then graphically display the results by time, location, weather, more. The API to their data is available under a Creative Commons license, but I don't know if their server is already set up with a policy to accept cross-domain SWF requests. [via Evan Williams] Posted by JohnDowdell at 04:51 PM | Comments (1) | TrackBack June 16, 2006 在度假 在度假: heh, *that* should break some aggregators... I'm on vacation this week, back on Monday June 26, although I may skulk around in web-comments towards next weekend. Lots of other Adobe staffers will be writing, in both MXNA and blogs.adobe.com. 再见! Posted by JohnDowdell at 04:39 PM | Comments (0) | TrackBack Lotsa links Lotsa links: Too many browser windows open, but too much interesting info on the web to lose... check the extended entry for a smorgasbord of interesting things you may or may not have seen before or ever wish to see again.... Info on the work required for font-encoding in Chinese. Joel Spolsky writes on how, as a new Microsoft employee in 1991, he gave a review presentation to Bill Gates, and passed. (But how MacroMan was killed in the process.) Matt Marshall has succinct information on how Riya may be attempting to generalize image recognition across a wide range of search tasks. Philip Su has an on-again, off-again essay on the dynamics within a very large software group... Mini-MSFT has more... in comments at Scoble's there's proof that you can never really delete anything from the web. Those problems aren't unique to Microsoft, or even to large software efforts... even in the most intimate of settings you still have to carefully consider the actual effects of honestly describing posterior acreage in a new Armani suit.... The mobile Linux initiative seems like it will have repercussions, although I can't yet see what they might be. Alexandru Costin has notes from yesterday's Adobe financial conference. (Odd note: The immediate Reuters syndication was headlined "MM drags Adobe results", but Alexandru's notes confirm my own memory is that no such thing seemed to have been said in the call... the integration is going as planned, but it was the bundle software sales dip which had the biggest impact on results. At least they spelled the name right.... ;-) Tim O'Reilly hosts a number of observations on how mobile culture is evolving more quickly in South Korea than the rest of the world. An analysis of payback to musicians for CD sales and online sales... the writer advises Weird Al Yankovic to push CDs, 'cause he gets next-to-nothing from online sales. Nick Carr commented on Robert Scoble's change of venue: ?" (I think it's more sustainable to have a network of staffers blogging, rather than focus on a single contributor... "The company is the company, and you are just you.") There's growing conversation about how text advertising is changing the very content of the blogosphere. (I hit the same idea last month with ironic followup.) At some point advertisers will realize that the ad vendor has no immediate incentive to cut down on ad fraud... to make things sustainable they need better feedback and monitoring somehow, I think. More innovation in Flash delivery to environmental signage. Microsoft's Windows Presentation Framework has an elevator pitch... I would've thought it to be more like "Like Flex, but able to use !3D! !acceleration! on the far fewer machines on which it runs", but I guess that's why they didn't hire me to write the blurb.... ;-) That Yahoo Mail worm is very interesting... it's not so much "an ajax bug" as it is a consequence of exposing user data to the WWW browser's presentation layer. How can a user access that data while blocking off hidden automated abuse of that data...? This set of XAML animation behaviors got a lot of play in the MS-oriented communities this week, but the approach is already available in Flex. Renaun Erickson does some spot-checks of WMODE efficiency in his current browser... he found that performance was 10-40% slower when asking the browser to add the plugin rendering to the browser's offscreen compositing buffer, as opposed to blasting plugin content directly to screen in the normal way. This will vary greatly by browser, too, and even by platform... Firefox/Mac performance differs from Windows, and for Internet Explorer, well.... ;-) Info on getting listed in Google News. Microsoft finds it difficult to integrate with GNU Public License, which enforces a strict separation of engineering work between its license and others. Ryan Stewart has info on the growing awareness of need for offline access and remote synch. Posted by JohnDowdell at 03:26 PM | Comments (1) | TrackBack My status My status: Yes, I've had a silent weblog this week. It's been self-imposed, I just felt in an odd position for posting anything. I found a Pocket-Lint article Tuesday morning about an Adobe statement on recent Microsoft events, and have been seeking guidance on how much attention the company wishes brought to this document. It's been busy during earnings week, though, and other mainstream news sources have since run articles on the statement. I want to do the best thing by shareholders, other employees, customers and even by other companies too, though -- didn't want to risk a misstep with this new, still-forming company, and so I shut myself down pretty fully the last few days. I've also been sensitive that not everything is as it may first appear -- Joe Wilcox pointed out that it's rare for a lawyer to work through the newspapers, and the ambiguous voice of the sudden Microsoft blogging is unusual to read too ("is he speaking for himself? how does he know what he says he knows?") -- it's hard to talk about something with so much behind-the-scenes movement. But the issue is also the elephant in the room, and I found it hard to write about other things normally without acknowledging it. Soooo.... that's why I've been silent recently... I've scheduled a vacation for next week, and anticipate a clearer perspective when I come back towards June 26. Posted by John Dowdell at 08:42 AM | Comments (2) | TrackBack June 09, 2006 Lotsa links Lotsa links: Gotta clean up some browser windows here, and while I don't have enough to say to make these top-line blog entries, there's too much of interest to let them go unacknowledged.... Seen On Slash is one author's choice of the most striking comments from regular Slashdot reading. Ben Forta is keen on the Flex-based interface to National Geographic's Map Explorer. (I put some time in here, but haven't yet figured out how to overlay demographic info.) Claus Wahlers talks about XML meta-languages for declaring interfaces, before choosing the delivery method. Daniel Fischer pursues similar ideas. Glenn Fleishman expands on his earlier reporting to trace back last week's "those bastards killed golive" story. Robin Ducot describes some of the strategizing behind merging the Adobe and Macromedia websites. John Martellaro has an insider's perspective on why Apple may not focus on gaming. Lots of comments at this article describing practical failings with LAMP. Forbes describes the actual management environment at Google: "As charming as he is, Schmidt runs Google about as much as much as the Dalai Lama runs the world's spiritual life." Michael Mace described some possible Flash/Microsoft dynamics a month ago, and his article is still drawing fresh comments today. Jim Allchin's description of attempts by Steve Ballmer to clean up an infected Windows system. iMode use in the United Kingdom reports good adoption, and that there's a signficant increase in consumers who use mobile data services via this richer kind of interface. A new type of assistive device I didn't fully understand... seems to toss the visual metaphors still followed by screenreaders. ." Darrel Plant proposes a "Shockwave and Awe" meet-up alongside the upcoming Adobe MAX event in Las Vegas. Firefox and Microsoft are both dropping the Win98 OS. John Rhodes has a whole bunch of usability links. Tim O'Reilly notes that data-mining of the public record is not limited to (friendly) government analysis. Posted by JohnDowdell at 03:59 PM | Comments (3) | TrackBack June 06, 2006 CS2, new Intel Macs CS2, new Intel Macs: No news here... I'm posting it in hopes of assisting someone whose comments lie behind a registration wall. The new Intel-based Macintosh require not only a port of application code, but a prior port of development environment as well... expect a native version on the next full version of the creative suite. For QuickTime 7.1, yes, it did have problems with existing applications, but fortunately those problems have been addressed in QuickTime 7.1.1. Posted by JohnDowdell at 07:45 PM | Comments (0) | TrackBack Wilcox on magicians Wilcox on magicians: Off-topic (but it's a chance to confirm that I still don't have any info of my own on the MS lawyer's story from last week ;-) ... Joe Wilcox wrote in passing "Good magicians are effective by way of distraction. The crowd looks here instead of there and so misses the trick behind the trick." That's true, but it may be more accurate to state that top magicians consider where attention would naturally flow, rather than create distractions themselves. Tony Slydini introduced a wonderful sense of timing into the New York magic scene in the 1940s... there were few "moves" as such, but the business happened during the natural cycle of relaxation and attention. Other great magicians, like John Ramsay, did deliberately create bits of business which would distract those who thought they were clever... some of his sleights are actually pretty easy to spot (his thimble steal is blatant), but he'd create an "aha!" suspicion which would lead other magicians astray. Overall, though, I think it's not the sneaky business which was effective, but the long-term pattern of watching how things really do play out which led to the most real magic. (And by the way, if you like sleight-of-hand, I'd recommend the Ross Bertram home movies which were recently pressed to DVD... the lighting is sometimes off, and the score of Canadian schottisches is seldom heard today, and some of the "educational" stock footage would cause today's video editors to shake their heads, but Ross and Helen Bertram were early do-it-yourself creatives, and they managed to preserve some really important records of some exhilaratingly beautiful impossibilities.) Posted by JohnDowdell at 11:42 AM | Comments (1) | TrackBack June 05, 2006 Whitespace coding Whitespace coding: Funny... a programming language written in strings of whitespace. "The Whitespace interpreter ignores any non-whitespace characters. Only spaces, tabs and newlines are considered syntax." Theoretically you could embed these instructions into other code, but my brain is starting to hurt now, so.... ;-) [via Greg Costikyan] (btw, I'll likely be blogging light most of the week... I'm at an offsite, meeting other staffers from other workgroups.) Posted by JohnDowdell at 04:15 PM | Comments (0) | TrackBack June 02, 2006 Semi-offline Semi-offline: For those interested in such things, I have internet access, but do not have access to email and similar similar functions. (Friday afternoon I started sneezing at the office and so left for home, but now I'm having difficulty negotiating the new VPN system.) If you came by my blog looking for comments on Microsoft's story today, then I don't know enough to usefully comment about it. And if you notice any typos in the above paragraph, then you'll know that the cold medicine is starting to kick in here.... ;-) Posted by JohnDowdell at 04:19 PM | Comments (3) | TrackBack May 31, 2006 Lotsa links Lotsa links: I'm 'way behind this week, so let me do quick links on some of the pages still open in my browser from last week.... WIRED notes how bad interfaces gain constituencies... the state of California mailed out prefilled tax returns for citizens to sign and return (they know all that data already, the paperwork purgatory is just for show)... but tax preparers are pursuing political action to prevent the "ready returns". 13 reasons for and 13 reasons against using Microsoft for "Web 2.0 development". Simon Wacker shows another way to declare SWF interfaces in XML. Media College offers "The Pro and Con of Flash Video". Joe Clark writes "To Hell with WCAG 2" at A List Apart... the accessibility spec is apparently lengthy and difficult for people to implement. Roger Johansen talks about accessibility (principally text-to-speech screenreaders) in the context of dynamic content via JavaScript. I particularly dislike the nameless commenter who tells screenreader manufacturers to "take their finger out". Andrew Kirkpatrick discusses accessibility in the larger sense ("no js", etc) in the context of the recent Adobe Spry framework. Ajax & SEO as a search term is pulling up an increasing number of results these days too. Andres Zapata wrote "The Guided Wireframe Narrative for Rich Internet Applications" at Boxes & Arrows... lots of comments here as well. John Battelle describes the "Too Many Passwords" problem... Meebo.com apparently has 11,000 people hit the "forgot your password?" link each day. The Lion King was a classic trainwreck, watching a high-profile title try to play atop a newly-delivered system capability. Ryan Stewart points out how blaming the browser does not suffice... you've got to match the task to the capabilities, a tricky piece of judgment. There's a bunch of comments on various angles. Gabor Cselle essayed on occasional connectivity and synch of local storage, but from a browser-centric position: "First, take a browser you can run on any platform, then add a mechanism to easily create applications that perform three things..." Asking 90% of the potential audience to change their browsing chrome is difficult, I think. Seattle Times discusses how Google is playing US politics. A PHP pitch does the standard debatable feature matrix, but I liked this line: "PHP has broad functionality for databases, strings, network connectivity, file system support, Java, COM, XML, CORBA, WDDX, and Macromedia Flash." Dr. Dobbs discusses Microsoft's proposed new photography format, but says "Then PNG came along, a dollar short and a day late as it turned out. A public domain alternative, PNG avoided most of the acrimonious legal wrangling of GIF and JPEG, but was introduced too near the end of the LZW patent lifecycle to gain much traction." The format actually came together amazingly quickly, much faster than later W3C Recommendations... it was over the end-of-year holiday weeks when the issue arose and most of the work was done. BitTube has been doing some SWF development for Sony Playstation, and notes that it's similar to how we've had to refactor downwards for smaller devices or more constraints every few years. I like these maps of language spread over geographic areas. Posted by JohnDowdell at 02:33 PM | Comments (0) | TrackBack May 27, 2006 IE7 name change IE7 name change: MS staffer says it will be called "IE7+", or "Internet Explorer 7+". I guess they want us to refer to it in conversation like this: "Tested in >=IE7+". No idea if next version will be called "IE7++". The commenters make the points you'd expect. At least it's not called "IE7+MX" eh...? ;-) [link fixed] Posted by John Dowdell at 12:00 PM | Comments (7) | TrackBack May 26, 2006 T-shirts T-shirts: Get 'em while they're hot! (There's a big Web2.0 beatup on Memeorandum now, but it's particularly tricky for individuals within a group like O'Reilly.com to speak when they have to consider another group as well (the CMP conference organizers and senders of the letter), and meanwhile think about possible legal ramifications of anything they do say. I'd ask folks to consider the general background and significant contributions of the whole O'Reilly effort, and give them some time to get their internal group conversation together before they can speak publicly with a solid voice. The US has started a long holiday weekend today... please give them a little slack, 'cause we know their overall intent is good.) Posted by JohnDowdell at 12:25 PM | Comments (0) | TrackBack May 18, 2006 Microsoft vs Adobe Microsoft vs Adobe: I don't usually go in for articles like this, but Michael Mace's lengthy essay raises so many ideas that I think you'd like to read it too. (My general take is that Microsoft must become Microsoft, Adobe must become Adobe, Google and Yahoo and Apple must become more themselves too -- each business starts with a different mission, has a different ecology, and they only fleetingly overlap.) Michael looks at mobile, Flex, the universal client for SWF/PDF/HTML, portability of Microsoft's future work, corporate structures, more. What do you think of his viewpoint on various details...? Posted by John Dowdell at 08:16 AM | Comments (1) | TrackBack May 15, 2006 Lots of links Lots of links: Got some open browser windows here, and want to make these links searchable within this weblog's database... airline boarding, Flash in Fortune 500 companies, changing understanding of accessibility, more tidbits from the last few days. An article asks "Is FLASH Appropriate in a Business Web Site". I'd guess so, because most successful businesses use it -- a recent informal study shows 67% of Fortune 500 companies use SWF, compared to 36% back in 2004 (no source; just what I've heard). The article starts "The short answer is maybe. The long answer is that the question might be better asked, 'Is a 100% FLASH web site appropriate in business?.'" About as appropriate as a 100% HTML site, without bitmaps or other richer media, I'd wager. You blend together your media assets to create the experience you'd like your audience to have. The article also contains folklore such as "Search engines can not see the text in a Flash page" and such. Telamon used to be the first search result for "father of Ajax", but these days he doesn't even place.... ;-) Kevin Kelly pointed to a resource on general debugging troubleshooting, and it includes stuff the stuff that's heard so regularly on the mailing lists... change one part of the problem at a time, know how to make it fail so that you can prove you've made it stop failing, watch out for philosophy getting the way of observation, the basics. Massimo Foti describes how the Spry framework focuses on data display within a page, instead of on JavaScript programming. Meanwhile, Drew McLellan is unhappy that Spry uses HTML attributes which have not yet been approved by the W3C, as do many of the approaches people are taking to do things application-ish inside of document browsers. Carol Sliwa of ComputerWorld writes on "Massachusetts OpenDocument plans questioned by disabled"... one thing I've been seeing lately is that the needs of the accessibility community, the web-standards community, the dynamic-data community, the open-source community, all can often be a little askew from each other. It's hard to raise one priority above the others; we've got to find ways to make these different needs fit together. Target Stores is apparently dealing with a lawsuit because its website is hard to use for an unsighted person. I think we're all differently-abled, to some degree or other, and more people have sub-average intelligence than visual impairments... I'm not sure how you'd be able to codify where to draw the line. Joshua Porter had a good essay on "7 Reasons Web Apps Fail", describing some common ways to get distracted away from user experience these days. Airlines are still testing new boarding strategies. A little bit in Business Standard about Adobe Mobile growth trends in India replicating those in Japan. I'll be looking to learn more about the Brevity project, which provides a different type of abstraction layer: "Brevity takes source code files written in Brevity syntax and processes them into valid ActionScript 3.0 files, which it then compiles into Flash 9 SWFs using the Adobe AS3 command line compiler. This is very much like Processing converts processing source files into Java code and then compiles them." Kim Cavanaugh was written up in the "Technology Horizons in Education Journal" for his use of Breeze meetings, presentation and training in school districts in Florida. It seems a relatively easy way to extend current practices, for both time-shifting and space-shifting. A new proxying approach may make it more difficult for the mundanely powerful to control what others say or read. Posted by JohnDowdell at 12:06 PM | Comments (0) | TrackBack May 09, 2006 Lots of links Lots of links: My browser has too many pages open, but some of this stuff I want to get into my weblog's search engine. This isn't everything great that people wrote recently, because I still sometimes lose browser sessions, but here's some of the writing I found impressive, useful, or just plain weird during the past week.... ;-) Valleywag dings Google for not creating a special Cinco de Mayo logo like Yahoo did. (In contrast, today I was moved by the story of Ayaan Hirsi Ali.) Plagiarism Today is a weblog dedicated to the unauthorized reuse of someone else's original content. "Linux Kernel 'Getting Buggier'" is a Ziff-Davis story about how older systems do not seem to get the same support that equipment used by early-adopters does. 37 Signals had a good business tip for "Web2.0 companies" last week -- set up a pricing model where people can choose premium services: "What we learned from this is that people will pay for quality. Offer them something really good, and they will go for it." Derek Powazek discusses ways to steer clients back to reality. [via John Gruber] Roger Johansson describes how he uses JavaScript to open new browser windows, instead of the TARGET attribute, which various validators currently disdain. Jesse Rodgers writes "AJAX and screenreaders - could Flash make it better?", but I suspect the core problem is how to turn an interactive, non-linear experience into a linear and unchanging text stream. (I think there's a great deal of work to be done in audio-only interfaces... there's investment here, in the phone tree world, but mobile users may not want to be staring at a screen all the time too.) Joe Clark offers related articles. Noel Billig has a great summary on video streaming vs progressive download, when to use each... a gloss to Chris Hock's DevNet intro. One key difference: progressive download leaves a local copy, while streaming does not, and this has implications on random access... both techniques are useful. Last ActionScript Hero has more info on undocumented (and therefore use-at-your-own-risk) FlashPaper calls and properties. Wall Street Journal describes how the increasing complexity of larger software applications means that security concerns need to be addressed earlier, and has a few paragraphs on Adobe's Adrian Ludwig toward the end. Brian Lesser took ten strong pages of notes on sessions he attended at Flash In The Can in Toronto last month... how he remembered all that despite catching a cold I don't know.... ;-) Koen De Weggheleire and Peter Elst describe the new Adobe road show, this one at an event in Brussels. The story about using laptops to steal cars got big play last week. Even keeping a ravenous pitbull in your car won't protect against thieves equipped with Rohypnol and hamburger, and then there's always EMP to deal with. A book company is releasing titles based on images rather than just text, and offers free on-screen reading with nominal charges for higher-res versions for printing. Posted by JohnDowdell at 12:28 PM | Comments (1) | TrackBack May 04, 2006 DirectX OS support DirectX OS support: Paul Thurrott has a piece, unconfirmed, that the next version of Microsoft's graphic routines and APIs will not be portable to Windows XP or other Microsoft users. Buy it all, or none, if this report is correct. Posted by JohnDowdell at 02:53 PM | Comments (2) | TrackBack May 02, 2006 Tracking and complexity Tracking and complexity: Four different links I find interesting, even though not directly relevant to our work... believe I picked these up through Slashdot and Digg. Popular Science describes how to track where someone goes if they're using a mobile phone you've modified... P2P.net publishes an activist press release which alleges that Levi's Jeans are impregnated with short-range RF transmitters in certain stores. An essay on "freedom from complexity" got picked up on Slashdot... at first I thought it would be about writing concisely and clearly, but instead it's apparently about encouraging consumers to use opensource-branded software on Windows instead of Linux. Norbert Ehreke has a parallel Thoughts on Simplicity essay which I'm not sure I can abstract into a single sentence. Posted by JohnDowdell at 03:09 PM | Comments (0) | TrackBack Five-gig texture Five-gig texture: Not really a texturemap, more like a very large database table with values coded in RGB instead of ASCII. John Carmack's next game references this giant bitmap to figure out where to place 3D objects (grass, moss) for rendering, what types of footstep soundfiles to play, more. Posted by JohnDowdell at 02:48 PM | Comments (0) | TrackBack April 26, 2006 Lots of links Lots of links: I've been blogging light last few days, from password and server difficulties, but I've accumulated a lot of open browser windows of interesting stuff... that Commodore 64 emulation in Flash 9 particularly sounds intriguing, just so long as we don't get chased by giant hamsters while doing so.... USA Today carries a story about "CEOs say how you treat a waiter can predict a lot about character"... lots of real human stuff here. WIRED describes new VR games which let people play against their pets... sensors on your body control effectors to manipulate some bait which a mouse pursues, chasing you throughout an artificial environment. If you haven't seen the ClickTV interface, it's worth a look... allows time-based commenting on a common video stream. Brent Simmons details common-sense tips to getting a feature request implemented. He's actually talking about how to put a good user-experience on some text you're crafting. ValleyWag exposes Google's fondness for Toto Washlets. Ryan Stewart points to Google's use of Flash in a Sony promotion for a movie via a puzzle contest. Some Firefox users are getting slammed for holier-than-thou attitudes. Dave Carabetta reviews his new Adobe-branded leather computer bag. (I haven't seen this yet myself... been using a Filson bag the last two years and the investment has been worth it. The leather one looks nice, though.) The "GuGe" rebranding of Google in China ("谷歌", if your browser renders it) has its own theme song Flash presentation. Cool-looking credit-card-sized flash-memory drive from Taiwan is in the news today... 16G, USB 2.0, Mac/Win. Ever wonder what ActionScript Hero looks like beneath that mask...? Director Web, the site which innovated tons'o'stuff like plugin detection, browser/plugin intercommunication, conference blogging and more, is now in maintainence mode, being kept live but not being updated. Alan Levine made massive contributions here, as well as the content from all the writers... thanks! Datadriving is hunting for unlocked webservices... this example is on finding and using mapping data. (Just like screenscraping, unauthorized use of someone else's content can break really easy once they wise up you're not being straight with them... better to set up a relationship, get something solid.) A blog from DoubleClick's DART Motif group, for rich-media advertising. Looks like a new set of Windows Mobile delays as well. Rob Enderle writes on Linux on the desktop, why OS/2 failed, the perils of zealotry, more, in "Why Linux May Never Be a True Desktop OS". Michael Arrington of TechCrunch busts some WebEx astroturfing -- staffers making comments without owning up to having a stake in the issue. (Stakes can be financial investments, or are often personal commitments or associations to The Cause... ya gotta be clean, and make your argument based on the facts.) (And in fairness, I haven't seen the IP addresses myself, but I accept Michael's word in this matter.) Related: JBoss astroturf. Everybody Hates Google, according to BusinessWeek. (But I bet they all work with Google too.... ;-) San Francisco meetup this Thursday with Meebo messaging, UserPlane rich-messaging, and Second Life. Microsoft has a Michael Wallent video which talks about the latest predictions on Windows Presentation Framework, but I haven't invested the time in watching him talk. (Ryan Stewart has some reaction.) Matt Cutt offers a good example of how carefully staffers at search engine vendors need to speak when talking about the hidden mechanisms they use to rank sites. Spread Firefox notes that Google's "About" page advertises Firefox/GoogleToolbar, along with the other projects which Google more clearly owns. Interviews with Julieanne Kost, Photoshop advisor, and Jeremy Allaire on Brightcove video. Roger Johannsen continues to spread misinfo about HTML supremacy... PDF can tap into text-to-speech readers and its archiving format is an ISO Standard, just like some of the HTML variants are. FC64 is a Commodore 64 emulator writeen in Flash 9... more info from Claus Wahlers and Darron Schall... I was excited to read this the other day, even though I haven't seen it yet, the idea is so audacious.... ;-) Posted by JohnDowdell at 02:03 PM | Comments (3) | TrackBack April 14, 2006 Lots of links Lots of links: I've kept lots of webpages open this week, but don't have sufficient original content of my own to prompt a top-level entry... if you're looking for interesting reading this weekend, then try some of the articles in the extended entry here.... Houston Business Journal has a story on how video and motion can be more accessible than text... it's not a scientific survey, more anecdotal, and written by Paul Jerome of 917Media, who presumably has a stake in rich-media interfaces... interesting video presentation at their site, check out how the shadow follows the speaker's motion yet doesn't follow the curvature of the sportscar... you know what's going on here, right...? ;-) Two aggregation lists at 3spots.blogspot.com... Digg-style apps and Flash or JavaScript entrypages. I don't watch "South Park", but I appreciate the way that the creators skewered self-destructive censorship this week... they showed a whole bunch of stuff which would offend lots and lots of different people. But their sponsor corporation, Comedy Central, balked at displaying innocuous drawings of a certain historical figure they've aired before, who has been drawn without riots throughout history, and who is currently portrayed in much less flattering light by those who scream the loudest against others. This whole "cartoon jihad" thing is a crock from top to bottom, and I appreciate how exquisitely Parker & Stone laid bare such murderous hypocrisy. BBC carries a study on different social effects of increased mobile connectivity... I'm not sure there's anything shockingly new here, but it's an ongoing task to see how we humans will adapt to these new abilities. "The World's Best Video Websites" may be a bit overstated, but it's a goodsized list of various types of recommendations. More Flash clones appear... I'm not certain I should call them "clones", because most of these groups try to render parts of the SWF files they find instead of actually replicating full Adobe functionality, but "clones" is still the best word I currently have to describe them. In Oregan's case, their website still seems bare of technical detail... impossible to tell what they actually succeed in reading... if you ever get any functional reality from such firms then I'd be interested in hearing, thanks. When I check with the mobile teams they say such variant engines don't actually turn up in partners' business discussions, so the risks of realworld forking are low, but it may be something you get questioned on by your own clients and colleagues, should they happen to read the press releases. "Web Design for the Sony PSP" was published last autumn, but still offers a comprehensive list of browser concerns on the console device. Lots of conversation this week about Vista hardware requirements... it'll be hard to tell what type of hardware is actually needed for satisfactory performance until they actually ship. More on possible requirements at CNET. David West writes at Web Pro New about the inclusion of source files in webwork contracts, from the perspective of the client rather than the designer or developer. Info on how new .EU domains were subverted by a gap in the registration process. Nitesh Dhanjani has thoughts on Ajax security... nothing new here, but a good look at current perceptions of the subject, from a JavaScript point of view, which hasn't had to deal with problems like behind-the-firewall data requests before. Cl1P.net is a site where you can copy/paste text across machines. Jen Larkin has news on a Flex User Group in the San Francisco Bay Area... I've seen other posts this week about similar groups in other areas but unfortunately don't have the links handy, so please add in comments if you wish. Steve Pavlina has a great essay on "10 Stupid Mistakes of the Newly Self-Employed"... great reality checks for single-person or small-group businesses. At informit.com, James Gonzalez offers new web designers an intro to Flash audio control. I'm not sure of all the content in this Finnish map, but I like the overall look of that they have accomplished. Last ActionScript Hero has a great entry on a MathML app... it's not a public application, but I like hearing about work done in such hard yet meaningful areas. Bill Burnham has an essay on "persistent search"... I think he's envisioning this as a serverside service, though, where someone else notifies you if they find new items on your desired search term... for privacy & decentralization reasons, I'm leaning more towards clientside agents, such as the "headless agents" which provided notifications if their recurring server requests turned up new info. Posted by John Dowdell at 01:54 PM | Comments (0) | TrackBack PS/MacTel benchmarks PS/MacTel benchmarks: Rob Morgan compares the timing of a few Photoshop and AfterEffects operations on a desktop Mac, a notebook Mac, and (under Rosetta emulation) one of the new Intel-based Macintosh computers. (I don't think he included the newer "running WinXP on Macintosh" scenario.) I'm linking it here because it got some blog attention earlier today... as you'd expect, a fast desktop outperformed notebook emulation. But the part that really caught my eye was the op/ed at the end: "We all need to start bugging Adobe to get UB versions of Photoshop and After Effects finished for the Intel Macs... How do you speed up Adobe's updates? I know it's not an easy transition to Universal Binaries. However, if the UB versions are not a priority at Adobe, you may be able to help change that by posting your opinion on Adobe's discussion groups." No, that won't help... it would be more useful to first listen to what Adobe execs have been publicly advising since last year, before the MacTel shipped, and the background given by engineers since then... the new hardware requires a new development environment, and the port of the workflow which would enable the port of the code has been scheduled for the first full release of the larger mature applications.... last summer this was publicly estimated to take place around the turn of the coming year. Flooding the forums won't change this. (See also my own personal experience with early adoption of new hardware... I'm sympathetic, but it's hard when asked to listen to those who won't listen in turn.) Posted by John Dowdell at 01:49 PM | Comments (1) | TrackBack 08:02 AM | Comments (1) | TrackBack 03:31 PM | Comments (1) | TrackBack April 06, 2006 CNET on IE changes CNET on IE changes: They do have a point: "On Tuesday, Microsoft will push out an update for Internet Explorer that will change the way the Web browser displays certain pages. Web developers who have not tested their Web sites with the update may be in for a surprise." But they also muddy the water a bit: "This means that certain parts of a Web page, such as a Macromedia Flash animation or QuickTime movie, might need an extra click of the mouse to start." It'll start fine... it's the interactivity which needs an extra click first. Anyone rolling over that part of the screen will see some text pop up first... hassle, but not breakage. Still, it's a good reminder that all those PCs which now use Windows Update and don't use Opera or Firefox will have a bit of a different experience next week. Source info at Active Content Center... lots of people are modifying these ideas, one search term is here. Update: [Additional blogsearch terms: eolas, patent, activex, Active Content] Posted by John Dowdell at 09:40 PM | Comments (2) | TrackBack Linux Nano Linux Nano: It sure is a gender-bending week for computer operating systems... "Linux on my desktop, workstation, laptop, Tivo, and router. I had to have it on the Nano, too. Here's my report how I converted my stock iPod Nano into a dual-booting, sweet MP3-singing, iDoom-playing monster." Posted by John Dowdell at 12:40 PM | Comments (0) | TrackBack March 31, 2006 Flash coup Flash coup: uh-oh, this could be bad news... I just had a thousand new business cards printed: ." (My point with all this Foolishness? Here. We humans are a flawed lot, but skepticism may be our most valuable trait....) Posted by John Dowdell at 09:36 PM | Comments (1) | TrackBack VRML becomes mandatory VRML becomes mandatory: It is now standard, for websites. ISO-approved, no less. Many sites will probably implement this over the next week, on principle alone, just as they've already switched to PNG instead of JPEG or GIF. I must have missed the memo on this one.... Posted by John Dowdell at 09:25 PM | Comments (1) | TrackBack MS web plugin MS web plugin: Hey, this sounds significant... Microsoft's Steve Ballmer says: ." Bill Gates has more. Sounds impressive, if they can bring it to fruition.... Posted by John Dowdell at 09:18 PM | Comments (2) | TrackBack More SF events More SF events: Please pardon the regional chauvinism, but the San Francisco Web Innovators Network will be meeting in the Adobe building at 7th & Townsend on Thu April 13... keep an eye on Niall Kennedy's Tech Sessions too, if you're trying to network with people interested in pushing the edge. Posted by John Dowdell at 03:02 PM | Comments (0) | TrackBack Another Eolas wrinkle Another Eolas wrinkle: Earlier this week Microsoft announced that they'd offer a switch to defer the expected April 11 installation date, and today Mark Swords of the patent-holding firm laments all the work people around the world are doing in complying with this set of events. ... ... ... I've been sitting here five minutes now trying to figure out how to end this paragraph without giving Adobe Legal a heart attack, but this is the best closing line I've got. ;-) Update: [Additional blogsearch terms: eolas, patent, activex, Active Content] Posted by John Dowdell at 02:37 PM | Comments (3) | TrackBack March 30, 2006 Lots of links Lots of links: Lots of tabs & windows open in my browser, mostly with content that did not appear in MXNA (although Samurai Kittens is, like, really freaking me out)... hit the extended entry for varied interesting links.... Tips on optimizing weblogs for higher placement in a range of search engines. Flaraby offers Arabic text in Flash Player, now in beta2 and free... more info here. Robert Reinhardt had one of the most interesting takes on Microsoft's MIX06 event last week -- he was a speaker at one of the sessions. WPF/E guy Joe Stegman has a blog, and even Wikipedia sounds a little confused about how the talk relates to the eventual reality. Tim Anderson seems to be the most diligent in understanding the talk -- here he seems to imply a fullsized WPF, the WPF-Compact, and then WPF/E as something like a WPF-Tiny -- but I'm now sort of waiting until they commit to a ship, myself. AppleInsider seems to suggest, with its "Despite rumors to the contrary" lead, that part of the reason Scott Byer's MacTel essay got such heavy linkage was that it contradicted a ThinkSecret "sources say" piece awhile back. Check your source evidence, best longterm cure. I'm not sure, but this reads like PGP encryption has been comprompised... the press release cites password-recovery on an intranet network, but the same distributed processing could occur on a stolen botnet as well. Claus Wahlers has implemented his DENG multiformat renderer in Laszlo development workflows to SWF. The latest campaign from Rebecca MacKinnon feels increasingly strange to me... leading with describing the head of Yahoo as "spewing excrement", responding to his "we think the balance makes things better" with "tell it to someone in jail"... something doesn't smell right about this deal, and I don't see full finance/influence disclosures on her blog. Maybe my view is colored by knowing prior CNN influences or underreported cooperation stories, might color my judgment. Just feels like there's something odd here, pieces don't seem to me to hang together, different groups pushing and pulling over how various group endeavors should act.... Notes on Casual Gaming session at GDC... development funds will more likely come from sponsorship and product placement... piracy in Asia helped push towards more online-connected gaming... gaming supply is quite high, so developmental efficiencies, good distribution & business modesl will likely be key. (Darrel Plant has a photo of a recruiting poster there for Flash & Director developers.) I don't remember how I pulled this site, and haven't had the chance to research it, but here's an interesting-looking list of satellite TV coverage in North American continent. It's been six years since Liquid Motion faded away. A mobile report says that it's the actual user interface which is the gating factor towards full use... this is hard to bake into a box, universal for all audiences... lots of support behind "experience matters" these days.... Arul Prasad has the first comment I've seen with an official "Adobe Flash Player" sighting. Posted by John Dowdell at 01:24 PM | Comments (1) | TrackBack March 24, 2006 Flash/MacTel wrap Flash/MacTel wrap: I like the way this MacFixIt summary is organized... first they offer the link to the version-test page, then identify 8.0.17 as the early Apple preview, 8.0.22 or 8.0.24 as the security updates for Motorola Macs (which must run under emulation on Intel Macs), and 8.0.27 as the official MacTel preview, to tide us over until the full 8.5 release for all platforms later this spring. Posted by John Dowdell at 01:06 PM | Comments (0) | TrackBack March 13, 2006 Lots of links Lots of links: Boombox sneakers and houseware telepresence... eBooks, Ajax, John Denver, Visual Basic, lots more links that stayed open in my browser over the weekend, in the extended entry. If you're travelling light you may not have a good pocket for an MP3 Player, so why not put it in your shoe? Might as well put some small sneaker speakers in there too. Me, I'd probably record some munchkin voices saying "Hey, you big galoot, watch where you're walking, you almost squashed us!", but then, each of us has our own little oddities..... People made fun of these Lovers' Cups last week, but I think there's a real angle in simple household objects which naturally inform you of distant events... the single example may not hold, but I think the general principle will. Slashdot had a rework of current attitudes on eBooks... I've scanned it a few times but can't summarize patterns... part of me wonders about the future for longform text in general, but now that reading devices are reaching a friendlier form factor I've got to believe this will take off sooner or later. Internet hunger strike: "Guillermo Farinas, a 41-year-old psychologist, went on a hunger strike on Jan. 31 to press Cuba's Communist authorities to respect his right to freedom of information and allow him Internet access, which is controlled by the government." Castro replies that the reason is limited bandwidth with their satellite relays. His condition is deteriorating, updates here. Burritobot collects reviews of San Francisco taquerias. Meanwhile, CNET bought Chowhound... lots of great behind-the-scenes info in this interview. There's a lengthy essay here comparing Ajax Frameworks for ASP.NET... I've made two passes through it but don't feel I can explain the concept of "indirect Ajax programming" (best guess is that it's "you never type 'XmlHttpRequest()' yourself", but I suspect there's an additional qualifier hidden within the text)... it's a lengthy piece of work, which I respect, but the browser dependencies section still just deals with browser brandnames, rather than also their version and OS cofactors, much less how the JavaScript libraries support visitors in non-compliant browsers. Slashdot argues over Visual Basic history/use... VB made forms for early Windows apps, and then got over-complexified, and even had a backwards-compatibility chasm... in some ways Flex reminds me of the original strengths of Visual Basic, being approachable and fast, although having a wider audience and being more savvy of remote services. Simple brainpower boosts -- do something different. Now that the consensus is that adult brains can indeed grow new cells, techniques like these can spur cell growth in general, and I guess we're hoping that this growth can then be steered in profitable directions.... This "Adobe mobile" article got syndicated a bit last week, but there's one line in there I particularly like: "Flash does for mobile devices and content creators what it did for computers running on various operating systems. It provides a neutral platform for displaying rich media content." All of these Adobe engagement technologies, from PostScript printers to video-editing to web browsers to network applications, they're all neutral to the OS differences (MS vs Apple) and the service differences (Google vs Yahoo). Kevin Kelly put together an annotated catalog of different news-discovery services, such as Digg, Newsvine, del.icio.us and more. Jon Udell writes: "Why can't the standard description and the standard implementation be the same thing?" It is, when you don't start with the file format before the implementation (Flash, Acrobat, MacOS, etc). But I think he may have a qualifier in there "for technologies which have multiple implementations", which would make it more like "How can you have a single implementation for things which have multiple implementations?", or something like that. If so, maybe one trick is to stay a few years behind on using new features of the various implementations... it took a few years to browsers to render HTML 2.0/3.2 the same, then a few more years to get most of the older CSS requirements in compliance with each other... staying a few years behind the curve is one proven way to get similar performance from multiple clientside implementations. Lots of pretty money origami I found while musing on the high hype level of a Microsoft product last week. Bruce Tognazzini dissects the airplane interface that turned a Rocky Mountain High into a Monterey Bay Low. Posted by John Dowdell at 01:16 PM | Comments (1) | TrackBack March 07, 2006 Amazing Origami Photos!! Amazing Origami Photos!! I'm just catching up -- been in jury duty much of last week -- and I've been seeing a whole bunch of links on Memeorandum, interspersed among the "Fox Interactive buying Google!" posts, so somehow I just couldn't resist.... ;-) Posted by John Dowdell at 05:21 PM | Comments (2) | TrackBack March 01, 2006 FlashForward photos FlashForward photos: The link goes to the Flickr tag... they're beating out WebDU photos, although there's a lot of straight tourist shots in the FForward group. If you're in conference mode, then here's the FlashForward search term on MXNA, Technorati, and on IceRocket, each with links the others haven't indexed. Posted by John Dowdell at 04:42 PM | Comments (3) | TrackBack Quick links Quick links: Stuff found while seeking something else... exercise grows neurons... hidden passages in your house... more, in the extended entry. Exercise triggers brain growth by releasing brain-derived neurotrophic factor (BDNF), which spurs growth of new brain cells. We used to think humans didn't grow brain cells, but that's because we examined the brains of primates locked up in cages who lacked both exercise and novel stimulation. Use it or lose it, bigtime. HiddenPassageway.com supplies a range of clandestine solutions for your living needs... site in SWF UI. Press release of a study about how people still prefer to watch video on their home system in the living room -- the sitback experience -- and that this tendency even *increases* among those who have grown up with computers. Hints from Mena Trott about where their blogging software/service is going... more media types, more customization for readers, more emphasis on the user experience. Adam Green covers some of the sociology behind Memeorandum.com, and proposes a test to confirm his hypothesis of linking patterns. Slashdot talks of wall paint which blocks mobile transmissions, a new book about "AJaX" (skeptical replies, with a request for offline work), and a viewpoint on how search engines encourage garbage when combined with an advertising program (see Wall Street Journal). A design contest cosponsored by Adobe. Some debate about the role of corporate investment in opensource projects, as well as speculation about how some are being purchased. Greg Costikyan muses about anti-theft mechanisms on a game he is distributing via CD. Molly Holzschlag described how some are whiners, some are lonely, and some crave understanding rules that others do not... more via Paul Boag (who also has a good definition of "web standards", it's basically HTML for layout, CSS for styling, and JS for interactivity, so you don't need to junk GIF for PNG -- main goal is the normal separation of data from presentation). Geoff Stearns has been logging anecdotes about the user experience and design experience of the new Internet Explorer version. Matt Haughey missed the obvious title of "iPad".... ;-) Dave Shea has tips on public speaking, particularly for a webtech crowd. Posted by John Dowdell at 03:41 PM | Comments (0) | TrackBack Recursive critters Recursive critters: Novelty link here... a hardware company is releasing a computer whose case is in the shape of a seven-inch-tall plastic penguin. It contains a single-board computer called "Fox". So the penguin contains a fox, which runs Linux, which gives you another penguin. Then I guess you can run Firefox on the computer, which gives you a fox within a penguin within a fox within a penguin. Then, if you call up a page which has a picture of Arctic birds, then... okay, I'll stop now, but you get the idea. ;-) Posted by John Dowdell at 08:11 AM | Comments (0) | TrackBack February 28, 2006 More links More links: Various interesting items, only some of which have come through MXNA so far. Hit the extended entry for gloss & links. Singapore guide, in SWF, for PocketPC use. Ten-page article (short pages ;-) at informit.com on things the writer particularly likes about the beta Adobe Lightroom, a photo-management application. Robert Hall has info on David Lynch's new SWF-based production. A long discussion via Roger Johansson about various ways of handling noise while working. John Rhodes has a short bit on the dynamic tension between playing-by-the-rules and breaking-the-rules when designing interfaces... he titles it "Eye Candy and Creativity Constantly Beat Down Web Standards". David Adams summarized some of the recent news about Flash Lite two weeks back. Jakob Nielsen is advising against the way that links to named anchors are often used. Lots of people are building applications atop Flash Platform... today ChatBlazer announced their service for text, audio and video chat with a number of enterprise features. Speaking of chat, Jon Udell publishes an audio-chat with screensharing, where Christophe Coenrats does 20 minutes on Flex. In the first section he shows how easy it is to declare a messaging interface... towards the middle they get into how the serverside element adds to the clientside interactivity... they close out with some discussion of the Eclipse-based FlexBuilder development environment. If you're in the UK, Adobe has a road show of the authoring tools coming up. There are various reports today that Google has been quietly testing video ads delivered as SWF. Jen deHaan has notes from FlashForward, Seattle. An intro to the use of personas during the design process... by defining fictional customers who represent specific audience elements, you can often minimize abstract arguments when trying to settle on a design with a group of coworkers. Jason Fincannon: ." Posted by John Dowdell at 01:53 PM | Comments (0) | TrackBack February 22, 2006 Funny headline Funny headline: Ran across this at CNET: "Congressman quizzes Net companies on shame". Wish I were there, I always do good on experts' true-and-false quizzes.... ;-) (If you're interested in such things, then search term "able danger china" is turning up much under-reported news this week.) Posted by John Dowdell at 04:25 PM | Comments (0) | TrackBack February 21, 2006 Lots of links Lots of links: My browser has windows full of tabs, and I don't want to click that little red X to close them out without at least logging them here... more in the extended entry. Ballmer on mobility, the Microsoft keynote at 3GSM. Requires Windows Media Player to view. (I haven't had the time to invest watching this, so if you've got any observations after watching it then I'd appreciate hearing, thanks.) SYS-CON has a call for papers on "Rich Internet Applications -- AJAX, Flash, Web 2.0 and Beyond". Deadline for submissions is mid-April, but I'm not sure of time & place yet. Max Shuleman had a cute line in his essay "Putting AJAX in Perspective": "There have been attempts to add "richness" to the standard HTML "experience". Macromedia Flash brings us all the way up to the level VB programmers enjoyed in 1992. And if someday Sun people pull their collective head out of their collective asses and deliver simple to install and thus usable Java on the desktop, it will rule the world. Meanwhile the current meme is the AJAX - the attempt to raise Javascript silliness to the level of application frameworks." I don't know if I could defend that "Flash 06 = VB 92!" stance to others, but it gave me a kick.... ;-) Dion Almaer has an audio interview with someone from Tibco, an IE-only JavaScript library. Dion posted his interview questions; if you've got notes on the audio answers then I'd appreciate a summary, thanks. Niall Kennedy has a great few paragraphs on the vital difficulty of simplicity... the real key to everything, I think, is in making interfaces which are natural and easy for diverse audiences to use. Niall's also hosting an office app faceoff at CNET in SF this Thursday. Here's a list of forbidden emoticons, so you'll know what not to send in email. And, as an equal-opportunity blasphemer, I finally found the lyrics to "He's Giovanni Montini, the Pope", in waltz time, chord progression I V I I, I V I I, I V I vi, ii V I I. The first-ever "Sex in Video Games" conference will be held in San Francisco in June... I wonder if they'll have a game of Twister set up in the hall.... That "Flash controls your webcam" meme is still spreading around... fortunately, Jack Schofield of The Guardian did do some quick web searches before publishing, so he has a link to source info in there. Oddest comment: "flashplayer not the only new player group called NEW ORDER creating information resevoirs using prisoners inside penal institutes via internet and phone technology...." Now that you mention it, Jonathan Gay does look a little like Adam Weishaupt.... ;-) LiveJournal seems to have a lot of discussions like this recently, about warez infections... I think their solution is to go where a stranger says, which doesn't seem like the strongest advice to me. US movie studios are apparently suing Samsung because they once produced a DVD Player which didn't respect their privacy bits. I suspect this is mostly a legal move, to establish that they're indeed trying to protect their intellectual property... hardware prohibition is like other prohibitions, it just increases the incentive to enter the greymarket. Om Malik hits a sensitive point, in discussing online video services: "I believe that the growing popularity of You Tube and other online video sites has less to do with amateur content, and more to do with copyright infringing content... I wonder how many people actually visit You Tube to watch broadcast content online." I think we'll eventually get to a place where it's easier & cheaper for small groups on small budgets to produce audio/video content which captures significant audience interest, but these days it's still strange to see how those who don't buy into BigCo stores still buy into BigCo content... I mean, and I hope this isn't a shock to anyone, Britney Spears is not actually much of a singer, even though she's at the tops of the warez charts. I guess this is a good place to link in the Rice Krispies theme song, too... I like the way three singers interweave their lyrices in the final go-round. Getting back on-topic, Marcus Alexander had a piece earlier this month on diagramming interactivity... it's easy enough to storyboard a linear presentation, or to wireframe a site navigation, but more complex interactivity requires a stronger set of visualization techniques. The lost camera story seems to be spurring some net vigilantism reminiscent of Dog Poop Girl. A Microsoft Product Manager proudly shows off a new feature, but after getting Slashdotted, there's just a long list of comments about how ugly the interface looks. Some days ya just can't win.... ;-) A discussion on Google, Measure Map and privacy correctly notices that many online services are involved in third-party content on websites, which raises the ability to do some tracking of some visitors across multiple sites. I'm not sure why the author singled out Measure Map, though... AdSense, Amazon badges, lots of other off-site content all contributes to a trackable web. (I have no reason to suspect that Google is collating these various bits, but just know that it will be a constant temptation to do so... centralization creates attractive targets more quickly than decentralization does.) Posted by John Dowdell at 04:08 PM | Comments (0) | TrackBack February 20, 2006 Waterfall 2006 conference Waterfall 2006 conference: Held in London on, uh, April 1 2006. Includes sessions like "Pair Managing: Two Managers per Programmer" and "Slash and Burn: Rewrite Your Enterprise Applications Twice a Year". There's lots of ways that humans can do work together, and here's a good dissection of some of the ways that don't.... ;-) Posted by John Dowdell at 08:07 AM | Comments (2) | TrackBack February 16, 2006 SE/30 + HyperCard SE/30 + HyperCard: There's no law against it, and they're consenting adults, so why can't they have fun with old gear? "You can say what you want about its cramped, nine-inch, black-and-white monitor and its snail's-pace 16MHz Motorola 68030 processor, but it's impossible to keep yourself from grinning once you start monkeying around in Hypercard, an easy-to-use program that inspired Macromedia Director, Flash and the World Wide Web." Posted by John Dowdell at 07:41 AM | Comments (3) | TrackBack 03:49 PM | Comments (0) | TrackBack 12:47 PM | Comments (2) | TrackBack January 24, 2006 January 19, 2006 MacTel ports MacTel ports: This CNET interview with Adobe CEO Bruce Chizen is still the best resource I know for estimating completion of new Intel-based Macintosh products -- I haven't seen any more recent or more detailed announcements yet. (The reason I'm pointing to this again is the subject hit various blogs this morning, and a comment I made to the PS blog on my morning shift hasn't made it through their comment-moderation process yet. (Tip: If a comment needs an email response, better to put that in the header, not as afterthought.)) Anyway, last August Bruce Chizen said that it would be more likely to build a port for the new hardware into a new full software release, rather than port for only half a product cycle. Impact: If you're buying a new architecture, it can take awhile to get native apps, so checking against Apple's Rosetta emulation would be advisable, at least for the near term. Posted by John Dowdell at 01:06 05, 2006 07:45 AM | Comments (9) | TrackBack December 20, 2005 More Top Changes in 2005 More Top Changes in 2005: Building atop the prior items, here are some more significant changes of the past year, all in my own opinion. 2005 saw the widespread acceptance of the need for both clientside and serverside interactivity -- the acceptance of the Rich Internet Application approach. This was formalized by the widespread press buzz around "AJaX" -- the ability to refresh text independently of presentation isn't a new thing for HTML browsers, so the attention paid to AJaX actually signified general acceptance of the R
http://weblogs.macromedia.com/jd/archives/miscellaneous/index.cfm
crawl-002
refinedweb
28,756
61.36
Welcome ‘forms’ as we currently know them. Plus, we’ll be taking a sneak geek-peek at how your code will change in the next version of Visual Basic. And boy, will it change. So, strap in tightly and brace yourself for another whirlwind tour of VB.NET… Windows Forms are essentially a more advanced version of forms as we know them today. And they bundle with a load of pretty cool functionality that enable you to build some darn advanced screens. Top Tip: The name ‘Windows Forms’ may change by Beta Two. Microsoft haven’t yet fully decided on a name. They originally christened this baby ‘WinForms’, then realised they’d be breaching some serious trademark turf. So, it’s still in the air – prepare for change.Again. Well, instead of boring you with a technology thesis, let’s jump straight in and explore Windows Forms… - Launch VB.NET - On your Start Page, click ‘Create New Project’ - Under ‘Visual Basic Projects’, select ‘Windows Application’ - Change the Name and Location, if required - Hit the OK button Hurrah – You’re looking at a Windows Form! Top Tip: Look at the Solution Explorer. See how the form filename is Form1.vb? All Visual Basic code – whether we’re talking about forms or class modules – are stored as .vb files. The code inside that file describes what it is and does. Now, click on Form1 and have a quick scroll through the Properties window. Ohhh, a few changes there. The Caption property is now known as Text. The Font property is broken down into Name, Size and such (hurrah!). Oh, and there’s an IsMDIContainer property for building MDI apps. Top Tip: .Caption properties have gone inVB.NET. You’ll find they’ve all been standardised to .Text. You’ll also findthat .Tag properties have disappeared. Turn your eye to the Toolbox on the left of your screen. Click the ‘Win Forms’ box and stare in amazement. Well, maybe. Yes, these are all the new control toys you get to play with in VB.NET! Scroll down that list using the down arrow near the bottom of the Toolbox. You’ll find more ‘intrinsic’ controls than ever before. Let’s meet a few. Add a Label to Form1, the same way you would in VB6 Try changing the Font and what was previously the Caption property. No major changes yet – so use this opportunity to dab your brow. Now VB.NET also bundles with the regular control crew; Button (aka CommandButton), RadioButton (formerly OptionButton) and GroupBox (previously Frame). Oh, and of course the TextBox, CheckBox, PictureBox, ListBox and ComboBox – which are at least a little more self-explanatory. Try adding each of the above controls to your form and playing with their core properties Top Tip: You’ll notice the Shape control has disappeared. Uhm, yes. However you can still add pictures to your form – and ‘draw in code’ using something called the System.Drawing.Graphics namespace – more on this later! In this list, you’ll also find a hot bunch of controls you wouldn’t usually find on the Visual Basic 6 Toolbox. For example, you’ll notice the DateTimePicker, ProgressBar and ListView controls controls you’d usually have to ‘bring into’ your application using the Components menu. Now have a play with any controls you think you’ve seen before and know what they do Top Tip: To see how your controls look likeat runtime, press F5 to compile and launch your application – just as in VB6 In addition to all this, you’ll find controls there you’ve never seen before. Even I don’t know what hey all do – still, let’s skim over a couple of the most important. First off, there’s the MainMenu control. This is essentiallythe old Menu Builder. Let’s use it. - Add the MainMenu control to your Form - On your Form, click in the box that now says: Type Here - Type in: &File - Now add a few sub-items to the new File menu - Expand out by clicking in the ‘Type Here’ box to the right of ‘File’ – and add a number of menu - Press F5 to run your app and test your new menu Top Tip: Enter a single dash to add aseparator to the menu And you can add code to these menu items in much the same way as you would in VB6. Just double-click the item and enter your jazz in the code window. But we’ll be looking at all that later. Next up, let’s look at the LinkLabel. This is a control design to look like a Web page hyperlink – by default it’s an underlined blue, your mouse turns into a hand when you hover over and it changes colour upon being clicked. But it isn’t linked to a Web site by default – when you click it, the code under the Click event runs. Add a LinkLabel control to your FormHit F5 to run and test your new LinkLabel Top Tip: Try checking out the LinkBehavior property for even more LinkLabel effects! Elsewhere – and I personally find the ErrorProvider an exceptionally cool control. It will automatically highlight controls with an icon if a validation error occurs. Here’s an example of it in use: Also, the likes of ToolTips are handled differently in VB.NET – enter stage the ToolTip control. Plus, those Windows Open and Save dialogs are now accessible as ‘intrinsic’ controls. Oh, and the TrayIcon control allows you to simplify adding your own icon and menu to the system tray. And the HelpProvider control allows you to easily implement helpfile access. The list goes on! And alas in this tutorial, there’s no time to cover them all in intricate detail – but if you are looking to find out more, check out the help. Top Tip: Looking for assistance? Simply click the ‘Dynamic Help’ button just under the Properties window. For now, let’s move on to exploring a couple of the new and groovy form features… Now this is the fun bit. So perhaps I shouldn’t have dedicated a whole page to these things they call ‘Anchor’ and ‘Dock’…: - Click on TextBox1 and view its Anchor property (under Layout) By default, the control ‘anchors’ to TopLeft. In other words, it remains at a constant distance from the top and left sides of the form. Let’s change that: - Change the Anchor property so Top is unselected and Left, Right and Bottom are selected The property text should change to ‘Bottom ‘stick’ to a side of the form – or with the ‘Fill’ ‘inherits’ its layout (and maybe even its code) from another’master’ form. Let’s pretend you have a common set of features on more than one form. Perhaps I’m talking about a ‘OK’ ‘common elements’, I’ve added a LinkLabel that ‘anchors’ to BottomRight, an ‘OK’ Button that anchors to BottomLeft. Oh yes – and a simple Label bearing the name of my application. And it all looks alittle like this: Now before you can ‘inherit’ a form, it needs to be ‘built’ (sort of a mini-compile). Don’t look at me, but you have to do it. Let’s go: - From the Build menu, select Build Next up, let’s inherit that form: - Click Project, Add Inherited Form - Ensure ‘Inherited Form’ is selected, then click OK - In the list that appears, select your Form1 and click OK - If Form2 does not automatically appear, double-click on it in the Solution Explorer - Add a few TextBox controls to Form2: Have a quick browse around. This is where you can change the Assembly name (what we used to call the ‘Project’ ‘override’ certain pieces of functionality – for example, the code behind the ‘OK’ Button could be determined by Form2, even though the visuals come from Form1. If you’re eager to learn more, check out the help. ‘View ‘plus’ and ‘minus signs to the left of your code window. You can also define your own ‘hideable’ regions using the #Region statement. Check out the help for more information. ‘Names ‘organising’ of classes has a number of advantages. For a start, uhm, it’s organised! You also avoid naming conflicts and gain a common ground throughout all languages. However by default, all commands in the Microsoft.VisualBasic ‘namespace’ are ‘imported’ by default, meaning you only have to use their name and can skip the Microsoft.VisualBasic prefix. Top Tip: A ‘namespace’ is imported by either specifying ‘Imports Whatever.Whatever’ within your form or component – or by specifying Imports in the Project Properties. Another Top Tip: Don’t get confused when people talk about ‘Imports’. It’s just a way to save you typing all those lengthy prefixes. In fact, it’s very much like the ‘With’ statement you already know and love. You do love it, don’t you? So if we don’t need to use the Microsoft.VisualBasic ‘namespace’ – ‘import’ it or reference it using the full ‘namespace. Confused? You will be. Let’s recap. Namespaces are a naming scheme to help organise the various classes available to our application. And you can access the commands of some namespaces that are ‘imported’ by default without having to type all those whopping great prefixes. Don’t forget, new namespaces will step onto the scene. And although we’ve covered some of the most important right here on this page, your ‘V ‘clicked’, ‘New’ ‘Try…Catch…Finallystatement’ section and test the example provided. Default ByVal – By default, all parameters are now passed ‘by value’ as opposed to ‘by reference’. To be safe, make all declarations explicit It’s No .Show – There’s no longer a simple Form.Show method. Everything in VB.NET is an object – so you need to actually ‘Dim FormName As New Form1’, then do a ‘Form ‘live’ for a few minutes before being terminated by the Garbage Collector – so you can never be too sure when class termination code will run! Strange though it may seem, this ‘nond!
https://www.developer.com/microsoft/visual-basic/vb-net-uncovered-big-changes/
CC-MAIN-2022-40
refinedweb
1,673
72.56
I have a streamlit app that displays a pandas styler object created from a dataframe. It is not a particularly huge dataframe, about 300 rows, and the styler just loops over columns and highlights them good/great/improve based on their values. To generate the styler takes no time at all, but once it gets displayed on screen, the google chrome renderer starts eating massive amounts of CPU to the point where the dashboard becomes unusable exceeding 100% cpu usage just trying to scroll down the dataframe. I don’t really understand this cos I would have thought at this point, no more code is being run, and it implies it is literally struggling to just render this dataframe? When I switch back to a dataframe instead of a styler, the performance immediately improves dramatically. Has anyone come across this or have any ideas what might be causing this? Here is an example of one of the styling functions. def highlight_overall(numbers): highlight_list = [] for i in numbers: if i >= 80: highlight_list.append("background-color: #99DEBB") elif i < 70: highlight_list.append("background-color: #ffbb9e") else: highlight_list.append("background-color: #fdff9e") return highlight_list Here is a graph of my CPU usage when trying to scroll on the styler
https://discuss.streamlit.io/t/very-high-cpu-when-displaying-pandas-styler/28545
CC-MAIN-2022-33
refinedweb
206
62.17
Eclipse Community Forums - RDF feed Eclipse Community Forums Query problem with IS NULL <![CDATA[I have a problem JPQL querying. when asked whether an item is null and also asked his name, the query returns only the values that have the name, null values are omitted, but I also want null values. my entities are similar to these. public class Activity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String info; @Temporal(javax.persistence.TemporalType.TIMESTAMP) private Date dateOfEvent; @OneToOne private User user; ... getters and setters... public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String username; private String name; ...getters and setters... My query is... SELECT a FROM Activity a WHERE a.user IS NULL OR a.user LIKE :name For example. If i have |Activity| |id,info,user,...| |1,act1,user1,...| |2,act2,user1,...| |3,act3,NULL,...| |4,act4,user1,...| |5,act5,NULL,...| only 1,2 and 4 are return, but i want 3,4 also]]> a juan 2012-11-08T23:39:52-00:00 Re: Query problem with IS NULL <![CDATA[Hello, Using a.user in the query forces an inner join to be used. What you will need to do is use an alias in the query, and define the alias with an outer join. "SELECT a FROM Activity a left join a.user user WHERE user IS NULL OR user LIKE :name" Best Regards, Chris ]]> Chris Delahunt 2012-11-09T22:19:12-00:00 Re: Query problem with IS NULL <![CDATA[ perfect, thank you very much, I had spent many days trying querys only one note user LIKE :name, is changed to user.name LIKE :name]]> a juan 2012-11-12T21:20:58-00:00
http://www.eclipse.org/forums/feed.php?mode=m&th=432235&basic=1
CC-MAIN-2016-40
refinedweb
300
60.82
NIS+ security is an integral part of the NIS+ namespace. You cannot set up security independently from the namespace. For this reason, instructions for setting up security are woven through the steps used to set up the other components of the namespace. Once an NIS+ security environment has been set up, you can add and remove users, change permissions, reassign group members, and perform all other routine administrative tasks needed to manage an evolving network. The security features of NIS+ protect the information in the namespace, as well as the structure of the namespace itself, from unauthorized access. Without these security features, any NIS+ client could obtain, change, or even damage information stored in the namespace. NIS+ security serves two purposes: For example, a given NIS+ table may allow one class to both read and modify the information in the table, but a different class is only allowed to read the information, and a third class is not even allowed to do that. This is similar in concept to the operating system's file and directory permissions system. (See Authorization Classes for more information on classes.) Authentication and authorization prevents someone with root privileges on machine A from using the su command to assume the identity of a second user who is either not logged in at all or logged in on machine B,. The following figure details this process. Figure 7-1. Summary of NIS+ Security Process. This illustration shows a representation of the NIS+ security process. NIS+ principals are the entities (clients) that submit requests for NIS+ services. An NIS+ principal may be someone who is logged in to a client machine as a regular user, someone who is logged in as root user, or any process that runs with root user permission on an NIS+ client machine. Thus, an NIS+ principal can be a client user or a client workstation. An NIS+ principal can also be the entity that supplies an NIS+ service from an NIS+ server. Because all NIS+ servers are also NIS+ clients, much of this discussion also applies to servers. NIS+ servers operate at one of two security levels. These levels determine the types of credential principals must submit for their requests to be authenticated. NIS+ is designed to run at the most secure level, which is security level 2. Level 0 is provided only for testing, setup, and debugging purposes. These security levels are summarized in the following table. Note: Use Web-based System Manager, SMIT, or the passwd command to change your own password regardless of security level or credential status.
http://ps-2.kev009.com/wisclibrary/aix51/usr/share/man/info/en_US/a_doc_lib/aixbman/nisplus/secur_nisplus.htm
CC-MAIN-2022-33
refinedweb
429
53.41
New submission from Michael Hipp <michael at redmule.com>: A local *unexecuted* import appears to be changing the namespace. Attached files are ready to run. # over.py SOMETHING = "overridden" # main.py OVERRIDE = False SOMETHING = "original" def main(): #global SOMETHING # uncomment and it works if OVERRIDE: from over import SOMETHING # comment out and it works pass print SOMETHING # UnboundLocalError: local variable 'SOMETHING' referenced before assignment The SOMETHING variable has a value from the module global namespace, but it gets lost due to an import that is never executed. I would think an unexecuted statement shouldn't have any effect on anything. The second file will have to be submitted in a follow-on, it appears ---------- components: None files: main.py messages: 151635 nosy: hippmr priority: normal severity: normal status: open title: Unexecuted import changes namespace type: behavior versions: Python 2.7 Added file: _______________________________________ Python tracker <report at bugs.python.org> <> _______________________________________
http://mail.python.org/pipermail/python-bugs-list/2012-January/157507.html
CC-MAIN-2013-20
refinedweb
151
55.44
Hello all and thank you for keeping this forum up and running, I am new to this and only just introduced myself here. However, I have my first problem at hand. Trying to run some simple if statements (I am a noobie to Java), I ran into this error: My code was as follows:My code was as follows:--------------------Configuration: AnotherAgeCheck - JDK version 1.7.0_01 <Default> - <Default>-------------------- How old?65 Coupon?Exception in thread "main" java.lang.NullPointerException at AnotherAgeCheck.main(AnotherAgeCheck.java:15) Process completed. import java.util.Scanner; class AnotherAgeCheck { public static void main(String args[]){ Scanner myScanner = new Scanner(System.in); int age; double price = 0.00; char reply; System.out.print("How old?"); age = myScanner.nextInt(); System.out.print("Coupon?"); reply = myScanner.findInLine(".").charAt(0); if (age >= 12 && age < 65) { price=9.25; if (reply == 'Y' || reply == 'y') { price -= 2.00; } }else { price = 5.25; } System.out.print("Pay $ "); System.out.println(price); System.out.println("Enjoy!"); } } I really don't get what's missing. Can somebody help me out? Thank you very much
http://www.javaprogrammingforums.com/exceptions/12449-problem-java-lang-nullpointerexception.html
CC-MAIN-2013-20
refinedweb
179
54.39
I am trying to parse text and run an sentiment analysis over the text from multiple websites. I have successfully been able to strip just one website at a time and generate a sentiment score using the TextBlob library, but I am trying to replicate this over many websites, any thoughts on where to start? Here is the code: import requests import json import urllib from bs4 import BeautifulSoup from textblob import TextBlob url = "" html = urllib.urlopen(url).read() soup = BeautifulSoup(html) # kill all script and style elements for script in soup(["script", "style"]): script.extract() # rip it out # get text text = soup.get) wiki = TextBlob(text) r = wiki.sentiment.polarity print r Thank you in advance
https://www.howtobuildsoftware.com/index.php/how-do/k4y/python-web-crawler-sentiment-analysis-how-to-iterate-over-many-websites-and-parse-text-using-web-crawler
CC-MAIN-2020-10
refinedweb
117
64.41
Nothing would have to be "installed". They will all be standalone applications. The applications should have a specific file which will be indexed by the OS so that it knows that its an application. Everything should be possible from a keyboard shortcut - shutdown, etc. Kinda like quicksilver. And it should be aesthetically beautiful. A lot of applications would be included by default, like pdf reader/editor, a decent graphics editor, office.. Like nepomuk and nepomuk folders part of what KDE4 is doing (you wont see it being useful until 4.4 or 4.5, because of the current nepomuk backends) or Windows 7's Libraries? The nepomuk one is more powerful, IMHO. I use it now. You can have a folder that's just a nepomuk folder, like smart folders in Mac OSX. Allready done in Os X. [q]. Allready done in BeOs. I'd just fork the Linux kernel, add a standard driver abi so they don't need updated anymore, ship with a minimal desktop, and kill dependencies forever. All software you get will be one file that already contains dependencies (the security isn't necessary for an average user anyway, it just makes them suffer when they need something not provided by their distro.). Then all annoyances would be solved and it would actually have a chance. And throw in an X replacement somewhere in there.. Nvidia has flat out stated that they don't want to open the core of their driver. Some companies don't want to open source their drivers because they don't want unsupported drivers floating around. They don't like the idea of someone running Joe Schmo's modfied driver and then calling the company when something goes wrong. But as I said before the reasons are irrelevant. Hardware companies prefer to provide binary drivers that last throughout the life of a system. Linux devs can choose to work with this preference or against it.. In terms of Linux based platforms, the OS developers are doing all they can to make it easier for hardware manufacturers. Kernel and Xorg folk will write the drivers taking development costs away from the vendor. The linux driver project provides a point of contact for hardware manufacturers rather than them having to figure out if they talk to Linux, Xorg, Alsa or some other project that provides direct hardware support. Free platform support in exchange for the minimal interface specs to write drivers against; how much easier for the hardware vendor can it get? This is like your neibour saying; "point out where the endge of your driveway is and I'll shovel the snow out of it each morning while I'm doing mine" - 'I'm sorry, that's too complicated, I'll keep shoveling my own driveway." It's completely unrealistic to think that they will continue to maintain every driver in existence for Linux, and that the ones they do will always work perfectly for every release. It could still be argued that having people continually update drivers instead of just being able to use the same ones is a waste of resources. We should be so lucky as to have interface specs overwhelmingly provided by hardware manufacturers. Aren't driver issues now managed like a bug found anywhere else in the kernel source tree? The glut of hardware supported natively in the kernel is staggering even if it's not 90% of desktop latest hardware. I still like the example of Creative who started an open source X-FI driver then chose to hand it off to Alsa with full documentation. When they lost interest in the project, they performed a project lead's final duty; find a new project lead to carry on. Because Vista and Win7 have very similar software stacks. I know that certainly wasn't true with the XP-to-Vista transition; I interned with the County Governement in undergrad, and I was there when they moved from XP to Vista for many of their machines. There was a sizable minority of devices and programs that we just could not, for the life of us, get to work with Vista (or that caused unreliable behavior, or could crash the system -- thanks, Norton AV). And "devices" is not just graphics cards; it also included, right off the top of my head, a number of parallel-port printers. So, I'll repeat my motto: Hey, Windows Has This Problem Too._3<< So I guess Apple and Google are in the X hater's club too, right? Thom is in there too lol. You must be pretty deluded to believe that all this hatred is baseless or exaggerated. X was built with poor design descisions that cannot be blamed on the typical excuse of buggy video drivers. There are plenty of cases of X crashing that show this. Here is my favorite: X crashes when mouse is unplugged:. It's a simple process. Once commercial companies have a stable target, they target it. They stop releasing hardware specs. People use their drivers because such drivers exist, greatly driving down demand for a Free replacement or for enhancements to a Free version.. This is not certain, but it's certainly likely. Arguments like "It hasn't happened to $FOO, which has a stable driver interface" do not necessarily apply. Most Free operating systems do not have nearly the level of corporate interest that Linux has. What Linux really needs is an improvement to workflow involved in getting and loading out of kernel drivers. That would solve most of the problems people actually want solved without any of the drawbacks.. But all that stuff's only a problem when you're dependent on repositories. There's no reason someone couldn't look up the specs of their computer an download it directly from the vendor, this is a one time annoyance that anyone who has installed a clean version of windows has dealt with, and no one complains about. And there isn't any real demand for "free drivers", it's all about drivers that work is all they care about. And you seem to have made up this "driver distribution vendor" there's the OS vendor, the user, and the hardware vendors, nothing else. Having to download drivers from hardware vendors, and having them work without special settings is a completely acceptable compromise. Any vendor that wants to sell their product to the market will undoubtedly allow the driver to be shipped with the operating system, especially if it becomes apparent that it's market share will significantly rise. The idea that somehow people will stop working on the kernel because only proprietary drivers are available is completely baseless, a lot of average users buy a computer and never need to know what a driver is anyway. Hardware specs don't matter either, the hardware vendors have to stay competitive and make the drivers exploit the full potential of their products. Having the hardware specs for something like a wireless adapter might make it possible to add wpa to an old card or something, but really would just be delaying buying a new piece of hardware. Right now they have no incentive to write good drivers because of the small market share. Edited 2009-11-07 03:20 UTC No. Vendors generally do not provide their specs for download. You can download drivers for Windows, or spec sheets, but not specs. Not the information you'd need to write a driver. This is the heart of the matter, which I addressed in my original post. You may not care about free drivers, and I know the people wanting a stable driver API don't, but I do and the kernel developers sure do. This is entirely about free drivers. If you want to be honest and rephrase your position as "I believe Linux should have mostly binary-only proprietary drivers and we need a stable API to allow that to happen," then that's fine, but you will see little support from the free software community. Linux exists largely because of people who care about Free software with a capital F. Have you ever actually used Linux? There's the OS vendor, which is Linus and cohorts, the hardware vendors, and the Linux distributions, who, in order to provide a system that actually can install, have to ship drivers with the install CD. If the drivers are Free this is no problem but if the drivers are non-Free they would require an agreement with the driver author--namely the hardware vendors. This causes many problems, not the least of which is that it prohibits Joe-Random-Me from rolling a distribution. Nobody cares where you download your drivers from. As I said in my original post, having a better process for installing and loading out of kernel drivers is what Linux really needs. What is a problem is when those drivers are proprietary. In your optimistic opinion, sure. In my pessimistic opinion, no. I am certain that even if *some* companies do allow redistribution not all will (they will not be required to, so they wont) and that means unsupported hardware at install time. Like, you know, your network card. Can't get the vendor's site now! I never said that people would stop working on the kernel altogether, although eventually it could happen. I am talking about a disincentive to write replacement Free drivers for proprietary drivers that already exist. If you think this doesn't happen you have only to look at existing Linux driver history to prove otherwise. Only the strong pressure to get drivers in-kernel has been enough to incentivise the creation of replacements thus far. What? First you say specs don't matter, which is blatantly untrue as without specs Free drivers are fiendishly difficult to write. Then you admit that hardware vendors don't care to write good drivers because the market doesn't require it. This seems like a strong argument to not leave it up to them! You ignored his question. He asked how a stable ABI would kill the kernel, not reduce the number of open source drivers. Oddly enough, Microsoft is able to keep advancing their kernel, despite the fact that their ABI is relatively stable. You ignored his question. He asked how a stable ABI would kill the kernel, not reduce the number of open source drivers. Oddly enough, Microsoft is able to keep advancing their kernel, despite the fact that their ABI is relatively stable. " And you cannot see how the Linux kernel will be a non-starter if its drivers cannot be legally distributed with it? Assuming some kind of shim ala nvidia is used to bypass the GPL problem you still have to have agreements between each and every distribution vendor and each and every hardware vendor, or open distribution offers from the hardware vendors. This is an untenable situation and will lead to a decline in the usefulness of Linux. You're looking at this all wrong. Hardware manufacturers aren't at war with Linux. They want a symbiotic relationship with OS developers that allows them to sell as much hardware as possible and protect their intellectual property. Microsoft has been able to make this work because they provide a stable driver platform for the hardware manufacturers to work with, and Microsoft doesn't require that they disclose their secret sauce, as you clearly want them to do. Hardware manufacturers *want* to ship drivers with your distros. They really do. But you're making it impossible -- or, at best, extremely difficult -- for them to do it by constantly shifting the ABIs and thus requiring source code disclosure. Let me ask you something: If you find yourself doing something over and over again, and things aren't getting better, should you keep doing the same thing again and again (and repeat the same mistakes), or should you try something different? I would argue that Linux is going to get far better driver support if it accedes to the business requirements of hardware manufacturers and works with them. I do understand that there are many people who prefer to look at this issue through an ideological lens, but I don't think it's reasonable to make all-or-nothing demands of hardware manufacturers without giving anything back. Give them a stable ABI. Allow them to ship binary drivers and protect their intellectual property. If you did this, the whole issue of not being able to play DVDs, not use the latest graphics hardware, and many other issues would simply disappear, and level the playing field with Windows. But I fear that that won't happen, as long as you listen to people like Stallman, who really don't care about commercial interests.. " Who said Desktop Linux? I said Linux, the kernel itself, meaning all Linux. If Haiku beats Linux on the desktop I will applaud. Free is Free. But, Haiku won't win because of its stable driver interface. It will win because of consistency, integration, etc, etc.. Things users actually see. If there were one desktop and one look and feel on Linux, with a single target for the menu, file locations, etc, etc then Linux would be having an easier time, too. Desktop Linux has many, many problems that need solutions in order for it to succeed. A stable driver ABI is not essential and won't make a significant difference in user experience. The no stable driver ABI is brought up again and again as the reason that Linux is not succeeding on the desktop. However the people who make this argument fail to give any evidence that this is what is holding linux back. I've yet to see any company saying that the driver ABI is a serious problem for them. To the contrary the NVidia guys said in a recent interview that it's not much of a problem, and they are probably the most relevant provider of closed source drivers for linux. Similarly if the driver ABI is the main thing holding linux back, how come that Opensolaris hasn't overtaken Linux in popularity and why is it that Opensolaris has a lot less hardware support than Linux? (Note I'm not criticising Solaris, I think more open OS are always good). I've yet to see these two questions being answered. The evidence is staring you in the face, but you don't want to hear it. Why can't the vast majority of distros do something as simple as play DVDs or Blu-Rays without being sued? This is 2009, for chrissakes. How can you possibly call that success? The primary reason for this failure is the insistence of Linux zealots on having source code for anything they ship. Constantly shifting the ABIs isn't rational, from a development perspective. People claim they want "flexibility", but that's a red herring. What these same folks really want is to create a binary incompatibility such that you would HAVE to have the source code and compile the drivers with that specific version of the kernel in order to have a prayer of working. Hardware OEMs aren't going to disclose all of their secret sauce to open source developers. Just as they won't share all of their IP with Microsoft. It's not a trust or fairness issue. It's a trade secret and patent issue. If you give away your technological advantages to your competitors, you cease to offer differentiation -- and you die as a commercial entity. Your competitors can leverage and replicate your research without putting in the same level of investment. You know, I'm surprised that so many people in the FOSS community are either blissfully unaware of the realities of this situation -- or simply don't care. Either way, you're shooting yourselves in the foot. It's like you're afraid of success or something, even when people explain step-by-step how you can win. As for me, I don't care, one way or another. I write commercial software for a living, and the fact of the matter is that, if you guys fail to solve this problem, it just means more business for me. So, by all means continue to ignore what I'm saying. Enrich me, please. First, OpenSolaris hasn't been open very long. Linux has had more than a decade headstart, and being first means a lot. Some people refer to this as First Mover Advantage. It takes time to write drivers, and there has to be sufficient interest and motivation to target any OS. Second, no slight to OpenSolaris (it's a good OS), but it was derived from Sun's relatively expensive workstation and server OS codebase which didn't use horizontal market hardware. Somebody has to write those drivers. Comparing one form of failure against another is counterproductive. Edited 2009-11-08 04:46 UTC What has any of that got to do with a stable or changing kernel ABI? Oh yes, nothing. What conversation do you think we're having here? I find this laughable. Firstly, I have a pretty good idea why Linux is failing on the desktop and it has nothing to do with an 'insistence' on Free software. Distribution vendors routinely ship non-Free software when they have a good reason to do it... and a workable agreement with the rights holder. Second, if shifting ABIs isn't rational why is it done? Yes, I know what you're about to say: So now it's a conspiracy! The fact is that kernel devs do want the source code to drivers written for their kernel. The GPL requires this without any shifting of ABIs. This is, in fact, the rational argument against my argument that a stable ABI helps proprietization of the kernel. It's amazing no one has attempted it. So, given that we get the source code anyway, why do you think there isn't a stable ABI? Could it be that there is some rational reason not to have one? This is simply not true. They will disclose that information if that's what it takes to sell hardware. Their business wont die if they do, it may if they don't. I for one welcome our new OpenSolaris overlords. If what you say is true it should gradually take over from Linux. If it does I will owe you a caffeinated drink of your choice. Source code. FOSS zealots insist on having the source code for everything that they distribute -- drivers, media players, etc -- and having an unstable ABI is a perfect illustration of how they force that to happen. Content owners don't want to make media playback possible without DRM--and they're not going to allow the DRM-related code checked into the Linux tree. Result: Epic fail for Liux distros. They can't even play a damned DVD or Blu-Ray with a default install. See above. Tell me how that is a better experience for users. I'd love to hear your response. They ship commercial software because it includes things that people want -- like basic DVD playback, etc -- that can't be included in Linux without a license. And since the FOSS zealots have an ideological problem with DRM -- thus causing them to ignore basic & reasonable customer requirements -- the result is epic fail. More like a confederacy of dunces. Duh. Ignoring market realities. The GPL does NOT prevent establishing a binary interface contract for the kernel ABI. Any suggestion to the contrary is ridiculous and wrong. So far, all that you've argued is that kernel devs like to have source code for their drivers. That's a pretty pathetic defense. Continued idiocy is not a rationale for idiocy. LMAO. Wrong. You guys keep prodding the hardware manufacturers to release specs about their hardware, and then you whine, wring your hands, and complain when they don't. You're like a dog chasing its tail. Apparently, you missed the part where I mentioned that Linux has had a decade headstart on OpenSolaris, and its forebear Solaris was primarily run on expensive workstation and server hardware, not widely available x86 desktop PCs. So, it's unlikely that it will ever catch up to Linux, for reasons wholly unrelated to the kernel ABI. But, by all means, feel free to erect another strawman and flog it, if it makes you feel better. I would go for very social apps that make sharing of photos, files (audio, video, profiles etc) EASY and SECURE. Something like Retroshare.sf.net would be a good basis for that ( already includes secure file sharing/messaging etc without the need for a server ) I would integrate Retroshare in all KDE apps, everything should be well integrated. I would tune the kernel for desktop responsiveness and use BtrFS, which snapshots would be integrated into Dolphin/Konqi. This would be perfect for anti-corporate paranoid privacy geeks like me. Oh yeah and a webkit based browser with adblocking would be a must When I think about it, it could be done today. Now I just need a few million$. Edit: And updates would just install silently and I would rename a lot of apps. More like what Kroc is suggesting.. verbs and nouns, unless the app has a really good name (not like Firefox or Kopete etc.) Edited 2009-11-05 21:33 UTC Updates should never install silently ... things get broken Extending BeShare to be decentralized/heavily encrypted would be a cool thing for someone to work on. My idea of a BeShare decentralized node would share all downloaded data plus download additional data to share when idle thus improving availability. Cool thing about BeShare is it supports file atributes and searching just like BFS And when you accept to install an update, it can still break the machine, so what’s the difference really when you boil it down? As long as the machine has auto-rollback features and the in-built ability to deal with update problems then not prompting to install only makes things simpler for all users. I would tune the kernel for desktop responsiveness Con Kolivas and other enthusiasts, already tried that. Unfortunately, Linus and other decisional factors doesn't support the orientation of Linux as a "desktop OS". Some guy even tried to replace X with a better GUI system, Wayland. But major Linux players are neither helping him, nor supporting his. just use one of the more mature Operating systems out there. I'd use VMS. Ok, I'm biased here as I first used it in '77. However, it works, has cluster uptimes including updates that are measured in years (17 is my record) and is pretty secure. Has had all the ACL's etc for over 20 years.. An extension of that, files would be tagged also by their package name and instead of storing files in hiearchical directies, you (or tools) would add your own tags much like photo/music aplications work but for everything. I'd go for a small kernel, and an extremely minimalistic UI that would spend most of the time hidden. I'd like the window manager to include a "tiled mode" like wmii, dwm and friends. The central point would be an app / document / web launcher and nothing else. This would require tight integration with file indexing services and web services of course, but it can be done today. Actually, I think I can do something fairly similar using some Linux / BSD derivative Edit: Oh, of course, no modal windows. At all. Edited 2009-11-05 21:38 UTC. Honestly, Linux is already mostly there. I love the degree of control I have over it, and the number of power-tools you get with a GNU userland. Throw in some X stabilization and some long-term-stable APIs -- like driver APIs for the kernel, and maybe DE-neutral high-level windowing and sound APIs -- and you'd pretty much be there. If I where to do this in perfect-world fantasy land, I'd use some kind of microkernel, with the ability to switch between multiple sets of userspace daemons to provide different personalities at different times to accomplish different tasks. Like, the same microkernel could drive different userspaces, to be a slim, fileserver here, to mimic a Windows userland over here, and to mimic a POSIX environment over here. In the real world, tho, I don't really have any outstanding entries on my OS feature wish-list; bug-fixing, driver availability and some holy-war-resolving standardized API's would pretty much make Linux my perfect OS. Edited 2009-11-05 21:46 UTC Every distro is designed with the assumption that all applications are open source. There's no standard installation package that will work across distros. There isn't even a standard program files or system icons directory. Not only does it make Linux unappealing to proprietary developers but it's a waste of resources. An application should only be compiled once by the developer, not a few dozen distro maintainers. Software distribution systems should be designed to work with both closed and open source. Proprietary software isn't going away, it's delusional to think otherwise. But I guess some FOSS advocates prefer delusion to market share so expect Linux to however around 1% for yet another decade. Provide a stable platform for developers and the apps will come in. Just look at how many game developers have flocked to the iphone. Programmers need to get paid and you can't sell support or services with a $3 game that has 8 hours of gameplay. Anyone that cares about this is free to pick a distro, flash it on a phone and support it for 5 years. I don't see why Linux ecosystem as a whole should stagnate because of these poor developers that need to sell fart games to kids in order to pay the bills. You might not care about cell phone games but that doesn't change the fact that when you dismiss proprietary developers you become unable to provide software that people want. Software that GPL programmers haven't been able to provide alternatives for.). Generally, freetards will respond with: -fck Visual Studio, VI and Emacs are soo much better, when you'll learn to use them, you'll be soo productive -fck GUI, who needs GUI? I don't need GUI, I use links as web browser, I use ircII in text mode to connect to IRC and talk with other freetards; I don't even need to write C++ apps, cus I write suuuch powerfull bash scripts in Emacs, and anyway, python rocks; I use latex and I'm soo much productive and I'm free and I don't want to use software from proprietary pigs -if you need GUI, you can allways use X; it's not X's fault for crashing, it's proprietary pigs's fault cus they don't provide open source drivers... so what if X is bloated, slow like hell, nobody is hurrying, and it really rocks cus I can use it over network when I'm sitting on toilet and write powerfull shell scripts on my electric toaster which runs Ubuntu Ziggy Zebra -who needs Half Life, Oblivion? playing tetris in text mode is soooo much fun Generally a combination of: "RTFM idiot", "it works as intended", "so what if it doesn't do what you want? either implement it yourself or stfu cus nobody is payed to do it", "maybe linux is not for you", "linux is not windows", "so what if it's crappy? it's free and freedom is better than performance", "open office death slowness and curruption of .doc files is MS's fault", "os is crashing because of Nvidia, nut because X cause X is superrior and foss", "it works for me", "you don't need that", "it works from time to time". I don't really see what anything in that rant had to do with my post. I was talking about lowest-common-denominator APIs that both Gnome and KDE could implement, to allow for DE-agnostic GUI programming. I most certainly was not advocating some kind of universal package format. I don't really see how you could've gotten from one to the other, unless you just really wanted an excuse to complain about Linux. I like many of the ideas, especially 'no-brands', and making applications file-management based. Some of these things are possible to do right now. For example, on my Ubuntu installation I never open programs, only files (with the exception of Chrome and Calculator, since they are not file based). Rather than using File/Open, I find the file with the file manager and open it. Instead of opening, for example, OpenOffice.org Word Processor to create a new document, I navigate the folder where I want the document created and create it using a template called "ODF Text Document" stored in ~/Templates. For window management, I would love to see an easy to use tiling window manager: Each screen would be divided into two columns. Each column would be divided vertically into any number of frames. Each frame would have tabs that would contain windows. There would no necessary keyboard shortcuts (although they would still exist). The user could select an active column or frame that new windows would appear in. Applications could integrate with the window manager so that for example, a web browser would use the window manager's tabs, rather than having its own. Edited 2009-11-05 22:13 UTC OpenBSD is pretty near what I want in an OS, Simple, configurable and stripped down to only what is really necessary ... Once you learn how to use the tools provided properly. Takes a while to get your head around but once you got that sussed. Using any other of the BSDs or Linux just seems limited. I would preferrably use OpenBSD with the Window Manager that IRIX used (4Dwm), and better SMP performance and 3D acceleration, would be nice ... but just having something to use as nice as the IRIX desktop would be nice, I don't get on with the 3 Big Desktop Environments. I would love SGI to Open Source IRIX, I loved using it in the computer labs on the old O2 machines that used to smoke everything else. I doubt this will ever happen unfortunately. I'd want: - Total transparency for all processes. Like dtrace/system tap for everything + time machine, so you could ask what an app did one minute ago, what program changed a particular file & why ("why" as in see the call stack for the occurence). Impossible, but maybe someday... ;-) - Instant 0-copy IPC - Native code sandboxing for all apps. I absolutely agree - Plan9 is very elegant and it celebrates the "everything is a file" metaphor - unlike Unix systems where device drivers are special files (I always found that IOCTL stuff creepy). I think this is a good base... Filesystem should be not Unix-Standard but more MacOs like - there was an article covering a FSH here on OSNews. Well, regarding the GUI I think the old X should be retired. A ZUI as proposed by Jef Raskin based on OpenVG. This would eliminate the metapher of standalone apps and break compatibility with all current apps, of course. I am a FreeBSD user and love the core system but have the following annoyances and/or missing features. If they are addressed, then it would be the perfect OS: 1. A binary package management system for applications and system - more like a Debian and less like pkg_*. I know its improving every year but veeerrrrrrryyyy slowly. 2. A virtualization solution - Virtual box and qemu have half baked support (no USB, no GPU hooks, etc.) Something that compete with Linux(s). 3. Maybe come up with a native X like implementation and run X applications like on mac (XonX) - this is a long shot. I still like FreeBSD and no, I am not going to move to a Mac. I agree with most of KrocOS, but rapidly disagree with the amount of windows a *user* would have to *manage*. Window managers ought do their job-- I've thereby used wmctrl & devilspie to shove minor apps to the left 40% of my screen (with no window decorations) & keep the major ones on the right 60%. I prefer tablet/pen computing, and use mouse gestures for my maximize,minimize & corners with brightside & zenity-lists to open new apps, switch between apps (actually redecorates, shades & cascades) & show recent documents. Otherwise, I see all 'files and folders' as libraries with tags (yes, remember card-catalogs? they had TAGS for the books!) All in all, I (gasp!) like Microsoft's Courier, but know it will fail me (so I'm makin' my own!!) The rest of the details are on my blog, which I'll be updating more details soon (by end of year ):? What a silly silly thing to say! How do you know what he has thought about? Oh! I know how! His views don't match your prejudices! Ah! He can't be serious can he? Lets be a little more tolerant if we can. Regards, Peter. reactive kernel that just handle hardware routing, memory allocation for realtime stuff and garbage collection for less demanding parts, computations multiplexing. on top of that a ~~haskell/ruby~~ shell with by default reactive geometry/vector/typography rendering and that's about it. ( with automatic fallback into vga/ascii classic shell ) no hard coded graphic computing, ergonomic (fitz law, analogic changes) oriented renderer that update everything in a "coherent" manner. with something ala plan9, aka namespace/trees representation of about anything, and nixOs .. emphasis on versionning/transactionning features of FS. factorized/typed/generic operations as much as possible. no "programs", just functions that are easily composable, a so-called program would just be a preconfigured function graph ~math equation etc etc everything is heavily jit-statistic compiled, taking in account communication cost model to pipeline interfunctions dataflows. maybe some bayesian self optimizing shortcut system to speed things. of course with that kind of os , a new keyboard would be neat ( dimension iterating keys , symmetric positionning , no teletype background ) to picture the result ... throw plt scheme, sidefx houdini, some of aza raskin work, smalltalk environnement in an advanced opencl computing system. just Data Data Data, Data representation and transformations lol signed FantasyMan Edited 2009-11-05 23:45 UTC. Also, I would expand on this, and add that if window and program session state were transient enough that we could freely move it around (like something from Plan9), then I would like the ability that I could drag a file into someone else’s computer across the network, but instead of seeing just a folder hierarchy of that computer, I would see the actual computer’s screen with its session. In fact, I could just freely use any computer’s session on the network (if I had permissions to do so), like a super virtual desktop. This would reduce the disconnect regular users feel with the difference between accessing data when in front of a computer, and accessing the same data from another computer. It’s not like-for-like enough IMO.. first off, what an elegantly designed website,, if this is what HTML5 can do, perhaps I should take a look at it. Anyway, the perfect OS would essentially be OSX, but legally run on any hardware, and preferably open source. The kernel, and bottom end would be based on probably Solaris, or possibly BSD. At the very least, I really really wish Linux would pick up on some of the things OSX does well, like application folders (for those who do not know, applications are bundled into a special folder, ending in .app, everything goes here, the program, resources, configuration, libraries, everything. Then all a user has to do to 'install' it is just copy it to whatever folder they like, and to 'uninstall' it, just delete it. thats it. No libraries spayed all over the place, no sym links, no menu entries, everything is contained in the .app folder). Also, I really wish there was a bigger push behind GNU Step, it has real promise, but needs a LOT OF WORK. 1) The hardware support of Windows - both out of the box and third parties. 2) The software support of Windows by way of a large ecosystem of third party developers. 3) A FreeBSD core + Better graphics layer. 4) IRIX Indigo Magic Desktop ( ) but updated. If a company provided that, I'd be a very happy lad; a combination of power, ease of use and flexibility all rolled into one. A wished OS would have the following: The configurability and flexibility of Linux. Hardware support and software options of Windows. Simplicity and ease of MacOS 9. Friendliness and responsiveness of BeOS. Here's what to leave out: Windows: Price tag. Registry mess. Disorganized system files. Linux: Tedious Unix file system hierarchy. Cryptic software titles. Scattered and inconsistent development. Version-specific library dependencies, aka "dependency hell." BeOS: Hardware compatibility. Software choices far below Windows and Linux offerings. In the previous comments I saw some really good ideas. I encourage their respective authors to submit them as a feature requests to their favorite OSes What I would like to have : Tons of compatible software, installed via one click, no deps - something like PCBSD's .pbi packets (AFAIR, they don't have deps). Total and easy control from a users's perspective to the OS. Reliability and stability, supreme performance for both Desktop and system level processes. Easy upgrades, frequent updates. EVERYTHING explained in a human readable format, i.e. : "This is an update of software, version X.X. It does this, so you might want to install it. It downloads from the Net, and it's large, so please consider this, the package is about 200MB." Just an example. Then, a good backup and restore solution. Every applications has a good UI, with a lot of options - some advanced are hidden, the most often used are bring up to the front. The applications are AI - they learn the habits of the user. Nothing is being done silently, unless the user has requested it. Log files for everything, with meaningful messages, timestamps, gzipped. Portability over different hardware, no need to stuck with some fancy driver installation. Open source. Large portion of the OS is social oriented, a good, one app, that takes care of your social activities. No need to go into konsole to fix your network card options, as instead, a nice, easy to understand UI. Compatibility layer for Windows apps. On the other hand, a comprehensive documentation for devs and geeks that love to tweak the OS. A desktop look and feel similar to Mac, everything is user friendly, and it responds really fast. Something that my mom would love to play with. Localization, support for different languages. A centralized place to control the OS (via just a few clicks). Those are the things I suffer from today, though being a Linux / BSD user for more than 10 years. While I have already fixed some of those by myself, the rest of the users are afraid to take a shot with Linux. I have several things I would like to see: 1. Full persistence. Even if I cut the power and yank the batteries out, I should start in a consistent state that is at most a few seconds old when I resupply power. This also means that there is no need for a specific hibernate function -- you just cut power. 2. Hot updates. There should be no need to restart applications (let alone the OS) when you upgrade applications or OS modules. 3. Driverless devices. More specifically, let devices store their own drivers which are transferred to the OS when they are plugged in. The drivers should be written in a high-level language so they are independent of the platform CPU. Alternatively, let devices communicate with the OS through a standardized protocol. Adding CPUS to devices cost next to nothing these days, so you might as well move a lot of the "intelligence" to the devices. 4. Full versioning file system. You can go back and see any previous version of any file. You can offload older versions to the net, so you don't fill your media (this will make access to older version slow, but since it won't happen often, that's O.K.). You can explicitly ask to permanently delete some data (for security reasons etc.) but that can only happen if you enter a "management" mode, which general application can not use. 5. Location-free file system. You should be able to access data in the same way regardless of whether it is stored locally, in "the cloud", or on your data home server or the office data server. 6. Transparent parallelism. Tasks should automatically distribute over the available processors. Not just assign applications to processors, but split tasks over multiple processors. This requires a break away from the current programming models, so applications have to be written so they can be parallelised, using a language that makes this easy. The major thing for an OS and a Software for me as a user is = it doesn´t have to be annoying. There is no need for major updates, if a product is done it should run like that for long term. And any changes should be the choice of the user. Just like an add-on that you can install if you like or not. For example, Mandrake 8 -> 9 or W2k -> XP Both did not chance much under the hood, but they chanced the look & feel of the user interface and the admin interface dramatically. From my point of view, it would be better if the new version would be an add-on and one should be able to install it or not. Or it should be able to change things under the hood, but one should be able to choose to keep the old user interface and admin interface unchanged. The same goes with Adobe Acrobat 5.0 -> actual Version or Photo Shop 7.0 -> actual Version or Winamp 2.91 -> actual Version At the moment we have a Dictatorship of multiple companies. That is better than one Dictatorship, like a country where only W2k would be allowed as an Operating systems for all Desktops and Servers and mobile devices. Which from my point of view would be VERY GOOD. Problems and annoyances and wasted time and wasted capacities would shrink. Imagine 1 OS for all. But this is not doable, because there are millions of individuals on both sides, the programmers and the users. First, I would like to salute your idea as the article tries to be constructive not destructive. If I'll have 1 billion euros and I I'll agree to spend 100 milions to design a new OS, these are the thing I will do: -make a team of professional OS programmers; not hobby os programmers, not other kind of programmers -make a group to study the latest discoveries and improvements and research studies in the Operating Systems field (things like L4 microkernel family, research file systems, researc oses etc); keeping in touch with researchers and teachers from universities -employ a research firm to really see what users want and to see how they want an os to behave -employ an research firm to see what will developers want; ; what kind of apis amd ides they will prefere to use when they will write software for the new platform -make a group to study latest research in gui, desktop gui design and usability -let the programmers, designers and researchers make some brainstorming: it will come clear the os arhitecture, the type of kernel, the type of file system, the type of gui, the type of apis, etc -everything will have to be written from scratch, heavily optimized for speed, stable and responsive and also bloat free; the os will have to be as usable as possible -keep all things as simple as possible; don't write software monsters that "do it all". instead write a single software that does one job, does it properly and is designed with interoperability in mind. -write design ideas, write specifications and design rules based on things done earlier -write the actual os according to specifications, design rules and design idees -employ some hundreds programmers; sign NDAs with major hardware providers (AMD, Nvidia, Intel, etc) and write drivers for the new OS - don't expect them to do that -employ some thousands programmers, sign NDAs with major software houses and port at least: the 20 most used bussiness software, the 20 most used home software , the 10 most popular games and the 10 most awaited games. -do some proper alpha and beta testing meantime What do you all think? Will 100 million euro suffice? Also, please excuse my grammar mistakes, as I'm not very fluent in English. -lack of apps (as in lack of commercial quality apps) -bloat -lack of stability -unresponsiveness -improperly designed apis -cloud computing -virtual machines -non native compiled code -lack of standards -lack of interoperability -1000 libs and 1000 pieces of software that does more or less the same job I can continue for ever, but I'm only allowed 8000 characters and I'm stopping here as I pointed the most problems that I think that hider and hold back operating systems. A new OS designed from the ground up by me would probably look like this: * All Data is on the Web: The harddrive would merely be a cache to allow fast access times or make the OS continue working when the connection to the web is temporarily broken. The final store for all data will be on the web, so no explicit synchronisation between computers and devices is necessary they just download everything (think IMAP but for everything). You might be able to use free services (google) or pay some money for hosting provides that guarantee your privacy. In each case the providers will create backups and ensure your data integrity. * Programs/Code is on the Web: Like for the data there are no installation routines or anything. Programs/Code is on the web - not necessarily in the limited and complicated forms that is http, javascript, ajax today - more like a universal bytecode (think javas security/vm features but better GUI apis providing ways to integrate into the system and not limiting it to the browser window). The benefits are obvious: No installation needed, external service providers will take care about updates and are responsible that everything works. Again I might pay some providers so I get the service I want and not advertisements and privacy problems with free services. * The interface is document, task and event centric. The operating system is not about starting applications. It's rather about opening and editing and organizing documents (my e-mails, word documents, mp3 files, videos, ...). Performing certain tasks (shopping, filling government forms, making a phone call, sending emails) and getting notified of events (incoming calls, news site updates, upcoming birthdays and events in my calendar, ...) Of course there are applications in the background - but the interface won't force me to think in application terms. * Of course I don't want to think/fiddle with my hardware. There has to be driver/universal standards for everything and the computer should just work. Additional everything should have very robust error handling. See next part. * Robust and lots of fail safety mechanisms. The software should be as robust and correct as possible, but at the same time we have to be aware that there will always be bugs or simple hardware failures, or other failures (the hamster is eating the power cable). The solution here is having a robust and easy failsafe mechanism: Applications do regularily and automatically save their state to the harddisk (the ram is just a cache for the state on disk) and the harddisk is regularily saved to the web (the harddisk is just a cache for the data on the web). If something fails the system must be able to reset to the last saved state on disk/the web and continue seamlessly from there. So that usually just a few seconds of work are lost. If certain applications, drivers etc. are failing they are just restarted and the state restored from disk/the web. There have to be mechanisms that ensure data integrity so that you can really always go back to the last saved state. Even if my computer completely fails I just want to switch to another one and continue working from there having a nearly seamless switch as the data/state gets restored from the web. * Obviously the system would need to have sophisticated security concepts. We need good authentication mechanisms, I want fine-grained but easy to use access right management so I can share data with others. And all code executed only has just the right amount of access rights so it can perform its task but not do additional damage or read private data that is not needed for the task. * It has few sensible options and configuration possibilities. In general I want the programs and designers of the applications to think for me and make sensible choices. I don't want them offloading decisions to me as a user about stuff I don't really care about. In doubt better use a default and hide one more configuration option. There should be many people crying out loud before options are added (on the other side they should react to many people crying out loud...) Kernel 1. object-oriented architecture. 2. Each object lives in its own process. 3. 64-bit address space. 4. object addresses valid in all processes. 5. asynchronous message passing. 6. capability-based security. 7. drivers are objects. 5. automatic transfer of computations to other machines of the network based on real time cost/benefit analysis. drivers 1. simple driver system: each device having one and only one object that manages it. filesystem 1. objects instead of files. 2. objects managed programmatically via classes. 3. directories replaced with views based on object queries. 4. object versioning. 5. 'live' objects: changes in objects automatically propagated to users of said objects. 6. automatic replication/backup/history. 7. virtual 'file' system: copy-on-write for privileged 'files' (i.e. objects). networking 1. automatic sharing of objects between computers on the same network. software management 1. classes instead of applications. 2. automatic updating of classes based on publisher URL. 3. class versioning. 4. automatic linking of appropriate class version. user interface 1. clean screen interface; only the object being edited is visible all the time. Commands/options accessible only via context menu. 2. full screen interface for each edited object; other screens accessible by context action. 3. realistic rendering of edited objects; objects look like real objects as much as possible. 4. task-driven menu interface for initial user screen. 5. no double or triple clicks that confuse the user. programming 1. system-wide garbage collection. 2. system-wide automatic persistence. 3. object-oriented language with low-level features that don't break the OO abstraction or security. 4. the Actor model being used for parallelism/concurrency. 5. abstraction on networked resources. 6. the same programming language used either for system scripting or application programming. Edited 2009-11-06 12:58 UTC The perfect OS to me would have the simplicity of Macs (everything just works out of the box), the customization of Linux (basically, make it dead simple to use, and hide the advanced options just far enough out of reach so the average users don't hurt themselves), with the kind of support like Windows has. Because, after all, a great OS without great apps is pretty much a useless OS. I agree with the one dude who said that all apps should be portable, not installed. But I would like it better if the OS came with no apps at all, except for basic OS utils (like system-wide spell checking) and a 'click n run' type appp that let you download other apps. An operating system should be out of your way and the trend of shiny toys and widgets has resulted in clutter and reduced quality user experiences. Today the workflow associated around navigating folders, opening documents and finding things is terrible because in most operating systems there are slightly different ways to do things because applications can implement things differently. There is an affinity to the relationship between the documents/resources and applications I am concerned for accomplishing a particular goal, but this is usually lost when I switch off the power. Leaving my laptop session going for days is not much better because only one arrangement of windows can be stored, but I usually work on multiple streams concurrently. I want to never have to manage/close a window or put effort into grouping applications. The only thing that matters is a document is saved, or I don't want to change it. Applications should arrange themselves usefully, a calculator adjunct to a spreadsheet app if I am clicking between them all the time. Also, why has nobody got pie menus working? For a full answer, I'd need more characters than OSNews grants me (or, perhaps, to write an article). But, it'd boil down to just this: Designed for the desktop, and designed only for the desktop. Of the big two OSs, both OSs are trying to design their systems to be a desktop OS and a server OS as well as running on phones, settop boxes, et cetera. (OSX doesn't have a game console... yet; as soon as apple can figure out a way to expand their iContent to games...) And Unix... Unix was never designed so much as iteratively expanded, so modern design techniques are juxtaposed with (and are unable to displace) design goals that almost made sense 40 years ago. Core: 1. User interrupts rule all. Realtime through and through, but with full NUMA support, where a process can be optionally flagged as preferring bandwidth, instead. 2. UTF8 all the way through. Unicode isn't perfect, no, but UTF8 is a great compromise all around. Just start at the bottom with it. 3. Local and remote resources transparently blended, a la Plan 9. FS: 1. Unix-like main structure, but beyond setting out devices and such, the structure has pools to be accessed. A pool being not unlike an LVM volume, in terms of relating actual storage with what you see using the system. This is where the hierarchical bit of it ends. 2. Each pool would contain unique files with certain attributes, from which security and file structure could be created (persistent views) or divined (ad-hoc queries). The system would be purely relational, and support versioning of every kind (roll back files, have multiple library/app versions, explicitly view file edits, etc.)--use it or not, your choice. If you wanted a certain version of a certain library, you ask for that, rather than hope it is a path you think it should be. Applications could add their own properties to files, easily viewed by anything else in the system, for near-infinite flexibility. The security system in the kernel would be able to handle who and what has write permissions to the attributes. 3. Fancy features like replication, being able to roll back data, snapshots, what have you, would be able to be turned on and used with such an on-disk FS, or it could remain unused for any reasons you may have (save space, gain speed, etc.). FSes preferred would be 2nd or 3rd gen transaction-based non-journaled FSes, learning from pioneering ones like ZFS. All this would allow transparent use of user, local system, and distributed system resources without propagating symlinks and whatnot. Persistent views would allow arrangements for backwards-compatibility with apps made for other systems, and to handle cross-platform apps (so, it could make an entire Red Hat file tree, FI, have a WINE-like app, and then go). Also, you could have your favorite file manager or media browser or whatever else, whose UI could give you radically different views, and allow for radically different workflows, without screwing with the underlying system, without creating its own FS-on-top-of-an-FS, and in a way that other applications could be extended to use with minimal or no added coding. If we start to see good SMP on mobile devices (or generic stream processors in mobiles), this sort of thing could be done efficiently and powerfully with the mobile hardware of 5 years from now, as so much of it is naturally parallel, the raw data would tend to small, and the future of the workstation-like desktop is less interesting than mobile stuff or server stuff . Data/app management: 1. Applications would have well-defined inputs and outputs, with near direct linking by using the hierarchical side of the FS. Monolithic applications, even for GUI user things, would be eschewed, in favor of using these features to tie multiple apps together. Libraries, instead of proper applications, would likewise be eschewed. Monolithic apps could be literally be front ends that controlled pipe and socket type file interfaces. 2. Files would automatically have persistence, within the limits of the file system implementation. Files would support stream, OO, and relational interfaces, so that applications would be encouraged to work directly on files, rather than using large in-memory buffers, at little to no performance penalty (or to map to those interfaces for incremental persistence of custom data structures). Applications with ownership of a file would get significant control over exact data structures used, to have better control over memory use, speed, etc.. 3. The OS would have services to serialize states of these file objects to images for the disk (something more efficient, and friendly to non-hierarchical views than XML, like a compressed UTF8 Lua). Using the OO or relational interfaces, the application could declare the beginning and end of a write, for a proper transaction (otherwise, every write is one, like w/ byte-stream style files, which would remain supported directly). 4. Free RAM and disk resources would determine the aggressiveness of garbage collection (down to an embedded option for immediate freeing, rather than incremental GC). Any app that used OS-specific interfaces for managing its data would automatically get a system-wide GC, so only need to worry about direct memory management of its internal temporary structures (getting rid of such things will just get devs hating your platform, so...). UI/development: 1. The default terminal would connect to a JIT VM, that then connected to an OS abstraction layer. You'd have a real functional programming language right there, geared towards OO. It would have included direct robust support for working with multidimensional data structures, so you wouldn't have to go through weird machinations to do basic things with objects, or roll-your-own mappings. Native machine compilation of shell scripts would be an option. 2. Included GUI would include applications to do real-time diagramming and tracing of more intricate data structures and events, because that's going to be a n00b hurdle like nobody's business, and be handy for new users of a specific system instance (your workstation or phone, FI), that already know how to use the system in general. 3. The primary GUI (make your own, if you want) would have a zooming interface, made to be menu-driven. Pack a lot on there for a keyboard and mouse, make it 10' for your TV (or tablet), have deterministic scrolling or categorical rearranging for small mobiles (FI, a separator in the WIMP-like UI makes for a submenu in the mobile), etc.. It could scale from big icons and buttons to curses. No toolbars, or anything like that (so, more like a good mobile UI that scales up nicely, than a common desktop UI that can cram itself down). Applications could provide specific presentation rules, should they need to take over sets of, or the whole, screen space. Details would depend on UI research applied to actual application workflows. The less you know there is even a WM there, the better it is working (I am intentionally leaving out managing multiple windows, as that should be a bit different, depending on hardware platform). 4. Programming libraries made for small size, and efficiency, over speed. Robotics: A scheduled job would be included, to make a caffe breve every morning for me. If I'm gonna dream... So, ultimately: good horizontal scaling (including generalized heterogeneous computing), user responsiveness over throughput, and the best data and IO models yet devised, so that the rest of the system can be done the best way possible, with thorough horizontal software integration (FI, what I've laid out would make hot updates and live backups trivial, and a cloud OS UI possible, but not trivial). Edited 2009-11-06 18:34 UTC Design an OS around users who know how to use computers, and throw out the stuff designed to make first-time computer users more comfortable. They aren't comfortable with a computer no matter what gets done to the UI, and it makes life harder in the long term, not just for new users but for power users. Don't pop up a bunch of notifications when I plug in a USB thumbdrive. You don't need to tell me I just plugged in a thumb drive. How could I forget? I have a memory that lasts longer than 6 seconds, after all. And, for Pete's sake, stop trying to guess what I'm doing, and when I decide to do something, stop second-guessing me. I KNOW WHAT THE #%$& I'M DOING! But make everything undoable in case I don't. Re: KrocOS. Now, first, this has been one of the most entertaining, thought-provoking, and Wikipedia-link-following-for-hours threads in a good while. Since I've said my pipe dream, let me criticize our star, Kroc. Branding: I somewhat agree. I think distinctive software should be, well, distinctive, but not to the point of its own foundation with a special license and everything else. The user gets, like in politics, to choose the least worst. I would go with noun/verb combos giving you program choices, but not that being everything. The thing is, how many verbs can you really have? Edit: nano, leafpad, vi, emacs, scite (an OS w/o scite is something I don't want ), joe, ... App/OS separation: absolutely. While I ran into the char limit, I would go so far as to do things like have a very low level regex system, and most every generally powerful thing in the C++ std, boost, or standard Java or Haskell bits, that can stand alone, as shared OS functionality. Compile an app that uses it, and it just asks the OS for it. Otherwise, you can use it many different ways in the OS. There are many features should be basic OS things, and simple system programs, that get pushed into libraries and language extensions, adding obfuscation and complication. I had not thought of it in terms of branding, before, but it makes a lot of sense. Context: yes and no. A file manager which can morph into a music manager would be neat, but maybe, just maybe, I want to see files. That is one of a billion reasons for a metadata-centric FS. You can have your cake and eat it, too, with all that context, and I can see damn files, and start my damn music player to play the way I damn want to! The whole time, neither of us have to use a radically different system to do it, and could even have that separate work flow using the same music player and file manager--just change a few check boxes in the options. To work well, though, for both, context metadata needs to be supported from the ground up. Also, being a tinkerer kind of person, I like exposed plumbing. But, the user should not have that plumbing shoved in their face. It should be neatly against the walls and ceilings, should they want to inspect it. App folders: *shrug* As long as I can get my app there and working, I don't care. The one thing I don't want is for a Debian-like hiding of the build system, so I can never track down enough packages in the right places, if the package hasn't had its make file tweaked for Debian. Give me Slackware or Arch's slightly bigger packages, so things actually build, any day. FS view: hard drives matter, sometimes, and should be exposed, but not like in Windows. Add an extra button to show additional storage resources, of make a FM option. The plumbing thing, and all. make some of the innards very easily discoverable and usable, just slightly out of the way. FS in general: I may have just been getting out of elementary school at the time, but I remember BeOS. With my current knowledge, I think a relational file system, giving defined types of attributes to a set of a bytes, is THE way to do it. You can then organize it flat, in a normal tree, in different trees, even in 3+ dimensional networks (fast indexing becomes iffy, then, of course), if you care to. UI complexity would be the major limitation (that's when you bring up a console...). Custom apps would especially be good with this, as tying data from different things together would be a snap (your calendar example, FI). Menus: looks good to me. File handlers: yes. Window manager: less is better, and it needs to be adjustable by workflow. Real research is the key. Tiling WMs, Expose, Compiz Expo (grid of VWs), etc., are quite cool. The real trick is finding a good enough one, or a window/menu/task system that is flexible enough to work really well in many WM paradigms. Calendar, RSS, address book, and the file system: that's why a relational FS, surrounded by a context-app system, would rock, IMO. Data is well-defined, at the OS level (not DE-level), and apps just do stuff to it, in a OS/FS-sanitized way. 1. Imagine seven hundred apps all named video player? or do you mean that your perfect OS would only have one player, as it would be locked out for other players? 2. BeOS had it right, thus i agree with you there. 3. Hiding stuff from the user, no matter the method is NEVER OK! As you said, if you remove an app in BeOS its effing! gone, and that is the way it should be. no binary registry or nothing. 4. yeah beos did it better and all that functionality is abailable in beos from 3rd party software. (that is free non the less) 5. Meh i still find anything due to my awsome hierarcial system. Even though the mass ive downloaded, still its not cluttered with crap. Its just a question about personal "tidyness" 6. Stupid, not worth answering. 7. oh i get it now, your perfect OS is a graphical one only.. how silly of me. You get tired of the shorcuts in a while, or too dependent on them. Thus you cant work in a "non customized to your liking" one. 8. Once again: MEH ive got google for all that stuff. For me, the perfect OS would use open development using open standards and its applications would use open formats. This OS would thus conceivably be able to run any program created for any modern OS, viz., Linux, Win, OSX, Chrome OS (yes, Linux). This would allow me to cherry pick the best apps among the OSes that would then update them in a Linux-like way. Most my computing these days is cloud computing, and it's just getting started in user space. Thus the browser is more dominant than the OS. So things like Web Open Font Format (WOFF) are a great step in the right direction. Still, Linux is setup and designed far better than the others. 1) KISS Keep It Safe Secure Safe from malware Secure from hacker 2) KISS Keep It Simple Straightforward Simple to use ( a thin manual ) Straightforward to use ( can complete a task in a few clicks ) 3) KISS Keep It Speedy Stable Speedy response ( fast ) Stable ( no system crash ) Finish etoile, port tons of apps from mac osx. Finish GNUStep and provide a full desktop environment including webkit browser. Apple have some good ideas but it can be done better. Also linux kernel supports more hardware than osx so would be better choice to build the OS on.
http://www.osnews.com/comments/22444
CC-MAIN-2013-48
refinedweb
11,567
62.27
Feedback Getting Started Discussions Site operation discussions Recent Posts (new topic) Departments Courses Research Papers Design Docs Quotations Genealogical Diagrams Archives. A language or system is object oriented if it supports the dynamic creation and use of objects. Support means that objects are easy to define and use. It is possible to encode objects in C or Haskell, but an encoding is not support. No offense intended, but it seems like this exposition is a lot of informal definitions and a little bit of history. TaPL's treatment of existentials is only briefly mentioned. In fact, the dismissal of existentials because "they can be used for other things" is a total non-sequitur. Similarly, the paper making a distinction between objects and ADTs could make its point much more concisely. The fact is, existing type theory can model "object oriented" features quite well, as compositions of more primitive ideas (like existentials + recursive types + record types). If you're looking for a definition, that's the place to go (and if you deem existing definitions insufficient, you should offer something with a logical theory that's at least as rigorous). You are missing the point. I am not proposing a new formal definition, I am proposing standardized vocabulary that enable people to talk about objects, especially if those people have not studied PL theory. The formal definitions are clear (mostly) but our informal descriptions are weak. By the way, existentials are not needed to formalize objects, as my previous work and chapter 18 of TaPL demonstrates. Update: several people have also asked me for definitions, because the OO vs ADT paper never really comes out and provides a simple definition. Or "what does bounded quantification mean?" or "what does partial application mean?" "Merely" proposing standardized vocabulary is proposing a formal definition. That's exactly the point of common formal definitions. Informal definitions aren't particularly valuable here, except as introductory motivations to formal definitions, IMHO. You wouldn't do physics without calculus, you shouldn't do PL semantics without the relevant logic. Sure, you can partially reason about "objects" in terms of bounded quantification (as in Chapter 18 of TaPL) or partial function application, and in both cases you'll compile to some intermediate stage probably expressed in terms of existentials (e.g.: in what way do +(1) and \x->x+1 have equivalent representations? exists T.rec X.{data:T,fn:X->int}, instances of which are undoubtedly objects). My point is, if anybody really cares about this subject, there's a very rich theory available to them to analyze all sorts of different aspects of programming languages. You are making things more complex than they need to be. (+1) and (\x->x+1) are just members of Int->Int, or Num a => a -> a if you are Haskell programmer. I have never found anything essential in Pierce's use of existentials for objects. It is not wrong, but the existential can always be eliminated without are loss of generality. As for definitions, we will just have to agree to disagree. (+1) and (\x->x+1) are just members of Int->Int And how is that equivalence realized? That's my point. Why is a behavior a collection? I would propose you flip it around - if you must have collections, have a collection of named behaviors. But do you need collections? or names? Actors only have one behavior, after all, though it might (if it so chooses) distinguish on value. I quite favor OO models where there is no extrinsic notion of methods - i.e. where any distinction is performed by the object. Cloud Haskell distinguishes messages on type, Erlang on arbitrary patterns; E language and Smalltalk and many more OO models don't use named methods except as syntactic sugar for programmable dispatch. I tend to understand named methods as a compromise to avoid richer type system. If we had dependent types, we could build rich protocols and constraints without the semantic pains of namespaces. The dictionary definition of behavior often allows a range of different responses to different stimuli. Therefor the idea of a collection is already present in the concept of "behavior". I tried to avoid "name" and use something "identifiable" ... but I ended up needing the concept of names in order to be able to define "dynamic dispatch". You see it used there in the definition. I try to be a little fuzzy about this, to allow Erlang style, but still concrete enough to match with our intuition about multiple operations. Names aren't necessary for dynamic dispatch. I agree that different behaviors for different stimuli is at least vaguely related to the notion of 'collection'. I agree that they are not necessary for the concept. I just found them necessary for writing the definitions in a concise way, without introducing many other ideas that I didn't want to get into. So its a question of wording and presentation, not meaning. I think one of the (not to be neglected) goal of wcook is to capture the definition of "object-oriented" as actually used in practice, rather than what he or you would like better as an object-oriented system. That's probably the reason why he captured the idea of collection in his definition. Methods are only an occasional part of the practice. That was half my point. Not only do I favor such OO models. They exist to be favored. A description of the OO practice should account for them. And in my extensive discussions with @w7cook on this subject, I must say he's more interested in an "insightful" definition of OO than one that reflects practice. For example, he's quite intent on removing state from the definition. Unlike method names, state is universally part of the OO practice. (I don't mean that every object is stateful.) The definition seems to say that a simple record of functions qualifies as an object, especially if its "easy" to write. Many different records with distinct functions could satisfy the same record type. But one of the things that makes standard objects distinct from simple records of functions is "this"/"self" reference and open recursion such that if an object has a bar behavior which calls this.foo then the foo called may be something that bar couldn't have been "aware of" at the time it was defined. The way foo gets (re)defined could be through inheritance or prototyping or whatever. Or perhaps that's covered under "the specific operation to be invoked must come from the object identified in the client's request"? If so, that's not clear especially with the later commentary saying that open recursion isn't necessary to the definition. Good point. I say that inheritance is not required for objects, therefore open recursion is not required either. Some form of basic recursion between the operations is probably needed for any useful object to be defined, but there is no requirement for the recursion to be open. Excluding inheritance from the required features is controversial, I know. But I am convinced that inheritance, while very useful, is not absolutely essential to create a program that is recognizably object-oriented. Language support for inheritance isn't necessary for OO. But the basic delegation pattern represented by inheritance is common to OO. It can be achieved readily enough by has-a, especially in languages with programmable dispatch methods. (Doing it by hand per method can be quite painful, but also counts.) if an object has a bar behavior which calls this.foo then the foo called may be something that bar couldn't have been "aware of" at the time it was defined Languages without an implicit 'this', and instead explicit passing of the receiver (typically as first argument) have this ability, too, so I don't see how 'this' is central to OO. Arguably those languages aren't OO, but allow a shallow encoding of OO. I view this as a trivial syntactic matter, without any bearing on the question of whether a language is OO or not. You don't lose (nor gain) any expressivity by requiring senders to pass the receiver as first argument. object.method() becomes method(object). And even in the implementation of an object's methods, nothing changes since method() (on the implicit 'this') is just a shorthand for this.method() [so it's trivially expressible as method(object) in languages with explicit receiver.] object.method() method(object) method() this.method() I disagree that this is a trivial syntactic difference. Scoping works completely different. In fact, the "method" in method(object) and in object.method() aren't even in the same semantic class: the former is a variable, the latter a label. One consequence is that the former is alpha-convertible while the latter is not. method I don't think this distinction is universal. method in method(object) is a label in a language with first-class modules, where modules are records. Your distinction does indeed seem like a limitation of the encoding of OO, not the definition. Hm, I don't follow. Which module system do you have in mind? I agree that modules essentially are glorified records, but I don't see how that changes the variable/label distinction, at least not in principle. (In practice, module systems try to hide it somewhat, but it still exists once you desugar enough to get a view of the underlying semantics.) Edit: The main point I was trying to make is that in the function call syntax, the "method" is bound externally, while with method call syntax, the method is internal to the object, at least conceptually. IMHO, that has quite some -- fundamentally different -- implications. The example I was thinking of where the distinction doesn't exist was Leijen's first-class labels. Indeed, I'd say any pure definition of OO must include the possibility OO systems with first-class messaging, and dually, any definition of functional programming must allow systems with first-class labels. The deeper issue is that I have removed inheritance/delegation/open recursion from the definition. My point is that OO has two kinds of extensibility. 1. The first concerns how objects are used, and is given by dynamic dispatch. This is the same kind of flexibility given by higher-order functions (which are always dynamically dispatched) 2. The second concerns how objects are created, and is provided by inheritance. Inheritance is a general idea that can be applied to derivation from any self-referential structure (ML modules, recursive types, objects, classes, interfaces, state machines, etc). I have said #1 is essential to the definition of OO, while #2 is not. That is, you can have objects and OO without inheritance. The Go programming language is an example. I learned the following: An object I really fail to see the advantage of this new, other, definition for objects. Its a good question. The biggest change in my definitions is to the word "object-oriented". Previously it was generally understood to require inheritance, classes, and perhaps other things, which I have removed. As for objects, your definition might apply to modules in ML, Ada or Modula-2, and perhaps even to type classes in Haskell (since state isn't required to be mutable. It also doesn't specify how the operations are bound, so static binding might be allowed. I guess that my point is I want a definition that is very precise about the essential characteristics, and omits things that are non-essential. I have, for example, removed mutability as an absolutely essential characteristic of an objects. I did this not because mutability is not useful, or almost necessary in practice. I removed it because it is orthogonal to the issues that make objects unique. William, I like your definition, in particular as opposed to the old one which required "identity and state". Identity and state are intertwined with mutable objects, and that's something we need to get away from. So I am really glad to have a precise definition that concentrates on behavior and is silent about identity and state. Well. I had this discussion before on G+, and my counterargument is that without identity and state you're not doing something that is recognizable for a large audience as OO. Maybe it's better, I don't know, but I would prefer that one wouldn't call it OO, but something else. The thing is that identity and state give rise to OO modelling, as made concrete by UML, in which one can reason over object diagrams, state diagrams, sequence diagrams, and class hierarchies in class diagrams. (There are more, of course.) I might not like it, but that's OO for a large audience, and I don't think this definition is better than the old one I learned out of a number of UML books. Agreed. Again, a technical definition of OO is hard to grock without some "why" context. I dont find the UML argument very strong, but design is a big part of what make objects "objects" as opposed to just some bits in memory. Identity and state are very important for my own definition of OO; it is also the primary distinguished between OOP and FP. We definitely need saner ways to manage them, but to discount them as non essential...we are thinking about different paradigms. I used to very strongly feel that identity and state were irrelevant to whether a language was "OO" or not. Cardelli's (immutable) sigma calculus, and the fact that utilizing state-passing in typical "OO" languages loses you no more than it otherwise does, reinforces this. I also felt that implementation inheritance (and to a lesser extent inheritance in general) was unnecessary and undesirable. I tended to lean toward delegation. Really, though, I and, I feel, most others were picking and choosing which features to include mainly on tastes. While I could justify/rationalize my choices, I didn't have some independently compelling model whose features I was enumerating. I thought about this off and on over several years and during that time I learned about object capabilities, got in to Haskell, learned about the pi calculus, and deepened my understanding of formal programming language theory and things like category theory. Several things became clear. 1) The lambda calculus was fundamentally important within and far beyond computer science. 2) Functional programming was essentially based on the lambda calculus and had benefited enormously from that base. 3) Object-oriented programming had no similar base, and notably not even the lambda calculus served as such a base. 4) The OOPL research literature was rife with isolated "intuitive" metaphors and isolated ad-hoc formal systems (such as the sigma calculus or your nuObj calculus for that matter). I.e. they were formalizing existing practice rather than deriving it. 5) From things like object-capabilities and connections to coalgebra, it was clear that there was something to OOP. It was NOT just a pragmatic pile of ad-hockeries. Ultimately, after writing programs in the raw pi calculus and writing other message passing code, I found myself drawn toward patterns rather similar to OOP. The literature suggested that I, at least, wasn't alone in this lack of creativity, but the blue and deep blue calculi cemented this as something more significant. I now view (that is define) OO as based on concurrent message passing calculi in the same way FP is based on the lambda calculus. The pi calculus, or more conveniently the deep blue calculus, gives rise to something resembling typical OOPLs. Other calculi, such as the join calculus, with your Funnel taking the place of the deep blue calculus, provide variants. Taking this perspective, which seems reasonably well motivated historically though not as much in current practice, provides pretty clear answers to what the "features" of OO should be. One thing that's imminently clear is that OO is inherently stateful. With this comes a weak notion of object identity, but something like Scheme's eq? does not seem to appear fundamentally. An eq? can be constructed if desired by cooperating objects, as you yourself demonstrate with Funnel, but it can't be imposed. Providing a pervasive eq? doesn't seem incompatible and this ambivalence about the neccesity/desirability of eq? is reflected in the object-capability community. Implementation inheritance does not exist in this view except via delegation. It could be added, but there is nothing justifying it. Interface inheritance is more natural, but is more of a concern for type systems than the underlying calculus. Encapsulation is rather important. Connections between coalgebra, concurrency, and OOP seem more natural in this light. Similarly for connections between concurrent calculi/logical frameworks, security, and object-capabilities. Finally, while this may just be an artifact of how we like to formalize things, this perspective leads to something more akin to E-style lambda-based objects rather than prototype- or class-based objects. I think Smalltalk may have been one of the earlier and more influential drivers away from this conception of object-oriented programming. The goal for Smalltalk was really late binding. From the perspective of having everything be as late-bound as possible, "everything is an object" makes sense. From the perspective of an object being a (constellation of) concurrent process(es), having 1 be a concurrent process seems absurdly extreme even if technically doable. This is consistent with the lambda calculus and functional programming where everything could be a function, but it isn't really desirable to take that view. To conclude, I don't want to say that this is a good description of what people typically mean by "OOP", nor do I have any intent of going around and telling people that their definition of "OOP" is wrong. I do feel, though, that this is much closer to what OOP ought to have meant and perhaps should come/return to mean, and is certainly a much more actionable and principled foundation for extending (this notion of) OOP. I have my own designy definition: object-oriented programming is about thinking about your program in terms of interacting and somewhat encapsulated objects. Some of those objects are virtual computer manifestations, while some of those objects exist in the real world and interact via IO (yes, the user is an object :P). But now, how do we support object thinking? When I was young, I rolled my own objects in C (which otherwise supports procedure thinking), add my little v-tables, whatever. But the only reason I got there is because I wanted to think about my program that way and only then did I accidentally reinvent OOP (reinvented is too strong, I exposure to Smalltalk so I was unwittingly biased). My point is that my "what" of objects at the time emerged from why I wanted to use them. William, I think your definition would be much stronger if you included some more "why objects" then you could argue how the "what are objects" matches back to the why. A language or system is object oriented if it supports the dynamic creation and use of objects. Am I the only person on here who disagrees with the "or system" part? To me, object-oriented systems are totally different from object-oriented languages. Object-oriented systems like the Smalltalk environment and CLOS are living things you can directly manipulate. As for collection of named behaviors, I understand OO interfaces as a record of operations. Hi John. The intent of the definitions is to state required properties, but the properties are not exhaustive. Object-oriented systems may have many other properties, but they are required to use behavioral objects. I understand that we have overloaded the term "object-oriented" until it means many things, and many things to many people. I'm trying to unbundle it. You could have a "highly reflective dynamic object-oriented system" which added more capabilities. But I would argue that these additional capabilities are not part of the definition of "object-oriented". I'd say OO langs and OO systems are different because langs and systems are different, not because they have different idea of objects. What do you think? This definition essentially says polymorphism is the essence of OOP. I agree with that. Especially it leaves out concepts like encapsulation, private state, parametric polymorphism, subtyping, and inheritance. What I dislike about the definition is the use "may" and "can". For example, you could say "a behavior is a collection of named operations with shared state". Avoid subjective words like "easy". Personally, I find it easy to encode objects in C. Does that mean C supports object-oriented for me, but not for other people? Detail: client's -> clients Except that the use of the term "polymorphism" for (essentially) dynamic dispatch has always been pretty much a category mistake, and is usually avoided in PLT circles. Objects generally are no more polymorphic than integers. They just happen to have a more interesting behaviour, because they can encapsulate computations. Like any random first-class function, for that matter. As I commented above, I don't think that's enough. Here's some Haskell {- the interface -} data Animal = Animal { speak :: Int -> String, move :: Int -> String } {- One type of animal -} bird = Animal { speak = \repeats -> concat $ replicate repeats "cheep ", move = \repeats -> concat $ replicate repeats "flap " } {- Another type of animal -} dog = Animal { speak = \repeats -> concat $ replicate repeats "bark ", move = \repeats -> concat $ replicate repeats "run " } *Main> speak bird 2 "cheep cheep " *Main> speak dog 2 "bark bark " This exhibits exactly what OOers tend to mean by "polymorphism" and is very easy to write. The same thing would take 3 times as many tokens in Java. Yet, IMHO, what I've done does not qualify as object oriented programming in an object oriented language. It's just functions and records, and in Haskell records are basically just sugar for functions and algebraic data types. Even OO-like method call syntax is available in Haskell: bird `speak` 2 dog `speak` 2 Looks like object-oriented programming to me. Why do you say that it isn't? Sure, things will get a little more complicated when the interfaces are recursive, as in a stream interface. Adding many of the non-required OO features, including inheritance, subtyping, encapsulated state, etc, is also nontrivial. But those look like objects to me. Someone commented that I need to fix the definition to avoid using "easy". I could say "provides useful syntactic support for creating and using objects". In any case, should I say that Haskell is OO or not? It is pretty easy to do OO programming in Haskell, that is well known. I didn't count it, but it looks like about the same number of tokens in Java. Why the "repeat" method is not included in the String class I will never know. In Ruby it would probably be fewer tokens than Haskell. interface Animal { String speak(int x); String move(int x); } class Bird implements Animal { String speak(int x) { return StringUtils.repeat("cheep", x); } String move(int x) { return StringUtils.repeat("flap", x); } } class Dog implements Animal { String speak(int x) { return StringUtils.repeat("bark", x); } String move(int x) { return StringUtils.repeat("run", x); } } Mea culpa, the Java code is roughly twice as many "essential" tokens not three times (where essential ones are mandated by the language and inessential ones are just gaps in the standard libraries). Ruby would definitely be fewer tokens because you don't need to declare an interface or specify types. Why isn't it OO? Because as soon as I want to do anything interesting that simple encoding falls flat on its face. If some animal's "move" needed to refer to its "speak" then Haskell can do that, but not nearly so trivially. It definitely moves away from "support" into "can encode" territory. See my reply below. By the way, adding open recursion and even inheritance via "self" to Haskell is relatively easy as well: data Animal = Animal { speak :: Int -> String, move :: Int -> String, act :: Int -> String } base self = Animal { speak = \repeats -> "", move = \repeats -> "", act = \repeats -> (self `move` repeats) ++ (self `speak` repeats) } {- One type of animal -} bird self = let super = base self in Animal { speak = \repeats -> concat $ replicate repeats "cheep ", move = \repeats -> concat $ replicate repeats "flap ", act = (super `act`) } {- Another type of animal -} dog self = let super = base self in Animal { speak = \repeats -> concat $ replicate repeats "bark ", move = \repeats -> concat $ replicate repeats "run ", act = (super `act`) } fix f = f (fix f) b = fix bird d = fix dog *Main> act b 2 "flap flap cheep cheep " Now this is OO programming. But once you have users writing fixpoints then you've moved out of "supports" territory hence it's quite reasonable to say that Haskell is not an OO language. What if instead of the identifier fix I use the identifier new? fix new William, you write "A language or system is object oriented if it supports the dynamic creation and use of objects. Support means that objects are easy to define and use. It is possible to encode objects in C or Haskell, but an encoding is not support." So, by your definition, I would say Haskell is OO, but you specifically cite Haskell as not supporting OO. I agree with other correspondents that the culprit is the word 'easy'. You need to replace it with a more specific criterion, which won't be easy! I don't see the problem using using "may" or "can". The word "client" is introduced in the second sentence of the definition paragraph because it is needed later. I don't see a case where "clients" or "client's" is misused. You are right about "easy". I'll change that. I have difficulty distinguishing between objects and first-class functions using William's proposed definitions. Given that Will argues 'varying behavior for different stimulus' to be sufficient for a collection, even that can be observed within a function (varying results for different inputs) - e.g. just use a message type that allows pattern matching. IMO, the judge of objecthood is support for OO patterns. Many GoF patterns (including the most important ones) require state. And more important than GoF patterns are the object capability model patterns. Today, object capabilities are the best result from and the best justification for OOP. Object capability patterns are all about controlling state and authority - grant, delegation, attenuation, isolation, etc.. The difference between functions and objects is that objects can encapsulate authority, while functions can only borrow it from or pass it to the caller. I.e. this difference corresponds to first-class functions vs. first-class procedures. Procedures may observe, influence, and reference state resources. (Whereas we can have "everything is an object", we cannot have "everything is a function" since there must be an ultimate 'caller' that can observe and influence the world on the function's behalf.) Objects don't need to have "private mutable state" to be about state, and not every object needs to be mutable for state to be essential. Ignoring authority to observe and influence state from the definition of OO is, IMO, to ignore one of the most essential aspect of objects (the other essential aspect being that they're first class, can be shared and configured at runtime). You are the only person I have ever heard proposing that the definition of object should be based on OO patterns. There are many reasons why tying objects to patterns is a bad idea. One is that OO existed and was used in significant projects long before OO patterns were formalized. You could ague that they patterns existed but weren't written down. However, that is a stretch. More importantly, patterns focus on difficult situations, not the basic cases. Thus they tend to emphasize the problems in using a language, not on the easy standard cases. I think it would be better if you focused on OO design as a component of the definition of objects. For example Wirfs-Brock's CRC methodology or any of the other OO design methodologies. These are better because they focus on the common case, not the outlying case as in patterns. Also, you are moving into the question of why objects are they way they are and how to use them correctly. These are important topics, but I don't think they belong in a technical definition. Do you seriously believe "it's a stretch" that, for example, state and strategy patterns existed before being written down? You believe command and adapter patterns are "not basic cases"? Perhaps you should embrace a more realistic understanding of patterns. Realistically, all GoF patterns existed before being written down - the GoF was naming patterns exhibited from existing applications, not inventing patterns from whole cloth. Realistically, there are many more patterns they chose to not publish - after all, nobody wants a book about the boring, common or trivial patterns everyone can figure out. If it makes you happy to call it "OO design", that would be acceptable to me. In essence, it's the same thing - communicating patterns for structuring multiple objects and the communications between them in order to achieve common goals. The relevant bits are that: We recognize object systems in terms of software design patterns. Even Nygaard and Kay emphasize how programs are structured, designed, organized, and regarded above syntactic support for 'objects'. We can recognize OO and objects even when they are modeled in non-OO languages. I am not attempting to define objects in terms of "how to use them correctly". Many OO patterns that naturally emerge are quite awful, or require a lot of state management that is not essential to the problem or domain. But any definition should be consistent with how OO is recognized and distinguished from other programming models today. Your pet definition fails in that regard. My point is that patterns are just one part of the picture. They typically (at least originally) were both *common* and *domain-independent*, so they cannot describe many of the important object structures that arise as a result of detailed analysis of a particular application. These application-specific particulars are what I meant by "basic cases". As a result, I think patterns are not a good basis for a definition of objects or object-oriented programming. Also, something like the command pattern would be equally useful for implementing the Undo feature in a functional program. Thus they are not necessarily object-specific. Someone else suggested that I include more about design in the proposed definition. I have been thinking about it and plan do make some revisions. PS: By the way, I respect your opinion and that is why I'm engaged in this discussion with you. There's no reason to add in little jabs like "pet definition". It just brings down the entire tone of the conversation. OK? While application-specific particulars are the real "basic cases" in OO programming, they are generally not domain-specific. Rather, they are specific applications of domain-independent patterns. In general, domain modeling with objects turns out to be a mistake - i.e. design an application with polymorphic Person and TaxReport objects and you end up with a business simulator rather than a business data processor. This happens a lot to new OO programmers because, for misguided didactic purposes, most toy examples of OOP are simulators (duck say quack, cow say moo). For professional OO developers, in my experience and in discussions I've had, the base cases are generally not domain specific beyond simple value-objects (which would be served as well by plain-old-data as by ADTs or OO) for representing data and commands. Rather, objects are a way to reduce coupling and improve configurability internal to the application's communication structure. The common cases for leveraging OO properties are generally not domain specific. Even developers of games and simulators will often advise domain-generic approaches to structuring objects (cf. type object). OO has not proven ideal, nor even very suitable, for domain-specific techniques. (Though this has been mitigated in languages with multimethods; multimethods mix in a bit of logic programming, and logic programming is great for domain-specific purposes.) Nygaard's and Kay's descriptions of OO don't even mention the problem domain. They're all about the program's internal structure. And that is as it should be. something like the command pattern would be equally useful for implementing the Undo feature in a functional program True. We recognize systems by combinations of patterns and their prevalence, not by any specific pattern. RE: "no reason to add in little jabs" - I apologize for how I expressed that opinion. You are the only person I have ever heard proposing that the definition of object should be based on OO patterns. I had been resisting the urge to comment on this thread because of this :) Basically, whether they're in the definition or not, OO patterns seem essential for a useful definition of objects. I agree that they need not be in the definition itself, but if the definition does not imply what is intended -- a language in which OO is practiced -- that suggests the definition is for something else or what is intended is somehow inconsistent. Two cases popped up in the reasoning: the ability to create abstractions and inheritance. You recognize support for creating objects varies, but then ignored it as orthogonal and (me editorializing) controversial. I would like it supported somehow. Ideally, with a notion of strength or consistency (the 'lambda cube' is quite elegant in this). The other vivid case was inheritance. The ability to share code is problematic for many PL researchers (e.g., superficially, guaranteeing Liskov substitution), but that doesn't mean inheritance should be ignored as an irrelevant or inherently undesirable part of OO. Indeed, in surveying programmers in what they value about OO systems, I saw inheritance ranks much higher than interfaces. (I didn't even consider polling about different forms of dispatch.) The definition should allow us to tackle what is meant by OO, such as the ideas above. Whether that is easy or even possible is a different issue. Even if the support is not directly in the definition, pretty basic litmus tests of a grounded definition would be in analyzing these ideas. This is the point that I've tried to make in this thread, though I haven't been able to articulate it successfully I guess. Definition needs context. It seems to me that people are reasonably happy with the definition of "object" (although taking out mutable state is still controversial). But I can see that there are lots of problems with my definition of "object-oriented". This is a more difficult thing to define, because it is a style or a focus rather than a technical construct. It also seems to me that "inheritance" is a property more of "object-oriented programming" than of objects themselves. In other words, inheritance is about how to make objects, not about the exactly nature of objects themselves. My proposed definition was minimalistic: its OO if it "supports" objects. People have had trouble with the precise meaning of "supports". I'm not sure what to do here. One problem I have with the idea of including patterns or design is that a definition should not imply a value judgment, in that you could do bad OO programming and it would still be OO. Do you think its possible to define OO in an objective way that is useful and would accurately describe what it is? Do you think its possible to define OO in an objective way that is useful and would accurately describe what it is? No. Compare your definition to what I was accustomed to telling students. An object has identity, state, and behavior. A class is a blueprint for a collection of objects. All that relatively naturally translates to UML diagrams where a box can be an object (the name of the box is its identity, the state is a valuation of its attributes, etc) or a class (describing the name, state, and behavior). From these notions, 'typical' OO features 'emerge' such as class diagrams with inheritance, an 'is-a' relation, or membership, an 'has-a' relation, etc. Honestly, all these definitions are colloquial and formally pretty much debatable. One might wonder about: what exactly _is_ identity, what exactly _is_ inheritance, what exactly _is_ behavior. Nothing is precise. Fortunately, students hardly wonder about the precise semantics of things, and that is a good thing, since I see OOAD, design, as an inherently 'sloppy' mental exercise. To me, the essence of OOAD isn't much more than: Derive/draw a picture, a mental model, and implement it (making the design precise.) Consequently, I don't think OO can be defined in an objective -precise- way, and I don't think there are any merits to that. Well, except for the study of an aspect of OO, such as precise typing systems, for instance. I.e., in a paper an academic can dive into an aspect of 'the essence of OO' by presenting a very precise meaning for an OO language with OO types. Or study inheritance in a philosophical manner with your definition. I wouldn't call that OO, but an academic exercise at getting certain aspects precise in order to study them. But only aspects. (Actually, I also have a philosophical objection to your definition. You say: "An object is ... behavior." Behavior of what? Doesn't the term 'behavior' imply an observable quality of 'something,' which forces that a 'something' is a more fundamental notion than 'behavior' itself? Short of a 'panta rei' answer, I think you need another term.) No. Compare your definition to what I was accustomed to telling students. An object has identity, state, and behavior. I think Cardelli has studied objects more than most anyone here, and his object calculi are functional (edit: by 'functional', I mean 'pure', not the meaning 'based on functions'). He also provides imperative extensions in the same vein as extensions of the pure lambda calculus with mutation. The definition given to your students accurately describes all modern, deployed OO languages, it simply does not encompass all possible OO languages. Well, you can't please everybody. True for both Cook and me. But I am not too bothered if Cardelli's academic work isn't covered by my definition. [Note it isn't my definition. Just stuff out of UML books which I find serve their purpose in explaining the OO mindset. And I don't think UML is particularly bound to a programming language. The definition also fails on Javascript, in which -some claim- it is possible to do OO programming too. ] The argument you're presenting seems to require equivocation, i.e. using 'OO' with two different meanings. If marco chose to stick with his definition, he could argue that all possible OO languages have identity, state, etc. because languages that lack those features are, by definition, not OO. QED. If we're going to argue about definitions, we should try to make it clear that this is what we're doing. Definitions are judged differently than arguments. Cardelli's Theory of Objects does not, by the way, demonstrate that his effect-free object calculi would be suitable as an OO language. The study of effects was deferred because it was important enough to study on its own, after the foundation was laid. First sentence of chapter 10 of Theory of Objects: "Object oriented languages are naturally imperative". The book introduces effects in chapter 2. The argument you're presenting seems to require equivocation, i.e. using 'OO' with two different meanings. There is no equivocation if you use a definition of OO that encompasses both imperative and pure OO languages. The study of effects was deferred because it was important enough to study on its own, after the foundation was laid. Exactly, so the foundations of OO do not inherently require effects. We can look at the pure object calculus and still recognize objects and object-oriented programming, like some of the OO patterns you say are essential for defining objects to begin with. That's telling. First sentence of chapter 10 of Theory of Objects: "Object oriented languages are naturally imperative". The book introduces effects in chapter 2. For those who are interested, here is the opening page of Chapter 10. It's not at all clear to me that this statement is intended as a definition of objects as inherently imperative, as opposed to simply a recognition of the current state of the field, ie. all cars naturally had 4 wheels, until we invented ones that had 3. All definitions are working definitions subject to refinement as needed. I've designed languages that I've called OO that weren't imperative but still had state and identity. I would also claim that declarative + OO + state + identity are not mutually exclusive. Its even possible to have a OO language without methods (say, a data-flow language that supports object connections and object inheritance). Only if we look at popular OO languages do we find standardization of their companion paradigms. But its definitely not true for possible, niche, experimental OO languages that one is unlikely to use. So, then what is meant by naturally? I'm guessing this word has something to do with natural selection (animals naturally don't have 3 legs as they wouldn't survive to reproduce). So perhaps the claim here is that in order for an OO language to survive, it must be imperative? But then that gets at the crux of the issue: we could make claims that feature A naturally implies feature B, meaning you can't have a successful language that has A and not B, even if such a language is possible to imagine, design, and construct. Since all my counterexamples are fairly niche, I can't really argue against that. in order for an OO language to survive This phrase seems problematic. Perhaps separate it: It might be that a language doesn't need to be imperative to survive, but does need to be imperative to be recognized as OO. Or perhaps the ability to alias state would be sufficient. Or maybe OO has nothing to do with properties of the language, and is really in the hands of marketing... So perhaps the claim here is that in order for an OO language to survive, it must be imperative? One could argue that every usable language is ultimately imperative because, as Jones said, a language that performs no I/O is useless. Any OO language will enable side-effects in some manner, the question is merely whether the side-effects will be referentially transparent (as in Haskell), or uncontrolled as all current OO languages in use. Whoa...what? Imperative programming is basically step-by-step recipe programming, it does not necessarily imply side effect nor IO, though its often found useful for that; and you can write perfectly state free referential transparent code with procedures if it floats your boat. You can write imperative code in Haskell (using state/IO monads), and you can write declarative code in C# (using functions); you can even control your side effects if you want. You can do IO without writing imperative code (data flow), and we often even have weird mixes of imperative and declarative IO (data binding). So far OO has been paired mostly up with imperative control at the language level; anything else (data binding) is done at the library level. But contemporary OO does have fairly good support for encapsulation, its not completely uncontrolled. I'm curious how you'd write imperative code without mutation. These seem inetricably linked, which means imperative programming implies side-effects. Edit: could you elaborate on your meaning of dataflow I/O? Imperative code without "real" mutation are simply functions that are expressed with reassignment. My best examples here are earlier versions of GSL/HLSL, where code is definitely not doing IO or even messing with memory beyond array reads; it is actually quite functional...yet the language designers decided it best to make the language imperative anyways, and we are only one step away from functional by going to SSA. Dataflow I/O...think Quartz Composer: there is definitely IO going on, that's the whole point of the language. But you enable this behavior by wiring up your program without any imperative code at all. Basically, you have an event source and you wire it up to an event sink...maybe transforming it in between. And then the IO just happen, you don't need to be directly involved in the flow for IO to happen, you just make it so the flow can happen. it is actually quite functional...yet the language designers decided it best to make the language imperative anyways, and we are only one step away from functional by going to SSA. Isn't SSA just A-normal form? I'm not sure I'd classify that as imperative programming. Once we introduce the store via which we write memory, then we're doing imperative programming. The mutation was still that final step, so it doesn't seem separable. Re: non-imperative I/O, given your description as a dataflow program, it sounds like we're declaring a device (the display) to have a purely functional behaviour. Can all I/O be represented in this fashion, or just I/O that just happens to share this sort of character? If the latter, then I'm not sure I'd classify the language as being capable of I/O, but rather it containing a domain-specific abstraction that happens to encompass a subset of I/O of interest. I'm aware I haven't advanced a precise definition, and I'm trying to avoid circularity in how I define I/O so that it doesn't necessarily imply imperative programming. It just seems that a program must be capable of expressing some arbitrary interleaving of updates via its I/O abstraction. From this, we build domain-specific abstractions that restrict the interleaved updates to those we consider correct, like dataflow. I hope that makes some kind of sense. All I/O can be modeled declaratively. cf. Dedalus or discrete event calculus. I/O doesn't need to be imperative. Very little I/O can be modeled purely - at least, assuming we want open or extensible systems. Purity requires there be no aliasing, no dependency on environment, no implicit observers. E.g. we declare the device (the display) to have a purely functional behavior. Can we explain how this declaration reaches the display? and when? What happens when there are concurrent declarations (from other agents or processes)? What happens when we want to change the display function for another one? These are the questions that characterize I/O. a program must be capable of expressing some arbitrary interleaving of updates via its I/O abstraction. From this, we build domain-specific abstractions that restrict the interleaved updates to those we consider correct, like dataflow. That's actually an abstraction inversion. I.e. you're starting with a more powerful and expressive technique, then applying layers of discipline to control it. Sure, it might seem like the natural approach for programming CPUs, because CPUs are very eventful (and events are a major cause of accidental complexity). If we were starting with FPGAs or GPUs, it would be clearer that all this arbitrary interleave is something to avoid unless necessary. If we start with a synchronous concurrent base, we can build stateful systems atop it. We can even still model promises, mutexes, queues, etc.. But such techniques are often unnecessary, symptoms of accidental complexity. You can reduce the amount of state to something much closer to essential. The cost, of course, is that such declarative approaches are further from modern CPU models, and it takes a clever compiler to achieve performance. HLSL/GSL are definitely imperative languages. As shader pipelines begin to accept more CPU-style instructions (or think geometry shaders), they are transitioning fairly easily to more general purpose imperative languages, which would have been possible if they were originally designed as functional. For IO, think of your monitor: you have to raise the right electrical signals at the right time in order to get the image you want on the screen; that is very imperative. But the coding in which I enable that, plugging the cable into the VGA port, is definitely declarative. So you can always enable IO by simply declaratively routing and transforming opaque wires, even if what happens inside the wires is imperative. Obviously there are limits: at some point you might need to directly generate or receive that electrical signal on the wire, and then you are in imperative land. But that functionality could just as well be encapsulated inside a black box...so it "depends." But to say you always need to be imperative to do IO is incorrect. Also, transcoding can make things confusing here: I can transcode imperative on top of a declarative language by simply "declaring" instructions; this is most definitely imperative programming even if the language isn't supporting me directly. This sort of happened in SuperGlue sometimes as I tried to make it more expressive. I can also transcode declarative code on top of imperative code; i.e., WPF databinding. Transcoding always make the story much more nuanced. HLSL/GSL are definitely imperative languages. I'm still not on the same page. The HLSL samples I've looked up all look like they're in SSA form, which jives with what you said earlier. SSA form is considered functional programming by many, ie. not one step away, which I believe was your original claim. Re: transcoding, isn't this just interpretation? Re: any sort of I/O without imperative programming, perhaps I'm being overly skeptical, it's just that I've read a lot of papers on type and effect systems, regions, etc. and all of them seem to be focused on properly ordering effects via the application of functions. Perhaps that just biases me to think I/O is imperative, so I'll have to mull it over awhile; I'm not yet convinced that any sort of I/O could be represented in Dedalus or via dataflow without also embedding some core assumption that makes it all work out in the end (like call-by-value functions). Effects achieved through message passing are imperative - i.e. messages effect an observable, temporally ordered sequence of discrete computations and state changes. Unless you switch away from messaging, effects in OO will be imperative. If you switch away from messaging - e.g. instead use declarative signals or dataflows - many people would hesitate to call the result OO. However, use of state and aliasing would still allow recognizable expression of every OO pattern (including messaging, by explicitly modeling an inbox, aliasing it, and influencing its state). General purpose programming does need to model IO, but we cannot conclude that it's necessarily imperative. OTOH, many of the alternatives for non-imperative, impure effects (such as concurrent constraint programming, or discrete event calculus) are neither widely known nor recognizable as OO. Sean and I are closer than most to creating viable alternatives to imperative, message-based OO. Though, I'm not so fond of OO that I insist on using that descriptor. side-effects will be referentially transparent (as in Haskell) Side-effects are not referentially transparent in Haskell. Exactly, so the foundations of OO do not inherently require effects You could validly say that the foundations of Cardelli's object calculus do not inherently require effects. But you're missing a step in reaching a conclusion that all "the foundations of OO" were laid prior to introducing effects. All definitions are working definitions subject to refinement as needed. Indeed. In some conceivable futures, we might be using "OO" to describe Snusp language. Definitions do change. But if we go around pretending to be prophets and using future definitions today, the best we can hope for is to confuse our audience and to present inconsistent arguments that might reduce to `OO is not OO`. I already mentioned the step, and in fact it's based on your own argument: the OO patterns expressible in pure languages are still recognizable. the OO patterns expressible in pure languages are still recognizable As phrased, this is a potentially vacuous form of argument. Compare: all the unicorns and rainbows you can express with Intercal are still recognizable. I agree that the pure object calculus does resemble OO within the limits of what we can express. I don't find this nearly as profound as you seem to. I'm a little mystified by how you can claim that OO patterns define the nature of OO, and in the next breath call it a vacuous argument. It's not intended as a profound argument, it's merely intended to show that the character of OO is not defined by state and identity. I said your phrasing potentially admits even vacuous arguments. That is, you said: "the OO patterns expressible in pure languages are still recognizable", but you did not argue even one OO pattern can be expressed, nor that a significant subset of patterns can be expressed, nor even that important or common patterns can be expressed. We can say anything is true of all elements of an empty set. you can claim that OO patterns define the nature of OO, and in the next breath call it a vacuous argument First, I have not (in this thread) called anything a vacuous argument, much less my own claim. Second, I have never claimed that OO patterns "define the nature of" OO. I did claim "the judge of objecthood is support for OO patterns". There are significant differences between the two. For example, my claim allows that we define OO without ever mentioning patterns so long as the definition ensures the patterns are admitted. Third, I do not mean ability to express just a few select patterns. I mean all of them, or at least those most valuable or common to OOA&D - adapter patterns, monitor/observer patterns (which require aliasing), object capability patterns, etc. it's merely intended to show that the character of OO is not defined by state and identity If that is your intent, you have not succeeded. My statement on pure OO, while imprecise, is not so imprecise that it admits any interpretation. The pretty clear implication is that most OO patterns are expressible, otherwise there wouldn't be much point to attempting to use patterns to distinguish OO. Only the patterns requiring global state changes are difficult to express in the presence of purity, like capability revocation patterns. Only the patterns requiring global state changes are difficult to express in the presence of purity, like capability revocation patterns. Why do you preface this sentence with the word "Only"? And what do you mean by "global state changes"? Why do you preface this sentence with the word "Only"? Because in reviewing the OO design patterns during this thread, the only ones that looked truly difficult for a pure language are the ones specified in my sentence. Is there another possible interpretation of "only" in that context? And what do you mean by "global state changes"? I mean a pattern that exploits mutation in a way that implies global source code changes when representing the pattern in a pure language, instead of a small set of local transformations. Capability revocation is an obvious example, as it would require explicitly passing around the whole store or an ST monad to thread the store implicitly. One or two of the behavioural patterns may also qualify, like Observer. Is there another possible interpretation of "only" in that context? Rhetorically, the word asks the audience to dismiss or ignore a point. Use of words 'merely', 'just', 'simply', 'only', etc. are common signs of bias of perspective. Cf. Just is a dangerous word. "the only ones that looked truly difficult" "Only the patterns requiring global state changes are difficult" Try the same phrases without the word 'only', or even with the opposite emphasis: "common, possibly essential patterns requiring global state changes are difficult" a pattern that exploits mutation in a way that implies global source code changes We can model stateful objects in a pure system by returning an updated version of the object along with any response. This regresses the state burden back to the caller, who ends up threading an object graph through a series of operations. Not very different than threading any other store, really. An application written in this style requires a global discipline, i.e. a by-hand global code transform just to model local state across messages. Would you include this pattern? If so, you might want to review just how much of Cardelli's chapter 6 relies on exactly this global discipline. If not, I suggest instead you focus on aliasing of state: the ability to effect a change on one reference then observe that change on another. I suspect this to be closer to your intention. One or two of the behavioural patterns may also qualify, like Observer. Many patterns require state. More than you might suspect, since it isn't always obvious without context. For example, adapter pattern doesn't require state in the trivial case where messages correspond 1:1, but does require state in the common case that the adapter must join messages. I never was big on patterns. Basically, my view on patterns is that 1) "I'll bloody well invent a new pattern when I need one." and 2) "My students are better off when they can bloody well invent new patterns when they need one, instead off applying the wrong pattern badly." so I am a bit reluctant muddling into your discussion. But there is one thing. The whole purpose of OO, to me, is to model a program as a set of collaborating objects. UML makes that explicit by allowing one to define collaboration diagrams to specify how objects interact to implement a specific result. OO without state? I just -pun intended- don't see it. Of course you should invent new patterns when you need them. But the reason that patterns become patterns is that they are suitable in a wide variety of situations - i.e. even in the projects that use new patterns, you'll tend to use a lot more old patterns. The more patterns you have, the less often you'll need to invent new ones. Patterns are the "crafting techniques" of any paradigm, experience distilled from trial and error. You can learn them through study or through invention (often re-invention), but learn them you shall - if you are to succeed with a paradigm, anyway. The "only" problem with learning them on your own is that you'll make a lot of your own errors, rather than learning from the errors of other people. To say OO is more about the patterns rather than the material is analogous to saying carpentry is about the techniques rather than the wood. I.e. in the unlikely case we could transfer all those techniques to another material, we could still call it carpentry. Yet, if we leveraged an entirely different set of techniques for processing the material - e.g. using CNC and lasers to shape wood - it would be difficult to call it carpentry. I believe that OO is about the development process, about the expression and techniques of human programmers, not about the product or the material. Therefore, OO is about patterns. to model a program as a set of collaborating objects I don't believe the connotations of "collaboration" are entailed by OO. At least, that aspect seems very weak in comparison to certain other paradigms like multi-agent systems, blackboard metaphors, and concurrent constraint programming. If collaboration was the essence or purpose of OO, I think OO would be stronger at it. OO systems tend to be built of passive objects rather than agents that actively collaborate. Rather than the "social" model implied by "collaboration", the materials and patterns of OO are more oriented towards an understanding of programs as physical objects. Of course you should invent new patterns when you need them. Well. I admit it's one of those things where I am probably mostly wrong, but there's something to it. No biggy, just one of those quirks I live with. I don't believe the connotations of "collaboration" are entailed by OO. ... OO systems tend to be built of passive objects rather than agents that actively collaborate. I think you're wrong. The overhead of implementing languages which pass messages is just too large, and Java/C/C# now dominate OO software development, therefor we now colloquially mostly 'call methods' instead of 'pass messages' (the later the more popular phrase from -say- the smalltalk world and OO design.) Stated differently, to an OO designer 'calling a method' is a lousy misnomer for 'passing a message.' Moreover, the fact that objects are mostly passive doesn't imply that they don't cooperate. The message passing model, or mindset, from Smalltalk dominates the OO field. Which in turn dominates software design. The overhead of implementing languages which pass messages is just too large Work-stealing implementations and buffers can pass messages very efficiently and even leverage cache locality effectively. It is not unusual to get the mean message passing overhead down to less than 10 CPU cycles per message (albeit at some cost to mean latency). Further, a good compiler can inline the stateless actors and reduce some stateful elements (e.g. actors modeling stateful cells) to simple lookups (and queue updates for later processing, since we don't need to "receive" those updates right away). Recursive messages can be unwound to a finite depth. In my experience, we can typically eliminate the vast majority of messages at compilation or JIT, thus eliminating many latency and buffering overheads (while remaining compatible with message-passing semantics), if we wish it. But I think you misunderstood. Even actors are passive objects by my understanding. Sure, each one is concurrent, but actors are still passive between processing messages. Any initiative or purpose for an actor must be applied from somewhere else. the fact that objects are mostly passive doesn't imply that they don't cooperate "Collaborate" and "cooperate" don't connote quite the same concepts. There are some meanings for 'cooperate' that might apply to some OO systems. Here is an exercise: look at an engine for a vehicle. Certainly, it makes sense to use the word concurrent to describe the operation of different parts. Maybe even synchronous (not to be confused with sequential). But which elements are collaborating? Which are cooperating? Does it even make sense to use these words? Work-stealing implementations and buffers can pass messages very efficiently and even leverage cache locality effectively. ... Okay. I am tempted to respond, but I think we dive too much into the specifics of OO language implementation. No, I don't think I misunderstood. UML even makes the provision to state which classes are 'active' which is part of an elaborated design. No, it certainly isn't true that OO assumes all objects/classes to be 'passive'. "Collaborate" and "cooperate" don't connote quite the same concepts Fine, I meant 'cooperate' as in 'collaborate'. Typo. ;-) [ Again, I mention UML since it, to me, epitomizes the OO paradigm, or OO 'thinking'. ] Patterns are like cooking recipes: the dimension of one's personal taste, in the first place, for the target meal is likely almost as important as the accuracy and ease of use of the recipe proper. And by "one" I mean either an individual programmer or the full dev team he/she is in, along with their culture and various kinds of legacies (current codebase, libraries, etc). To me it is kind of intriguing to see people still struggling to give a definition of OO, formal or not, thriving to get the broadest possible acceptance. It always seemed to me that OO's arbitrary choice to model programs after rather, say, biased notions of objects, types, modules, etc was somehow less important than the actual, higher level, claims and pride for the objecthood support: composition, reuse, separation of concern and contracts (or so called) via official public interfaces and encapsulation, and so on. OO as hyped up 30 or so years ago in the mainstream, just my historical theory, was appealing to a broad audience already a bit aware (though maybe not deeply enough) of the evil of uncontrolled side effects, that found the "receiver . message ( arguments )" syntactic scheme very speaking to a (I suspect) mostly unconscious mental association with : subject . verb ( complement ) "How cool. See how natural it is ?! That just can't possibly be wrong to program this way !" (okay, mocking a bit) Back to them, as far as patterns go, some well known, and influential, OO proponents have already stated for quite a while now, that patterns can be good, and components can be too, and "good patterns" (cf. my remark about tastes above), when turned into components, are even better anyway... for what OO claims to be important and wants to fulfill. Coincidentally, though, componentized patterns, contemplated with the envy and OO bias to design and implement software, also turned out to NOT be as easy (at all) to obtain as one first wished for. I share your cynicism about OO. It certainly hasn't lived up to any of that marketing hype. OO code lacks justification for any claims of being more reusable, configurable, modular, maintainable, etc. than code developed with equal discipline in competing paradigms. It is difficult to justify any claim about OO if you can't even define it. And the "intuitions" offered by OO seem to mislead people to develop business simulators when they want something else entirely. I share your cynicism about OO. Well, in all honesty, it was just my take more as a Devil's prosecutor than anything else, since, I liked it or not, I most often had to accept be classified more as a "OO programmer" if only to make a living, with few opportunities over the years, in the market jungle, to emphasize better on some other "saner" skills or experience. But that's fine. It is difficult to justify any claim about OO if you can't even define it. I got that. I sure didn't mean to say the OP is "wrong" in trying so. I suppose such efforts can still make sense. Fair point. Among the classics, there's always Meyer's "early" (definition), I suppose relevant to recall: "Object-Oriented Design We shall simply offer a definition of this notion: object-oriented design is the construction of software systems as structured collections of abstract data type implementations. The following points are worth noting in this definition: • the emphasis is on structuring a system around the objects it manipulates rather than the functions it performs on them, and on reusing whole data structures, together with the associated operations, rather than isolated procedures. Objects are described as instances of abstract data types; that is to say, data structures known from an official interface rather than through their representation. • The basic modular unit, called the class, describes the implementation of an abstract data type (not the abstract data type itself, whose specification would not necessarily be executable). • The word collection reflects how classes should be designed: as units which are interesting and useful on their own, independently from the systems to which they belong. Such classes may then be reused in many different systems. System construction is viewed as the assembly of existing classes, not as a top-down process starting from scratch. • Finally, the word structured reflects the existence of important relationships between classes, particularly the multiple inheritance relation." (Citing: SIGPLAN Notices, 1987) I've always found Meyer's definition interesting not so much because of its intrinsic value (or flaws thereof), as debatable as others I suppose, but rather because of Meyer's strong and consistent commitment to his own proposed definition, a posteriori, and both as a language designer and as a language implementor. And isn't a consistent commitment a form of an interesting dual of argumentation that one shouldn't overlook either ? Anyway, turns out the resulting OO language, IMO, was / is far from being among the worst that OO proponents may have seen, to say the least..., but (sadly enough) widespread acceptance (use) by the industry definitely seems to be much of an independent animal to deal with. Why do you believe patterns and design indicate value judgement? The patterns themselves can be judged in terms of consequence and context, but certainly not all patterns are good ones. Anti-patterns are also quite prevalent. For paradigms, the good generally comes with the bad. It seems to me that people are reasonably happy with the definition of "object" (although taking out mutable state is still controversial). I suspect what's left in your definition is non-controversial, but what is missing is controversial. This is the typical challenge with reductionism :) Patterns may simply be a good test of the definition. Can I construct a full OO language, by the definition, and test that it fails to support inheritance, factories, etc.? What does that say about the OO language and the definition of OO? Likewise, what if I can construct a non-OO (by the definition) and perform the expected patterns? [ Universal Turing machines and fancy program analyses... uh oh. ] The lambda cube is a great example of where you fall on a spectrum being neither good nor bad. Consider the case of inheritance. I don't follow the literature on distilling the essence of OO etc., but a relevant lesson from meta object protocols / faceted values / proxies / mirrors is of consistency: I would expect a scale of inheritance would be the ability toread/write otherwise encapsulated object environments / state. (This seemingly borders on the expression problem). If an object can do it, so should an object extension. This really gives two ways of moving up/down the spectrum: via functionality (is there first-class / second-class X) and consistency. There are trade-offs: making something first-class may challenge consistency elsewhere. It's a moving target in both the notion of utility and accuracy: PL interests change and new languages will probably keep showing up (imagine talking about OO pre and post Self, aspects, ...). That doesn't mean it's a useless endeavor, though I am curious as to what you hope to get out of this. A typical exercise for testing kernel semantics is to express richer semantics as sugar. This case is a bit harder in that you only have a meta-semantics (well, not even). Maybe the current approach is inherently controversial? That depends what you mean by 'objective' and 'accurately describe', but I suspect that as far as your purposes are concerned, my answer would be no. Basically, I think that OO is, more than anything else, a cultural transmission or tradition of praxis, with all that that perspective implies. Precisely what technical foundation is recognized as epitomizing this culture is variable in both time and space. Like other cultural traditions, OO is prone to branching and splitting, rejecting/revising its past while claiming to embrace it, fabricating definitions for itself that are baldly in tension with what it actually embodies, and so on and so forth. This point of view allows us to make sense of the fact that different branches of the OO culture may not even recognize each other, today's OO may insist that the OO of the past (or, for that matter, of the future) is heretical in any number of ways, it may claim to have always been a way that it has obviously only recently become, etc. None of this should surprise us: an even cursory study of the history of religion (even restricted to a single family of religions, say Christianity or Buddhism) would be most instructive here. And as in the case of religion, I don't at all mean to say that individual claims made by particular people at particular times cannot be subject to judgment. Obviously if someone claims in the name of religion that humans walked the earth with the dinosaurs, well, we can certainly look at the evidence. But to view such contingent doctrinal theorizing as the "essence" of Christianity is the height of historical naivete. Are today's doctrinal arguments relevant to the rest of our public life? Yes. Are they related in some complex way to the entire history of the traditions from which they emerge? Yes. Do they define those traditions? Absolutely not. So, to bring this back to earth: no, I don't think that any technical definition of OO will be sufficient. In fact, I think any such technical definition is just yet another contingent elaboration of history-up-to-now, one more layer of sedimentation. All traditions have their essentialists. (Of course, all traditions also have their relativists, so I don't claim to be able to escape the mire either.) I don't expect this messy point of view to be pleasing to the rational, mechanistic and formal view which is so often a defining characteristic of "nerds." (And I ought to know, as a proud nerd I have a very strong streak of that myself, and often find my own point of view somewhat distasteful.) But I do think that a useful definition of OO will be first and foremost cultural/historical, and will be able to survey both the tools made/used by that culture, the tools rejected/ignored, the terminology and incidental fetishes (any definition of OO should also be able to account for the rise of "agile" methodology), dare I say mode of dress and hairstyle? Such a definition would probably be completely useless for some purposes, but I do believe it would be very fruitful in general, and I believe as well that it would be more honest. I don't know, it seems Will is on the right track. There is a common theme to all OO languages, and that is a certain type of procedural abstraction resolved dynamically in some way based on the object. Class-based, untyped, prototype-based OO languages all share this element, albeit with the resolution occurring in different ways. We may have to agree to disagree here. I don't mean to say that his definition is bad or useless. I think it's a perfectly reasonable and useful definition for some purposes. But as we've seen in the rest of this thread, I think it's doomed on the one hand to exclude some languages/systems/people who claim to be doing OO (and have a reasonable historical basis for that claim) and doomed on the other hand to constant questions like "But this Haskell code seems to fit your definition, so why isn't Haskell OO?" The only way to resolve that is by drawing ever finer and more arbitrary distinctions, or else blowing hard against the wind and saying "Well, the definition is king, so I guess Haskell must be OO!" Definitions of programming paradigms are like political maps. Some of the borders may correspond to geographic, ecological or cultural features that have always been there (rivers, for example, or different spoken languages), and others may through long-term influence come to be mirrored in the geography, ecology or culture (walls or fortifications, for example, or deliberately maintained wasteland, or the emergence of new dialects). Lines on maps have power to change reality, so we should be careful where we draw them. But we also deceive ourselves if we mistake the map for the territory. On a purely technical level, incidentally, I don't completely buy your claim that "There is a common theme to all OO languages, and that is..." What about languages that use multi-methods? What about the actor model? Must we then regard actors as objects, plain and simple? Of course lots of OO languages all look roughly the same at this particular point in history, and even more use superficially similar jargon to describe radically different models. But I think "all OO languages" is pretty broad... I'd say multimethods fit into OO too, as they dispatch on the runtime value. Is this not considered OO? Are actors not generally considered objects? Some people certainly think so. The capability operating systems (KeyKOS, EROS, etc.) expose an object-oriented development model, but the objects are processes that communicate via IPC, ie. actors. I don't have any statistics on the prevalence of this view actors=objects though, assuming that's relevant. But as we've seen in the rest of this thread, I think it's doomed on the one hand to exclude some languages/systems/people who claim to be doing OO (and have a reasonable historical basis for that claim) The broad definition is pretty inclusive, so I don't recall anything mentioned that's incorrectly excluded. Excluding type classes is trivial simply because they are not first-class. But this system supporting first-class type classes is definitely object-oriented. I don't know, it doesn't seem nearly so vague or ill-defined in my mind. Multimethods, at a meta-level, are quite difficult to explain with OO. Where do these methods come from? How does the system peek into my "opaque" objects and know which behavior to dispatch? Who is receiving the lists of arguments? What black magic is this? They aren't impossible to explain, fortunately. I've modeled multimethods a few different ways - with a registry of methods in a shared space (spaces being modeled with objects), and another time with a tuple space for the parameter lists. But to register the methods or establish precedence for agents still requires an explanation... generally in the form of a global discipline or an interpreter. Seems a bit dubious to say "multimethods fit into OO". But I think it would not be controversial to say that multimethods are more than expressive enough to easily model OO systems. I.e. "OO fits into multimethods". Slate attempted to resolve this by implementing multimethods using extended method dictionary tables that included "role" metadata (encoded as bitmasks), essentially indicating for each entry which positions the current table owner "fit". So, logically, the method dictionary became a map from symbol+position to method. Perhaps I'm missing something, but doesn't the characterization ... means that different objects can implement the same operation name(s) in different ways, so the specific operation to be invoked must come from the object identified in the client's request apply just as well to static dispatch as it does to dynamic? Perhaps it is not worded as clearly as it could be. But the idea is that operation actually comes from the *runtime value* of the object identified in the request. Since "the object" is not known until runtime, there is no way that this kind of dispatch can (in general) be performed statically. Can you suggest a rewording that would make it more clear? (This is exactly the same as a first-class function, which is dispatched dynamically to the actual closure value at runtime. The particular code to be called when invoking a first-class function cannot be known statically) My feeling is that you have to talk about object references and object values in order to make this clear. By polymorphism, an object reference of type T can assume values of any subtype of T; with static binding, it is the type of the object reference that determines the implementation of a method, and with dynamic binding it is the type of the object value. It's only "exactly the same as a first-class function" in a language with mutable (function) references - the distinction is void in a language in which each reference is bound to exactly one value. Jeremy I disagree with most of what you say here. By focusing on subtyping, you confuse the issue and miss the simple basic point: there can be two different objects or two different functions that *behave differently* even though they have exactly the same type. Thus "object polymorphism" can occur even if there are no subtype relations involved. The "value : type" relationship that is important here, not the "type : type" relationship. Discussions of OO have often promoted this confusion by suggesting that object polymorphism is somehow tied to inheritance. But in fact it is not. The other source of confusion is when people consider classes as types. Doing so exposes representations and blends in notions of existentials and ADTs into the more pure object-oriented style, which is based only on interfaces as types. Secondly, I assert again that dynamic dispatch on OO is the analogous to calling a first-class function, even without mutable function references. This is because functions can be passed to other functions, and at that point it cannot (in general) be known statically what function will be invoked by a given call. Mutable references are not required. Secondly, I assert again that dynamic dispatch on OO is the analogous to calling a first-class function, even without mutable function references. Indeed, and to formalize this somewhat: Type Inference for First-Class Messages with Match-Functions. So polymorphic sums = messages, pattern matching function = dynamic dispatch in object. How about concurrent objects are Actors (as in Actor Model) :-) * See overview publication at * See overview video at Since Hewitt brought this thread back.... I'd be fine Marco's class based definition (above). Or something like "An object is a data structure and associated routines for data processing using that data structure". That being said, I read the discussion above about dropping inheritance. I like PIE (polymorphism, inheritance, encapsulation ) as the essentials of object orientation. I wouldn't consider any language without inheritance to be object oriented. So possibly I'm missing the point. Inheritance seems peripheral to OOP. Inheritance is a feature of type systems or some (allegedly) convenient object construction models. Inheritance is neither a property of objects nor essential to any OOP design pattern. Inheritance is neither a property of objects nor essential to any OOP design pattern. We disagree on this one. I think the has-a vs. is-a distinction is the core OOP design pattern. Classes are in a hierarchy and objects are an instance of classes. I guess what would you consider a commonly thought of OO language that doesn't have inheritance? Polymorphism supports the 'is-a' property in every relevant technical sense, and does not depend on inheritance. Encapsulation provides the 'has-a' property - the ability to hold references to hidden objects. Even if you consider those the "core OOP design patterns", it isn't clear how that serves in defense of inheritance as an essential OOP feature. There are many OO and actors languages that either lack inheritance or marginalize it (e.g. relying on dynamic duck typing). I think of E and JavaScript off the top of my head, but I remember reading about more of them. I do acknowledge that inheritance is correlated with OOP, and there are many variations on inheritance (e.g. traits). But there are also non-OOP systems with variations on inheritance (e.g. frame technology, and some variations on logic programming). I think inheritance is pretty much orthogonal to OOP, and is more about composing concepts declaratively. Encapsulation provides the 'has-a' property - the ability to hold references to hidden objects. What? HasA is taxonomic, it allows us to describe objects that have other objects (and is not novel to OOP at all)...encapsulation is a separate thing and we can even apply to IsA in certain cases (as in dreaded private inheritance!). Inheritance is not orthogonal to OOP, its more of an optional mechanism in support of it. Frame systems, as classically defined by Minsky, are very object oriented, even if they are also rule driven. OK those are good examples. I wouldn't consider Javascript an object oriented language. I consider it functional, things like first class functions and map as an iterator. Javascript makes use of Microsoft's distinction between "object based" which they applied to Visual Basic 6 and "object oriented" which applied to VB.NET C++, J++... AFAIK Javascript's own designed consider themselves "object based" a) data encapsulation b) data binding and access mechanisms c) automatic initialization and garbage collection of objects d) operator overloading but not: e) inheritance f) dynamic binding where (e) and (f) are required for object oriented. ________ Polymorphism supports the 'is-a' property in every relevant technical sense, and does not depend on inheritance. I'm not sure if I agree with that. Polymorphism is about the behavior of functions, so Haskell for example I think has good polymorphism. I will agree that good polymorphism can get you good dynamic binding but what you can't do is override them (excluding type classes which IMHO mostly are OOP). I have a tough time even defining OOP without inheritance so just going there I'd say the key is the ability for base class methods to be overridden. In terms of duck-typing. Yeah that allows you to override. A language that was otherwise object oriented in feel that made use of duck typing to implement inheritance I wouldn't have a problem calling object oriented. ____ In terms of it being essential I'm sort of waiting for your argument. The very first basic examples: Corolla 2348769 is an instance of Corolla which is a Toyota car which is a car which is a vehicle. If you can't do that, then I don't see how you are doing object oriented programming at all. In practice, OOP is not about domain modeling, but is rather about program modeling - describing and organizing a program with metaphor of a collection of physical components (this is a stack, that is a queue, there is a mailbox and a pipe and a state-machine). Even in game and simulation development, best practices would have you modeling entities in terms of what you can do with them (movable, renderable, clickable, animated, destroyable). Unless you're writing a simulator - badly - I think you would not model your Corolla 2348769 the way you describe. It is my impression that OOP is traditionally taught poorly, with hierarchies of animals and vehicles that have nothing to do with object oriented programming in practice. It is unfortunate that people unthinkingly return to such examples when explaining OOP, despite their irrelevance. In OOP practice, the technically relevant 'is-a' relationships are those that describe roles, interfaces, or contracts. Organizing code with hierarchical inheritance relationships is unnecessary to achieve technically relevant 'is-a' relationships. Polymorphism is essential. Polymorphism is also an overloaded word. The meaning of polymorphism in OOP refers to "the ability of objects belonging to different types to respond to method, field, or property calls of the same name". OK good that's an excellent observation. You are right I'm using the definition of domain modeling not program modeling. And you are right that OO in practice tends to be more about program modeling. So that's a good argument for why inheritance isn't fundamental, this distinction between domain and program modeling. I'm not convinced yet, but I do see your point. But what would you consider the distinction between your functional definition "clickable" and type classes. I.E. "X has a click method" and "the click method applies to all Y" seem like just looking at the problem from different directions. Moreover type classes seem to capture more directly the "what you can do with them" rather than the "what they are". I have to think about your distinction a bit more but feeling like you are describing type classes not classes in the OO sense is the first thing that comes to mind. And that's what's initially worrying me about accepting the program modeling distinction vs. domain modeling. Typeclasses by themselves don't offer OOP polymorphism. I.e. you can have a Clickable type, but you cannot represent a list or collection of heterogeneous Clickable types. The additional requirement for OOP-style polymorphism is existential quantification. While Haskell extensions can represent existentials, existentials remain inconvenient to express and use widely in Haskell programs. A natural presentation of existentials in ML languages (Haskell included) was suggested by in 1992 by Läufer and Odersky, An Extension of ML with First-Class Abstract Types. As far as I know, they were not added as is to existing ML implementations, but have made a comeback as a subset of GADTs (which combine existential types with type equality constraints). While not part of the official Haskell specification (either 98 or 2010, I believe), GADTs are commonly understood as a stable part of the GHC Haskell language, which is what people actually use, and have been recently added to OCaml as well (where existentials where previously accessible as first-class ML modules, which were heavier to use). I think this is a satisfying presentation of existential types in functional programming languages of the ML family. I make no claim as whether this suffices for OOP programming (presumably you'll want syntactic sugar to bundle together the several different aspects of OO you're interested in). Scala has existential types written explicitly `T forSome { type X <: Foo }` without a form of datatype wrapping, which allow implicit rather than explicit conversion to the existential type. This may be an even better solution on the long term. I have a personal thinking design space of "Parametric polymorphism" and "subtyping" being two knobs that can be either explicit (annotated) or implicit (inferred) in your language, knowing that having both implicit tends to work badly (ML languages have implicit polymorphism and, sometimes, explicit subtyping, OO languages tend to have explicit polymorphism (generics) and implicit subtyping). I'm not sure whether existential types are a third dimension, or should be considered as a part of parametric polymorphism, or a part of subtyping. I recall that there was a problem with encoding OOP with existentials + type classes, because it would lack some kind of extensibility, though at this moment I'm not sure exactly what it was. Does somebody know? Can you elaborate on what you mean by implicit polymorphism? Would you consider dependently typed languages to have explicit polymorphism? That's an interesting definition of OOP: type classes (methods) + heterogeneous data structures on a type class. What would you do with such a data structure in a strongly typed language with Haskell? You wouldn't want to do something like ls = map (click) cs where cs are clickables unless the output of click was always the same sort of thing like IO(). I see this as you only can't construct trees or lists on Haskell "clickables" because Haskell is semi-hostile to heterogeneity at the data level. ls = map (click) cs But if everything lined up you could do: data Clickable = A A' | B B' | C C'... click2 (A x) = click x click2 (B x) = click x or just dump the type class entirely and just define click on Clickable. etc... In a dynamically typed language all this complexity about data structures would just go away. And certainly regardless of language if the developer spent a lot of time tying clickable methods to clickable data structures I'd call that object oriented design. But ultimately that still answer the question as to why I should consider this an object oriented language. I'm still not seeing what is wrong with the commonly used definitions. Clickable is not the best example. As you mention, if the Click operation causes an update in IO, one could just as easily create a list of click-functions (all of type `IO ()`). Existential types are better motivated if you also plan to evolve the values, e.g. for `class Clickable a where click :: a -> T -> IO a` (enabling a change in a value when clicked at time T). IO () class Clickable a where click :: a -> T -> IO a Note: I do not (and did not) suggest that OOP is "type classes (methods) + heterogeneous data structures". Where does encapsulation fit in that definition? What about aliasing? I consider aliasing to be another essential feature of OOP. By 'aliasing' I mean the ability to update an object through one reference then observe the update through another reference. Aliasing is essential for design patterns that join multiple event streams or grant or attenuate authority through objects. Aliasing is weaker than object identity, but does require a pervasive model for state and effects. (Aliasing is not explicit in many definitions of OO. But common definitions of OO date before Haskell and other languages began to make pure functional programming feasible and practical.) Many people would consider the ability to dynamically create `new` objects to be essential for OOP - i.e. to create a `new Foo()` that has unique state from all the other instances of Foo. I used to be one of those people. new Foo() But I've learned that if I have aliasing without `new`, I can still securely partition and logically arrange views of static state resources. Metaphors of discovery and composition replace dynamic 'creation', and are sufficient for every OOP design pattern I've attempted (even capability security patterns). In many ways the resulting discovery-and-composition metaphors seem more natural, having nice conservation properties: we can't ever create objects from thin air in the physical world, and 'objects' of the physical world really just logical views of sensory data anyway. Disfavoring `new` also helps with orthogonal persistence, live coding, time-traveling debuggers, plugins and extensions, and other features that require cross-cutting access to application state. I've begun to consider `new` to be a harmful feature of many OOP languages. Today I favor aliasing of external state and stateless objects observing and influencing a stateful grid, though much work is needed to make these techniques more convenient and efficient. Concurrent objects need to be modeled using axioms and denotational semantics as in the Actor Model (see post above).
http://lambda-the-ultimate.org/node/4569
CC-MAIN-2018-30
refinedweb
15,805
54.02
asynctools 0.1.0-0 Async tools for Python AsyncTools Async Tools for Python. Table of Contents - Threading - Parallel - Pool Threading Threading is the most simple thing, but because of GIL it’s useless for computation. Only use when you want to parallelize the access to a blocking resource, e.g. network. Parallel Source: asynctools/threading/Parallel.py Execute functions in parallel and collect results. Each function is executed in its own thread, all threads exit immediately. Methods: - __call__: Add a job. Call the Parallel object so it calls the worker function with the same arguments - map(jobs): Convenience method to call the worker for every argument - join(): Wait for all tasks to be finished, and return two lists: - A list of results - A list of exceptions Example: from asynctools.threading import Parallel def request(url): # ... do request return data # Execute pll = Parallel(request) for url in links: pll(url) # Starts a new thread # Wait for the results results, errors = pll.join() Since the request method takes just one argument, this can be chained: results, errors = Parallel(request).map(links).join() Pool Source: asynctools/threading/Pool.py Create a pool of threads and execute work in it. Useful if you do want to launch a limited number of long-living threads. Methods: - join(): Wait for all tasks to be finished and return (results, errors) (same as with `Pool <#pool>`__) - close(): Terminate all threads. The pool is no more usable when closed. - __enter__, __exit__ context manager to be used with with statement Example: from asynctools.threading import Pool def request(url): # ... do long request return data # Make pool pool = Pool(request, 5) # Assign some job for url in links: pll(url) # Runs in a pool # Wait for the results results, errors = pll.join() - Author: Mark Vartanyan - Keywords: async,threading,multiprocessing - License: BSD - Platform: any - Categories - Package Index Owner: kolypto - DOAP record: asynctools-0.1.0-0.xml
https://pypi.python.org/pypi/asynctools/0.1.0-0
CC-MAIN-2016-22
refinedweb
317
57.16
Source code for sympy.liealgebras.type_d from .cartan_type import Standard_Cartan from sympy.core.backend import eye from sympy.core.compatibility import range[docs]class TypeD(Standard_Cartan): def __new__(cls, n): if n < 3: raise ValueError("n cannot be less than 3") return Standard_Cartan.__new__(cls, "D", n)[docs] def dimension(self): """Dmension of the vector space V underlying the Lie algebra Examples ======== >>> from sympy.liealgebras.cartan_type import CartanType >>> c = CartanType("D4") >>> c.dimension() 4 """ return self.n[docs] def basic_root(self, i, j): """ This is a method just to generate roots with a 1 iin the ith position and a -1 in the jth position. """ n = self.n root = [0]*n root[i] = 1 root[j] = -1 return root[docs] def simple_root(self, i): """ Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative. In D_n, the first n-1 simple roots are the same as the roots in A_(n-1) (a 1 in the ith position, a -1 in the (i+1)th position, and zeroes elsewhere). The nth simple root is the root in which there 1s in the nth and (n-1)th positions, and zeroes elsewhere. This method returns the ith simple root for the D series. Examples ======== >>> from sympy.liealgebras.cartan_type import CartanType >>> c = CartanType("D4") >>> c.simple_root(2) [0, 1, -1, 0] """ n = self.n if i < n: return self.basic_root(i-1, i) else: root = [0]*n root[n-2] = 1 root[n-1] = 1 return root[docs] def positive_roots(self): """ This method generates all the positive roots of A_n. This is half of all of the roots of D_n by multiplying all the positive roots by -1 we get the negative roots. Examples ======== >>> from sympy.liealgebras.cartan_type import CartanType >>> c = CartanType("A3") >>> c.positive_roots() {1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0], 5: [0, 1, 0, -1], 6: [0, 0, 1, -1]} """ n = self.n posroots = {} k = 0 for i in range(0, n-1): for j in range(i+1, n): k += 1 posroots[k] = self.basic_root(i, j) k += 1 root = self.basic_root(i, j) root[j] = 1 posroots[k] = root return posroots[docs] def roots(self): """ Returns the total number of roots for D_n" """ n = self.n return 2*n*(n-1)[docs] def cartan_matrix(self): """ Returns the Cartan matrix for D_n. The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], ...., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>). Examples ======== >>> from sympy.liealgebras.cartan_type import CartanType >>> c = CartanType('D4') >>> c.cartan_matrix() Matrix([ [ 2, -1, 0, 0], [-1, 2, -1, -1], [ 0, -1, 2, 0], [ 0, -1, 0, 2]]) """ n = self.n m = 2*eye(n) i = 1 while i < n-2: m[i,i+1] = -1 m[i,i-1] = -1 i += 1 m[n-2, n-3] = -1 m[n-3, n-1] = -1 m[n-1, n-3] = -1 m[0, 1] = -1 return m[docs] def basis(self): """ Returns the number of independent generators of D_n """ n = self.n return n*(n-1)/2[docs] def lie_algebra(self): """ Returns the Lie algebra associated with D_n" """ n = self.n return "so(" + str(2*n) + ")"def dynkin_diagram(self): n = self.n diag = " "*4*(n-3) + str(n-1) + "\n" diag += " "*4*(n-3) + "0\n" diag += " "*4*(n-3) +"|\n" diag += " "*4*(n-3) + "|\n" diag += "---".join("0" for i in range(1,n)) + "\n" diag += " ".join(str(i) for i in range(1, n-1)) + " "+str(n) return diag
https://docs.sympy.org/latest/_modules/sympy/liealgebras/type_d.html
CC-MAIN-2018-43
refinedweb
672
65.62
I am trying to figure out how to batch geocode a table of addresses using the ArcGIS Online World Geocoder using Python. I have an enterprise account. I don't get any errors when I run my script. The result is a point FeatureClass with all the input records but they all have a null shape so nothing displays on a map. Here is my python code: import arcpy from arcpy import env env.workspace = "C:/TestData/Geocode.gdb" try: arcpy.SignInToPortal_server("<my arcgis online enterprise userid>", "<my password>", "") in_table = r"MYTABLE" # ArcGIS Online Locator found in ArcCatalog locator = r"Ready-To-Use Services/Geocoding/World.GeocodeServer" out_table = r"GEOCODE_RESULTS" fields = r"Address Address;City City;Region State;Postal Zip" arcpy.GeocodeAddresses_geocoding(in_table, locator, fields, out_table, "STATIC") except Exception as e: print e.message arcpy.AddError(e.message) I discovered the answer on github. Hopefully this will help someone else with the same question.
https://community.esri.com/thread/150344-how-to-batch-geocode-with-arcgis-online-using-python
CC-MAIN-2018-47
refinedweb
154
51.14
Hi, Now I am able to compile my own small wrapper, which calls the mlf interface function of the converted .c file. Here is the steps I have done: 1) 'mcc -m file1.m file2.m' under MATLAB: to convert my m files to c files, the generated object file 'file1' worked fine under Unix. 2) 'mbuild mymain.c *.c' under Unix: mymain.c is my small wrapper (see code below), to compile my own .c file to call mlf interface function from file1.c generated in 1). Here is the problem: the compile worked, except long list of warnings, but when I try to execute the generated 'mymain' object file, I got error: --------------------- ERROR: Not enough input arguments EXITING -------------------- Can anybody point me out what's wrong here and how to fix it? The code of 'mymain.c' is as following: ------------------------ #include <stdio.h> #include "matlab.h" void mlfFile1(void); void main(void) { mlfFile1(); } ----------------------- The partial code of generated 'file1.c' is as following: -------------------------- ... void mlfFile1(void) { mlfEnterNewContext(0, 0); Mfile1(); mlfRestorePreviousContext(0, 0); } ... static void Mfile1(void) { ... ---------------------------- The original file1.m looks as following: -------------------------- function file1 data6 = dlmread('brown5.data', ' '); vlb = zeros(1,8)+1e-4; vub = vlb+100; x0 = [.3,.2,.1,0.1, 0.1, 0.07, 0.56, 0.64]; p=zeros(1,5); for k=1:256 .. calculateing ... end p=p/sum(p); x = constr('file2',x0,[],vlb,vub,[],data6,p); y=file2(x, data6, p); ------------------------------ and file2.m is the object function. Was I wrong to convert my .m files to stand-along applications? Should I convert them to MEX files? What I want is to be able to call file1.c function (mlfFile1()) in my own c code so that I can apply MPI or multi-thread to the function. Thanks, P:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/40193?requestedDomain=www.mathworks.com&nocookie=true
CC-MAIN-2016-30
refinedweb
300
79.06
As BeautifulSoup is not a standard python library, we need to install it first. We are going to install the BeautifulSoup 4 library (also known as BS4), which is the latest one. To isolate our working environment so as not to disturb the existing setup, let us first create a virtual environment. A virtual environment allows us to create an isolated working copy of python for a specific project without affecting the outside setup. Best way to install any python package machine is using pip, however, if pip is not installed already (you can check it using – “pip –version” in your command or shell prompt), you can install by giving below command − $sudo apt-get install python-pip To install pip in windows, do the following − Download the get-pip.py from or from the github to your computer. Open the command prompt and navigate to the folder containing get-pip.py file. Run the following command − >python get-pip.py That’s it, pip is now installed in your windows machine. You can verify your pip installed by running below command − >pip --version pip 19.2.3 from c:\users\yadur\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7) Run the below command in your command prompt − >pip install virtualenv After running, you will see the below screenshot − Below command will create a virtual environment (“myEnv”) in your current directory − >virtualenv myEnv To activate your virtual environment, run the following command − >myEnv\Scripts\activate In the above screenshot, you can see we have “myEnv” as prefix which tells us that we are under virtual environment “myEnv”. To come out of virtual environment, run deactivate. (myEnv) C:\Users\yadur>deactivate C:\Users\yadur> As our virtual environment is ready, now let us install beautifulsoup. As BeautifulSoup is not a standard library, we need to install it. We are going to use the BeautifulSoup 4 package (known as bs4). To install bs4 on Debian or Ubuntu linux using system package manager, run the below command − $sudo apt-get install python-bs4 (for python 2.x) $sudo apt-get install python3-bs4 (for python 3.x) You can install bs4 using easy_install or pip (in case you find problem in installing using system packager). $easy_install beautifulsoup4 $pip install beautifulsoup4 (You may need to use easy_install3 or pip3 respectively if you’re using python3) To install beautifulsoup4 in windows is very simple, especially if you have pip already installed. >pip install beautifulsoup4 So now beautifulsoup4 is installed in our machine. Let us talk about some problems encountered after installation. On windows machine you might encounter, wrong version being installed error mainly through − error: ImportError “No module named HTMLParser”, then you must be running python 2 version of the code under Python 3. error: ImportError “No module named html.parser” error, then you must be running Python 3 version of the code under Python 2. Best way to get out of above two situations is to re-install the BeautifulSoup again, completely removing existing installation. If you get the SyntaxError “Invalid syntax” on the line ROOT_TAG_NAME = u’[document]’, then you need to convert the python 2 code to python 3, just by either installing the package − $ python3 setup.py install or by manually running python’s 2 to 3 conversion script on the bs4 directory − $ 2to3-3.2 -w bs4 By default, Beautiful Soup supports the HTML parser included in Python’s standard library, however it also supports many external third party python parsers like lxml parser or html5lib parser. To install lxml or html5lib parser, use the command − $apt-get install python-lxml $apt-get insall python-html5lib $pip install lxml $pip install html5lib Generally, users use lxml for speed and it is recommended to use lxml or html5lib parser if you are using older version of python 2 (before 2.7.3 version) or python 3 (before 3.2.2) as python’s built-in HTML parser is not very good in handling older version. It is time to test our Beautiful Soup package in one of the html pages (taking web page –, you can choose any-other web page you want) and extract some information from it. In the below code, we are trying to extract the title from the webpage − from bs4 import BeautifulSoup import requests url = "" req = requests.get(url) soup = BeautifulSoup(req.text, "html.parser") print(soup.title) <title</title> One common task is to extract all the URLs within a webpage. For that we just need to add the below line of code − for link in soup.find_all('a'): print(link.get('href')) …. …. /about/about_privacy.htm#cookies /about/faq.htm /about/about_helping.htm /about/contact_us.htm Similarly, we can extract useful information using beautifulsoup4. Now let us understand more about “soup” in above example.
https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_installation.htm
CC-MAIN-2020-29
refinedweb
801
52.7
SQL Server 2005 and ADO.NET 2.0 promised a powerful notification of database changes through the SQLDependency object. While SQL 2000 could only inform a client app of changes at the Table level, SQL 2005 promised the ability to notify of changes at the query level. If changes to the database table affect a query given to SQL 2005, a notification is given to the client app. If data is changed that does not affect a query given to SQL 2005, then no notification takes place. SQLDependency Anyone that has tried using the SQLDependency object has found that this functionality does not actually exist. Notifications are still only at the table level, no matter what query is given to SQL 2005 to examine. I present here a workaround using SQL 2005 triggers and TSQL Service Broker Conversation to send a notification to a client app. Just unzip the attached code, run the SQL script, and then run the C# application. Make changes to the SQLNotificationRequestTable (update, insert, delete), and see your changes be reported on the C# form... SQLNotificationRequestTable update insert delete The C# portion of this article is taken from this MSDN page with some slight modifications and one large modification: There is a location in the code where you can handle the Notification as an SQLDataReader and examine the message. I use this functionality to get the messages and display them. SQLDataReader The SQL portion of this article I wrote myself once I learned how the Service Broker and TSQL Triggers worked. The Service Broker is a complex concept, and I was thrilled to actually get my messages working. One other avenue I explored was the Microsoft.SQLServer.Samples namespace, which has some C# classes for the Service Broker, but I actually hit a dead-end using these classes. There may be a better way to do this if you are super knowledgeable in the Service Broker. Microsoft.SQLServer.Samples The majority of the SQL is devoted to examining the inserted and deleted tables to determine what caused the trigger to fire. The contents of the inserted or deleted tables are copied to a string variable which is then inserted into an XML variable because this Service Broker Message requires well formed XML. Then, in the last part of the SQL, I send the message. string I have never tried this, but according to documentation Client and Database can be separate computers, and the IP address of the client app would replace 'LocalHost' in the SQL script attached when creating a Service Broker Route. Would love to hear back if anyone tries that. I also do not know how production quality this is, and I haven't tried this on multiple tables. I tried to copy snippets of my code into this article, but the formatting would not behave, so refer to the download. This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) <br /> command.CommandTimeout = NotificationTimeout + 15;<br /> SqlDataReader reader = command.ExecuteReader();<br /> <br /> while (reader.Read())<br /> {<br /> General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
https://www.codeproject.com/Articles/18130/Advanced-SQL-SQLNotificationRequest-Functiona?msg=4063687
CC-MAIN-2017-22
refinedweb
543
52.6
Observable.Throttle<TSource> Method (IObservable<TSource>, TimeSpan, IScheduler) Ignores the values from an observable sequence which are followed by another value before due time with the specified source, dueTime and scheduler.. - scheduler - Type: System.Reactive.Concurrency.IScheduler The scheduler to run the throttle timers on.. The Throttle operator buffers an item from the sequence and wait for the time span specified by the dueTime parameter to expire. If another item is produced from the sequence before the time span expires, then that item replaces the old item in the buffer and the wait starts over. If the due time does expire before another item is produced in the sequence, them that item is observed through any subscriptions to the sequence. This example demonstrates using the throttle operator to guarantee that items are observed at an interval no faster than two seconds. This is demonstrated by using the EndlessBarrageOfEmails method to continuously yield emails that are produced as items in an observable sequence. The email items in the sequence occur at random intervals within three seconds from each other. Only the items that occur with no item following it for the two second time span are observed from the sequence. using System; using System.Collections.Generic; using System.Threading; using System.Reactive.Linq; using System.Reactive.Concurrency; namespace Example { class Program { static void Main() { //*****************************************************************************************************// //*** Create an observable sequence from the enumerator which is yielding random emails within ***// //*** 3 sec. continuously. The enumeration of the enumerator will be scheduled to run on a thread ***// //*** in the .NET thread pool so the main thread will not be blocked. ***// //*****************************************************************************************************// var obs = EndlessBarrageOfEmails().ToObservable(Scheduler.ThreadPool); //****************************************************************************************************// //*** Use the throttle operator to ONLY deliver an item that occurs with a 2 second interval ***// //*** between it and the next item in the sequence. The throttle buffer will hold an item from the ***// //*** sequence waiting for the 2 second timespan to pass. If a new item is produced before the ***// //*** time span expires, that new item will replace the old item in the buffer and the wait starts ***// //*** over. If the time span does expire before a new item is produced, then the item in the ***// //*** buffer will be observed through any subscriptions on the sequence. ***// //*** ***// //*** To be clear, an item is not guarnteed to be returned every 2 seconds. The use of throttle ***// //*** here does guarntee that the subscriber will observe an item no faster than every 2 sec. ***// //*** ***// //*** Since a new email is generated at a random time within 3 seconds, the items which are ***// //*** generated with 2 seconds of silence following them will also be random. ***// //*** ***// //*** The timers associated with the 2 second time span are run on the .NET thread pool. ***// //****************************************************************************************************// var obsThrottled = obs.Throttle(TimeSpan.FromSeconds(2), Scheduler.ThreadPool); //***********************************************************************************************// //*** Write each observed email to the console window. Also write a current timestamp to get ***// //*** an idea of the time which has passed since the last item was observed. Notice, the time ***// //*** will not be less than 2 seconds but, will frequently exceed 2 sec. ***// //***********************************************************************************************// obsThrottled.Subscribe(i => Console.WriteLine("{0}\nTime Received {1}\n", i, DateTime.Now.ToString())); //*********************************************************************************************// //*** Main thread waiting on the user's ENTER key press. ***// //*********************************************************************************************// Console.WriteLine("\nPress ENTER to exit...\n"); Console.ReadLine(); } //*********************************************************************************************// //*** ***// //*** This method will continually yield a random email at a random interval within 3 sec. ***// //*** ***// //*********************************************************************************************// static IEnumerable<string> EndlessBarrageOfEmails() { Random random = new Random(); //***************************************************************// //*** For this example we are using this fixed list of emails ***// //***************************************************************// List<string> emails = new List<string> { "Email Msg from John ", "Email Msg from Bill ", "Email Msg from Marcy ", "Email Msg from Wes "}; //***********************************************************************************// //*** Yield an email from the list continually at a random interval within 3 sec. ***// //***********************************************************************************// while (true) { yield return emails[random.Next(emails.Count)]; Thread.Sleep(random.Next(3000)); } } } } The following output was generated from the example code. Press ENTER to exit... Email Msg from Wes Time Received 6/5/2011 11:54:05 PM Email Msg from Marcy Time Received 6/5/2011 11:54:08 PM Email Msg from Bill Time Received 6/5/2011 11:54:12 PM Email Msg from Bill Time Received 6/5/2011 11:54:15 PM Email Msg from John Time Received 6/5/2011 11:54:33 PM Email Msg from Wes Time Received 6/5/2011 11:54:35 PM Email Msg from Marcy Time Received 6/5/2011 11:54:38 PM Email Msg from Bill Time Received 6/5/2011 11:54:43 PM
http://msdn.microsoft.com/en-us/library/hh229400(v=vs.103).aspx
CC-MAIN-2014-15
refinedweb
735
63.19
Our goal in this series is to learn about Android SDK development. So far we explored the development tools, looked at the structure of an Android app project, started to create a user interface, and responded to user interaction. In this tutorial, we will look at the basic structures and concepts in Java that you need to know in order to start developing apps for Android. Introduction If you are already familiar with Java you can ignore this section. If you have limited or no familiarity with the language, then this tutorial will indicate what you need to learn in order to go any further with Android. This tutorial is not enough in itself to teach you Java from scratch, but will act as a primer to get you started. You should follow the tutorial with additional Java learning as necessary. We won't spend too long going over the details in this tutorial, but if you are struggling with any of the concepts check out the Oracle Java Tutorials. This is an extensive guide to the language that is accessible to beginners. Don't be too alarmed if you feel a little overwhelmed by what we cover in this tutorial at first, it will make a lot more sense once you start implementing the structures in Android projects. 1. Java Syntax Step 1 You already saw a little Java syntax in our Android project, but for clarity, let's start another project. Rather than an Android project, this time we will use a Java one, so that you can easily see the structures we use. Open Eclipse. Click the "New" button. In the wizard that appears, scroll down to the Java folder and expand it. Select "Java Project" and click "Next". Enter "MyJavaProject" as the project name and click "Finish". Eclipse then creates your new project in the workspace. In the Package Explorer, expand the new project folder. Right-click on "src" and select "New" then "Class". Enter "MyMainClass" in the Name field. Check the checkbox with "public static void main" next to it and click "Finish". Eclipse creates your class and opens it in the editor. Don't pay much attention to the structure of the project or the existing content of the class because your Android projects will be differently structured. You can use this project to work on your Java coding skills, it's easier to run and test the code you write here than with an Android app, and you can focus on the Java syntax. The "public static void main" line you see in the class file is the main method. Whatever is inside this method executes when the application runs. The content of the method is what appears between the curly brackets after "public static void main(String[] args)". Eclipse may have generated a "to do" line - just ignore it. Create a new line after it and we will add our code there. Step 2 In Java, a variable can store a data value such as a text string or number. When you create, or "declare" a variable in Java, you have to specify the type of the data within it and give it a name. Enter the following: int myNum; This line declares an integer variable. We can declare a variable and assign a value to it by extending the line: int myNum = 5; We can now refer to this variable using its name. Add the following line next, writing the variable value to the output console: System.out.println(myNum); You will not typically write to the system output like this in your Android apps, but will use the LogCat view instead. However, writing to the output in this way is a convenient way to test your Java code. Step 3 Let's run the application. The process is slightly different for Android apps, but we'll get to that later in the series. Select "Run" then "Run Configurations". Select "Java Application" in the list on the left and click the "New launch configuration" button above it. Eclipse automatically selects your new Java application if it is the only one you have. Otherwise, select it using the "Browse" button. Click "Run" to run your application. You should see the number five written out to the Console view beneath the editor. You can use this technique to test your Java code as you learn it. You can run the project you ran last at any time using the "Run" button in the toolbar. Step 4 You'll use the same syntax whenever you declare a variable in Java. To assign a different value to the variable later in the program, you can refer to it by name: myNum = 3; This overwrites the existing value. In Java there are many different variable types. The int is referred to as a primitive type, along with a few other number types, char for character values and boolean, which stores either a true or false value. There are also Object types; we will explore Objects later. An essential Object type to familiarize yourself with is String, which stores a text string: String myName = "Sue"; Text string values are enclosed in quotes. You can include these directly in some cases, for example: System.out.println("number: " + myNum); Add this code and run it, the console will display: "number: " followed by the variable value. Step 5 Above we saw the assignment operator "=" - here are a few of the other common operators: //add myNum = 5+6; //subtract myNum = 7-3; //multiply myNum = 3*2; //divide myNum = 10/5; //remainder myNum = 10%6; //increment (add one) myNum++; //decrement (subtract one) myNum--; The operators can be used on variables as well as hard-coded numbers (as above): int myNum = 5; int myOtherNum = 4; int total = myNum+myOtherNum;//9 Step 6 One other Java structure that is essential to Android is the comment. You can add a comment in two ways: //this is a single line comment /* This is a multiline comment * stretching across lines * to give more information */ It is vital to get into the habit of commenting your code as you write it, for your own benefit as well as anyone else who reads the code. 2. Control Structures Step 1 The code we added to the main method executes when the Java application runs. When the Android application we created runs, whatever is in the onCreate method of the main Activity is what runs. Each line inside these methods is executed after the previous line, but the flow of execution is not always linear. There are many control structures involved in Java, so let's look at some of the most common, starting with conditionals. Conditional statements involve carrying out tests to determine the flow of execution. The simplest conditional structure in Java is the if statement: if(myNum>3) System.out.println("number is greater than 3"); This tests determines whether the value of the variable is greater than three. If it is, the string will be written to output. If not, then nothing will be written out and processing simply moves to the next line in the program. We say that a conditional test "returns" a true or false value. True and false are boolean values. We can add an else, which only executes if the if returned false: if(myNum>3) System.out.println("number is greater than 3"); else System.out.println("number is not greater than 3"); The else executes if the value is three or less. Try the code with different values for the integer variable to see the results of the conditional tests. We can also chain multiple tests: if(myNum>10) System.out.println("number is greater than 10"); else if(myNum>7) System.out.println("number is greater than 7"); else if(myNum>3) System.out.println("number is greater than 3"); else System.out.println("number is 3 or less"); Each test performs only if all previous tests in the chain returned false. So for any number, only one string is output. You can chain as many else if statements together as you need. You can also use if statements chained with one or more else if blocks without a final else. We tested for one number being greater than another. Try the following variations: if(myNum<10) System.out.println("number less than 10"); if(myNum==10) System.out.println("number equals 10"); if(myNum!=10) System.out.println("number is not equal to 10"); if(myNum>=10) System.out.println("number either greater than or equal to 10"); if(myNum<=10) System.out.println("number either less than or equal to 10"); You can carry out similar tests on other variable types including strings. To carry out multiple tests at once, use the following syntax: if(myNum>=10 && myNum<=50) System.out.println("number is between 10 and 50"); The "&&", known as the "and" operator, means that the whole statement will only return true if both tests return true. The "or" operator will return true if either test returns true: if(myNum<0 || myNum!=-1) System.out.println("number is less than 0 or not equal to -1"); To group code into a block, we can use curly brackets - all of the code between the brackets executes if this test returns true: if(myNum<10) { System.out.println("number less than 10"); myNum=10; } Such brackets group code in loops, methods, and classes. Step 2 Let's look at loops now. The following for loop iterates ten times, meaning its content executes ten times: for(int i=0; i<10; i++){ System.out.println(i); } The first expression in the for outline initializes a counter integer variable to zero. The second expression is a conditional test, checking that the variable is less than ten. If this returns true, the content of the loop executes, if not the loop will end. Once the content of the loop has executed, the third expression executes, incrementing the counter. The while loop uses slightly different syntax. The following example has the same effect as the for loop: int i=0; while(i<10){ System.out.println(i); i++; } Loops can contain multiple lines of code, including other loops. Step 3 We have already encountered the main method and the Android onCreate method. Let's look at creating your own methods. Place the following method after the closing bracket for your main method: public static void doSomething(){ System.out.println("something"); } This method is defined as public, meaning any class in the project can call on its processing. If it was "private" it's only accessible inside the class (this is "visibility"). You will not typically have to include the "static" modifier in your first Android apps, so ignore it. The "void" represents the return type. In this case the method returns nothing. To execute the method, add a call to it back in your main method: doSomething(); Run your application to see this function. Alter the method to return a value: public static int doSomething(){ return 5; } Alter the method call and run again: System.out.println(doSomething()); The returned value is written out. Methods can also receive parameters: public static int doSomething(int firstNum, int secondNum){ return firstNum*secondNum; } When calling the method, you must pass parameters of the correct type and number: System.out.println(doSomething(3, 5)); Methods can split application processing into logical chunks. They are particularly useful if you need to carry out the same tasks more than once; you simply define them in the method then call it whenever you need it. If you change the process, you only need to change it in the method code. 3. Classes and Objects Step 1 We've seen how methods can be used to reuse code and to split it into logical sections. Classes and objects do this on a larger scale. You can divide the tasks in an application up between objects, with each object having a set of responsibilities defined by its class. This is similar to a method being responsible for a particular area of functionality, but an object can have multiple methods and also store data values. Imagine you are creating a game - you can create a class dedicated to handling the details of the user. Select your application package, in "src", in the Package Explorer. Right-click and choose "New" then "Class". Enter "GameUser" as the class name, make sure the main method stub checkbox is unchecked this time and click "Finish". Eclipse then opens the class file, which initially only has the class declaration outline in it: public class GameUser { //class content } Everything you add is between these brackets (unless you add import statements, which are listed above this section). Your Android apps notice that the class files lists the package name at the top. It isn't listed here because we used the default package. Step 2 Inside the class, add a couple of variables: private String playerName; private int score; These are called "instance variables" because they are defined for each instance of the class we create. Add a constructor method after these. This is what executes when an object of the class is created: public GameUser(String userName, int userScore){ playerName=userName; score=userScore; } The constructor always has the same name as the class and may or may not require parameters. The constructor should typically assign values to the instance variables, often using the parameters. Step 3 The class can also define methods. Add the following typical set after the constructor: public String getName() {return playerName;} public int getScore() {return score;} public void setName(String newName) {playerName=newName;} public void setScore(int newScore) {score=newScore;} These are known as get and set methods, or getters and setters, because they provide code external to the class with the ability to retrieve and set the values of the instance variables. Have a look at the Outline view in Eclipse to see how it can help to navigate class content. Step 4 Save your new class file. Back in your main class, create an object of the new class in the main method: GameUser aUser = new GameUser("Jim", 0); We pass the parameters listed in the constructor - the "new" keyword will make the constructor execute. We can now use this instance of the class to access the data values in it by calling its methods: System.out.println(aUser.getScore()); aUser.setScore(5); System.out.println(aUser.getScore()); Run the program to see how the value changes after calling the public methods on the object. You can create multiple instances of the object which will be managed separately: GameUser anotherUser = new GameUser("Jane", 5); 4. Inheritance & Interfaces Step 1 We've seen how a class defines the sets of responsibilities you can make use of by creating object instances. This applies not only to classes you create yourself, but also to existing Java and Android classes which you can also make use of. As well as creating instances of these platform classes, you can extend them using inheritance. With inheritance, you can create a class which inherits the functionality of an existing class while also providing its own processing. We saw an example of this in the first Android project we created, with the main Activity class. Open the class now. In the opening line of the class declaration you will see "extends Activity". This means that the class is a subclass of the Android Activity class. Using the Activity class lets Android handle the details of presenting a screen to the user, with methods for when the screen is in various states (created, paused, destroyed, etc). This lets you focus on the unique aspects of the app, by adding code to the methods defined within the Android Activity class declaration and additional methods of your own if necessary. This is a pattern you will often use on Android, extending defined classes for common aspects of apps. You can complement these with your own classes where appropriate. Step 2 Look again at your Activity class opening line. Remember that we added "implements OnClickListener" to handle clicks on a button in the UI. This is referred to as implementing an Interface. An Interface is similar to a class you inherit from using "extends" except that the Interface declaration simply lists method outlines. You have to provide the method implementation for each of them. So when we implemented OnClickListener we committed the class to providing an onClick method, which we did. An Interface is therefore like a contract. With inheritance, extending classes inherits the method implementations provided in the class declaration for their superclass (the class being extended). You can override these implementations if you need to. Conclusion In this tutorial we outlined some of the essential features of Java syntax you need to understand. There are more structures and concepts to become familiar with. If you don't have Java experience and want to make sure you know enough to develop effectively for Android, use the Oracle Java Tutorials. Topics to consider learning about include arrays and switch statements. Later in the series we will look at some of the most common Android classes you are likely to use. In the next part, we will explore the resources in an Android app project. Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post
https://code.tutsplus.com/tutorials/android-sdk-java-application-programming--mobile-20462
CC-MAIN-2018-22
refinedweb
2,911
63.19
Relies on DNS to resolve own hostname Bug Description In charm/hooks/ @cached def get_host_ if config( return get_ipv6_addr()[0] hostname = hostname or unit_get( try: # Test to see if already an IPv4 address return hostname except socket.error: # This may throw an NXDOMAIN exception; in which case # things are badly broken so just let it kill the hook answers = dns.resolver. if answers: return answers[0].address Firstly, the dns.resolver.query call strikes me as incredibly silly. What if the other node in not resolvable via DNS, but its name is in /etc/hosts? What if the other node *is* in DNS, but is a CNAME? And, bottom line, why not simply use socket. Secondly, this currently (as of today) breaks a Ceph deployment. It definitely didn't do so a month ago, so whatever it was that changed in the interim, this is a regression. I don't know if this code path wasn't there earlier, or whether it was just never hit. But it definitely used to work, and no longer does. If my analysis here is correct, then it doesn't just break Ceph; instead it would break all of the affected charms when hosts are not DNS-resolvable. Which never happens when using MAAS and the MAAS host acts as one's DNS server, but would probably be the case with most (all?) non-MAAS Juju providers. This function is used to resolve IP addresses from hostnames; I'll take a look and see what's changed recently, but this approach was put together over a few cycles of testing against MAAS and OpenStack providers and provided the most generally applicable approach to resolving an IP address. AFAICT this code has not changed in quite some time; so I'm not sure what's causing the change in behaviour that you are seeing. Which provider are you using? It would be helpful to understand so we can see the full context. Having a final attempt using gethostbyname might be a sensible improvement - from memory this might return 127.0.1.1 on quite a few of the Juju providers, but that's worth testing with to see. "What if the other node *is* in DNS, but is a CNAME?" The way that query is done means that a CNAME record gets resolved down into an underlying A record automatically. MAAS used to structure dns in this way, with the actual hostname being a CNAME that pointed to an auto-generated A record. The problem pops up when using the "manual" provider. I've just spun up a simplified test environment to confirm the problem; the exact Juju config is here if it helps: https:/ After running that setup, cinder-volume and neutron-gateway are broken: $ juju stat neutron-gateway --format=oneline - neutron-gateway/0: charlie.example.com (error) $ juju stat cinder-volume --format=oneline - cinder-volume/0: daisy.example.com (error) $ juju debug-log --replay | grep NXDOMAIN unit-neutron- unit-neutron- unit-cinder- unit-cinder- By the way: why exactly is this just an INFO message when it's an unhandled exception that, according to the comment, "kills the hook"? All nodes have an /etc/hosts file that makes them mutually resolvable by gethostbyname(), but they use 8.8.8.8 and 8.8.4.4 for their DNS servers, which means they obviously can't resolve each other's host names via DNS. Forgot to add evidence that in the test environment nova-volume is broken too. training@deploy:~$ juju stat nova-compute --format=oneline - nova-compute/0: bob.example.com (error) unit-nova- unit-nova- unit-nova- unit-nova- Just as a reference point. It appears that what this charm helper *really* wants to do is get the host's "default" IP address. Recognizing that a reverse name lookup is a rather poor way of finding that out, Ansible does an ip route get to two well-known IP addresses (v4 and v6) to determine the outgoing interface for the default route, and then returns that interface's address as ansible_ See https:/ I just ran into this bug as well. The function is ipv4 only which is unfortunate. If DNS fails to resolve it falls back on this: https:/ Marking the charm-ceph task wontfix as the ceph charm has been removed from support for a while now So, this works just fine: @cached ip(hostname= None): 'prefer- ipv6'): def get_host_ if config( return get_ipv6_addr()[0] hostname = hostname or unit_get( 'private- address' ) socket. inet_aton( hostname) gethostbyname( hostname) try: # Test to see if already an IPv4 address return hostname except socket.error: return socket.
https://bugs.launchpad.net/charm-neutron-gateway/+bug/1538812
CC-MAIN-2019-26
refinedweb
772
62.17
So far, we have seen how to retrieve data from our code, and manipulate that data. What we have not learned, however, is how to make decisions with that data. Making decisions is something that we do every day in the real world. For example, if a restaurant is too expensive we may want to choose a different one. If it's too cold outside, we should find something to do inside. These are the types of decisions we want our code to make as well. After learning about conditionals we can do just that. ifstatement can change the execution flow of our code when certain conditions are met ifkeyword works with the elsekeyword in Python ifstatements in forloops So far in Python, all of our lines of code run one after the other. So in the code below, vacation_days is initially assigned to 0, then it is reassigned by incrementing by one, and again reassigned by incrementing again by one, which brings the vacation_days to a total of 2. vacation_days = 0 vacation_days += 1 vacation_days += 1 vacation_days 2 The +=is used to increment. The statement vacation_days += 1can be thought of as vacation_days = vacation_days + 1. On line 2, vacation_daysis 0. Then we reassign vacation_daysto equal the previous value of vacation_days, which is 0, plus 1. Again we increment vacation_days on line 3, which would now equate to 1 + 1, and finally we output the new value of vacation_days, 2. Contrast this with code that contains an if statement. Code that is part of an if block runs only when the conditional argument following the if evaluates to True. So it is not necessarily the case that every line of code runs. vacation_days = 1 if False: # code does not run as conditional argument False vacation_days += 1 vacation_days 1 Above we can see that since the condition following the if equals False, the code directly underneath is not run. So, vacation_days stays assigned to the number 1. Just as we did with functions, we indicate that something is part of the block by indenting. So the line vacation_days += 1 is indented to ensure that whether it is run depends on the conditional argument above. To end the block we simply stop indenting. vacation_days = 1 if False: # if block begins vacation_days += 1 # if block ends vacation_days += 2 vacation_days 3 So in the above cell, the last two lines are run because they are not part of the if block. And, as you may have guessed, when the conditional argument is True, the code in the conditional block does run. vacation_days = 1 if True: # code in if block runs, as True vacation_days += 1 vacation_days 2 Our code in conditional arguments becomes more interesting when we use conditional arguments that are less direct. def long_vacation(number_of_days): if number_of_days > 4: return 'that is a long vacation' long_vacation(5) # 'that is a long vacation' 'that is a long vacation' long_vacation(3) # None In the code above, you can hopefully see the power of our if statement. Our if argument is the expression number_of_days > 4, which sometimes evaluates to True and sometimes False, it depends on the number of days. Now sometimes we want to say that when something is True do one thing, and when not True do something else. def vacation_length(number_of_days): if number_of_days > 4: return 'that is a long vacation' else: return 'not so long' vacation_length(3) # 'not so long' 'not so long' vacation_length(5) # 'that is a long vacation' 'that is a long vacation' So far our conditionals have depended on whether something evaluates exactly to True or False. But conditionals don't force us to be so precise. Conditionals also consider some values True if they are truthy and False if they are falsy. Take a look at the following: vacation_days = 1 if vacation_days: # this is run vacation_days += 1 vacation_days 2 Even through vacation_days did not equal True above, it still ran the code in the if block because the value for vacation_days was 1, which is considered truthy. However, 0 is not considered truthy. vacation_days = 0 if vacation_days: # this is not run vacation_days += 1 vacation_days 0 Since 0 is not truthy, it is considered falsy. We can see that the if block was not run and vacation_days was not incremented, almost as if vacation_days evaluated to False. So what is truthy and what is falsy in Python? Zero is falsy, and None is falsy. Also falsy is anything where len of that thing returns False, so '', [] are both falsy. Let's see that. greeting = '' if greeting: greeting += 'Hello' else: greeting += 'Goodbye' greeting 'Goodbye' If we are ever curious about the whether something is truthy or falsy in Python, we can just ask with the bool function. bool(0) # False False bool(1) # True True Finally, we can use conditionals in loops. This is great at filtering out certain elements and selecting just what we need. Let's see this. greetings = ['hello', 'bonjour', 'hola', 'hallo', 'ciao', 'ola', 'namaste', 'salam'] def starts_with_h(words): selected = [] for word in words: if word.startswith('h'): selected.append(word) return selected starts_with_h(greetings) ['hello', 'hola', 'hallo'] The above starts_with_h function uses a for loop to move through the list of words one by one. For each word, it checks if the word starts with h and if it does, it adds that word to the selected list. Finally, the function returns that list of selected elements. So by using the for loop combined with if we can choose elements of a list based on a specific criteria. In this lesson, we saw how conditionals allow us to make decisions with our code by only executing code under the if statement when the conditional argument is True or truthy. We then saw how we can use the else statement to only run code when the conditional argument is False or falsy, and as we know, code that is not in a conditional block is still run as normal. We examined what is truthy or falsy, and saw that None, 0, and data with a length of zero are falsy. If we are unsure, we can use the bool function to see a the boolean value of a piece of data. Finally, we saw how by using if in a for loop we can return a subset of a collection that meets a criteria.
https://learn.co/lessons/conditionals-python-readme
CC-MAIN-2019-09
refinedweb
1,053
60.14
I have a simple problem that is driving me crazy. All because I'm so close into solving it, but just don't know how. Here is what I'm trying to do. I have a bank program that is suppose to take in your account number, pin number, and if this information matches what is on a data.in file then you will be able to continue on with other menu options; like deposit, withdraw, loads, balance etc.... so the problem is simple. I figure out a way to have the problem match your account number with the number set inside of the data.in but the pin number(a set of different number) is completely ignored. Here is my code: #include <iostream> #include <fstream> #include <string> using namespace std; //function table void Deposit(); void Withdraw(); void Transfer(); void Load(); void Balance(); void Help(); int main() { int option, loop; char userid[15], pin[15]; char account[15],name[15]; //menue do{//main loop do{ //second inside loop cout<<"Welcome to BIG FAT BANK FOO ATM!!"<<endl<<endl; cout<<"Please Enter your account number: "; cin>>userid; cout<<endl; cout<<"Please Enter your PIN number: "; cin>>pin; cout<<endl<<endl; ifstream fin("BANKDATA.in"); while(fin>>account>>name) { if (strcmp(userid, pin) == 0) { cout<<"Accessing account!..."; loop=0; }//end of if else {cout<<"User Not Found!!"<<endl; cin.ignore(2); }//end of else }//end of inside loop }while(loop!=0); cout<<"Here are your options: "<<endl<<endl; cout<<"1: Depost \t"<<"2: Withdraw"<<endl; cout<<"3: Transfer \t"<<"4: Load"<<endl; cout<<"5: Balance \t"<<"6: Help"<<endl<<endl; cout<<"The exit press 0:"<<endl; cout<<":"; cin>>option; //if statements if (option==1) { Deposit(); } if (option==2) { Withdraw(); } if (option==3) { Transfer(); } if (option==4) { Load(); } if (option==5) { Balance(); } if (option==6) { Help(); } else { cout<<"Invaid entre!! ERROR!!!"<<endl; cout<<"Press any button to restart"<<endl; cin.ignore(2); } }while(option!=0);//end of main loop cout<<"Press any button to continue"<<endl; cin.ignore(2); return 0; }// end of main void Deposit() { } void Withdraw() { } void Transfer() { } void Load() { } void Balance() { } void Help() { } And here is what's inside of the data.in file 12345678 1111 My fist test would be to make sure that the program can match up your account number with your pin number inside the data.in file. If that were to be false repeat the loop until user inputs the right code. My second test is to display balances and other account information on that data.in file. So the program would have to read the first two lines of numbers ( account and pin number) to access the rest of information.. My last test would be to allow the program to edit balance information, much like if a user would deposit, withdraw, or transfer money in a real bank... So can you guys help me here?
http://www.dreamincode.net/forums/topic/205099-c-bank-project-problem/
CC-MAIN-2017-47
refinedweb
481
70.43
What (general)? In statistics, the earth mover’s distance (EMD) is a measure of the distance between two probability distributions over a region D.[ref] - In stats or computer science, it’s “Earth mover’s distance”. - In maths, it’s “Wasserstein metric” - The Wasserstein distance is the minimum cost of transporting mass in converting the data distribution q to the data distribution p. What (math way)? The idea borrowed from this. The first Wasserstein distance between the distributions and is: where is the set of (probability) distributions on whose marginals are and on the first and second factors respectively. If and are the respective CDFs of and , this distance also equals to: Example of metric Suppose we wanna move the blocks on the left to dotted-blocks on the right, we wanna find the “energy” (or metric) to do that. Energy = weight of block x distance to move that block. Suppose that weight of each block is 1. All below figures are copied from this. There are 2 ways to do that, 2 ways of moving blocks from left to right. Above example gives the same energies () but there are usually different as below example, Coding from scipy.stats import wasserstein_distance arr1 = [1,2,3,4,5,6] arr2 = [1,2,3,4,5,6] wasserstein_distance(arr1, arr2) 0.0 # they are exactly the same! arr1 = [1,2,3] arr2 = [4,5,6] wasserstein_distance(arr1, arr2) # 3.0000000000000004 import seaborn as sns sns.distplot(arr1, kde=False, hist_kws={"histtype": "step", "linewidth": 3, "alpha": 1, "color": "b"}) sns.distplot(arr2, kde=False, hist_kws={"histtype": "step", "linewidth": 3, "alpha": 1, "color": "r"}) References - What is an intuitive explanation of the Wasserstein distance? - GAN — Wasserstein GAN & WGAN-GP - An example of why we need to use EMD instead of Kolmogorov–Smirnov distance (video). •Notes with this notation aren't good enough. They are being updated.
https://dinhanhthi.com/wasserstein-earth-mover-distance
CC-MAIN-2020-29
refinedweb
312
66.64
ncl_gfa - Man Page output primitive for filling polygonal areas. Synopsis CALL GFA (N, X, Y) C-Binding Synopsis #include <ncarg/gks.h> void gfill_area(const Gpoint_list *point_list); Description - N (Integer, Input) - The number of points in the polygon to be filled. N must be greater than two. - X (N) (Real Array, Integer) - The X world coordinates of the polygon. - Y (N) (Real Array, Integer) - The Y world coordinates of the polygon. Usage The area to be filled is delimited by the sequence of straight line segments connecting the successive points (X(1), Y(1)), (X(2), Y(2)), ..., (X(N), Y(N)). The last point in the polygon is connected to the first point with a straight line segment in the case that (X(N), Y(N)) does not equal (X(l), Y(l)).sfais and gsfasi for these. Note well: By default in GKS, the interior fill style is hollow, or no fill. If you call GFA and do not get a filled interior as you expected, you will probably need to call GSFAIS to set the fill style to something other than "hollow". Access To use GKS routines, load the NCAR GKS-0A library ncarg_gks. See Also Online: gsfais, gsfasi, gscr, gsfaci, gqfais, gqfasi, gfill_area Hardcopy: User's Guide for NCAR GKS-0A Graphics; NCAR Graphics Fundamentals, UNIX Version University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.
https://www.mankier.com/3/ncl_gfa
CC-MAIN-2022-40
refinedweb
237
62.88
Suppose we have an array nums of integers, we can perform some operations on the array. Here in each operation, we pick any nums[i] and delete it to earn nums[i] amount of points. We must delete every element equal to nums[i] - 1 or nums[i] + 1. Initially the point is 0. We have to find the maximum number of points we can earn by applying such operations. So if the input is like [3,4,2], then the output will be 6. So this is because, if we delete 4, we will get 4 points, consequently 3 will also be deleted. Then delete 2 to get 2 points. 6 total points are earned. To solve this, we will follow these steps − n := size of nums array, define map m, ret := 0, store the frequency of elements in nums into m cnt := 0 for each pair it of m x := key of it temp := x * value of it it1 := point to previous of it, and it2 := point to the previous of it1 if cnt >= 1 and x – key of it1 > 1, then temp := m[key of it1] otherwise when cnt >= 2, then temp := temp + m[key of it2] a = m[key of it1] if cnt >= 1, otherwise 0 m[key of it] := max of temp and a ret := max of ret and temp increase cnt by 1 return ret Let us see the following implementation to get a better understanding − #include <bits/stdc++.h> using namespace std; class Solution { public: int deleteAndEarn(vector<int>& nums) { int n = nums.size(); map <int, int> m; int ret = 0; for(int i = 0; i < nums.size(); i++){ m[nums[i]]++; } int cnt = 0; map <int, int> :: iterator it = m.begin(); while(it != m.end()){ int x = it->first; int temp = x * it->second; map <int, int> :: iterator it1 = prev(it); map <int, int> :: iterator it2 = prev(it1); if(cnt >= 1 && x - it1->first > 1){ temp += m[it1->first]; } else if(cnt >= 2){ temp += m[it2->first]; } m[it->first] = max(temp, cnt >= 1 ? m[it1->first] : 0); ret = max(ret, temp); it++; cnt++; } return ret; } }; main(){ vector<int> v = {3,4,2}; Solution ob; cout << (ob.deleteAndEarn(v)); } [3,4,2] 6
https://www.tutorialspoint.com/delete-and-earn-in-cplusplus
CC-MAIN-2021-43
refinedweb
371
76.25
Natural Language Procecssing Toolkit with support for tokenization, sentence splitting, lemmatization, tagging and parsing for more than 60 languages Project description News [15 April 2019] - We are releasing version 1.1 models - check all supported languages below. Both 1.0 and 1.1 models are trained on the same UD2.2 corpus; however, models 1.1 do not use vector embeddings, thus reducing disk space and time required to use them. Some languages actually have a slightly increased accuracy, some a bit decreased. By default, NLP Cube will use the latest (at this time) 1.1 models. To use the older 1.0 models just specify this version in the load call: cube.load("en", 1.0) ( en for English, or any other language code). This will download (if not already downloaded) and use this specific model version. Same goes for any language/version you want to use. If you already have NLP Cube installed and want to use the newer 1.1 models, type either cube.load("en", 1.1) or cube.load("en", "latest") to auto-download them. After this, calling cube.load("en") without version number will automatically use the latest ones from your disk. NLP-Cube NLP-Cube is an opensource Natural Language Processing Framework with support for languages which are included in the UD Treebanks (list of all available languages below). Use NLP-Cube if you need: - Sentence segmentation - Tokenization - POS Tagging (both language independent (UPOSes) and language dependent (XPOSes and ATTRs)) - Lemmatization - Dependency parsing Example input: "This is a test.", output is: 1 This this PRON DT Number=Sing|PronType=Dem 4 nsubj _ 2 is be AUX VBZ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 4 cop _ 3 a a DET DT Definite=Ind|PronType=Art 4 det _ 4 test test NOUN NN Number=Sing 0 root SpaceAfter=No 5 . . PUNCT . _ 4 punct SpaceAfter=No If you just want to run it, here's how to set it up and use NLP-Cube in a few lines: Quick Start Tutorial. For advanced users that want to create and train their own models, please see the Advanced Tutorials in examples/, starting with how to locally install NLP-Cube. Simple (PIP) installation / update version Install (or update) NLP-Cube with: pip3 install -U nlpcube API Usage To use NLP-Cube *programmatically (in Python), follow this tutorial The summary would be: from cube.api import Cube # import the Cube object cube=Cube(verbose=True) # initialize it cube.load("en") # select the desired language (it will auto-download the model on first run) text="This is the text I want segmented, tokenized, lemmatized and annotated with POS and dependencies." sentences=cube(text) # call with your own text (string) to obtain the annotations The sentences object now contains the annotated text, one sentence at a time. To print the third words's POS (in the first sentence), just run: print(sentences[0][2].upos) # [0] is the first sentence and [2] is the third word Each token object has the following attributes: index, word, lemma, upos, xpos, attrs, head, label, deps, space_after. For detailed info about each attribute please see the standard CoNLL format. Webserver Usage To use NLP-Cube as a web service, you need to locally install NLP-Cube and start the server: For example, the following command will start the server and preload languages: en, fr and de. cd cube python3 webserver.py --port 8080 --lang=en --lang=fr --lang=de To test, open the following link (please copy the address of the link as it is a local address and port link) Cite If you use NLP-Cube in your research we would be grateful if you would cite the following paper: - NLP-Cube: End-to-End Raw Text Processing With Neural Networks, Boroș, Tiberiu and Dumitrescu, Stefan Daniel and Burtica, Ruxandra, Proceedings of the CoNLL 2018 Shared Task: Multilingual Parsing from Raw Text to Universal Dependencies, Association for Computational Linguistics. p. 171--179. October 2018 or, in bibtex format: @InProceedings{boro-dumitrescu-burtica:2018:K18-2, author = {Boroș, Tiberiu and Dumitrescu, Stefan Daniel and Burtica, Ruxandra}, title = {{NLP}-Cube: End-to-End Raw Text Processing With Neural Networks}, booktitle = {Proceedings of the {CoNLL} 2018 Shared Task: Multilingual Parsing from Raw Text to Universal Dependencies}, month = {October}, year = {2018}, address = {Brussels, Belgium}, publisher = {Association for Computational Linguistics}, pages = {171--179}, abstract = {We introduce NLP-Cube: an end-to-end Natural Language Processing framework, evaluated in CoNLL's "Multilingual Parsing from Raw Text to Universal Dependencies 2018" Shared Task. It performs sentence splitting, tokenization, compound word expansion, lemmatization, tagging and parsing. Based entirely on recurrent neural networks, written in Python, this ready-to-use open source system is freely available on GitHub. For each task we describe and discuss its specific network architecture, closing with an overview on the results obtained in the competition.}, url = {} } Languages and performance Results are reported against the test files for each language (available in the UD 2.2 corpus) using the 2018 conll eval script. Please see more info about what each metric represents here. Notes: - version 1.1 of the models no longer need the large external vector embedding files. This makes loading the 1.1 models faster and less RAM-intensive. - all reported results here are end-2-end. (e.g. we test the tagging accuracy on our own segmented text, as this is the real use-case; CoNLL results are mostly reported on "gold" - or pre-segmented text, leading to higher accuracy for the tagger/parser/etc.) Project details Release history Release notifications Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/nlpcube/
CC-MAIN-2019-43
refinedweb
954
53.81
Phooey From HaskellWiki Revision as of 01:18, 24 February 2010 1 AbstractPhooey is a functional UI library for Haskell. Or it's two of them, as it provides a Besides this wiki page, here are more ways to find out about Phooey: - Read the Haddock docs (with source code, additional examples, and Comment/Talk links). - Get the code repository: darcs get. Phooey is also used in GuiTV, a library for composable interfaces and "tangible values". Since Reactive is currently broken (as of February 2010), Phooey is also broken. uses the Reactive library to perform the dependency inversion invisibly, so that programmers may express GUIs simply and declaratively while still getting an efficient implementation., two interfacesAs an example, below is a simple shopping list GUI. The Phooey presents two styles of functional GUI interfaces, structured as a monad and as an applicative functor. (I have removed the original arrow interface.) Below you can see the code for the shopping list example in each of these styles.The examples below are all found under src/Examples/in the phooey distribution, in the modules Monad () ui1x = title "Shopping List" $ do a <- apples b <- bananas total (liftA2 (+) a b) -- Sum UIs infixl 6 .+. (.+.) :: Num a => UIS a -> UIS a -> UIS a (.+.) = liftA2 (liftA2 (+)) fruit :: UI (Source Int) fruit = apples .+. bananas ui1y :: UI () ui1y = title "Shopping List" $ fruit >>= total 3.2 Applicative Functor Applicative functors (AFs) type UI = M.UI :. Source 5 Event ExamplesThe shopping examples above demonstrate the simple case of outputs ( This section shows two classic functional GUI examples involving a visible notion of events. 5.1 Counter Here is simple counter, which increments or decrements when the "up" or "down" button is pressed. The example is from "Structuring Graphical Paradigms in TkGofer" The first piece in making this counter is a button, having a specified value and a label. The button GUI's value is an event rather than a source: smallButton :: a -> String -> UI (Event a) The pair of buttons and combined event could be written as follows: upDown :: Num a => UIE (a -> a) upDown = do up <- smallButton (+ 1) "up" down <- smallButton (subtract 1) "down" return (up `mappend` down) If you've been hanging around with monad hipsters, you'll know that we can write this definition more simply: upDown = liftM2 mappend (smallButton (+ 1) "up") (smallButton (subtract 1) "down").
https://wiki.haskell.org/index.php?title=Phooey&diff=prev&oldid=33828
CC-MAIN-2015-32
refinedweb
389
59.84
redux_api_middleware 0.1.9 redux_api_middleware # Redux middleware for calling APIs. The apiMiddleware intercepts and calls Redux Standard API-calling Actions (RSAAs), and dispatches Flux Standard Actions (FSAs) to the next middleware. Redux Standard API-calling Actions # The definition of a Redux Standard API-calling Action below is the one used to validate RSAA actions. - actions that are not instances of RSAAwill be passed to the next middleware without any modifications; - actions that are instancesof RSAAthat fail validation will result in an error request FSA. A Redux Standard API-calling Action MUST - be a RSAAinstance, Flux Standard Actions # For convenience, we recall here the definition of a Flux Standard Action. An action MUST - be a RSAAinstance, - have a typeproperty. An action MAY - have an errorproperty, - have a payloadproperty, - have a metaproperty. Credits # This lib is redux-api-middleware library simply adapted to Dart. Changelog # 0.1.9 # - The failure request payload wasn't being processed. - Exported the errors for typed usage. 0.1.8 # - The wrong descriptor was being used in request error. - Renaming the descriptor for more clarity. 0.1.7 # - Export the FSA for a more typed reducer. 0.1.6 # - Export the FSA for a more typed reducer. 0.1.5 # - The request action was not getting dispatched. Fixed that 0.1.4 # - Now the payload is a string, ww let the user parse this string. 0.1.3 # - http package user lower cased content-type. Fixing that. 0.1.2 # - Improving analysis score. 0.1.0 # - Initial version, includes a apiMiddleware, which intercepts and calls functions that are dispatched to the Store. example/redux_api_middleware_example.dart import 'package:redux/redux.dart'; import 'package:redux_api_middleware/redux_api_middleware.dart'; void main() { // First, create a quick reducer String reducer(String state, dynamic action) { switch (action.type) { case 'request': return 'dispatched a request :)'; case 'success': return 'dispatched a success :D'; case 'failure': return 'dispatched a failure :('; default: return state; } } // Next, apply the `apiMiddleware` to the Store final store = Store<String>( reducer, middleware: [apiMiddleware], ); // Create a `RSAA`. var rsaa = RSAA( method: 'GET', endpoint: '', types: [ 'request', 'success', 'failure', ], ); // Dispatch the action! The `apiMiddleware` will intercept and invoke // the action function. It will go to the reducer as an FSA. store.dispatch(rsaa); } Use this package as a library 1. Depend on it Add this to your package's pubspec.yaml file: dependencies: redux_api_middleware: ^0.1.9_api_middleware/redux_api_middleware.dart'; We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using: - Dart: 2.7.0 - pana: 0.13.4 Health issues and suggestions Document public APIs. (-1 points) 50 out of 50 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API. Format lib/src/middleware.dart. Run dartfmt to format lib/src/middleware.dart. Maintenance issues and suggestions Support latest dependencies. (-10 points) The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency ( redux).
https://pub.dev/packages/redux_api_middleware
CC-MAIN-2020-05
refinedweb
504
51.75
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video. Using @PathVariable to Create a Dynamic Detail Page14:30 with Chris Ramacciotti In order to create a dynamic detail page that changes according to a URI, we'll need to define a `@PathVariable` and include a placeholder in the URI of the `@RequestMapping` annotation. In this video, you'll learn exactly how to do that. Correction At the beginning of the video (0:51), I say that we are asking for the "compiler-bot" from our repository on each call to the controller method. In code, we're actually referencing the "android-explosion" GIF. Though I misspoke there, the idea is the same: we are fetching the same GIF every time, and we need to be able to fetch a GIF that depends on the request. In short, we need to make our unchanging controller method dynamic! Working with Attributes in Thymeleaf To learn more about all the supported attributes in Thymeleaf, as well as custom attributes, check out the Thymeleaf docs for Setting Attribute Values. Custom Date Formatting If you'd like to custom format the date, you'll want to alter your Thymeleaf template. By default, you're limited in what you can display with a LocalDate object. What you'll need to do is add the ability to format dates by adding a dialect to the template engine. A nice one to use is org.thymeleaf.extras.java8time.dialect.Java8TimeDialect. To use it, you'll need to take care of three items: (1) Add the thymeleaf-extras-java8time dependency to your Gradle build file: compile 'org.thymeleaf.extras:thymeleaf-extras-java8time:2.1.0.RELEASE' (2) Add the Java8TimeDialect to the template engine upon startup by altering your AppConfig class to include the following package com.teamtreehouse.giflib; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect; import org.thymeleaf.spring4.SpringTemplateEngine; @EnableAutoConfiguration @ComponentScan public class AppConfig implements CommandLineRunner { @Autowired private SpringTemplateEngine templateEngine; public static void main(String[] args) { SpringApplication.run(AppConfig.class, args); } @Override public void run(String... args) throws Exception { templateEngine.addDialect(new Java8TimeDialect()); } } Notice I've @Autowired the SpringTemplateEngine, which will be created by Spring at application startup. Then, since I've implemented CommandLineRunner, which requires only an implementation of the run(String...) method, our run method will be called after SpringApplication.run is finished. In our run method is where you finally see the Java8TimeDialect added to the template engine. (3) Format a date in your Thymeleaf template You now have available all the options listed on the dialect's Github repo. The snippets listed there are what you'd use in your Thymeleaf template. For example, if ${gif.dateUploaded} referenced January 1, 2015, then ${#temporals.format(gif.dateUploaded, 'MMM d yyyy')} would give you "Jan 1 2015". - 0:00 You've come a long way in this one course, - 0:02 geared towards developing a library of animated gifs. - 0:06 During the last video, you learned about dependency injection or DI, which - 0:11 allows you to rely on string to provide component instances when they're needed. - 0:16 You used the auto wired annotation to inject a gif repository into your gif - 0:20 controller. - 0:21 And string in knew that your gif repository was injectable, - 0:25 because you annotated it with the component annotation. - 0:29 With all that said, - 0:30 we have one more item to check off that will make our detail pages truly dynamic. - 0:36 What we like to do is have our gif details controller method - 0:39 serve the gif object that corresponds to the name with include in the URI. - 0:44 Currently our gif details template always shows the same gif, since each call - 0:49 to the controller method, we're asking for the compiler bot from the repository. - 0:54 Let's take that last additional step toward a dynamic page by - 0:58 adding what's called a path variable to our request mapping. - 1:02 Let me show you what I mean. - 1:04 Back in the gif controller class, let's look again at our gif details method. - 1:08 What we'd like to do is make this method serve dynamic data. - 1:12 That is, only if the URI requested is /gif/androidexplosion, would - 1:17 we wanna fetch the gif object whose name field has the value, android explosion. - 1:23 But if somebody requested /gif/compilerbot, - 1:27 we'd want to fetch the gif object whose name field has the value compiler bot. - 1:32 At this point though, we are stuck with whichever name we've hardcoded right here. - 1:36 The root of our limitation is that we are requesting a mapping to a single URI - 1:41 without allowing for any variation. - 1:43 In this case, we've used /gif. - 1:47 String offers us options to expand our URI mapping to include what are called path - 1:52 variables. - 1:53 These path variables act as place holders that we can capture in our method - 1:57 parameters. - 1:58 Check this out. - 1:59 Let's expand our mapping to include the name of the gif - 2:02 by including a place holder or path variable in curly braces. - 2:06 So, add a slash and then in curly braces, I'll type, name. - 2:11 In order to capture the actual value of the URI after /gif/, we'll need to include - 2:17 another parameter in the method annotating it with the path variable annotation as - 2:22 follows, PathVariable String name. - 2:31 The order of these parameters does not matter, - 2:33 as string can figure it out either way. - 2:35 At this point we've captured the name placeholder - 2:38 into the path variable parameter named, name. - 2:43 And because it's a parameter, - 2:44 we can use its value just like any other parameter value in a method. - 2:50 So, in place of android explosion, I could simply use the parameter value for name. - 2:56 Let's take a spin through everything that is happening here. - 2:59 First, the user requested URI such as /gif/androidexplosion. - 3:04 In a browser, the full URL would look something like this, - 3:10 http:// localhost:8080/gif/android-explosion. - 3:17 Because this controller method has requested a mapping to any URI that has - 3:21 a pattern /gif/something, this controller method is called, - 3:27 and the spring framework then passes that something into the name place - 3:32 holder which is captured by the string parameter called, name. - 3:37 So, name at this point has the value android explosion. - 3:42 Since name has the value android explosion, the value android explosion is - 3:46 then passed into the findByName method of the gifRepository object, thereby - 3:51 returning the gif object associated with the name android explosion, - 3:56 stored into our variable named gif. - 3:59 Which we then add to the model map under the string gif. - 4:04 The gif details timely template is then entered as a result of returning the name - 4:08 of that template. - 4:10 Now, hopping over to that template under gif details, the images - 4:15 source attribute now references the gif object that we added to the model map, - 4:19 specifically the gif.name method is called on that gif object and - 4:24 it's concatenated between /gifs/ and .gif. - 4:29 Thereby making the source attribute of the image tag in the resulting HTML read - 4:34 in full /gifs/androidexplosion.gif. - 4:41 When that HTML is rendered in a browser, - 4:43 we should see the the android explosion gif in the page. - 4:48 Lets redeploy and see if we get that result. - 4:51 So, I'll stop my boot run task and I'll rerun the boot run - 4:57 task as soon as I see that output telling that hey the boot run task is finished. - 5:03 There it is right there. - 5:07 Lets re run, we'll see that spring logo, there it is, and - 5:11 Tomcat started the [INAUDIBLE] in just over two seconds. - 5:15 Lets go back to our browser and see what we have here. - 5:19 Now, we're gonna have to add the name of the gif after this. - 5:22 So, if I pass it, android explosion, what I should see is this page. - 5:28 Excellent, it looks the same. - 5:31 And hey, if you're not convinced by that, why don't change the name - 5:35 after slash gif slash, to see if you can get another one to show up. - 5:40 There's the compiler bot. - 5:41 And as you're scrolling through some of the other gifs in IntelliJ in that gifts - 5:45 directory that I gave you, you can experiment with the other ones as well. - 5:54 Here is our Strange Cowboy Coder. - 5:58 This is great. - 5:59 It works. - 6:00 As you can see though, we have some missing details. - 6:03 Down here we have a URL that doesn't change, the date - 6:06 uploaded comes up the same every time regardless of the one that we enter here. - 6:10 I can prove that in just a moment. - 6:13 Android explosion, still October 30th, 2015. - 6:16 Still says URL. - 6:18 Still says the infamous Craig Dennis, Java teacher of treehouse. - 6:22 So, what we'll do here is take a couple minutes to finish our work. - 6:27 The first thing we'll do is fix the class of the favorite icon. - 6:31 Switching over to the gif details at HTML every time it says, mark as favorite. - 6:37 Now, if I switch back to the browser, - 6:39 you can see what'll happen if I change the CSS. - 6:42 So, we have that faint star there indicating that - 6:45 maybe I can mark it as a favorite. - 6:47 Now, I should note here that in this course we will not be implementing - 6:50 the feature of actually marking this as the currently logged in users favorite. - 6:55 >> Simply because there is no currently logged in user. - 6:59 That is the topic of another course, user authentication. - 7:03 Let's inspect this element using the Chrome developer tools, - 7:06 then we can see what the HTML in the browser actually looks like. - 7:11 If I drag this panel down, what I'll see is the actual HTML that produces that - 7:16 star icon right there, and it's this anchor here. - 7:20 Now, what you'll notice here is if you change this class to say unmark - 7:25 favorite instead of just mark favorite, and click outside of there, - 7:30 there the icon changes indicating that we have marked this as a favorite. - 7:36 What we need to do is make our Thymeleaf template produce the class name - 7:40 unmark when the gif is a favorite and mark when it is not - 7:45 according to the value of the favorite field in the associate gif object. - 7:51 Let's switch back to IntelliJ and do just that. - 7:53 To do this, we'll make the class name dynamic by using that th prefix again. - 7:58 So before class, th colon. - 8:01 You can use this prefix on most HTML attributes to make them dynamic. - 8:05 I've given you a link in the teacher's notes that shows you exactly which - 8:08 attributes are supported. - 8:10 Since we need to make the class name either mark or - 8:12 unmark, this amounts to conditionally prefixing mark with un. - 8:18 We can accomplish this in Thymeleaf with the operator much like in Java. - 8:23 That's the question mark and the colon. - 8:26 It's like an abbreviated if statement. - 8:28 What we wanna do is pre pend, mark favorite with either un or - 8:33 nothing, depending on the value of the gif object's favorite field. - 8:37 So, what I'm gonna do in here is, I'm gonna enclose this whole string - 8:43 marked favorite in a literal, because mark favorite will always be in the class name. - 8:47 It's either gonna be unmarked favorite or marked favorite. - 8:52 And to it, I'm gonna concatenate a value. - 8:55 Now this value will come in the form of a ternary operator expression - 8:59 using the question mark and the colon. - 9:03 So, the thing you put before the question mark is the thing that's either true or - 9:06 false. - 9:06 In this case, - 9:07 I'll use one of those variable expressions to check the favorite. - 9:12 Gif.favorite will be either true or false, so - 9:14 it's safe to put before the question mark. - 9:16 Now, what do I wanna do if gif.favorite is true? - 9:21 Well, I wanna use the un value. - 9:24 So, if gif.favorite is true, this whole class name will be - 9:28 un marked favorite because un will concatenated with mark favorite. - 9:32 Now, if the value is false or - 9:34 after the colon here, I'll just use nothing or an empty string there. - 9:38 So if gif.favorite is false, I'll be concatenating nothing with mark favorite, - 9:43 so that the resulting class will be simply mark favorite. - 9:47 Let's save those changes, stop our boot run task, and - 9:52 let's try to redeploy this thing, so - 9:54 we can see if our favorite icon is fixed according to the gif object. - 10:01 There we go, our server has started up and our application deployed. - 10:04 I'll go back here, I'm gonna close the Chrome developer tools. - 10:08 And I will hit refresh. - 10:10 Now, android explosion is not a favorite. - 10:13 Let's switch back to our data repository and find one that is a favorite. - 10:18 So, if I go back to my gif depository, - 10:20 I see that indeed android explosion uses false in it's favorite field. - 10:25 But, if I do Ben and Mike, that one looks like it's true. - 10:30 So, let's try that one. - 10:31 Ben and Mike. - 10:33 What I should see when I hit enter is this icon down here. - 10:38 Change to that favorite icon. - 10:41 There it is, it's marked as a favorite. - 10:43 So, it appears the Thymeleaf template is accurately using our favorite field - 10:48 to mark or unmark our gifs as favorites. - 10:52 Okay, let's go back to the gif details template. - 10:56 And update the username and the date uploaded. - 11:00 I'm going back into the gif details. - 11:03 Let's scroll down to the username. - 11:07 For the username, what we need to do is change the text that appears between - 11:10 the opening and closing h4 tags. - 11:13 That is this text right here. - 11:15 We see the username Craig Dennis being displayed every time because it's simply - 11:20 hard coded text in our HTML that is no way processed by Thymeleaf. - 11:24 The way that you can have Thymeleaf dynamically include text here, - 11:29 is by using an attribute in the opening tag called th:text. - 11:34 And inside there is where you put your expression that will be evaluated by - 11:38 Thymeleaf, and will replace the text that is between the opening and closing tag. - 11:44 So, inside the quotes we'll add the variable expression to grab the username. - 11:49 Again, a variable expression starts with the dollar sign and - 11:51 is enclosed with curly braces. - 11:54 So in this case, I want gif.username and we'll do the same for the date uploaded. - 11:58 Th:text=, and I a couple values here. - 12:05 I'll say uploaded on and - 12:07 then I'll concatenate the actual date it was uploaded on. - 12:12 That'll be gif.date uploaded. - 12:18 And now there's one more thing we could update as long as we are in here. - 12:20 And if I scroll down that would be the sharable URL. - 12:24 Right now, it's a static piece of text that just says URL. - 12:28 Switch back to the browser, you can see where that's displayed. - 12:31 Scroll down a little bit and there's the URL right there. - 12:35 I'd like for this value to be an actual URL that somebody could - 12:39 use to share this gif, so I'll switch back to IntellJ and take care of that. - 12:43 For the shareable URL, we wanna replace what's between the opening and - 12:46 closing span tags with an actual URL that comes from the gif object itself. - 12:52 Now, I'm gonna use a made up domain name called gif.fy. - 12:58 So, I'll start it with th:text= and - 13:02 then I'll concatenate. - 13:06 I just made that up. - 13:08 You could put whatever you like here, slash, and then my closing single quote, - 13:13 and I'll concatenate using a variable expression. - 13:16 I'll just say gif.name. - 13:20 Now I'll save that, I'll stop my bootRun task. - 13:24 Let see what we have here, give that a moment to stop and - 13:30 then I will click bootRun again, there's the logo. - 13:36 Tomcat started at config loaded. - 13:39 Excellent. - 13:40 Let's go back to the browser and refresh and see our results. - 13:44 I'm gonna refresh there. - 13:47 Cool. - 13:47 Check that out. - 13:48 The actual username that came from the gif object is included there - 13:52 as well as the date uploaded. - 13:54 Here's that shareable URL that I was talking about. - 13:57 Now, if you change this to another name, let's see that data change. - 14:03 This one is also marked as a favorite. - 14:05 There's the compiler bot image. - 14:08 Here is the actual user name that was included in a gif object, Ada Lovelace. - 14:14 The date uploaded is different in this case. - 14:16 The last one was October 30th. - 14:18 And here is the different shared URL here. - 14:22 Looking great. - 14:23 Now, we have all the pieces of information you need to each specific - 14:26 gif displayed on the page, great work.
https://teamtreehouse.com/library/spring-basics/modeling-storing-and-presenting-data/using-pathvariable-to-create-a-dynamic-detail-page
CC-MAIN-2018-51
refinedweb
3,265
73.07
In this final installment of my series of articles covering new features in C# 6, I'll discuss two more new features in the C# 6 language: static using statements, and what is often called 'Better Betterness.' The first is new syntax that reduces code clutter by making extensive use of static methods. The second is a series of improvements to the language specification and compiler implementation that determines the best match for method overloads. Constructs that previously introduced ambiguities now can often resolve to a single method. Let's start with using static. Static Methods Suppose you had this line of code in your program: var hypotenuse = Math.Sqrt(3 * 3 + 4 * 4); It's easy to read on its own, but imagine it as part of a large class that provides a number of statistical analysis routines. In a quick scan of the code, you'd likely see the Math class name all over, cluttering up the code and making it hard to see the algorithms and other important details. The static using feature addresses this problem. We add this statement to the using statements in the source file: using static System.Math; Now we can remove the Math qualifier on any invocation of a method in the Math class: var hypotenuse = Sqrt(3 * 3 + 4 * 4); This feature went through a couple of iterations as C# 6 neared release. You may find resources on the Web stating that you don't need to include the static keyword as part of the using statement, but that information represented the earlier proposed syntax, and it has been changed. The final syntax makes it easier to determine which using statements represent using classes, and which statements represent using namespaces. Another change has made the feature more useful. The first proposal allowed you to add using statements only for static classes, which proved quite limiting. Some classes containing only static members had not been updated to include the static keyword (which was introduced in C# 2); System.Diagnostics.Trace is one example. It's marked sealed, but not static. However, there are no accessible constructors and no instance methods. Many other classes contain a large number of static methods and also support instances of that type. The string class is an example. Because strings are immutable, the class has many static methods that manipulate strings and return new objects. In some cases, adding a using static statement for System.String results in more readable code. That last sentence leads into my final point about the basic syntax: In a static using statement, you must specify the fully qualified name for any class you use. You can't simply type the class name, even if you already added a using statement for the enclosing namespace. For example, the following two statements won't compile; you must specify System.Math when you're using that class: using System; using static Math; // CS 0246. The type or namespace type could not be found. You also can't use a C# keyword for types in which a keyword is defined as an alias for a type: using static System.String; // this compiles using static string; // this generates CS1001 Static Using and Extension Methods The C# 6 language design team took care to make sure that introducing this feature wouldn't impact the resolution for extension methods. Remember that extension methods are static methods that can be called as though they're members of the type represented by the first parameter (or any type containing an implicit conversion from the type of the first argument to the type defined for the first parameter of the method declaration). The design goal was to make this addition to the language coexist with any code currently using extension methods. The rules governing using static and extension methods were written to ensure this goal. They may seem a bit involved, but that complexity is intentional. Consider this query: using System.Linq; // So that the methods in the Enumerable class are found var squares = from n in Enumerable.Range(0, 1000) let root = Math.Sqrt(n) where root == Math.Floor(root) select new { Number = n, Root = root }; The where query expression resolves to System.Linq.Enumerable.Where(). The select query expression resolves to System.Linq.Enumerable.Select(). Those methods are in scope because of the using statement shown above. I'd like to simplify the code by adding static usings so I don't have to type Math. and Enumerable. in the query above. I begin by modifying the using statements: using static System.Linq.Enumerable; using static System.Math; Then I remove the name qualifiers in the query: var squares = from n in Range(0, 1000) let root = Sqrt(n) where root == Floor(root) select new { Number = n, Root = root }; Notice that I could remove the using statement for the System.Linq namespace. Because I've imported all the methods in the System.Linq.Enumerable class via using static, Where and Select can be found. However, because extension methods are designed to be called as if they were instance methods, using static won't bring those methods into scope to be called as static methods. Consider these two statements: var sequence = Range(0, 1000); var smallNumbers = Enumerable.Where(sequence, item => item < 10); I can't remove the Enumerable class name from the second statement. I still have the using static System.Linq.Enumerable statement, but that won't add those method names to the global scope when they're called as static methods. I also have to include the using statement for System.Linq for this example to compile. Without it, I would have to write System.Linq.Enumerable.Where(...). The justification for this behavior is that extension methods are typically called as though they're instance methods. In the rare case where they're called as static methods, typically the reason is to resolve ambiguity. Therefore, it seems wise to force the developer to declare the class name. Taking Advantage of 'Better Betterness' The final feature we'll explore is often called "Better Betterness," though its official name is improved overload resolution. This feature is hard to demonstrate easily; in fact, it won't really affect your daily practices unless you look for it. In a number of areas, the compiler has improvements that enable it to pick one "best" method in C# 6, whereas in C# 5 and earlier those constructs resulted in an ambiguity. When you found such ambiguities, you would have needed to update the code to give the compiler better hints regarding the method you wanted the compiler to choose. The one I ran into most often was when I used a method group as the argument to a method. I expected that I could write this code: // declared elsewhere: static Task SomeWork() { return Task.FromResult(42); } // Call it here: Task.Run(SomeWork); but the compiler couldn't resolve the method correctly. I'd get an error saying, "The call is ambiguous between Task.Run(Action) and Task.Run(Func<Task>)," and I'd have to change the method group to a lambda expression so the compiler would find the better method (Task.Run(Func<Task>)): Task.Run(() => SomeWork()); When code constructs you thought would work now do work in C# 6, thank "Better Betterness." Initial Guidance on Static and 'Better Betterness' I saved these two features for last in this series because, while they're important, they're the features that affect my daily coding practices the least. Improved overload resolution doesn't introduce any new syntax; it just removes rough edges around code that I previously thought should work. Now it does. By contrast, static using is a great feature, and I'm trying to make it part of my regular practices. But old habits are hard to break; I'm so accustomed to typing the class name before typing a static method that muscle memory just takes over. It's not such a significant improvement that I change existing code to take advantage of it. This wraps up my series on the new features in C# 6. Overall, it's an impressive update to my favorite programming language. As I write this, the release candidate is out, and I expect the final release to appear soon. I truly believe the whole C# community will be excited by this release. I'm becoming much more productive as I build habits using the new features. Get your hands on the bits, and start coding.
http://www.informit.com/articles/article.aspx?p=2425866
CC-MAIN-2017-13
refinedweb
1,420
63.8
We often see voltage fluctuations in electricity supply at our home, which may cause malfunction in our home AC appliances. Today we are building a low cost High and Low Voltage Protection Circuit, which will cut off the power supply to the appliances in case of High or Low voltage. It will also show a alert message on 16x2 LCD. In this project, we have used PIC Microcontroller to read and compare the input voltage to the reference voltage and take the action accordingly. We have made this circuit on PCB and added a additional circuit on PCB for the same purpose, but this time using op-amp LM358 (without microcontroller). For demonstration purpose, we have chosen Low Voltage limit as 150v and high voltage limit as 200v. Here in this project, we haven’t used any relay for cut off, we just demonstrated it using LCD, check the Video at the end of this Article. But the user may attach a relay with this circuit and connect it with PIC’s GPIO. Further check our other PCB projects here. Components Required: - PIC Microcontroller PIC18F2520 - PCB (ordered from EasyEDA) - IC LM358 - 3 pin Terminal Connector (optional) - 16x2 LCD - BC547 Transistor - 1k resistor - 2k2 resistor - 30K resistor SMD - 10k SMD - Capacitors- 0.1uf, 10uF, 1000uF - 28 pin IC base - Male/female burgsticks - 7805 Voltage regulators- 7805, 7812 - Pickit2 Programmer - LED - Zener diode- 5.1v, 7.5v, 9.2v - Transformer 12-0-12 - 12MHz Crystal - 33pF capacitor - Voltage regulator(fan speed regulator) Working Explanation: In this High and Low Voltage Cut Off Circuit, we have read the AC voltage by using PIC microcontroller with the help of transformer, bridge rectifier & voltage divider circuit and displayed over 16x2 LCD. Then we have compared the AC voltage with the predefined limits and displayed the alert message over the LCD accordingly. Like if voltage is below 150v then we have shown “Low Voltage” and if voltage is above 200v then we have shown “High Voltage” text over the LCD. We can change those limits in PIC code given at the end of this project. Here we have used Fan Regulator to increase and decrease the incoming voltage for demonstration purpose in the Video. In this circuit, we have also added a Simple Under and Over Voltage Protection Circuit without using any microcontroller. In this simple circuit we have used LM358 comparator to compare the input and reference voltage. So here we have three options in this project: - Measure and compare the AC voltage with the help of transformer, bridge rectifier, voltage divider circuit and PIC microcontroller. - Detection of over and under voltage by using LM358 with the help of transformer, rectifier, and comparator LM358 (without Microcontroller) - Detect under and over voltage by using a comparator LM358 and feed its output to PIC microcontroller for taking action by code. Here we have demonstrated first option of this project. In which we have stepped down AC input voltage and then converted that into DC by using a bridge rectifier and then again mapped this DC voltage to 5v and then finally fed this voltage to PIC microcontroller for comparison and display. In PIC microcontroller we have read this mapped DC voltage and based on that mapped value we have calculated the incoming AC voltage with the help of given formula: volt= ((adcValue*240)/1023) where adcValue is equivalent DC input voltage value at PIC controller ADC pin and volt is the applied AC voltage. Here we have taken 240v as maximum input voltage. or alternatively we can use given method for mapping equivalent DC input value. volt = map(adcVlaue, 530, 895, 100, 240) where adcValue is equivalent DC input voltage value at PIC controller ADC pin, 530 is minimum DC voltage equivalent and 895 is maximum DC voltage equivalent value. And 100v is minimum mapping voltage and 240v is maximum mapping voltage. Means 10mV DC input at PIC ADC pin is equal to 2.046 ADC equivalent value. So here we have selected 530 as minimum value means, the voltage at PIC’s ADC pin will be: (((530/2.046)*10)/1000) Volt 2.6v which will be mapped minimum value of 100VAC (Same calculation for maximum limit). Check the map function is given in the PIC program code in the end. Learn more about Voltage Divider Circuit and mapping the Voltages using ADC here. Working of this project is easy. In this project, we have used an AC voltage fan regulator for demonstrating it. We have attached fan regulator to the input of transformer. And then by increasing or decreasing its resistance we got desired voltage output.. When input voltage increases then we can see voltage changes over LCD and if voltage becomes more than over voltage limit then LCD will alert us by “HIGH Voltage Alert” and if the voltage goes low than under voltage limit then LCD will alert us by showing “LOW Voltage Alert” message. This way it can be also used as Electronic Circuit breaker. We can further add a relay to attach any AC appliances to auto cutoff on low or high voltages. We just need to add a line of code to switch off the appliance, below the LCD alert message showing code. Check here to use Relay with AC appliances. Circuit Explanation: In High and low Voltage Protection Circuit, we have used an LM358 op-amp which has two outputs connected to 2 and 3 number pins of PIC microcontroller. And a voltage divider is used to divide voltage and connects its output at 4th number pin of PIC microcontroller. LCD is connected at PORTB of the PIC in 4-bit mode. RS and EN are directly connected at B0 and B1 and data pins D4, D5, D6 and D7of LCD are connected at B2, B3, B4 and B5 respectively. In this project, we have used two voltage regulator: 7805 for microcontroller supply and 7812 for the LM358 circuit. And a 12v-0-12v step-down transformer is also used to step down the AC voltage. Rest of the components are shown in the circuit diagram below. Programming Explanation: Programming part of this project is easy. In this code, we just need to calculate AC voltage by using mapped 0-5v voltage coming from Voltage Divider Circuit and then compare it with predefined values. You can check the complete PIC code after this project. First, in the code, we have included a header and configured the PIC microcontroller config bits. If you are new to PIC coding then learn PIC Microcontroller and its configuration bits here. Then we have used some fucntions for driving LCD, like void lcdbegin() for initializing the LCD, void lcdcmd(char ch) for sending a command to LCD, void lcdwrite(char ch) for sending data to LCD and void lcdprint(char *str) for sending string to LCD. Check all the functions in the code below. Below given function is used for mapping the values: long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } Given int analogRead(int ch) function is used for initializing and reading ADC:; } Given lines are used for getting ADC samples and calculate average of them and then calculating voltage:); And finally given function is used for taking resulted action: if(volt > 200) { lcdcmd(1); lcdprint("High Voltage"); lcdcmd(192); lcdprint(" Alert "); delay(1000); } else if(volt < 150) { lcdcmd(1); lcdprint("Low Voltage"); lcdcmd(192); lcdprint(" Alert "); delay(1000); } Circuit and PCB Design using EasyEDA: To design this HIGH and LOW Voltage Detector Circuit, we have chosen the online EDA tool called EasyEDA. We have previously used EasyEDA many times and found it very convenient to use compared to other PCB fabricators. Check here our all the PCB projects. EasyEDA is not only the one stop solution for schematic capture, circuit simulation and PCB design, they also offer a low cost PCB Prototype and Components Sourcing service. They recently launched their there, we have also made our whole Circuit and PCB layouts public for this High and Low Voltage Protection Circuit, check the below link: Below is the Snapshot of Top layer of PCB layout from EasyEDA, you can view any Layer (Top, Bottom, Topsilk, bottomsilk etc) of the PCB by selecting the layer form the ‘Layers’ Window. You can also checkout the Photo view of PCB using EasyEDA: Calculating and Ordering PCBs online:. The user may also go with their local PCB vendor to make PCBs by using Gerber file. EasyEDA’s delivery is very fast and after few days of ordering PCB’s I got the PCB samples: Below are the pictures after soldering the components on PCB: This how we can easily build the Low-high voltage protection circuit for our home. Further you just need to add a relay to connect any AC appliances to it, to protect it from voltage fluctuations. Just connect the relay with any general purpose Pin of PIC MCU and write the code to make that pin High and low along with LCD alert message code. #include<xc.h> //xc8 is compiler #include<stdio.h> #include<stdlib.h> // CONFIG1H #pragma config OSC = HS // Oscillator Selection bits (HS oscillator) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled) #pragma config IESO = OFF // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled) // CONFIG2L #pragma config PWRT = ON // = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit)) #pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768) // CONFIG3H #pragma config CCP2MX = PORTC // CCP2 MUX bit (CCP2 input/output is multiplexed with RB1) #pragma config PBADEN = OFF // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset) #pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator Enable bit (Timer1 configured for higher power operation) #pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled) // CONFIG4L #pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset) #pragma config LVP = OFF // Single-Supply ICSP Enable bit (Single-Supply ICSP disabled) #pragma config) #define rs RB0 #define en RB1 char result[10]; #define lcdport PORTB #define method 0 void delay(unsigned int Delay) { int i,j; for(i=0;i<Delay;i++) for(j=0;j<1000;j++); } void lcdcmd(char ch) { lcdport= (ch>>2)& 0x3C; rs=0; en=1; delay(1); en=0; lcdport= (ch<<2) & 0x3c; rs=0; en=1; delay(1); en=0; } void lcdwrite(char ch) { lcdport=(ch>>2) & 0x3c; rs=1; en=1; delay(1); en=0; lcdport=(ch<<2) & 0x3c; rs=1; en=1; delay(1); en=0; } void lcdprint(char *str) { while(*str) { lcdwrite(*str); str++; } } void lcdbegin() { lcdcmd(0x02); lcdcmd(0x28); lcdcmd(0x0e); lcdcmd(0x06); lcdcmd(0x01); }; } long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } void main() { //ADCON1 = 0b0001111; //all port is digital TRISB=0x00; TRISC=0x00; TRISA=0xff; lcdbegin(); lcdprint("HIGH/LOW Volt"); lcdcmd(192); lcdprint("Detector by PIC"); delay(1000); lcdcmd(1); lcdprint("CircuitDigest"); lcdcmd(192); lcdprint("Welcomes You"); delay(1000);); lcdcmd(0x80); lcdprint("H>200V L<150V"); lcdcmd(0xc0); lcdprint("Voltage:"); lcdprint(result); lcdprint(" V "); delay(1000); if(volt > 200) { lcdcmd(1); lcdprint("High Voltage"); lcdcmd(192); lcdprint(" Alert "); delay(1000); } else if(volt < 150) { lcdcmd(1); lcdprint("Low Voltage"); lcdcmd(192); lcdprint(" Alert "); delay(1000); } } } Jan 02, 2018 Pic microcontrollers battery charger circuit input 220volt output 13.8volt 5amps lcd display volt and amps Jan 07, 2018 Hi I'm using MikroC pro and this code is not running in it pls help me. Jan 09, 2018 What error are you getting? How do you expect help without briefing your question Jun 18, 2018 Interesting to see you've managed to do it with the least components. Can you please tell me how you determined the LOW and HIGH voltage by setting it in the dc level. what is the relationship between the AC and DC voltage. Jun 18, 2018 He has actually converted the AC to DC and then used an op-amp in comparator mode to compare for the low and high voltage levels. It is also explained in the tutorial above read it .. Jul 20, 2018 Hello Sir, can u please explain how this voltage comparator part can be done using an Opamp without using a PIC. I want to design a circuit which cutsoff power supply below 150v and abobe 360v.
https://circuitdigest.com/microcontroller-projects/high-low-voltage-detector-circuit-using-pic18f2520
CC-MAIN-2020-34
refinedweb
2,089
54.66
I just want to make a note of something I read here: def <=>(other) self.age <=> other.age end It says: “If age is private, this method will not work, because other.age is not accessible. If “age” is protected, this will work fine, because self and other are of same class, and can access each other’s protected methods.” That statement is not actually true. They won’t access each other’s protected methods. They will access their own protected methods of the same class. Demonstration: 1.9.3p0 :001 > class A 1.9.3p0 :002?> protected 1.9.3p0 :003?> def method 1.9.3p0 :004?> puts “self is #{self.object_id}” 1.9.3p0 :005?> end 1.9.3p0 :006?> end 1.9.3p0 :009 > class A 1.9.3p0 :010?> def calling_method(o) 1.9.3p0 :011?> self.method 1.9.3p0 :012?> o.method 1.9.3p0 :013?> end 1.9.3p0 :014?> end => nil 1.9.3p0 :015 > b = A.new => #<A:0x007fcfe5b20900> 1.9.3p0 :016 > a.calling_method(b) self is 70265443297880 self is 70265444304000 As you can see, b is not invoking a’s protected method. It’s invoking its own, that was stored separately in this object, just as the instance vars are stored separately per object. I’m sure that’s what the book intended, but when it comes to writing, you have to be careful to clarify for accuracy.
https://www.ruby-forum.com/t/protected-method-access/223436
CC-MAIN-2022-33
refinedweb
239
86.5
mpv [options] [file|URL|PLAYLIST|-] mpv [options] files mpv is a media. Usage examples to get you started quickly can be found at the end of this man page. mpv has a fully configurable, command-driven control layer which allows you to control mpv using keyboard, mouse, or remote control (there is no LIRC support - configure remotes as input devices. Command line arguments starting with - are interpreted as options, everything else as filenames or URLs. All options except flag options (or choice options which include yes) require a parameter in the form --option=value.. The --option=value syntax is not strictly enforced, and the alternative legacy syntax -option value and --option value will also work. This is mostly for compatibility with MPlayer. Using these should be avoided. Their semantics can change any time in the future.. Currently, the parser makes no difference whether an option starts with -- or a single -. This might also change in the future, and --option value might always interpret value as filename in order to reduce ambiguities. Keep in mind that the shell will partially parse and mangle the arguments you pass to mpv. For example, you might need to quote or escape options and filenames: mpv "filename with spaces.mkv" --title="window: ./.: When playing multiple files, any option given on the command line usually affects all files. Example:.). Although some operations allow specifying multiple ,-separated items, using this is strongly discouraged and deprecated, except for -set. Without suffix, the action taken is normally -set. Some options (like --sub-file, --audio-file, --glsl-shader) are aliases for the proper option with -append action. For example, --sub-file is an alias for --sub-files-append. Some options only support a subset of the above. Options of this type can be changed at runtime using the change-list command, which takes the suffix as separate operation parameter..) Almost all command line options can be put into the configuration file. Here is a small guide: Some profiles are loaded automatically. The following example demonstrates this: [protocol.dvd] profile-desc="profile for dvd:// streams" alang=en [extension.flv] profile-desc="profile for .fl.. mpv is optimized for normal video playback, meaning it actually tries to buffer as much data as it seems to make sense. This will increase latency. Reducing latency is possible only by specifically disabling features which increase latency.: http://..., https://, ... Many network protocols are supported, but the protocol prefix must always be specified. mpv will never attempt to guess whether a filename is actually a network address. A protocol prefix is always required.://.... Since libbluray 1.0.1, you can read from ISO files by passing them to --bluray-device. title can be: longest or first (selects the default playlist); mpls/<number> (selects <number>.mpls playlist); <number> (select playlist with the same index). mpv will list the available playlists on loading. bluray:// is an alias.. appending://PATH Play a local file, but assume it's being appended to. This is useful for example for files that are currently being downloaded to disk. This will block playback, and stop playback only if no new data was appended after a timeout of about 2 seconds. Read data from the given file descriptor (for example 123). This is similar to piping data to stdin via -, but can use an arbitrary file descriptor. mpv may modify some file descriptor properties when the stream layer "opens" it., you can extend the pseudo-gui profile in the config file the normal way. This is deprecated. In future mpv releases, the behavior might change, and not apply your additional settings, and/or use a different profile name. -.) none resets any previously set option (useful for libmpv). If both --end and --length are provided, playback will stop when it reaches either of the two endpoints. If --audio-pitch-correction (on by default) is used, playing with a speed higher than normal automatically inserts the scaletempo audio filter. See also: --start. The value no is a deprecated alias for auto.! Playlist can contain entries using other protocols, such as local files, or (most severely), special protocols like avdevice://, which are inherently unsafe. Default: yes NOTE: This option only works if the underlying media supports seeking (i.e. not with stdin, pipe, etc). both options are set to no or unset, looping is disabled. Otherwise, the start/end of playback is used if one of the options is set to no or unset.: Without --hr-seek, skipping will snap to keyframes. You can also pass a string to this option, which will list all top-level options which contain the string in the name, e.g. --h=scale for all options that contain the word scale. The special string * lists all top-level options. NOTE: Files explicitly requested by command line options, like --include or --use-filedir-conf, will still be loaded. See also: --config-dir. Note that the --no-config option takes precedence over this option. This behavior is disabled by default, but is always available when quitting the player with Shift+Q. --watch-later-directory=<path> The directory in which to store the "watch later" temporary files. The default is a subdirectory named "watch_later" underneath the config directory (usually ~/.config/mpv/). This option is useful for debugging only. once will only idle at start and let the player close once the first playlist has finished playing back.. WARNING: This option may expose privacy-sensitive information and is thus disabled by default. WARNING: May be dangerous if playing from untrusted media.. NOTE: See --vd=help for a full list of available decoders. The argument selects the drop methods, and can be one of the following: NOTE: --vo=vdpau has its own code for the vo framedrop mode. Slight differences to other VOs are possible. This does: Set this option only if you have reason to believe the automatically determined value is wrong. -copy selects only modes that copy the video data back to system memory after decoding. This selects modes like vaapi-copy (and so on). If none of these work, hardware decoding is disabled. This mode is always guaranteed to incur no additional loss compared to software decoding, and will allow CPU processing with video filters. The vaapi mode, if used with --vo=gpu, requires Mesa 11 and most likely works with Intel GPUs only. It also requires the opengl EGL backend. gpu vo is not being used or filters are required. nvdec is a newer implementation of CUVID/CUDA decoding, which uses the FFmpeg decoders for file parsing. Experimental, is known not to correctly check whether decoding is supported by the hardware at all. Deinterlacing is not supported. Since this uses FFmpeg's codec parsers, it is expected that this generally causes fewer issues than cuda. safe when used with the d3d11 backend. If used with angle is it usually safe, except that 10 bit input (HEVC main 10 profiles) will be rounded down to 8 bits, which will result in reduced quality. Also note that with very old ANGLE builds (without EGL_KHR_stream path,) all input will be converted to RGB. be safe, but it has been reported to corrupt the timestamps causing glitched, flashing frames on some files. It can also sometimes cause massive framedrops for unknown reasons. Caution is advised. opengl-c opengl-c. Some implementations might support multiple formats. In particular, videotoolbox is known to require uyvy422 for good performance on some older hardware. d3d11va can always use yuv420p, which uses an opaque format, with likely no advantages.. This option is disabled if the --no-keepaspect option is used. If video and screen aspect match perfectly, these options do nothing. This option is disabled if the --no-keepaspect option is used. NOTE: Works in --no-correct-pts mode only.: It is advisable to use your graphics driver's color range option instead, if available.: -ao alsa:device=dmix=default In mpv you could instead use: --audio-device=alsa/dmix:default list option. See List Options for details.. --softvol-max is a deprecated alias and should not be used.. NOTE: Changing styling and position does not work with all subtitles. Image-based subtitles (DVD, Bluray/PGS, DVB) cannot changed for fundamental reasons. Subtitles in ASS format are normally not changed intentionally, but overriding them can be controlled with --sub-ass-override.:. NOTE: This affects ASS subtitles as well, and may lead to incorrect subtitle rendering. Use with care, or use --sub-font-size instead.: This affects ASS subtitles as well, and may lead to incorrect subtitle rendering. Use with care, or use --sub-margin-y instead. --sub-speed=25/23.976 plays frame based subtitles which have been loaded assuming a framerate of 23.976 at 25 FPS. NOTE: Using this option may lead to incorrect subtitle rendering.: Using this option may lead to incorrect subtitle rendering.:.: <rate> > video fps speeds the subtitles up for frame-based subtitle files and slows them down for time-based ones. See also: --sub-speed. NOTE: Never applied to text subtitles. NOTE: Never applied to text subtitles. Assuming that /path/to/video/video.avi is played and --sub-file-paths=sub:subtitles is specified, mpv searches for subtitle files in these directories: This is a list option. See List Options for details. NOTE: The --sub-font option (and many other style related --sub- options) are ignored when ASS-subtitles are rendered, unless the --no-sub-ass option is specified. This used to support fontconfig patterns. Starting with libass 0.13.0, this stopped working. Default: 55. NOTE: ignored when --sub-back-color is specified (or more exactly: when that option is not set to completely transparent).. Properties are expanded. (See Property Expansion.) WARNING: There is a danger of this causing significant CPU usage, depending on the properties used. Changing the window title is often a slow operation, and if the title changes every frame, playback can be ruined.: This option is not respected when using --frames. Explicitly skipping to the next file if the binding uses force will terminate playback as well.:.: Generally only supported by GUI VOs. Ignored for encoding.: Generally only supported by GUI VOs. Ignored for encoding. For example, --window-scale=0.5 would show the window at half the video size. See also --monitorpixelaspect and --video-aspect.: You need write access to the DVD device to change the speed.. --demuxer-lavf-o=fflags=+ignidx. This can also specify a direct file descriptor with fd://N (UNIX only). In this case, JSON replies will be written if the FD is writable. NOTE: When the given file is a FIFO mpv opens both ends, so you can do several echo "seek 10" > mp_pipe and the pipe will stay valid.: ignored when --osd-back-color is specified (or more exactly: when that option is not set to completely transparent).: This is a simple way for getting unique per-frame timestamps. (Frame numbers would be more intuitive, but are not easily implementable because container formats usually use time stamps for identifying frames.). This controls the default options of any resampling done by mpv (but not within libavfilter, within the system audio API resampler, or any other places).: Some messages are printed before the command line is parsed and are therefore not affected by --msg-level. To control these messages, you have to use the MPV_VERBOSE environment variable; see ENVIRONMENT VARIABLES for details.. See also: --tv-normid. NOTE:. NOTE: The channel number will then be the position in the 'channels' list, beginning with 1. tv://1, tv://TV1, tv_set_channel 1, tv_set_channel TV1. There are two ways of using this:. If you want to use a file cache, this mode is recommended, because it doesn't break ordered chapters or --audio-file. These modes open multiple cache streams, and using the same file for them obviously clashes. See also: --cache-file-size. Keep in mind that some use-cases, like playing ordered chapters with cache enabled, will actually create multiple cache files, each of which will use up to this much disk space. (Default: 1048576, 1 GB.). mpv --http-header-fields='Field1: value1','Field2: value2' \ Will generate HTTP request: GET / HTTP/1.0 Host: localhost:1234 User-Agent: MPlayer Icy-MetaData: 1 Field1: value1 Field2: value2 Connection: close WARNING: This breaks the RTSP protocol, because of inconsistent FFmpeg API regarding its internal timeout option. Not only does the RTSP timeout option accept different units (seconds instead of microseconds, causing mpv to pass it huge values), it will also overflow FFmpeg internal calculations. The worst is that merely setting the option will put RTSP into listening mode, which breaks any client uses. Do not use this option with RTSP URLs. Additionally, if the option is a number, the stream with the highest rate equal or below the option value is selected. The bitrate as used is sent by the server, and there's no guarantee it's actually meaningful. Default: no Both options control the buffer size. A low buffer size can lead to higher CPU usage and audio dropouts, while a high buffer size can lead to higher latency in volume changes and other filtering. The following video options are currently all specific to --vo=gpu and --vo=opengl-cb only, which are the only VOs that implement them. requires setting the --video-sync option to one of the display- modes, or it will be silently disabled. This was not required before mpv 0.14.0. --display-fps). Currently only relevant for --gpu-api=d3d11.:. By default, the chosen peak defaults to an appropriate value based on the TRC in use. For SDR curves, it defaults to 100. For HDR curves, it defaults to 100 * the transfer function's nominal peak. NOTE: When using an SDR transfer function, this is normally not needed, and setting it may lead to very unexpected results. The one time it is useful is if you want to calibrate a HDR display using traditional transfer functions and calibration equipment. In such cases, you can set your HDR display to a high brightness such as 800 cd/m^2, and then calibrate it to a standard curve like gamma2.8. Setting this value to 800 would then instruct mpv to essentially treat it as an HDR display with the given peak. This may be a good alternative in environments where PQ or HLG input to the display is not possible, and makes it possible to use HDR displays with mpv regardless of operating system support for HDMI HDR metadata. In such a configuration, we highly recommend setting --tone-mapping to mobius or even clip. The default of 0.5 provides a good balance. This value is weaker than the ACES ODT curves' recommendation, but works better for most content in practice. A setting of 0.0 disables this option.:.). If the sync code detects severe A/V desync, or the framerate cannot be detected, the player automatically reverts to audio mode for some time or permanently.. Possible values of <prio>: idle|belownormal|normal|abovenormal|high|realtime WARNING: Using realtime priority can cause system lockup. Unlike --sub-files and --audio-files, this includes all tracks, and does not cause default stream selection over the "proper" file. This makes it slightly less intrusive. (In mpv 0.28.0 and before, this was not quite strictly enforced.) This is a... Audio output drivers are interfaces to different audio output facilities. The syntax is:: See ALSA audio output options for options specific to this AO. WARNING: To get multichannel/surround audio, use --audio-channels=auto. The default for this option is auto-safe, which makes this audio output explicitly reject multichannel output, as there is no way to detect whether a certain channel layout is actually supported.: This driver is for compatibility with extremely foreign environments, such as systems where none of the other drivers are available. The following global options are supported by this audio output: The following global options are supported by this audio output: The following global options are supported by this audio output: NOTE: Completely useless, unless you intend to run RSound. Not to be confused with RoarAudio, which is something completely different. NOTE: Experimental. There are known bugs and issues. (Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel layouts.) Video output drivers are interfaces to different video output facilities. The syntax is: If the list has a trailing ,, mpv will fall back on drivers not contained in the list. NOTE:). Available video output drivers are: NOTE: This driver is for compatibility with old systems. The following global options are supported by this video output: NOTE: This is a fallback only, and should not be normally used..: This driver is for compatibility with systems that don't provide proper graphics drivers, or which support GLES only. The following global options are supported by this video output: NOTE: This driver is for compatibility with crappy systems. You can use vaapi hardware decoding with --vo=gpu too.: This driver is a joke.: The following global options are supported by this video output: Unless you have an intel graphics card, a recent kernel and a recent version of mesa (>=18) xrgb2101010 is unlikely to work for you. This currently only has an effect when used together with the drm backend for the gpu VO. The drm VO always uses xrgb8888.. Audio filters allow you to modify the audio stream and its properties. The syntax is: NOTE: To get a full list of available audio filters, see --af=help.: WARNING: Deprecated. Either use the --audio-resample-... options to customize resampling, or the libavfilter --af=aresample filter, which has its own options. It supports only the following sample formats: u8, s16, s32, float.: Loses sync with video.: Don't forget to quote libavfilter graphs as described in the lavfi video filter section. Video filters allow you to modify the video stream and its properties. All of the information described in this section applies to audio filters as well (generally using the prefix --af instead of --vf).: ["@"<label-name>":"] ["!"] <filter-name> [ "=" <filter-parameter-list> ] or for the special "toggle" syntax (see vf command): "@"<label-name> and the filter-parameter-list: <filter-parameter> | <filter-parameter> "," <filter-parameter-list> and filter-parameter: ( <param-name> "=" <param-value> ) | <param-value>: To get a full list of available video filters, see --vf=help and .: NOTE: For a list of available formats, see format=fmt=help.:.) See;a=blob;f=libswscale/swscale.h.. import vapoursynth as vs core = vs.get_core() core.std.AddBorders(video_in, 10, 10, 20, 20).set_output() WARNING: The script will be reloaded on every seek. This is done to reset the filter properly on discontinuities..) By default, this uses the special value auto, which sets the option to the number of detected logical CPU cores. The following variables are defined by mpv: Useful for some filters which insist on having a FPS.. Note that there's currently a mechanism that allows the vdpau VO to change the deint-mode of auto-inserted vdpaupp filters. To avoid confusion, it's recommended not to use the --vo=vdpau suboptions related to filtering. You can encode files from one format/codec to another using this facility. Options are managed in lists. There are a few commands to manage the options list. Options are managed in lists. There are a few commands to manage the options list. Options are managed in lists. There are a few commands to manage the options list. The mpv core can be controlled with commands and properties. A number of ways to interact with the player use them: key bindings (input.conf), OSD (showing information with properties), JSON IPC, the client API (libmpv), and the classic slave mode. The input.conf file consists of a list of key bindings, for example: mpv --input-keylist.) [Shift+][Ctrl+][Alt+][Meta+]<key> [{<section>}] [<prefixes>] <command> (<argument>)* [; <command>]. Arguments are separated by whitespace. This applies even to string arguments. For this reason, string arguments should be quoted with ". Inside quotes, C-style escaping can be used.. The second argument consists of flags controlling the seek mode: Multiple flags can be combined, e.g.: absolute+keyframes. By default, keyframes is used for relative seeks, and.. The second argument is like the first argument to screenshot. If the file already exists, it's overwritten. Like all input command parameters, the filename is subject to property expansion as described in Property Expansion. The async flag has an effect on this command (see screenshot command)...). Second argument: Third argument: The mode argument is one of the following:. The special argument !reverse can be used to cycle the value list in reverse. The only advantage is that you don't need to reverse the value list yourself when adding a second key binding for cycling backwards.:. key state consists of 2 letters:. Undocumented commands: tv-last-channel (TV/DVB only), ao-reload (experimental/internal)... WARNING: The legacy API is deprecated and will be removed soon.. These prefixes are placed between key name and the actual command. Multiple prefixes can be specified. They are separated by whitespace. All of the osd prefixes are still overridden by the global --osd-level settings. Input sections group a set of bindings, and enable or disable them at once. In input.conf, each key binding is assigned to an input section, rather than actually having explicit text sections. See also: enable-section and disable-section commands. Predefined bindings: Properties are used to set mpv options during runtime, or to query arbitrary information. They can be manipulated with the set/add/cycle commands, and retrieved with show-text, or anything else that uses property expansion. (See Property Expansion.). NOTE: Most options can be set as runtime via properties as well. Just remove the leading -- from the option name. These are not documented. Only properties which do not exist as option with the same name, or which have very different behavior from the options are documented below. OSD formatting will display it in the form of +1.23456%, with the number being (raw - 1) * 100 for the given raw property value. This has a sub-property: NOTE: This is only an estimate. (It's computed from two unreliable quantities: fps and stream length.) NOTE: This is only an estimate. (It's computed from two unreliable quantities: fps and possibly rounded timestamps.) Otherwise, if the media type is DVD, return the volume ID of DVD. Otherwise, return the filename property. (Renamed from demuxer.) This replaces the length property, which was deprecated after the mpv 0.9 release. (The semantics are the same.) drop-frame-count is a deprecated alias. vo-drop-frame-count is a deprecated alias. "length" MPV_FORMAT.).. fw-bytes is the number of bytes of packets buffered in the range starting from the current decoding position. "fw.) If video is active, this reports the effective aspect value, instead of the value of the --video-aspect option.. You can access (almost) all options as properties, though there are some caveats with some properties (due to historical reasons): Option changes at runtime are affected by this as well. Option changes at runtime are affected by this as well. Strictly speaking, option access via API (e.g. mpv_set_option_string()) has the same problem, and it's only a difference between CLI/API..) Within input.conf, property expansion can be inhibited by putting the raw prefix in front of commands. The following expansions are supported: In places where property expansion is allowed, C-style escapes are often accepted as well. Example:. By default, the OSC will show up whenever the mouse is moved inside the player window and will hide if the mouse is not moved outside the OSC for 0.5 seconds or if the mouse leaves the window. +---------+----------+------------------------------------------+----------+ | These key bindings are active by default if nothing else is already bound to these keys. In case of collision, the function needs to be bound to a different key. See the Script Commands section. The OSC offers limited configuration through a config file script-opts/osc.conf placed in mpv's user dir and through the --script-opts command-line option. Options provided through the command-line will override those from the config file. The config file must exactly follow the following syntax: # this is a comment optionA=value1 optionB=value2 # can only be used at the beginning of a line and there may be no spaces around the = or anywhere else. To avoid collisions with other scripts, all options need to be prefixed with osc-. Example: --script-opts=osc-optionA=value1,osc-optionB=value2 The layout for the OSC. Currently available are: box, slimbox, bottombar and topbar. Default pre-0.21.0 was 'box'. Sets the style of the seekbar, slider (diamond marker), knob (circle marker with guide), or bar (fill). Default pre-0.21.0 was 'slider'. Display seekable ranges on the seekbar. The OSC script listens to certain script commands. These commands can bound in input.conf, or sent by other scripts. Example You could put this into input.conf to hide the OSC with the a key and to set auto mode (the default) with b: a script-message osc-visibility never b script-message osc-visibility auto This builtin script displays information and statistics for the currently played file. It is enabled by default if mpv was compiled with Lua support. It can be disabled entirely using the --load-stats-overlay=no option. The following key bindings are active by default unless something else is already bound to them: While the stats are visible on screen the following key bindings are active, regardless of existing bindings. They allow you to switch between pages of stats: For optimal visual experience, a font with support for many font weights and monospaced digits is recommended. By default, the open source font Source Sans Pro is used. This script can be customized through a config file script-opts/stats.conf placed in mpv's user directory and through the --script-opts command-line option. The configuration syntax is described in ON SCREEN CONTROLLER.). A different key binding can be defined with the aforementioned options key_oneshot and key_toggle but also with commands in input.conf, for example: e script-binding stats/display-stats E script-binding stats/display-stats-toggle Using input.conf, it is also possible to directly display a certain page: i script-binding stats/display-page-1 e script-binding stats/display-page-2.. A script which leaves fullscreen mode when the player is paused: function on_pause_change(name, value) if value == true then mp.set_property("fullscreen", "no") end end mp.observe_property("pause", "bool", on_pause_change).. The mp module is preloaded, although it can be loaded manually with require 'mp'. It provides the core client API.). Returns a result table on success (usually empty), or def, error on error. def is the second parameter provided to the function, and is nil if it's missing..). method,. These also live in the mp module, but are documented separately as they are useful only in special situations.. This module allows outputting messages to the terminal, and can be loaded with require 'mp.msg'. The parameters after that are all converted to strings. Spaces are inserted to separate multiple parameters. You don't need to add newlines.). The identifier is used to identify the config-file and the command-line options. These needs to unique to avoid collisions with other scripts. Defaults to mp.get_script_name(). This built-in module provides generic helper functions for Lua, and have strictly speaking nothing to do with mpv or video/audio playback. They are provided for convenience. Most compensate for Lua's scarce standard library.. The parameter t is a table. The function reads the following entries: The function returns a table as result with the following entries: On Windows, killed is only returned when the process has been killed by mpv as a result of cancellable being set to true. The parameter t is a table. The function reads the following entries: The function returns nil.. Events are notifications from player core to scripts. You can register an event handler with mp.register_event.. This documents experimental features, or features that are "too special" to guarantee a stable interface. See Hooks for currently existing hooks and what they do - only the hook list is interesting; handling hook execution is done by the Lua script function automatically. JavaScript support in mpv is near identical to its Lua support. Use this section as reference on differences and availability of APIs, but otherwise you should refer to the Lua documentation for API details and general scripting in mpv. JavaScript code which leaves fullscreen mode when the player is paused: function on_pause_change(name, value) { if (value == true) mp.set_property("fullscreen", "no"); } mp.observe_property("pause", "bool", on_pause_change); mpv tries to load a script file as JavaScript if it has a .js extension, but otherwise, the documented Lua options, script directories, loading, etc apply to JavaScript files too.. No need to load modules. mp, mp.utils, mp.msg and mp.options are preloaded, and you can use e.g. var cwd = mp.utils.getcwd(); without prior setup.. The scripting backend which mpv currently uses is MuJS - a compatible minimal ES5 interpreter. As such, String.substring is implemented for instance, while the common but non-standard String.substr is not. Please consult the MuJS pages on language features and platform support - . mp.add_timeout(seconds, fn) JS: id = setTimeout(fn, ms). )]) (types: string/boolean/number) Note: read_file and write_file throw on errors, allow text content only. The standard HTML/node.js timers are available:.. searched at scripts/modules.js/ in mpv config dirs - in normal config search order. E.g. require("x") is searched as file x.js at those dirs, and id foo/x is searched as file foo/x.js.. The event loop poll/dispatch mpv events as long as the queue is not empty, then processes the timers, then waits for the next event, and repeats this forever... You can use the socat tool to send commands (and receive replies) from the shell. Assuming mpv was started with:.).. For example, this request: { "command": ["get_property", "time-pos"], "request_id": 100 } Would generate this response: { "error": "success", "data": 1.468135, "request_id":. In addition to the commands described in List of Input Commands, a few extra commands can also be used as part of the protocol: Example: { "command": ["get_property", "volume"] } { "data": 50.0, "error": "success" } Example: { "command": ["get_property_string", "volume"] } { "data": "50.000000", "error": "success" } Example: { "command": ["set_property", "pause", true] } { "error": "success" }. There is no real changelog, but you can look at the following things: are put into the mpv scripts directory in its config directory (see the FILES section for details). They must have a .so file extension. They can also be explicitly loaded with the --script option. A C plugin must export the following function:. The current implementation requires that your plugins are not linked against libmpv. What your plugins uses are not symbols from a libmpv binary, but symbols from the mpv host binary. See: There are a number of environment variables that can be used to control the behavior of mpv. $HOME/.mpv is always added to the list of config search paths with a lower priority. Notable environment variables: Normally mpv returns 0 as exit code after finishing playback successfully. If errors happen, the following exit codes can be returned: Note that quitting the player manually will always lead to exit code 0, overriding the exit code that would be returned normally. Also, the quit input command can take an exit code: in this case, that exit code is returned. For Windows-specifics, see FILES ON WINDOWS section...
https://man.linuxreviews.org/man1/mpv.1.html
CC-MAIN-2020-29
refinedweb
5,261
58.99
FACTORY AUTOMATION. MANUAL MTT3000-F180-B12-V45-MON System MT Transcription 1 FACTORY AUTOMATION MANUAL MTT3000-F180-B12-V45-MON System MT 2 With regard to the supply of products, the current issue of the following document is applicable: The General Terms of Delivery for Products and Services of the Electrical Industry, published by the Central Association of the Electrical Industry (Zentralverband Elektrotechnik und Elektroindustrie (ZVEI) e.v.) in its most recent version as well as the supplementary clause: "Expanded reservation of proprietorship" 3 1 Introduction Declaration of conformity Declaration of Conformity Safety Symbols relevant to safety General notes on safety Product description General Information about the System ID-Tags MTM-C MTO-C MTM-C MTO-C Read Range Write Range(The MTT3000-F180-B12-V45-MON can't write!) Communication Operating modes Tag reading Tag writing(the MTT3000-F180-B12-V45-MON can't write!) Tag life Security Reader Overview Functional Block Diagram Hardware Controller Board RF-block System Software Operating System TAGP Client Application Software P+F_MONITOR WiseMan 4 4.8 Interfaces Service Interfaces Serial Communication Interfaces Ethernet USB Host Micro SD memory Card Inputs and Outputs Indicators Features Web Server Frequency Hopping Realtime Clock Watchdog Timer Writing ID-tags Spectrum Scan Environmental Considerations Environmental Specification Installation Storage and transport Unpacking Preconditions Tools Cables Mounting the Reader 5 5.5 Cable Connections Interface isolation and protection Relay Output, Group J Wiegand/Magstripe, Group J Power Supply, Group J External Tamper Switch, Group J RS485 Serial Communication Interface, Group J RS232 Serial Communication Interface, Group J Service Interface, Group J Isolated Inputs, Group J Isolated Outputs, Group J Ethernet, Connector P USB Host, Connector P Micro SD Memory Card Interface, Socket P Installation Test Inspection Verification Configuration and Commissioning Connecting the Reader to a PC Serial RS 232 Connection Direct Ethernet Connection Network Connection Web Interface Information Settings Web Tools Reboot Usefull Software Tools Configuration of the software 'P+F_MONITOR' Configuration of the reader Configuration string options Data Format for each Mode Operation Application Firmware P+F_MONITOR 6 7.2 Tag data format Memory length options Format options Read speed and battery life Writing Data Writing Mini Memory Tags Writing Quarter/Full Memory Tags Ports Boot-up string Inputs and Outputs Setting the IP address Reading the IP Address Maintenance Trouble Shooting Appendix Technical Data Glossary Legend of the P+F_MONITOR commands Channel/Frequency Mapping (TAGD Settings) Fixed Frequency Channels used by P+F_MONITOR software Frequency Hopping Sub-bands ASCII table 7 Introduction 1 Introduction Congratulations You have chosen a device manufactured by Pepperl+Fuchs. Pepperl+Fuchs develops, produces and distributes electronic sensors and interface modules for the market of automation technology on a worldwide scale. Before installing this equipment and put into operation, read this manual carefully. This manual containes instructions and notes to help you through the installation and commissioning step by step. This makes sure bring such a trouble-free use of this product. This is for your benefit, since this: ensures the safe operation of the device helps you to exploit the full functionality of the device avoids errors and related malfunctions avoids costs by disruptions and any repairs increases the effectiveness and efficiency of your plant Keep this manual at hand for subsequent operations on the device. After opening the packaging please check the integrity of the device and the number of pieces of supplied. Symbols used The following symbols are used in this manual: Note! This symbol draws your attention to important information. Handling instructions You will find handling instructions beside this symbol Contact If you have any questions about the device, its functions, or accessories, please contact us at: Pepperl+Fuchs GmbH Lilienthalstraße Mannheim Telephone: Fax: 8 Declaration of conformity 2 Declaration of conformity 2.1 Declaration of Conformity All products have been developed and manufactured taking into consideration applicable European standards and regulations. Note! A Declaration of Conformity can be requested from the manufacturer. The manufacturer of this product, Pepperl+Fuchs GmbH in Mannheim, Germany, has a certified quality assurance system in conformity with ISO ISO9001 8 9 Safety 3 Safety 3.1 Symbols relevant to safety Danger! This symbol indicates a warning about a possible danger. In the event the warning is ignored, the consequences may range from personal injury to death. Warning! This symbol indicates a warning about a possible fault or danger. In the event the warning is ignored, the consequences may course personal injury or heaviest property damage. Caution! This symbol warns of a possible fault. Failure to observe the instructions given in this warning may result in the devices and any connected facilities or systems develop a fault or fail completely. 3.2 General notes on safety Only instructed specialist staff may operate the device in accordance with the operating manual. Independent interventions and separate modifications are dangerous and will void the warranty and exclude the manufacturer from any liability. If serious faults occur, stop using the device. Secure the device against inadvertent operation. In the event of repairs, send the device to Pepperl+Fuchs. The connection of the device and maintenance work when live may only be carried out by a qualified electrical specialist. The operating company bears responsibility for observing locally applicable safety regulations. Store the not used device in the original packaging. This offers the device optimal protection against impact and moisture. Ensure that the ambient conditions comply with regulations. Note! Disposal Electronic waste is hazardous waste. When disposing of the equipment, observe the current statutory requirements in the respective country of use, as well as local regulations. 9 10 Product description 4 Product description 4.1 General Information about the System 4.2 ID-Tags This chapter gives you an overview over the whole Ident-M System T. It illustrates the identification system with its components in general and the readers in particular. Environmental considerations as well as technical data are also described. An ID-tag is a battery-assisted passive 2.45 GHz RFID tag. It carries ID information that can be read at a long distance using radio frequencies. The actual reading range depends on reader type, ID-tag type, reader configuration settings and environmental conditions. Every ID-tag has a unique and permanent identification number called ID-tag fixcode. Many ID-tags can be read concurrently. A lithium cell is used in the ID-tag to preserve stored data, and get a high communication speed. There are two general types of ID-tags called MTM-Tags and MTO- Tags. MTM s can both be read from and written to, while MTO`s only can be read. The data stored in a MTO-tag includes the ID-tag fixcode. The data stored in a MTM-tag includes the IDtag fixcode and a writable data field called ID-tag user data. The data in an ID-tag includes a 32-bit checksum for automatic verification. The reader does not report ID-tag readings containing invalid checksums. Only valid ID-tag data is reported in order to increase the system and application software security. The system MT reader is capable of communicating with all Pepperl+Fuchs ID-tag formats, which include the following formats: Read only Read and write High or low data speed Random and constant mode ID-tags with mini-, quarter-, or full-memory data sizes Figure 4.1: R/W-tag, heavy duty & standard 10 11 Product description Figure 4.2: Read only tag, heavy duty & standard MTM-C1 The front side of the ID-tags must be oriented towards the front side of the reader. For maximum communication range, the front surface of the ID-tag should be parallel with the front side of the reader. If the ID-tag is misaligned relative to the front side of the reader, the communication range is reduced. This programmable credit card ID-tag can be used for many different applications in access and logistics. The ID-tag has some user memory and several format and mode options. The user memory can store up to 606 bits, corresponding to 71 8-bit ASCII characters and a 32 bit data checksum. Each tag is also permanently programmed with an 8 digit decimal mark. Every "mark" is unique and can only appear on one single tag. The patented programmed tag checksum eliminates any mark and user memory reading errors even if the tag is far away or if several tags are present in the same reading zone. The tag can be formatted for several different operating modes by the reader. The programming options include memory size, response interval, response type (random or constant interval) and data speed. A status register for formatting and battery level monitoring is included. A backup memory holds the old data, to be read at any time, also in case the write process failed. The tag can be mounted on metal without affecting any read range properties. A lithium energy cell gives a long predictable life independent from the number of times the tag is read. If the capacity is about to run out after several years of operating life, a status bit is set to give the user a warning via the reader. When the status bit is set, the tag will continue to function for about six months. The design is vibration resistant, watertight, corrosion free, UV stable and withstands most chemicals. The front panel is made from a polymer that can be printed according to user requirements. The back panel is equipped with the part number and a serial number. The C1 tags can be fitted by using a standard credit card holder or one of the holders provided by Pepperl+Fuchs. For windshield attachment e.g. we recommend the MTA-C1V2 with an adhesive tape. For permanent attachment by screws or by clip the MTA-C1V1 can be used. 11 12 Product description Figure 4.3: MTA-C1V2 Figure 4.4: MTA-C1V1 For special tagholders, like rubber units with suction cup attachment, ask Pepperl+Fuchs for possible solutions. Figure 4.5: MTA-C2V3 12 13 Product description MTO-C1 This versatile credit card ID-tag can be used for many different applications in access and logistics. The front- and backsides are available for custom prints. The ID-tag is read-only and permanently programmed with an 8 digit decimal fixcode Mark. Every fixcode is unique and can only appear on one single tag. The programmed code includes a 32 bit checksum for automatic mark validation. The patented preprogrammed tag checksum eliminates any Mark reading errors even if the tag is far away or if several tags are present in the same reading zone MTM-C2(The MTT can read these tags but can't write them) MTO-C2 The MTM-C2 comes in a robust housing for heavy duty and industrial use. It is specially designed for tough environments and high temperatures. Typical applications are indoors in heavy industry like skids and car bodies or outdoors mounted on sea containers, trains, trams, buses, trucks and lorries. It can be mounted on any surface with M4 screws. It communicates via the 2,45 GHz frequency and stores 606 bits, including a 32 bit checksum, e g as 71 8-bit ASCII characters. A factory coded 8 decimal digit "mark" and a separate 32 bit checksum give the tag a unique and substitution safe identity. The tag can be formatted into different operating modes regarding memory size, response interval/type and data speed. A status register for memory and lithium cell monitoring is included. If the MTM-C2 exits the write zone during programming, a "failed write" bit is set to warn the user. The old data is restored from a backup memory. Environmentally harmless lithium cell powering gives long reading range, high reading speed and multitag possibility. The cell life depends on the mode the tag has been formatted, but is independent from how often it is read. The cell life is not influenced from exposure to electrically noisy environments. When the capacity is about to run out, the status register warns via a "battery low" bit. The design is vibration resistant, watertight, corrosion free, UV stable and withstands chemicals. The front side can be printed according to user requirements. The rear side label is printed with type code and serial number. The MTO-C2 is the fixcode version like MTO-C1, but with the same industrial housing as the MTM-C Read Range An MTM-.. tag receives its signals through the front panel. The tag can not be read or programmed towards the backside. The read range is defined by a number of factors such as the position the reader and the tag. The read range also depends on the reader model and settings as well as the environment. The tag can be read using any rotational angle as long as the front side is turned towards the reader. The ID-tag will be read at any distance from the reader up to the maximum read distance. The read range shown in the identification lobe diagrams below indicates the typical read range for near 100% reading probability in an ideal environment with maximum read level: 13 14 Product description If the tag is tilted 45 vs. the reader the read range will be transformed according to the diagram below: The lobe is unaffected if the tag is mounted on a metal surface. Non metallic materials in front of the tag usually have little effect on the read range lobe. The diagrams show the typical MTM- C1 read range properties for an average of all available frequency channels in an ideal environment. Any excess read range can easily be reduced by setting the readers read level. If the read level function is used, very accurate identification lobes can be defined. The difference between the firm and the maximum read range can be minimized Write Range(The MTT3000-F180-B12-V45-MON can't write!) A detection circuit forwards programming signals from the reader to the tag memory. Using the MTT6000-F120-B12-V45 with an emitted power of 10mW EIRP, the write range is typically 0.25 meters. The tag can be programmed at all distances up to the maximum write range. 14 15 Product description Communication The ID-tag will supply the tag information to any interrogating reader set to any frequency (channel) within the frequency band. If different readers are set to different channels and simultaneously illuminate the tag, the tag will be safely read by all of these raeders without interference. The tag generates ID frames with either constant or random intervals. The time for two subsequent ID frames with an interval in between is called a "message time". When the MTM-C1 is set to random interval mode, it is possible to read several tags at the same time as shown in the picture below: When collisions occur, the checksum algorithm in the reader will cancel any faulty ID mark readings. In the example above however, the ID tag 1 will be correctly identified, since the tag is closer to the reader. In a worst case situation, e.g. if all tags would be remote and close to the read range limit or subject to strong interference, the likelihood for a reading error (wrong interpretation) is less than one in 5.E+9 ( ) readings, thanks to the 32 bit CRC checksum. In all practical cases the reader will always provide the correct information. The MTM-.. tags can be programmed for different interval lengths modes : 0, 4, 8 or 16. (i.e., the multiple of the ID frame time length minus 1.) During the interval the tag is silent which allows other tags to talk. When set to random interval mode the "interval length setting is the average number of intervals that will appear. The actual interval can be anything between 0 and twice the interval length setting. The fixcode tags MTO-C1 and MTO-C2 are preset to a random interval length of 8, high speed. This setting can not be altered. An interval plus leading and trailing ID-frames is called a "message time". The message time, i.e. the longest time required for a complete ID-frame to be read, is always less than 150 ms. The average time is 80 ms which means that the a tag is read 12 times every second. Tags in zone Average [ms] Comfort 99% [ms] Safe 99,9% [ms] 16 Product description The time required to read several tags in random mode depends on the number of tags present in the read lobe at the same time. The following table applies for a tag formatted to MR4H, i.e., Mini memory, Random interval 4 and High speed. (see chapter for detailed definitions) Operating modes The tag can be set to different operating modes by write commands. Parameters affected are memory size, interval type, interval length and data speed. Memory modes Mini Quarter Full 14bit user data ( 1 ASCII) + 32b CRC 154bit user data (19 ASCII) + 32b CRC 574bit user data (71 ASCII) + 32b CRC Interval type modes Constant Random i.e. interval is constant between ID frames i.e. interval is varying randomly Interval length modes 0 zero: continuous 4 short: 4 times the ID frame time 8 medium: 8 times the ID frame time 16 long: 16 times the ID frame time Data speed modes L H low: reading 4 kbps, writing 4 kbps high: reading 16 kbps, writing 4 kbps Possible modes are: MC0L, MR4H, FC0H etc. Modes are feasible in all combinations Tag reading The table shows the maximum message time, i.e. the total time for two ID frames and an interval. Message time vs. data speed High speed Mini memory [ms] Low speed [ms] MC0-H/L MC4-H/L MC8-H/L MC16-H/L 17 Product description Tag writing(the MTT3000-F180-B12-V45-MON can't write!) The write time depends on the tag operating mode and a statistical time distribution. The tables below lists the time it takes to program the tag for different modes. Some fields are left blank to indicate that the mode is too slow and is therefor not recommended. The 99% column represents 99 times out of 100 success. High speed Average [ms] 99% [ms] % [ms] Mini memory: MC0H MC4H MC8H MR4H Quarter memory: QC0H QC4H QC8H QR4H Full memory: FC0H FC4H FC8H 1700 FR4H 1300 Low speed Average [ms] 99% [ms] % [ms] Mini memory: MC0L MC4L MC8L MR4L Quarter memory: QC0L QC4L QC8L 2400 QR4L 1800 Full memory: FC0L FC4L 18 Product description Tag life A backup function is provided for the case that the tag is taken of of the write zone by accident while it receives data from the reader. The old data is automatically restored from the tag backup memory and a "failed write" flag is set in the status register to give automatic warning to the user system. The lithium cell is specified for high and low temperature operation, e.g. the tag is installed in a car window. The operating temperature is the key to predict the operating life of the tag. The interval length also affects the power consumption and battery life since the tag consumes less power when it is inactive. The theoretical battery life performance for different constant temperatures and different interval lengths can be found in the diagram below. The diagram does not represent the tag life in terms of average temperatures. Note that batteries are not specified beyond 10 years operation. Figure 4.6: Calculated battery live time MTO-C1 18 19 Product description Figure 4.7: Calculated battery live time MTO-C2 Figure 4.8: Calculated battery live time MTM-C1 & MTM-C2, depending on interval setting Security For security reasons, the serial number which is printed on the tag has no relation to the 8 digit decimal electronic mark stored in the memory of the tag. Both are running numbers that are never repeated. The mark is unique and is set at the semiconductor manufacturing level and can not be changed. The serial number and mark information is only supplied to the specific customer. 19 20 Product description 4.3 Reader Overview The 2.45 GHz frequency band can be used in most countries at low output power level without any specific site licence. This enables easy installation in a wide range of applications all over the world. The reader can be connected to a host computer using the standard serial communication interfaces RS232 and RS485. The reader can also be connected through ethernet via a TCP/IP communication. The TCP/IP network functionality of the reader enables remote operation and maintenance. The reader can also be operated completely stand-alone using the built in database that stores the approved ID-tag identities. Events registered by the reader are time stamped using a battery-backed real time clock. A temporarily connected PC is used to configure the settings of the reader. The configuration is performed using either a standard webbrowser or terminal emulation software, depending on the chosen reader application software. In this type of configuration the reader can handle input signals from any sensor like mechanical switch, proximity switch, ultrasonic or optical sensor. For more information about our sensor products please contact Pepperl+Fuchs. The system MT reader is a device for reading ID-tags using 2.45 GHz frequencies. In addition to reading, it also has the capability to write information to MTM-tags. The reader has built in antennas for communication with ID-tags as well as various serial interfaces for communication with a host computer. It is designed for configuration with a wide range of input and output devices, including relays, isolated I/O, indicators, and a buzzer. The reader is using the 2.45 GHz radio frequency. The usable frequency band includes 93 frequency channels. To reduce the risk of interference, several readers in close proximity to each other are set to different frequency channels. Readers can use frequency hopping when one specific frequency is not determined. The reader has several communication alternatives and is easily integrated using the following communication interfaces: Ethernet RS232 RS485 USB host Wiegand/Mag-stripe Micro SD memory card Note! The current reader application software does not support the use of all these interfaces. Any of these interfaces can be implemented in a customer-tailored application software. Please contact Pepperl+Fuchs for further information. The reader is powered with a voltage ranging from +10 to +30 Volt DC. 20 21 Product description Figure 4.9: Overview of the Reader 1. Lid 2. Controller board 3. RF-unit 4. Externally-visible indicators 5. Tamper switches 6. Red system status indicator 7. Green system status indicator 8. Yellow system status indicator 9. TX-unit 10. Enclosure base 11. Chassis 12. Knock-out for cable entry 13. Terminal blocks 14. Ground screw 15. Ethernet connector with link state and activity indicators 16. Micro SD slot 17. USB host connector (intended for internal expansion) 18. Pressure balance membrane 21 22 Product description 4.4 Functional Block Diagram The picture below shows a functional block diagram of a Pepperl+Fuchs system MT reader. Figure 4.10: Functional block diagram of the Pepperl+Fuchs system MT reader The reader can be divided into three major blocks: Hardware The reader hardware consists of a controller board with general interfaces and an RF board with antennas. For the hardware: see chapter 4.5. For the interfaces: see chapter 4.8 System Software The reader s system software includes an operating system and a set of device drivers, libraries and applications. A TCP server implements a protocol called TAGP. This protocol is used by reader-hosted or remote applications to control all RFID functionality of the reader. A TAGP client provides TCP client functionality. General services include a web interface and a terminal interface. The system software is described in detail later. Application Software 4.5 Hardware Application software is optional software that adds application specific functionality to the reader. Customer tailored software can be realised, adapted to special needs for certain applications. Please contact Pepperl+Fuchs for further information. On a general level, the reader hardware consists of two physical building blocks, which are the RF-block and the controller board. 22 23 Product description Figure 4.11: Hardware architecture overview The RF-block and controller board subsequently consist of several other blocks. The building blocks constitute the reader platform on which different reader products are based. Each building block is described in the subsections below Controller Board The controller board is the main component of the reader. The controler board controls the behaviour of the reader. It is conceptually divided into a microcontroller block, a signal processing block and an interface block. Microcontroller Block The microcontroller block is built around a microcontroller unit (MCU) from Atmel, the AT91RM9200 MCU with an ARM9 CPU core. The microcontroller block has flash memory, SDRAM memory, and a realtime clock with battery backup. 23 24 Product description Memory Size Description RAM 32 MB Volatile memory Flash memory 16 MB Holds all software. Is accessed via the journaling flash file system version 2 (JFFS2) Table 4.1: Controller board memory Signal Processing Block The signal processing block on the controller board receives radio signals from the RF-board. The signal processing block performs analogue filtering and analogue to digital conversion. The digitally converted signal is fed to a field programmable gate array (FPGA), which filters the signal digitally and decodes the ID-tag data. Interface Block RF-block External devices can be connected via several standard communication interfaces to the interface block on the controller board. System MT readers are also provided with two USB host interfaces and an SD memory card slot. These Interfaces make it possible to add additional hardware and storage media. These options can be used in a customer tailored application firmware. For more information please contact Pepperl+Fuchs. The RF-block is the radio interface. It is primarily used for communication with ID tags. The RFblock consists of an RF-board with an RX-antenna and a TX-antenna. The RF-block is controlled by software (i.e. frequency, attenuation, amplification, output power). This is sometimes referred to as software defined radio (SDR). A reader can be set to a radio frequency within the operating frequency band. Two readers set to different frequencies will not interfere, even if installed in close proximity of each other. It is recommended to use a frequency separation of at least 500 khz between two adjacent readers. Reader models prior to system MT use a frequency channel allocation scheme that divides the frequency band into distinct channels separated by 300 khz. System MT based readers are backwards compatible with the previous channel frequency allocation scheme to facilitate integration with installations of older revision readers. See section 6.5 for information about the channel/frequency mapping. Frequency hopping is also available with the system MT reader, see chapter System Software The system software consists of an operating system and a set of device drivers, libraries and applications. All system MT readers have the system software installed by default Operating System The operating system in the reader is based on the Linux kernel and other open source components. The Linux kernel includes device drivers for standard interfaces such as RS232, RS485 and Ethernet. 24 25 Product description TAGP Client The TAGP client complements the TAGP server with TCP client functionality. It automatically connects to a specified TCP server (IP address and port) as soon as there is data to send. If the server is unavailable, the TAGP client buffers the data until the server is available again at which time the TAGP client automatically reconnects. 4.7 Application Software Application software can be one of the Pepperl+Fuchs applications or a customer specific application written by Pepperl+Fuchs or the customer. The reader application software determines how the reader can be configured, how it operates and how it communicates with the system to which it is connected. See the table below for a software overview and comparison between different reader application software. Note that software features might be subject to change or available only as options. Some optionally available Reader application software can be delivered by Pepperl+Fuchs. It is also possible to order a customer-specific software, tailored to the demands of a certain application. Please ask Pepperl+Fuchs for more information P+F_MONITOR WiseMan The MTT3000-F180-B12-V45-MON includes a Pepperl+Fuchs specific monitor software as standard application software. This software has been designed to fit specific needs of many customers. It can be configured for 4 different modes of operation (see chapter Application Software P+F_MONITOR for detailed information). It supports the communication both via Ethernet TCP/IP and Serial Interface as well as the usage of certain I/Os. New devices are delivered starting this application software as default. In this case the main indicator shows a green light. The WiseMan software is used in identification systems that require a reader with both information storage and decision-making capabilities. With this option the reader will behave like the predecessor readers of this system, the MTT-S1 units. A reader installed with WiseMan can operate stand-alone. An alternative to using the reader stand-alone is to control the reader from a host computer and place some or all of the functionality externally into the host. The communication between the WiseMan software and the host application software is done via a serial communication interface. The WiseMan software is preinstalled in all readers and can be released by buying a release key. This release key can be send to the reader via the Options menu in the webpage. This software is copy-protected. The application software can only be executed from the reader on which it is installed. It is therefor not possible to move a piece of pre-installed application software from one reader to a second reader and then execute it on the second reader. For further information about the WiseMan application software please contact Pepperl+Fuchs. 4.8 Interfaces This section describes the standard interfaces available with the reader. Interfaces include communication interfaces, inputs and outputs, indicators and so forth. Each interface is briefly described. 25 26 Product description Service Interfaces The controller board has an RS232 serial interface that serves as a service interface. As the interface name suggests, the service interface is used for service and maintenance. Logging on to the Linux system and having full access to the reader is possible through the service interface. The service interface communication settings as shown in the table below, are static in order to facilitate customer support. Setting Static Value Baud rate Baud Data bits 8 Parity None Stop bits 1 Flow control None Table 4.2: Service interface communication settings Note! Do not use the service interface as an application port for standard communication. Doing so will compromise system security Serial Communication Interfaces The reader has both a RS485 and a RS232 serial communication interface. Both interfaces can be individually configured regarding Baud rate, data bits, stop bits, parity bits, and so forth. See the corresponding product data sheet for more information about the supported settings. These interfaces are used by Reader application software like P+F_MONITOR to interact with other devices or with a host computer. RS232 Serial Interface The reader has a RS232 serial interface, which is a single-ended full-duplex interface. The RS232 interface is supported by drivers statically built into the Linux kernel. RS485 Serial Interface Ethernet RS485 supports multi-drop serial networks. The communication can be in either full duplex of half duplex, that is 4-wire or 2-wire communication. The RS485 interface is more robust and less sensitive to transmission errors compared to a common RS232 interface. The RS485 interface is supported by drivers statically built into the Linux kernel. The reader has a 10/100 Mbps fast Ethernet interface. The network interface supports autonegotiation for automatic media speed and protocol selection as well as automatic MDI/MDI-X crossover. Indicators on the Ethernet connector show link activity and link speed. By default a reader has several services that use the Ethernet interface, such as HTTP, SSH and TAGP. Custom reader application software can apply standard Linux functions to use the network interface. 26 27 Product description USB Host The controller board has two USB host interfaces that comply with the USB 2.0 full speed specification. The USB host interfaces can be used as interfaces for expanding the functionality within customer specific application software Micro SD memory Card The controller board has a secure digital (SD) memory card interface, which supports the physical form factor of micro SD, also known as TransFlash. The interface can be used to add more flash memory to the reader Inputs and Outputs The reader has several inputs and outputs, which can be used to incorporate the reader in a system. Intergace Inputs Outputs Relay output Tampering switches Description The reader has three optocoupler inputs. The inputs can be set to generate a software event on change. Each input signal is filtered such that glitches shorter than 15 milliseconds are removed. The reader has two open collector outputs that can be set high or low. The three Wiegand signals are also possible to control with software and use as outputs. The reader has one relay output for heavy duty loads, which can be set open or close. The reader has two mechanical tampering switches that break if the cover of the reader is opened. The first tamper switch is connected internally to the controller board and creates a software event when opened and closed. The second tamper switch has an interface which can be connected to an external alarm loop Indicators 4.9 Features Table 4.3: Inputs and outputs The reader has visual indicators that can show red or green, or both, which is referred to as yellow. The indicators can also be turned off. The reader also has a buzzer for audible indication. This section describes some features found in system MT readers Web Server The built-in web server presents a web interface to the reader. A standard web browser is used to log on to the reader via Internet or a local network. Status information can be received and configuration settings can be altered when logged on through a web browser. For information about logging on to the reader using a standard web browser, see section 6.2. The web server is a HTTP daemon, which is a very small web server adequate for low-traffic hosts. 27 28 Product description Frequency Hopping The frequency hopping has a pseudorandom behaviour and is suitable for installations where frequency channel planning is not required or desired. Readers using frequency hopping are unaffected by other readers and unlikely interfered by other surrounding equipment. Subbands in which the frequency hopping takes place can be defined by software settings. At least 20 readers can operate in close proximity of each other when all are set to frequency hopping. Continuous Wave (CW) Transmitted frequency set to a fixed radio channel selected by user CW-mode: Radiation frequency MHz CW-mode: Number of RF channels 93 CW-mode: Channel separation 300 khz Frequency Hopping Spread Spectrum (FHSS) FHSS-mode: FHSS-mode: Number of RF channels FHSS-mode: Channel separation Realtime Clock Frequency hopping function which can be set to operate over the complete radio MHz band or over selected parts of the band. This will increase the performance and robustness due to the lowered risk of radio interferences MHz khz Table 4.4: Available channels and bandwidth - CW and FHSS mode The reader has a battery-backed realtime clock that can present a time stamp with century, year, month, day, day of week, hour, minute, and second. Using the Linux system time, the resolution is 1/1000 of a second. The reader automatically handles daylight saving time if the correct time zone has been configured. The realtime clock s battery is charged as long as the reader unit is powered. The clock will run on battery if the power supply fails Watchdog Timer The Linux kernel implements a watchdog timer that triggers a reader reset if the system/application software malfunctions. The intention is to bring the reader back from a hung state into normal operation Writing ID-tags When writing ID-tags, the reader occupies a broader spectrum of the frequency band compared to when reading ID-tags. Only one ID-tag at a time is allowed in the reading lobe while writing. Frequency hopping must be disabled. Configure the reader that writes ID-tags so that it is separated by at least two frequency channels from other readers in close proximity. The ID-tag to be written on must be still and positioned with the front side directed towards the reader Spectrum Scan The reader implements a spectrum scan tool that can be accessed through the web interface and works like a simple spectrum analyzer. This tool can be used to find interferers when selecting the best carrier frequency for a reader. See section for more information. 28 29 Product description 4.10 Environmental Considerations The system MT technology is a reliable solution for identification systems because it is unaffected by the normal electromagnetic background noise found in industries and elsewhere. Electromagnetic interference Industrial noise is typically present in the khz and low MHz frequency band. The system MT is using the 2.45 GHz frequency, so typical industrial noise will not affect the communication. Electromagnetic interference in cables By using specified cables, proper shielding and grounding as well as selecting a suitable communication interface, optimum communication reliability is ensured. For more information about cable specification see chapter Lightning In order to protect the reader from possible effects of lightning, additional surge protection on the inputs and outputs may be needed. Temperature For most applications, normal convection cooling is sufficient for the reader. If heat is generated close to the reader, the use of forced cooling or heat shielding should be considered. Safety To comply with Council Recommendation 1999/519/EC, it is recommended that the reader is installed so that a separation distance of at least 20 cm (8 in) from all persons is provided Environmental Specification Climate Parameter Value Reference Cold -30 C or -4 F IEC Ad Heat +60 C or 140 F IEC Bd Sealing IP65 IEC Mechanical Parameter Value Reference Shock 30 G, 6 ms, 10 x 3 dir IEC Ea Bump 25 G, 6 ms, 1000 x 3 dir IEC Eb Random vibration IEC 30 Product description Electrical Parameter Reference Immunity Acc. to CE: EN Emission Acc. to CE: EN FCC part 15 subpart B and C Class A digital equipment Safety EN/IEC Electromagnetic fields EN and EN The reader also conforms to the RoHS Directive 2002/95/EC Note! This equipment has been tested and found to comply with the limits for a Class A digital device, pursuant to Part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference when the equipment is operated in a commercial, industrial or business environment. If the equipment is not installed and used in accordance with the installation instructions below, it may cause interference to radio communications. In this case the user will be required to correct the interference at his own expense. 30 31 Installation 5 Installation This section describes the procedure of installing the reader. This includes mounting the reader, installing the necessary cables, and performing an installation test. Read through this entire section before performing the installation. The two main elements of a Pepperl+Fuchs identification system are the reader and the ID-tag. Peripheral elements are for example a host computer and other external devices, such as traffic lights and barriers. The figure above shows the overview of a Pepperl+Fuchs identification system with a polemounted reader, an ID-tag mounted on the inside of a car windscreen, a host computer, a power supply, and a barrier. The Pepperl+Fuchs system employs circular polarisation and can therefore be used when metal surfaces are in the vicinity of the antenna and the ID-tag, especially if the ID-tag is moving. In order to find the best arrangement, adjustment of the reader, ID-tag positions and distance may be necessary. 5.1 Storage and transport For storage and transport purposes, package the unit using shockproof packaging material and protect it against moisture. The best method of protection is to package the unit using the original packaging. Furthermore, ensure that the ambient conditions are within allowable range. 5.2 Unpacking Check the product for damage while unpacking. In the event of damage to the product, inform the post office or parcel service and notify the supplier. Check the package contents with your purchase order and the shipping documents for: Delivery quantity Device type and version in accordance with the type plate Accessories Manual/manuals 31 32 Installation Retain the original packaging in case you have to store or ship the device again at a later date. Should you have any questions, please contact Pepperl+Fuchs. 5.3 Preconditions Tools Cables The locations of readers and ID-tags have been specified during the project planning phase, based on considerations of communication distances and movement speeds. The cable paths and cable types have been determined during the project planning phase. The power supply must comply with all relevant safety regulations. The equipment must be disconnected from all voltage sources before any installation or service work is carried out. Capacitors inside the equipment can hold their charge even if the equipment has been disconnected from all voltage sources. Caution! Damage Damage may be the result if the equipment is switched on, when parts are removed from the controller board, or if a PCB is removed within one minute after switching off the equipment. The following tools are necessary for installation: Screwdriver, Torx T20 Screwdriver, 2.5 mm flat-bladed Hammer Short metal tube, diameter 16 mm Side cutter Wire stripper Crimping tool for ferrules Cables are not supplied with the system MT. All cables must be shielded and suitable for the installation environment, for instance indoor or outdoor environment. Use flexible cables with stranded wire. The terminal blocks used are Phoenix, type PT 1.5. These terminal blocks allow for a cable area of 0.2 to 1.5 mm² (AWG 26-14). Stranded wires must be fitted with a ferrule before being inserted in the terminal blocks. The cable for the RS485 interface must be a twisted pair cable and conform to the EIA RS485 standard. A category 5 (CAT 5) cable is required for the Ethernet connection. 5.4 Mounting the Reader Mount the reader in a horizontal position. In exceptional cases, the reader can be mounted in a vertical position. Mount the reader on a bracket and direct the front side of the reader so that the reading lobe covers the positions of the ID-tags. The reader identifies ID-tags within the reading lobe that expands in front of the reader. 32 33 Installation For optimal performance, tilt and rotate the reader into a position so that the front side of the reader is parallel with the front surface of the ID-tag to be read. Align the reader so that the actual reading range is 60 70% of the specified maximum reading range. The system MT reader is prepared for mounting directly in a bracket on the back side of the reader. The mounting holes enable the use of VESA 75 standard mounting brackets. There are several M4 holes which can be used to fasten the reader onto the mounting bracket. The mounting holes are sealed at the base, so the fixing screw must not extend more than 8 mm into the reader. Note! Do not drill any additional holes in the enclosure. This will affect the sealing specification. Figure 5.1: MTT6000-F120-B45 mounting hole layout on the back side of the reader (unit: [mm]) See datasheet for MTT3000-F180-B12-V45-MON mounting hole layout!. For installation of the reader on a pole or a wall, Pepperl+Fuchs provides an universal mounting kit MTA-MH09. 33 34 Installation Caution! Damage Never exceed the environmental and electrical limits as specified in see chapter 9.1. Exceeding the limits can result in permanent damage to the reader. 5.5 Cable Connections The reader is provided with knock-outs for incoming cables on both the horizontal and vertical edges. First and foremost use the cable entries on the horizontal edge of the reader, even if the reader is mounted in a vertical position. Note! The reader is certified for an installation of maximum four separate incoming cables. Do not exceed this maximum number. Cable connections Warning! Damage Keep the reader closed when knocking out the cable entries to prevent damaging the enclosure. Be careful that the tube does not contact any components inside the reader. 1. Use a short 16 mm-diameter tube to remove the desired knock-outs. Tap the tube sharply using a hammer as illustrated below. Figure 5.2: Knocking out the cable entries 34 35 Installation 2. Open the reader using a torx screwdriver. 3. Insert metal cable glands into the holes. 4. Cut the power cable to a suitable length and pull it through the cable gland as illustrated below. Figure 5.3: Grounding the cable in the cable gland 5. Connect the shield of the power cable to earth at the power supply end. The shield functions as earth connection for the reader. 6. Measure enough length of the cable to reach to the terminal block. 7. Strip the outer insulation and pull back the cable until the cable shield makes contact with the earthing fingers inside the gland. 8. Tighten the cable gland around the cable. 9. Cut away excessive length of the cable shield, strip the ends of the conductors, and crimp a ferrule onto the stripped end of each conductor. 10. Connect the power cable to group J31 (see chapter 5.5.4). 11. Make sure that the power source is turned off and connect the other end of the power cable to the power source. 12. Connect the remaining cables in the same manner. For connection of the Ethernet cable, see chapter Caution! IP classification Do not remove pressure balance membrane. This will compromise the IP classification. 35 36 Installation Figure 5.4: Controller board with external connections Note! It is possible to attach or remove the terminal block connectors inside the reader for more convenient connection of the cables. The terminals are grouped as specified in the following sections. 36 37 Installation Interface isolation and protection Figure 5.5: Pinning and schematic design of the readers interfaces 37 38 Installation The hardware design is protected against radiated or wired disturbances by extensive use of filters, transformers and shielding. The power input is galvanically separated from the main electronic part of the reader by use of an onboard DC-DC converter. The interface block with Ethernet, serial interfaces and I/O signals is also galvanically isolated from the rest of the reader. This makes sure that no ground current will occur between shielding, power lines or other interfaces. The common GND connection in J2 and J41-J43 is a floating reference ground for the interface block signals. This makes it possible to operate the interface with the voltage potential set from the other party. The reference ground is internally connected to the chassis via a discharge resistor to avoid static voltage potential. It has no other reference to connections outside the interface block. The USB port GND is connected to the chassis. The Wiegand/Magstripe interface, the isolated inputs, and isolated outputs have a varistor protection that will short-circuit signals over the rated maximum of 30 V Relay Output, Group J1 The controller board has one relay output for heavy duty loads. Pin Signal Description 1 RCOM Common terminal or relay 2 ROPEN Connected to RCOM when relay is open 3 RCLOSE Connected to RCOM when relay is closed Table 5.1: Relay output, group J Wiegand/Magstripe, Group J2 The controller board has an access control interface that supports both Wiegand and Magstripe protocols, which could be accessed via a customer tailored application program. Please ask Pepperl+Fuchs for further information. Pin Signal Description 1 D0 Wiegand 0 (zero) signal 2 D1 Wiegand 1 signal 3 CL Card load signal 4 GND Ground Table 5.2: Wiegand, group J2 Pin Signal Description 1 CLK Magstripe clock signal 2 DATA Magstripe data signal 3 LOAD Card load signal 4 GND Ground Table 5.3: Magstripe, group J2 38 39 Installation Power Supply, Group J31 Pin 1 is internally connected to pin 3 and pin 2 is internally connected to pin 4. The purpose is to make it possible to feed power to any peripheral equipment. Use pins 1 and 2 for power supply connection. Pin Signal Description 1 SPL Positive DC supply input 2 RTN SPL Negative DC supply input 3 SPL Positive DC supply input, internally connected to pin 1 4 RTN SPL Negative DC supply input, internally connected to pin 2 Table 5.4: Power supply, group J External Tamper Switch, Group J32 To protect the reader from tampering, there are two mechanical tampering switches which break if the cover is opened. One tamper switch is connected internally to the controller board and will generate a software alarm when broken. The other is an external tamper switch interface which can be connected to an external alarm loop. Pin Signal Description 1 TAMP A When the tamper switch is open, TAMP A and TAMP B are connected 2 TAMP B Table 5.5: External tamper switch, group J RS485 Serial Communication Interface, Group J41 The controller board has one RS485 serial interface for both 2-wire and 4-wire communication. RS485 supports multi-drop serial networks. The communication can be in both full duplex (4- wire) and half duplex (2-wire). Note! If the installation requires long cables or high data speeds it may be necessary to use termination Pin Signal Description 1 TX+ Transmitted data, from reader to host 2 TX? 3 GND Ground 4 RX+ Received data, to reader from host 5 RX? Table 5.6: Full duplex (4-wire) RS485 serial communication interface, group J41 39 40 Installation Pin Signal Description 1 TX/RX+ Transmitted and received data, to and from host 2 TX/RX? 3 GND Ground 4 NC Not used 5 NC Table 5.7: Half duplex (2-wire) RS485 serial communication interface, group J RS232 Serial Communication Interface, Group J42 The controller board has one RS232 serial interface. Pin Signal Description 1 TX Transmitted data, from reader to host 2 RX Received data, to reader from host 3 GND Ground Table 5.8: RS232 serial communication interface, group J Service Interface, Group J43 The service interface is used for maintenance and configuration of the reader. Do not use the service interface as a regular system interface. Pin Signal Description 1 TX Transmitted data, from reader to host 2 RX Received data, to reader from host 3 GND Ground Table 5.9: Service interface, group J Isolated Inputs, Group J51 The reader has three isolated optocoupler inputs which are protected from noisy environments. Pin Signal Description 1 IN 1A Input signal 1 2 IN 1C Input reference 1 3 IN 2A Input signal 2 4 IN 2C Input reference 2 5 IN 3A Input signal 3 6 IN 3C Input reference 3 Table 5.10: Isolated inputs, group J51 40 41 Installation Isolated Outputs, Group J52 The reader has two open collector outputs Ethernet, Connector P1 An RJ-45 connector labelled P1 with two internal indicators is provided for Ethernet connection. The clip for detaching the cable faces upwards from the controller board surface to allow midboard mounting. The Ethernet connector has eight pins. The wire scheme is based on the T568A standard. The pins are wired straight through the cable. I.e. pins 1 through 8 on one end are connected to pins 1 through 8 on the other end USB Host, Connector P2 USB devices are connected using a standard USB type A connector Micro SD Memory Card Interface, Socket P3 A standard micro SD memory card socket is used. The card socket is placed on the underside of the controller board. 5.6 Installation Test After having completed the installation as described in the previous sections, carry out an installation inspection and verification. If an error occurs, the guidelines in sthe chapter Trouble Shooting may be valuable. () Inspection Pin Signal Description 1 OUT 1C Output 1 collector 2 OUT 1E Output 1 emitter 3 OUT SPL External supply voltage for the outputs 4 OUT 2C Output 2 collector 5 OUT 2E Output 2 emitter Table 5.11: Isolated outputs, group J52 Note! The RJ-45 connector will not pass through the cable gland. Pass the Ethernet cable through the cable gland before crimping the connector on the cable. Ensure that there are no metal objects between or close to the reader and the ID-tag in the positions where communication is to take place. Ensure that the reader and the ID-tag are aligned properly. Avoid communication at maximum specified distance and misalignment. Ensure that the reader is not placed in a location where it is exposed to excessive heat or electromagnetic interference. 41 42 Installation Verification The installation verification is as follows: 1. Keep the lid of the reader open. 2. Switch on power to the reader. 3. Observe the behaviour of the system status indicators on the controller board. The yellow, red, and green system status indicators will be on continuously. 4. The green system status indicator will start flashing after about 30 seconds, indicating that the software is running. 5. The buzzer will sound a short beep and the red system status indicator will start flashing when the hardware is initiated and running. 6. If the reader is connected to an Ethernet network, the green link state indicator on the Ethernet connector will be on to indicate a 100 Mbps connection or off to indicate a 10 Mbps connection. The yellow activity indicator on the Ethernet connector will be flashing to indicate present network communication. If the hardware fails to initiate, the Reader will make two more attempts to initiate it. Each attempt is indicated by a short beep. If the hardware does not initiate after three attempts, contact Pepperl+Fuchs. Close the reader, fit the lid to the base enclosure, and fasten the screws on the lid. Tighten the screws to a torque of 1 Nm in order to seal the enclosure without destroying the gasket. Clean up the site and dispose of any debris from the work. 42 43 Configuration and Commissioning 6 Configuration and Commissioning The reader has a web interface and a terminal interface for configuration and maintenance. The web interface can be accessed over the network from a standard web browser. The terminal interface can be accessed over the serial service interface or over the network using secure shell (SSH). Both interfaces are password protected. The username is admin and the default password is qwerty. It is recommended to change the password to prevent unauthorized access. 6.1 Connecting the Reader to a PC To configure the reader it is necessary to connect it to a PC. This can be done in several ways as shown below: Serial RS 232 connection The terminal interface can be accessed through the serial service interface. For this type of connection see chapter Terminal interface only Direct Ethernet connection The terminal interface and the web interface can be accessed through a direct Ethernet connection. For this type of connection see chapter Terminal & web interface Network connection The terminal interface and the web interface can be accessed when the reader and the PC are both connected to a network with a DHCP server. For this type of connection see chapter Terminal & web interface 43 44 Configuration and Commissioning Serial RS 232 Connection A terminal emulation program is required to connect to the serial service interface. A suitable program is e.g. HyperTerminal that is included in Windows XP. Many modern PCs don't have built in serial ports. A serial port can be added by using a USB to serial adapter. The following serial settings should be used in the terminal emulation program: Baud rate: Data bits: 8 Stop bits: 1 Parity: None Flow control: None A cable for connecting the service interface to a 9-pin PC COM port should be created as specified in the following table. 9-pin D-sub Connector (female on cable) Reader Connector (J43) Pin Signal Pin Signal 2 RXD 1 TX 3 TXD 2 RX 5 GND 3 GND Table 6.1: Cable specification: PC COM port <-> reader service interface Example 44 After a power reset the switch on message appears first. Then you see the login procedure. With the command ifconfig you can check the IP address. With the command in the last line the IP address is set to another value. This address is valid until the power is switched off again. During that time You can connect yourself to the reader via the webpage and configure the entire unit. ************************************************************************************** **** Pepperl+Fuchs MTT6000-F120-B12-V45 - System Software v1.6.2 **** ************************************************************************************** tagload: module license 'Proprietary' taints kernel. tagload v1.6.0 (Apr :40:56) loaded tagmod v1.6.1 (Aug :03:57) loaded at91_mci at91_mci: 4 wire bus mode not supported - using 1 wire eth0: Setting MAC address to 00:18:58:10:1b:d2 eth0: Link now 100-FullDuplex tagd v1.6.1 (Aug :40:51) started on port 9999 Welcome to Linux PF-JW-Demokit login: root Password: qwerty login[880]: root login on `ttys0' BusyBox v1.2.1 ( : ) Built-in shell (ash) Enter 'help' for a list of built-in commands. PF-JW-Demokit:~$ ifconfig eth0 Link encap:ethernet HWaddr 00:18:58:10:1B:D2 inet addr: Bcast: Mask: PF-JW-Demokit:~$ ifconfig eth netmask PF-JW-Demokit:~$ 45 Configuration and Commissioning Direct Ethernet Connection The reader can be directly connected to a PC with an Ethernet cable. Automatic MDI/MDI-X crossover support makes it possible to use either a straight through cable or a crossover cable. When connected directly to a PC, the reader uses a fixed IP address which is set to at delivery. The IP address of the PC should be set to an address that is in the same subnet. A suitable address is In Windows XP, the IP address can be configured like this: Open the control panel Select Network Connections Select Local Area Connection Press the Properties button Select Internet Protocol (TCP/IP) in the list and press the Properties button Select Use the following IP address Enter for the IP address Enter for the subnet mask Close all windows by pressing OK or Close Tip If you frequently switch between connecting your PC to a network with a DHCP server and connecting it directly to a reader there is a convenient feature in Windows XP that makes it possible to specify dual network configurations. In the Internet Protocol (TCP/IP) Properties dialog, leave the configuration under the General tab as is (usually Obtain IP Address automatically ). Click on the Alternate Configuration tab and select User configured. Enter for IP address and for subnet mask. Close all windows by pressing OK or Close. When the PC is connected to a network with a DHCP server it will automatically obtain an IP address. When the PC is directly connected to a reader it will use 46 Configuration and Commissioning Example This connection is used e.g. by the P+F_MONITOR application software. Figure 6.1: Connecting via Ethernet - Windows XP, using HyperTerminal Figure 6.2: Connecting via Ethernet - Settings in Windows XP 46 47 Configuration and Commissioning Network Connection When the reader is connected to a network with a DHCP server it will automatically obtain an IP address. To connect to the reader s web interface, it is necessary to find the reader s IP address or use a service discovery tool. The reader implements service discovery with the mdns/dns-sd protocols (see <> for more information). One way to find the IP address is to use the serial terminal interface. The IP address can be found under Information /General Info. A freely available mdns/dns-sd service discovery tool is called Bonjour and can be downloaded from the following page: <> After installation, a bonjour button ( ) will be available on the command bar in Internet Explorer (marked by an arrow). Click on the button to display all discovered web pages at the left edge of the Internet Explorer window. Readers will show up with their hostnames. The default hostname is Pepperl+Fuchs-xxxxxx where xxxxxx is the last (unique) part of the reader s Ethernet address. Double click on a reader in the list to open the reader s web interface. The host name can be changed under Settings /System /Network using the web interface or the terminal interface. 6.2 Web Interface Connect to the web interface with a standard web browser. Enter the reader s IP address in the address field (default address: Figure 6.3: Web Interface Log in Log in with user name admin and password qwerty to open the reader s start page. The following picture shows the start page with the menu expanded to show all menu items. The different items are described in the following sections. Note! If some of the described Java applications are not displayed on your web browser, you might need to update your Java Runtime Editor. 47 48 Configuration and Commissioning Figure 6.4: Web interface start page Information The menu "Information" provides the following reader status information. General Information The General Info page provides information about system time, system up time, software and hardware versions, memory usage and network configuration. 48 Figure 6.5: Information / General Info 49 Configuration and Commissioning /proc/tagmod This submenu provides detailed information about the reader. The information is relevant only to the Pepperl+Fuchs technical support. /proc/tagfilter Settings This submenu provides detailed information about the Reader. The information is relevant only to the Pepperl+Fuchs technical support. The menu "Settings" is used to configure system and application settings. Settings /System /Passwords The submenu "Passwords" is used to change the passwords for users admin and root. The admin user has access to the web and terminal interfaces. The root user has access to the Reader s operating system. The default passwords for both users are qwerty. Figure 6.6: Settings /System /Passwords Settings /System /Date & Time The submenu "Date & Time" is used to set the time zone, date, and time of the reader s batterybacked realtime clock. The reader automatically handles daylight saving time if the correct time zone has been configured. The default time zone, UTC, does not use daylight saving time. 49 50 Configuration and Commissioning Figure 6.7: Settings /System /Date & Time Settings /System /Network The submenu "Network" is used to configure the reader s network settings. When the settings have been saved, the reader has to be rebooted to activate them. Figure 6.8: Settings /System /Network 50 51 Configuration and Commissioning The settings are described below: Setting DHCP Bonjour Hostname IP address Netmask Gateway DNS Description = Dynamic Host Configuration Protocol. If DHCP is on (default), the reader will try to obtain network settings from a DHCP server. If DHCP is off or no DHCP server is found, the reader uses the default values specified at the bottom of the page. Bonjour is a service discovery system based on the mdns/dns-sd protocols. If Bonjour is on (default), the reader will advertise its existence on the local network and can be found with service discovery tools like Bonjour as described in the previous section (see chapter 6.1.3). The unique name by which a reader is known on a network. This name is used to identify the reader with the Bonjour service discovery tool. The default hostname is PepperlFuchs-xxxxxx where xxxxxx is the last and unique part of the reader s Ethernet address. Every network interface on a TCP/IP network must have a unique IP address. If the device is part of the Internet, its IP address must be unique within the entire Internet. If a device s TCP/IP communications are limited to a local network, its IP address only needs to be unique locally. To communicate properly, each device (reader or host) on a network must use the same subnet mask. The subnet mask is set to by default. If the reader communicates with devices that are not on its local network, a default gateway address is needed. = Domain Name Server To resolve hostnames into IP addresses, each reader needs to know the addresses of one or several domain name servers. Table 6.2: Network settings Settings /System /TAGD The submenu "TAGD" is used to configure default settings for the reader. Note! Application software may override these settings! 51 52 Configuration and Commissioning Figure 6.9: Settings /System /TAGD 52 53 Configuration and Commissioning The settings are described below: Settings Value Description Security Server Interface local & external It is possible to connect to TAGD from readerhosted applications as well as from the network local It is only possible to connect to TAGD from reader-hosted applications, not from the network. Note: It is possible to connect to TAGD through an encrypted SSH tunnel! RF Carrier On RF carrier is on Off RF carrier is off Frequency RF carrier frequency FHSS mode On Frequency hopping is on Off Frequency hopping is off FHSS bands A..P Specifies which frequencies to use for frequency hopping. See 6.6 for more information Read level Specifies the reading range in 100 steps where 100 is the maximum range Tag Bitrate High High-speed tags are read Low Low-speed tags are read Filter type Off All tags are reported to applications Periodic Tags are reported periodically Once Tags are reported once Report N/A Read beep On The reader beeps when a tag is read Off The reader does not beep when a tag is read CRC discard On Tags with bad CRC are discarded Off Tags with bad CRC are not discarded Data CRC discard On MTM-Tags with bad userdata CRC are discarded Off MTM-Tags with bad userdata CRC are not discarded Table 6.3: TAGD settings Settings /System /Options The submenu "Options" is used to unlock certain reader options like the preinstalled application software WiseMan with an encrypted key. Paste the key into the key field, save the settings and reboot the reader to activate the key. Please contact Pepperl+Fuchs about information of available reader options. 53 54 Configuration and Commissioning Settings /Applications /Autostart The submenu "Autostart" is used to select which application software to run on readers that are allowed to run multiple applications. All enabled application are available in the Autostart list box. In addition the following choices are available: Default Application For backwards compatibility. Starts the reader s default application as in previous system software versions (< 1.6.0). Command Line For advanced users. Executes an operating system command line as specified in the Command line field. P+F Monitor This application software offers multiple ways of optimizing the communication to specific needs of customer applications. This option is activated on new readers delivered by Pepperl+Fuchs. Figure 6.10: Settings /Applications /Autostart Settings /Clone The submenu "Clone" is used to save reader settings including the WiseMan database to a USB storage device. The settings can then be imported to another reader. 54 55 Configuration and Commissioning Figure 6.11: Settings /Clone To save settings: Connect a USB storage device to the reader Select suitable options Press Save Settings Options are available for parameters such as IP address and ConfiTalk address. These addresses should usually be different on each reader. The following options are available: Settings Don t change Increment Copy Description Don t change this setting when importing, leave the setting as is on the importing reader Increment this setting when importing, generate a unique value on the importing reader Copy this setting when importing, set to same value as on original reader Table 6.4: Clone settings To import settings: Insert the USB storage device into a reader Wait for the visual indicator to turn yellow Press the tamper switch to import settings Wait for the visual indicator to turn green Wait while the reader reboots to activate the imported settings 55 56 Configuration and Commissioning Web Tools The menu "Web Tools" contains different utilities, which are available on the web interface. Web Tools /ID-tag Read/Write The submenu "ID-tag R/W" can be used to read and write to ID-tags. Figure 6.12: Web Tools /ID-tag R/W Read ID-tags are shown in a table, one ID-tag per line. The different columns show the ID-tag s ID, Status (battery OK or LOW), UserData, Control for MTM-Tags and the number of times the ID-tag has been read. The button "Clear" clears the table and resets the count column The field Bit rate determines if the reader should read ID-tags with high or low bit rate. The fields Filter and Timeout select the tag filter type and period: Off - no filter is used Periodic - an ID-tag is reported periodically with a time period specified by the filter timeout Once - an ID-tag is reported once and must be out of the reading lobe for the specified filter timeout before it is reported again The clickbox Read beep enables/disables read beep The clickbox Mark CRC enables/disables checking of the ID-tag s mark CRC The clickbox Data CRC enables/disables checking of the ID-tag s userdata CRC To write to a MTM-Tag, select Mode and UserData and press the Write button. Click on an ID-tag in the list to copy its current mode and UserData to the Mode and UserData fields. UserData is written in TAGP format which is ASCII with possibility to write any character as %xx where xx is a hexadecimal value between 00 and FF. 56 57 Configuration and Commissioning Web Tools /Spectrum Scan The submenu "Spectrum Scan" contains a spectrum analyzer, that shows the frequency spectrum as seen by the reader. This information can be used to find interferers when selecting a suitable frequency for the reader. Figure 6.13: Web Tools /Spectrum Scan The gray line shows the current scan. The yellow area shows the peak value for each frequency. The green area shows the average value for each frequency. The red line shows the reader s own frequency as a vertical line or the use of FHSS as a horizontal line. Web Tools /I/O Test The submenu "I/O Test" can be used to test reader inputs and outputs and verify that connections to external systems work as expected. Figure 6.14: Web Tools /I/O Test 57 58 Configuration and Commissioning Reboot The menu "Reboot" allows you to reboot the reader 6.3 Usefull Software Tools The following table list software tools, that are useful when working with a reader. Application TeraTerm HyperTerminal Description Free terminal emulator/ssh client for Windows <> Bundled with multiple versions of Microsoft Windows (not Windows Vista) Table 6.5: Terminal emulator software Windows text editors usually use carriage return (CR) plus line feed (LF) as end-of-line character. The reader s Linux operating system expects files to have a single line feed as endof-line character. When editing reader files on a PC it is recommended to use an editor that can handle Linux line endings. 6.4 Configuration of the software 'P+F_MONITOR' Configuration of the reader The reader uses a setup string to configure itself for the correct mode of operation and parameter settings. This string is stored on the reader in a file. Typically the configuration of each reader is different. The microwave channel and the read range are the two most commonly configured parameters. Also each reader may have a unique name. The configuration can be modified in a number of ways including through serial/ethernet ports, or setup tag. Here are examples of each. The default configuration on delivery is $SMDeskC98R4B1, which means operation in Standard Mode, Frequency Hopping, 100% Readrange, Baudrate Serial Interface = Configuration Note! Use capital letters for all parameter data! 1. Connect to the reader, either to ports 1 or 2 serially or via Ethernet. Send the L command to the reader to read out the existing configuration. See Reading the Configuration. The response will start with a status 0 and a 3-digit length and ends with <CR>. Use the C command to configure the readers. See Writing the Configuration. The response will be immediate. The reader reboots automatically. The normal boot up string can be used to verify the configuration. 2. Once the reader is configured, the configuration can be written to a setup tag. See Writing Setup Tags. If this tag is placed in front of the reader during the 30 s boot up time, the reader will be configured automatically. Special commands are used to write a tag with the current configuration of the reader. There is also a command to read the setup tag. See Reading Setup Tags. Once the tag data has the setup tag format, it will not be reported as a data tag. Setup tags are very handy if you have to replace a reader. A separate setup tag should be used for each reader, because every reader typically has a unique configuration. The new reader is wired up and the setup tag is placed in front of the reader on boot up. Configuration of the reader is completed and the reader runs normally. 58 59 Configuration and Commissioning Reading the Configuration Command Response L<CR> <Status><L3><ASCII_CAP_Data><CR> Example: Command L<CR> Response 0028UUUUStim05C01R4B1LF5T23H26A0<CR> Writing the Configuration Command Response C<L3><Configuration string><cr> <Status><CR> Example: Command C028 UUUUStim05C01R4B1LF5T23H26A0<CR> Response 0<CR> The reader will reboot automatically Writing Setup Tags(The MTT3000-F180-B12-V45-MON can't write!) Command Response K<CR> <Status><CR> Example: Command K<CR> Response 0<CR> If a tag placed in front of the reader and write is successful Reading Setup Tags Command Response M<CR> <Status><L3><Configuration string><cr> Example: Command M<CR> Response 0028UUUUStim05C01R4B1LF5T23H26A0<CR> Configuration string options The configuration string holds all parameters to run the reader. Each mode of operation has a specific parameter set, that must be included in the string. All parameters required for that operating mode must be included in the string for the configuration to be valid. Otherwise an error code 4<CR> is returned. Capital letters must be used for all parameter data. $$$$ These are the first 4 characters of the configuration string for standard, enhanced and track mode UUUU These are the first 4 characters of the configuration string for universal mode Table 6.6: Configuration strings 59 60 Configuration and Commissioning In the following table, the default configuration string for standard mode SMDeskC98R4B1 is explained in detail: Standard Enhanced Track Universal Options Default S(text, 5) X X X X Station ID, any 5 character text C(num, 2) X X X X Frequency channel ,02 - frequency hopping default sub-bands 03,04 - adaptive frequency hopping default sub-bands 98 - frequency hopping all bands 99 - adaptive frequency hopping all bands A1-P1 - specific bands, frequency hopping A2-P2 - specific bands, adaptive frequency hopping R(num,1) X X X X 1-4 and A-J, range 1 to 100% R4 B(num,1) X X X X B0-BE 4800 bps to 115,200 bps, 2-wire or 4-wire RS 485 Default 9600 bps, 4-wire RS 485 L(xn,2) X X X F1 to F5 = fixed length, exactly 1 up to 5 characters V1 to V5 = variable length max. 1 up to 5 characters 01 to 71 fixed length, exactly 1 up to 71 char F8 = :Mark only, FA = data :Mark Default: F5 T(hex,2) X X X The hex value of the termination character Default: # H(hex,2) X X The hex value of the prefix character Default: & X(hex,2) X The hex value of the handshake character M(num,1) X 1 = one tag is scanned and reading stops 2 = two tags are read and reading stops 0 = continuous reading A(num,1) X 0 = no heartbeat 1 = unsolicited heartbeat every 1 min 2 = unsolicited heartbeat every 1 min, handshake required SMDesk C98 B Table 6.7: Configuration string options 60 61 Configuration and Commissioning Examples of configuration of different modes Standard mode station str05, microwave channel 30, baud rate 9600, Range 2 Enhanced mode station MMM06, adaptive frequency hopping default bands, baud rate 9600, range 4, Fixed format length 10, terminator carriage return Track mode station 12345, channel 10, baud rate 9600, range 1, Fixed length 5, no terminator, no prefix, no handshake, one tag read after LON issued Universal mode station abcde, channel 97, baud rate 9600, Fixed length 71. Terminator carriage return, no prefix, with heartbeat and no user acknowledge $$$$Sstr05C30R2B1 $$$$SMMM06C03R4B1L10T0D $$$$S12345C10R1B1LF5T00H00X00M1 UUUUSabcdeC97R4B1L71T0DH00A1 Detailed explanation of configuration options S(text,5) The letter S followed by exactly 5 characters is used as a station ID and is stored in memory. C(number,2) Individual readers must be set to different frequencies, if they are being used in the same plant in close proximity to one another. It may be beneficial to set readers to a channel gap of 2 or more to minimize mutual interference. Certain frequencies may be used by other hardware in the plant and these frequency bands must be avoided, otherwise the read/write range may be very low. Alternatively frequency hopping or adaptive frequency hopping can be used. Frequency hopping will allow the reader to change its frequency automatically when reading. If there is interference and a read is unsuccessful, the next time the frequency changes the read may be successful. Adaptive frequency hopping will allow the reader to listen at a specific frequency before using it. If that frequency is taken, the reader will try another fequency. Readers cannot write while frequency hopping. The reader switches off frequency hopping and the last channel recognised will be used for the write functionality. If one unit is always used for writing then a fixed frequency channel should be used. The fixed channel settings 5-97 have a frequency separation of 300 khz. The individual channels used, when frequency hopping, are separated by 200 khz. Frequency Hopping Band Settings Channel Setting Bands Hopping The letter C followed by exactly 2 digits defines the microwave channel used for communications. This is a powerful feature that allows many readers to work in close proximity to one another without interference. A1 Sub-band A : MHz Frequency Hopping B1 Sub-band B : MHz Frequency Hopping C1 Sub-band C : MHz Frequency Hopping D1 Sub-band D : MHz Frequency Hopping E1 Sub-band E : MHz Frequency Hopping 61 62 Configuration and Commissioning Channel Setting Bands Hopping F1 Sub-band F : MHz Frequency Hopping G1 Sub-band G : MHz Frequency Hopping H1 Sub-band H : MHz Frequency Hopping I1 Sub-band I : MHz Frequency Hopping J1 Sub-band J : MHz Frequency Hopping K1 Sub-band K : MHz Frequency Hopping L1 Sub-band L : MHz Frequency Hopping M1 Sub-band M : MHz Frequency Hopping N1 Sub-band N : MHz Frequency Hopping O1 Sub-band O : MHz Frequency Hopping P1 Sub-band P : MHz Frequency Hopping A2 Sub-band A : MHz Adaptive Frequency Hopping B2 Sub-band B : MHz Adaptive Frequency Hopping C2 Sub-band C : MHz Adaptive Frequency Hopping D2 Sub-band D : MHz Adaptive Frequency Hopping E2 Sub-band E : MHz Adaptive Frequency Hopping F2 Sub-band F : MHz Adaptive Frequency Hopping G2 Sub-band G : MHz Adaptive Frequency Hopping H2 Sub-band H : MHz Adaptive Frequency Hopping I2 Sub-band I : MHz Adaptive Frequency Hopping J2 Sub-band J : MHz Adaptive Frequency Hopping K2 Sub-band K : MHz Adaptive Frequency Hopping L2 Sub-band L : MHz Adaptive Frequency Hopping M2 Sub-band M : MHz Adaptive Frequency Hopping N2 Sub-band N : MHz Adaptive Frequency Hopping O2 Sub-band O : MHz Adaptive Frequency Hopping P2 Sub-band P : MHz Adaptive Frequency Hopping 01 or 02 Bands G,H,I,J,K,L Frequency Hopping 03 or 04 Bands G,H,I,J,K,L Adaptive Frequency Hopping 98 All bands Frequency Hopping 99 All bands Adaptive Frequency Hopping Table 6.8: Frequency hopping band settings 62 63 Configuration and Commissioning R(number,1) The letter R followed by exactly 1 digit sets the read range of the reader. Numbers between 1-4 and A-J are possible, where 1 defines the shortest read range and 4 sets the longest read range. The read range can be set in 10% increments using the settings A (10%) up to J (100%). Range 4 and J have the same range. Range Setting % of Maximum Distance 1 1% 2 33% 3 66% 4 100% A 10% B 20% C 30% D 40% E 50% F 60% G 70% H 80% I 90% J 100% Table 6.9: Range settings B(number,1) The letter B followed by exactly 1 digit sets the baud rate for both serial ports and the port 2 RS 485 mode. Because 2-wire mode is half-duplex; data collisions are possible. The possible settings are: Setting Baud rate [bps] Port 1 setting Port 2 setting Port 2 mode B0 or B RS 232 RS wire B1 or B RS 232 RS wire B2 or BA RS 232 RS wire B RS 232 RS wire B RS 232 RS wire BB RS 232 RS wire B RS 232 RS wire B RS 232 RS wire B RS 232 RS wire BC RS 232 RS wire BD RS 232 RS wire 63 64 Configuration and Commissioning Setting Baud rate [bps] Port 1 setting Port 2 setting Port 2 mode BE RS 232 RS wire Table 6.10: Baud rate settings L(xn,2) The length and data format can be set using the letter L followed by the letter F or V and length. Fn indicates fixed format. The number of characters sent for barcode emulation port is fixed to n. Shorter tag data (i.e. fewer digits) is preceded by 0ASCII characters. Longer tag data (i.e. more digits) is truncate after n digits. For quarter and full memory tags n digits are always sent. The remaining bytes are truncated. F8 is a special case where only the MARK is read off read/write tags and read only tags. The data starts with : and is followed by an 8 digit MARK. Example : <CR> FA is a special case where the entire tag data is sent and the MARK is sent afterwards. The datasets are separated by ":. MARK only tags - return 9 characters on port 1 and 14 characters on 2 MINI memory tags - return 11 characters QUARTER memory tags - return 28 characters FULL memory tags - return 80 characters V indicates variable format. The number of characters sent for barcode emulation port depends on n. If the tag data is shorter (i.e., has fewer digits), only the necessary characters are sent. Longer tag data (i.e. more digits) is truncated after n digits. n is a length specification between 1 and 5. For quarter and full memory tags n digits are always sent. The remaining bytes are truncated. xx length specifier can also be Lxx where xx is the fixed length of data to be sent. The read only (MTO) tags always have a fixed format of ":" and 8 characters. Example: Format Number on Tag Data sent when triggered LF LV LF LV 65 Configuration and Commissioning Format Number on Tag Data sent when triggered L20 12 (Mini) abcdefghijklmnopqrs (Quarter) Abcdefghijklmnopqrs<0x00> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx (Full) xxxxxxxxxxxxxxxxxxxx MTO tags : (Read only, MTO) : LF8 : (Any tag) : LFA 12 (Mini) 00012: abcdefghijklmnopqrs (Quarter) Abcdefghijklmnopqrs: Table 6.11: Data format xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx: (Full) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx: T(ASCII,2) The letter T followed by two ASCII characters specifies the hex value for the postamble. Example: T0D specifies a <CR> trailer as postamble T00 specifies that no postamble is sent H(ASCII,2) The letter H followed by two ASCII characters specifies the hex value for the preamble. Example: H0A specifies a <LF> header as preamble H00 specifies that no preamble is sent X(ASCII,2) The letter X followed by two ASCII characters specifies the hex value for the handshake character. The handshake confirms that a command has been sent and received by the reader. This character is sent after a command ( LON, LOFF, g ) was received. Example: X21 specifies a! as the hand shake character X00 specifies that no hand shaking is used M(number,1) The letter M followed by exactly 1 digit sets the number of different tags, that are read before the reading stops. A value of zero indicates that the reader starts scanning at power-up. The LON and LOFF commands are not executed. Example: M1 specifies that reading tags stops after one tag has been read 65 66 Configuration and Commissioning M0 specifies that reading always takes place. LON and LOFF are ignored A(ASCII,1) The letter A followed by one ASCII characters specifies the type of heartbeat. Example: A0 specifies the no heartbeat will be used A1 specifies that an unsolicited heartbeat (1 min) will be used A2 specifies that an unsolicited heartbeat (1 min) with handshake will be used Data Format for each Mode Standard Mode The format of the data and the responses to the various commands are as follows. Tag moves over reader, no trigger or command No command sent Mini/quarter/full memory tag read: Response: Port 1 and 2 = <Data_Binary_Variable>(Bit 6 set if low battery on mini memory tags) Read only MTO tag read Response: Port 1 and 2 = :<Data_ASCII_DEC> Input 1 triggered or G<CR> command sent, requests the last dataset sent The response sends the data, that was sent to the previous tag by the reader. If no tag has been read since boot up, then the <0xBF><0xFF> message G<CR> or rising edge input 1 Mini/quarter/full memory tag read: Response: Port 1 and 2 = <Data_Binary_Variable> (Bit 6 low bat, bit 7 on for mini) Read only MTO tag read Response: Port 1 and 2 = :<Data_ASCII_DEC> No tag read since boot up Response: Port 1 and 2 = <0xBF><0xFF> 66 67 Configuration and Commissioning Input 2 triggered or N<CR> command sent, reread tag Data is only sent if the tag is within the reach of the reader. If there is no tag within the reach of the reader low bat, bit 7 on for mini) Port 2 = <Data_Binary_Variable> (Bit 6 low bat on mini) Read only MTO tag read Response: Port 1 and 2 = :<Data_ASCII_DEC> No tag within reach Response: Port 1 and 2 = <0xBF><0xFF> F<CR> command sent, requests the last data set sent and includes tag format The response sends the data, that was sent to the previous tag by the reader. The tag format is appended to the end of the string. If no tag has been read since boot up then F<CR> Mini/quarter/full memory tag read: Response: Port 1 and 2 = <Data_Binary_Variable><Format> (Bit 6 low bat, bit 7 on for mini) Read only MTO tag read Response: Port 1 and 2 = :<Data_ASCII_DEC>R8 No tag read since bootup Response: Port 1 and 2 = <0xBF><0xFF>?? Enhanced Mode Enhanced mode will add formatting to the mini memory data and will allow the data to have a fixed length out of port 2. Data format of tags with no triggers Port 1 will send data immediately when the tag arrives in field. Port 2 won't send data. Command No command sent Mini/quarter/full memory tag read: Response: Port 1 = <Data_Binary_Variable> (Bit 6 set if low battery on mini tags) Port 2 = - Read only MTO tag read or all tags when LF8 string format is specified Response: Port 1 = : <Data_ASCII_DEC> Port 2 = - 67 68 Configuration and Commissioning Input 1 triggered or G<CR> command sent, send last tag read to port 1 and only send to port 2 if tag is currently within reach of reader Port 1 will send the last data set that was sent by the reader. Port 2 will only send the tag data that is within the reach of the reader. Command G<CR> or rising edge input 1 Mini memory tag read: Response: Port 1 = <Data_Binary_ Variable><TERM> (Bit 6 low bat, bit 7 on for mini) Port 2 =<Data_ASCII_DEC><TERM>(Length Formatted by Lxx parameter) Quarter/full memory tag read: Response: Port 1 = <Data_Binary_Variable><TERM> Port 2 = <Data_Binary_Fixed><TERM> (length specified by Lxx parameter) Read only MTO tag read or all tags when LF8 string format is specified Response: Port 1 and 2 =:<Data_ASCII_DEC><TERM> No tag read since boot up Response: Port 1 = <0xBF><0xFF><TERM> Port 2 = - Input 2 triggered or N<CR> command, reread tag Data is only sent if the tag is within the reach of the reader. If there is no tag within the reach of the reader set if low battery on mini tags) Port 2 = - Read only MTO tag or all tags when LF8 is specified read Response: Port 1 = : <Data_ASCII_DEC Port 2 = - No tag within reach Response: Port 1 = <0xBF><0xFF><TERM>(3) Port 2 = - F<CR> command sent, requests the last dataset sent and includes tag format The response sends the data, that was sent to the previous tag by the reader. The tag format is appended to the end of the string. If no tag has been read since boot up then. The length is specified by Lxx parameter except when reading the Mark. 68 69 Configuration and Commissioning Command F<CR> Mini memory tag read: Response: Port 1 = <Data_Binary_Variable><TERM><Format> (Bit 6 low bat, bit 7 on for mini) Port 2 = <Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 = <Data_Binary_Variable><TERM><Format> Port 2 = <Data_Binary_Fixed><TERM> Read only MTO tag read or all tags when LF8 is specified Response: Port 1 = :<Data_ASCII_DEC><TERM><Format> Port 2 = :<Data_ASCII_DEC><TERM> No tag read since bootup Response: Port 1 = <0xBF><0xFF><TERM>?? Port 2 = - Track Mode Track mode is designed to completely emulate a barcode reader. The preamble and termination characters are optional and the length is specified by the L parameter. The reader can be turned on using the LON and LOFF commands. If M=0 then data is sent immediately when the tag arrives. If M NOT 0 then LON must be sent before tags will be sent to the ports. The value of M is the number of different tags, that can be read (up to 9) before the reader will no longer respond with tag data. LOF can be sent anytime to terminate reads. LON must be resent, when the number of tags reaches the number M or the LOFF was sent. Data format of tags with no triggers Data is sent out of the serial ports automatically when LON has been sent, or the M parameter is 0. Length is specified by Lxx parameter, except when reading the Mark. Command No command sent Mini memory tag read: Response: Port 1and 2 = <HEAD><Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD><Data_Binary_Fixed><TERM> Read only MTO tag read or all tags when LF8 string format is specified Response: Port 1 and 2 = <HEAD>:<Data_ASCII_DEC><TERM> Input 1 triggered or G<CR> command sent, request last data sent The last tag read is sent out of both serial ports. Length is specified by Lxx parameter except when reading the Mark. Command G<CR> or rising edge input 1 Mini memory tag read: Response: Port 1and 2 = <HEAD><Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD><Data_Binary_Fixed><TERM> 69 70 Configuration and Commissioning Read only MTO tag read or all tags when LF8 string format is specified Response: Port 1 and 2 = <HEAD>:<Data_ASCII_DEC><TERM> No tag read since boot up Response: Port 1 and 2 =<HEAD> <TERM> Port 1 and 2 =<HEAD>: <TERM> (with F8 specified) Port 1 and 2 =<HEAD>00000: <TERM> (with FA specified) Input 2 triggered or N<CR> command, reread tag Any tag that is within reach of the reader is sent out of the ports. It doesn t matter if LON was sent or that the communicator is reading tags. Length is specified by Lxx parameter except when reading the Mark. Command N<CR> or rising edge input 2 Mini memory tag read: Response: Port 1and 2 = <HEAD><Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD><Data_Binary_Fixed><TERM> Read only MTO tag or all tags when LF8 is specified read Response: Port 1 and 2 = <HEAD>:<Data_ASCII_DEC><TERM> No tag within reach Response: Port 1 and 2 =<HEAD> <TERM> Port 1 and 2 =<HEAD>: <TERM> (with F8 specified) Port 1 and 2 =<HEAD>00000: <TERM> (with FA specified) F<CR> command sent, requests the last dataset sent and includes tag format The responses are sent of the last tag that was within reach of the reader.><Data_ASCII_DEC><TERM><Format> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD><Data_Binary_Fixed><TERM><Format> Read only MTO tag read or all tags when LF8 is specified Response: Port 1 and 2 = <HEAD>:<Data_ASCII_DEC><TERM><Format> No tag read since bootup Response: Port 1 and 2 =<HEAD> <TERM>?? Port 1 and 2 =<HEAD>: <TERM>?? (with F8 specified) Port 1 and 2 =<HEAD>00000: <TERM>?? (with FA specified) Universal Mode The universal mode operation adds additional control over the data received from the reader. In universal mode, it is possible to buffer a settable number of tags and request either the last read tag data or all buffered tag data. The tag data buffer is FIFO. 70 71 Configuration and Commissioning A heartbeat function has been implemented and is optional. If no other data exchange (via the serial interface) has occurred for one minute, the reader sends an a heartbeat string. This is used to verify that the reader is still powered up and communicating. Data format of tags with no triggers Data is sent out of the serial ports automatically when LON has been sent, or M parameter is 0. Length is specified by Lxx parameter except when reading the Mark. Command No command sent Mini memory tag read: Response: Port 1and 2 = <HEAD><Status><Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD><Status><Data_Binary_Fixed><TERM> Read only MTO tag read or all tags when LF8 string format is specified Response: Port 1 and 2 = <HEAD>:<Status><Data_ASCII_DEC><TERM> Input 1 triggered or G<CR> command sent, request last data set The last tag read is sent out of both serial ports. Length is specified by Lxx parameter except when reading the Mark. Command G<CR> or rising edge input 1 Mini memory tag read: Response: Port 1and 2 = <HEAD>H<Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD>H<Data_Binary_Fixed><TERM> Read only MTO tag read or all tags when LF8 string format is specified Response: Port 1 and 2 = <HEAD>H:<Data_ASCII_DEC><TERM> No tag read since boot up Response: Port 1 and 2 =<HEAD> <TERM> Port 1 and 2 =<HEAD>5: <TERM> (with F8 specified) Port 1 and 2 =<HEAD>500000: <TERM> (with FA specified) Input 2 triggered or N<CR> command, reread tag Any tag that is within reach of the reader is sent out of the ports. It doesn t matter if LON was sent or if the reader is reading tags. Length is specified by Lxx parameter except when reading the Mark. Command N<CR> or rising edge input 2 Mini memory tag read: Response: Port 1and 2 = <HEAD><Status><Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD><Status><Data_Binary_Fixed><TERM> Read only MTO tag or all tags when LF8 is specified read Response: Port 1 and 2 = <HEAD><Status>:<Data_ASCII_DEC><TERM> 71 72 Configuration and Commissioning No tag within reach Response: Port 1 and 2 =<HEAD> <TERM> Port 1 and 2 =<HEAD>: <TERM> (with F8 specified) Port 1 and 2 =<HEAD>500000: <TERM> (with FA specified) F<CR> command sent, requests the last dataset sent and includes tag format The responses of the last tag within reach of the reader are sent.>H<Data_ASCII_DEC><TERM><Format> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD>H<Data_Binary_Fixed><TERM><Format> Read only MTO tag read or all tags when LF8 is specified Response: Port 1 and 2 = <HEAD>H:<Data_ASCII_DEC><TERM><Format> No tag read since bootup Response: Port 1 and 2 =<HEAD> <TERM>?? Port 1 and 2 =<HEAD>5: <TERM>?? (with F8 specified) Port 1 and 2 =<HEAD>500000: <TERM>?? (with FA specified) Input 3 triggered or A<CR> sent, Request all buffered data All previously read tags (up to 10) are sent out of the serial ports with a 500 ms gap between each one. After the last tag is sent, an end of buffer message is sent. The length of each response is specified by Lxx parameter except when reading the Mark. Once the response has been sent, the buffer is cleared. Command A<CR> or rising edge of input 3 Mini memory tag read: Response: Port 1and 2 = <HEAD>H<Data_ASCII_DEC><TERM> Quarter/full memory tag read: Response: Port 1 and 2 = <HEAD>H<Data_Binary_Fixed><TERM> Read only MTO tag read or all tags when LF8 is specified Response: Port 1 and 2 = <HEAD>H:<Data_ASCII_DEC><TERM> No tag read since bootup Response: Port 1 and 2 =<HEAD>5## <TERM> Port 1 and 2 =<HEAD>5#########<TERM> (with F8 specified) Port 1 and 2 =<HEAD>5#<TERM> (with FA, Vx specified) Heartbeat To determine the state of the serial interface between reader and control PC, the H character is used to indicate the heartbeat. The length of the heartbeat is identical to the configured length of the data. In fixed length mode F1-F5, the exact number of characters including head and trailer will be sent. In all other cases only one byte will be sent. 72 73 Configuration and Commissioning Heartbeat mode 0 Heartbeat mode 1 Heartbeat mode 2 disables the heartbeat enables the 1-minute heartbeat enables the 1-minute heartbeat and expects a user acknowledge. In this mode the control PC must reply by sending a single H<CR> back to the reader. If this string is not received within 1 second, the reader indicates this by toggling the main LED between RED and AMBER (frequency 1 second). The reader continues to operate normally. Toggling the main LED is stopped as soon as the control PC sends the heartbeat data handshake reply. Heartbeat mode 1 Sent by reader automatically Heartbeat: <HEAD>0H <TERM> Response: - Heartbeat mode 2 Sent by reader automatically Heartbeat: Response: <HEAD>0H <TERM> H<CR> The heartbeat handshake H<CR> may be sent anytime to reset the heartbeat timer. 73 74 Operation 7 Operation 7.1 Application Firmware P+F_MONITOR Introduction The MTT3000-F180-B12-V45-MON comes with a P+F specific monitor software. This software has been designed to fit many specific customer needs. It can be configured for 4 different modes of operation. These Modes of operation are: standard, enhanced, track and universal mode. Read through the specific features and benefits of each mode to determine how you want to configure your reader. Standard mode This basic mode of operation is used to read and send data back to the various connected ports. 2 bytes, 19 bytes, or 71 bytes of binary coded data MTO read only tags supported No formatting Hardware or software triggers can be used to resend data or reread tags Enhanced mode This extension of the basic mode allows for the formatting of tag data and a termination character to be specified. Formatted data is only sent on hardware trigger of input 1 to port 2. Port 2 data is only sent when tag is over reader and a trigger occurs on input 1. 2 bytes, 19 bytes, or 71 bytes of binary coded data sent out port 1 MTO read only tags supported Fixed or variable length data sent out port 2 Specification of termination character on port 2 Data on port 2 only sent when tag is over reader and there is a trigger on input 1 Track mode This mode of operation uses features of the enhanced mode but with additional parameters to further emulate a barcode reader. The same formatted data is sent out both ports MTO read only tags supported Data length can be specified Specifying of termination character is possible Specifying of prefix character is possible LON and LOFF barcode read commands implemented, Optional. LON turns reader on for reading of 1 up to 9 different tags. LOFF can be sent any time to turn off reading.(m1 to M9 parameter only) Optional acknowledge character can be specified in response to LON and LOFF commands Universal mode Some additional control over the serial data is now possible. This includes a status byte preceding the data, a heartbeat, and the storing of buffered data. The same formatted data is sent out both ports 74 75 Operation MTO read only tags supported Data length can be specified Specifying of termination character possible Specifying of prefix character possible LON and LOFF barcode read commands implemented, Optional. Turns on and off reading of tags. Status byte proceeds tag data string Request Buffer command. Will return the last 10 tags read Heartbeat can be sent at regular intervals with/without acknowledge 7.2 Tag data format All tags, except read only tags, are formatted during the write data operation. The tag is written completely every time. It is not possible to write only part of the tag while leaving some data unchanged. If some data is not to change, read the entire tag first, change the data and then write back the entire tag. There are three memory models for the MTM type tags. The data can be 2 bytes long, 19 bytes long or 71 bytes long. Depending on the reader mode, setting the length of the data can be truncated to smaller more manageable fixed length sizes. Quarter and full memory tags Any length of 19 bytes or less will be formatted to quarter memory. 20 bytes and higher is full memory. The smaller the memory model, the faster the data can be sent to the reader. Mini memory is faster then quarter memory, which is faster the full memory. If a length, that is smaller then the memory it is specified to, i. e. quarter or full memory, then the remaining bytes are filled with NULL 0x Memory length options During the write operation the tag format is also specified. The interval type is set to R for random and C for constant. This means that the time between successive data sent from the tag is at a constant time interval or a random time interval. Random should always be used, if multiple tags in field are expected. C should be used for the quickest response times. The interval length is then specified at 0, 4, 8, or 16. The time interval is 4, 8, or 16 times as long as the actual time it takes to send the data. The longer the interval, the more likely you will be able to read more tags in field and also the longer the battery life. Memory model Length Data range Data type Write length Mini memory 2 0 to ASCII 1 to 5 Quarter bytes Binary/ASCII memory Full memory bytes Binary/ASCII MTO read only to ASCII Table 7.1: Memory length options 75 76 Operation Format options Tag format Interval type Interval length ~multiple tags in field C0 C 0 0 C4 C 4 0 C8 C 8 0 C16 C 16 0 R4 R 0 to 8 ~4 R8 R 0 to 16 ~8 R16 R 0 to 32 ~8 Table 7.2: Tag Data Format options Read/Write speed and battery life Tag size Format Read time [ms] Write time 99.99% [ms] Battery life Mini C Mini C Mini C Mini C Quarter C Quarter C Quarter C Quarter C Full C Full C Full C Full C MTO tags Random 150 max, 80 average - 10 Table 7.3: Read/Write speed / battery life 7.3 Writing Data(The MTT3000-F180-B12-V45-MON can't write!) When writing data to a tag, only one tag is allowed to be within the entire maximum read zone. If there are multiple tags in the field, a write will not be performed. The write range is very short. The tag must be placed at a maximum of 0.25 m (0.8ft) from the reader. Do not take the tag out of the write range before the write is complete. The tag will lockup and a special procedure will be necessary to unlock the tag. The writing of tags can take some time. If no tag is in the read zone, the write will timeout after about 13 seconds. 76 77 Operation Writing Mini Memory Tags(The MTT3000-F180-B12-V45-MON can't write!) Up to 2 bytes of data are formatted on the tag. The data is programmed in ASCII and can have any value from 0 up to A write attempt outside this range will result in a status 4 (bad command) returned. The length and tag format must also be specified. The length does not include the tag format or termination character. Writing mini tags Command w<l1><data_ascii_dec><format><cr> Response <Status><CR> Example: Command w512345c8<cr> Response 0<CR> success Response 1<CR> success, low battery Response 4<CR> bad command, check string format Response 5<CR> no tag in field Writing Quarter/Full Memory Tags(The MTT can't write!) A three-character length is used to specify the write data length. Unlike the mini memory case, there is no restriction on the type of data that is written. The length does not include the tag format or termination character. Writing quarter/full Command w<l3><data_binary><format><cr> tags Response <Status><CR> 7.4 Por ts Example: Command w019abcdefghijklmnopqrsc8<cr> Response 0<CR> success Response 1<CR> success, low battery Response 4<CR> bad command, check string format Response 5<CR> no tag in field (takes 13 seconds to return) In this manual the ports are specified as port 1 or port 2 because on the reader and the data format may be different for each. The ports are defined as follows: Port 1 RS 232 port connected at J42-1 and Ethernet TCP/IP port Port 2 RS 485 port connected at J41.1 and Ethernet TCP/IP port Ethernet Port 10006, an 8 digit number is sent out of the port every 2 seconds. It has a range from to On first boot up it starts at and increments by 2 every 2 seconds. If the unit never shuts off it will take over 3.17 years to roll over. Sending Commands Commands used to configure and use this reader are simple. A serial timeout is used to determine which commands are valid. The entire command must arrive within 200 ms for the command to be valid. If not, an error code 4<CR> will be sent. Single character commands are easy enough to send from the keyboard but all other commands should be sent from a text file or custom application. 77 78 Operation 7.5 Boot-up string On power up, the communicator will send the model number and version information as well as the current loaded configuration. If the data looks corrupt, you might be connected at the wrong baud rate. Check all possible baud rates of 4800, 9600, 19200, 38400, 57600, and on your terminal program power cycling after each change. The default is 9600 bps. The communicator will take about 30 s to boot. Here is an example of the boot-up data: (C)P+F IDENT-M MTT3000-F180-B12-V45-MON # SMDeskC98R4B1 7.6 Inputs and Outputs The inputs are used to trigger a specific response from the reader. These responses are documented in the different modes Standard, Enhanced, Track, and Universal. The outputs are used to indicate to the user, that data is being sent to the serial ports in a specific way. Input 1: Used to send the last read tag to the serial port or the tag that is over the reader in Enhanced mode. Input 2: Used to perform a reread of the tag data. Because tag data is sent only when an actual tag is over the reader the output is sent when a tag is read and sent to the serial port. Input 3: In Standard, Enhanced and Track mode: Sending of data is suppressed to all ports if input is 1. In Universal mode the reader will respond with a list of all tags previously read up to 10. Once read, the buffer is cleared. The output does not turn on, when this data is sent to both serial ports. Output 1: Turns on for 100 ms when new tag data is sent Output 2: Turns on for 100 ms when new tag data is sent, same as output 1 Relay output: Turns on when a tag with low battery is read, independent of other outputs 78 79 Operation 7.7 Setting the IP address If you plan on using the Ethernet ports, you will need to set the IP address and subnet mask. The units come with a default IP address of and a subnet mask of If the IP address is not known, it can be interrogated via the serial service interface. Here the IP address can be changed temporarily, it is valid until a power reset. Afterwards the IP address and its parameters can be changed non volatile via the webbrowser to the desired values. All IP address settings take affect after a reboot. If you don t want the gateway set, just use where the gateway should be. If you set the IP address to , the IP address is reset to the default of and the subnet mask is reset to the default of A gateway is only recognized as valid, when it is connected to your network while the hardware powers up. Note! When DHCP is used, this hardware will not run until a valid IP address has been assigned to the reader. If you enable DHCP while a DHCP server is missing, it is not possible to set the IP address using DHCP. Leave the DHCP server on the network at all times. Example: Connection via hyperterminal to RS 232 application interface Figure 7.1: Connecting via hyperterminal The switch on message of the reader appears. The command ip is send from the computer. In the following line the response shows the current IP-address, subnet-mask and gatewayaddress. Now you can log on to the unit via a webbrowser using these addresses. You can change the adresses if desired. 79 5-port / 8-port 10/100BaseTX Industrial Ethernet Switch User Manual 5-port / 8-port 10/100BaseTX Industrial Ethernet Switch User Manual Content Overview... 1 Introduction... 1 Features... 3 Packing List... 4 Safety Precaution... 4 Hardware Description... 5 Front Panel... PRO 5000 CPE 1D Quick Installation Guide PRO 5000 CPE 1D Quick Installation Guide Introduction This Quick Installation Guide covers the basic installation of the PRO 5000 CPE. For more information, refer to the relevant sections in the Product... FB-500A User s Manual Megapixel Day & Night Fixed Box Network Camera FB-500A User s Manual Quality Service Group Product name: Network Camera (FB-500A Series) Release Date: 2011/7 Manual Revision: V1.0 Web site: Email: UniStream CPU-for-Panel UniStream CPU-for-Panel Installation Guide USC-P-B10 Unitronics UniStream platform comprises control devices that provide robust, flexible solutions for industrial automation. This guide provides Energy Communication Unit (ECU) Altenergy Power System Energy Communication Unit (ECU) Installation and User Manual (For ECU-3 V3.8) ALTENERGY POWER SYSTEM INC. All rights reserved TABLE OF CONTENTS 1.0 Introduction... 2 2.0 Installation... DK40 Datasheet & Hardware manual Version 2 DK40 Datasheet & Hardware manual Version 2 IPC@CHIP DK40 Evaluation module Beck IPC GmbH page 1 of 11 Table of contents Table of contents... 2 Basic description... 3 Characteristics... DESCRIPTION Termination Boards PROCESS AUTOMATION SYSTEM DESCRIPTION Termination Boards Non-IS Termination Boards for Yokogawa CENTUM C3 and ProSafe RS ISO9001 With regard to the supply of products, the current issue of the following 10/100/1000BaseT to Mini-GBIC Industrial Media Converter 10/100/1000BaseT to Mini-GBIC Industrial Media Converter User Manual Content Overview... 1 Introduction... 1 Features... 3 Packing List... 4 Safety Precaution... 4 Hardware Description... 5 Front Panel... Energy Communication Unit (ECU) Altenergy Power System Energy Communication Unit (ECU) Installation and User Manual (For ECU-3 V3.7) Version:3.0 ALTENERGY POWER SYSTEM INC. All rights reserved TABLE OF CONTENTS 1.0 Introduction... 2) SCREENLOGIC INTERFACE WIRELESS CONNECTION KIT SCREENLOGIC INTERFACE WIRELESS CONNECTION KIT FOR INTELLITOUCH AND EASYTOUCH CONTROL SYSTEMS INSTALLATION GUIDE IMPORTANT SAFETY INSTRUCTIONS READ AND FOLLOW ALL INSTRUCTIONS SAVE THESE INSTRUCTIONS Technical AC-115 Compact Networked Single Door Controller. Installation and User Manual AC-115 Compact Networked Single Controller Installation and User Manual December 2007 Table of Contents Table of Contents 1. Introduction...5 1.1 Key Features... 6 1.2 Technical Specifications... 7 2. Wind Sensor W-RS485 with RS485 Interface Wind Sensor W-RS485 with RS485 Interface Technical data and notes for installation Elsner Elektronik GmbH Steuerungs- und Automatisierungstechnik Herdweg 7 D-75391 Gechingen Germany Phone: +49 (0) 70 56/93 Version Date Author Description 1.00 19.07.2010 Jpo First version 1.01 21.12.2010 Jpo FET output descriptions made clearer 1.02 04.02. +3 # Version Date Author Description 1.00 19.07.2010 Jpo First version 1.01 21.12.2010 Jpo FET output descriptions made clearer 1.02 04.02.2011 Jpo Reset button added 1. Purpose of this user manual... FACTORY AUTOMATION MANUAL IPT-HH20 HANDHELD (125 KHZ) FACTORY AUTOMATION MANUAL IPT-HH20 HANDHELD (125 KHZ) With regard to the supply of products, the current issue of the following document is applicable: The General Terms of Delivery for Products and Services HP UPS R1500 Generation 3 HP UPS R1500 Generation 3 Installation Instructions Part Number 650952-001 NOTE: The rating label on the device provides the class (A or B) of the equipment. Class B devices have a Federal Communications ZC-24DO CANopen I/O Module: 24 Digital Outputs Z-PC Line EN ZC-24DO CANopen I/O Module: 24 Digital Outputs Installation Manual Contents: - General Specifications - Technical Specifications - Installation Rules - Electrical connections - DIP-switches HCR3.2/.. Chipcard reader HOTEL SOLUTION s 6 332 HOTEL SOLUTION Chipcard reader HCR3.2/.. Chipcard reader for hotel room access control Reads access code on chipcard Transfers access code to room controller Built-in optical display of messages HMI display Installation Guide HMI display Installation Guide Product Description Specifications Important Information o Package Contents o Related Documents o Accessories Cautions and Warnings Mounting and Dimensions o BAC-DIS-ENC, Kvaser Mini PCI Express User s Guide Kvaser Mini PCI Express User s Guide Copyright 2013-2014 Kvaser AB, Mölndal, Sweden Printed Sunday 28 th September, 2014 We believe that the information contained herein was accurate Alliance System Ordering Guide Alliance System Ordering Guide Multiple Technologies Versatile Hardware Powerful Software One family of parts and accessories Version 12-Nov-03 Alliance System Ordering Guide Table of Contents Controllers Controller 5000GL Controller 5000GL provides flexible system architecture with options of GBUS and LOCAL BUS communications to field devices, to meet a wide range of site requirements. GGBUS L LOCAL BUS 1 Serial RS232 to Ethernet Adapter Installation Guide Installation Guide 10/100 Mbps LED (amber color ) Link/Activity LED (green color ) 1. Introduction Thank you for purchasing this 1-port RS232 to Ethernet Adapter (hereinafter referred to as Adapter ). Bullet Camera. Installation Guide. Hangzhou Hikvision Digital Technology Co., Ltd. Bullet Camera Installation Guide Hangzhou Hikvision Digital Technology Co., Ltd. 1 Thank you for purchasing our product. If there are any questions, or requests, please do MANUAL PC1000R INFO@APART-AUDIO.COM MANUAL PC1000R INFO@APART-AUDIO.COM Features The APart PC1000R is a professional multisource CD/USB/SD card music player, equipped with balanced and unbalanced analog outputs, coaxial and optical digital Moxa EtherDevice Switch Moxa EtherDevice Switch EDS-205 Hardware Installation Guide Third Edition, June 2008 2008 Moxa Inc., all rights reserved. Reproduction without permission is prohibited. P/N: 1802002050000 Overview T3 Mux M13 Multiplexer T3 Mux M13 Multiplexer User Manual [Type the abstract of the document here. The abstract is typically a short summary of the contents of the document. Type the abstract of the document here. The abstract MOUNTING AND OPERATING INSTRUCTIONS MOUNTING AND OPERATING INSTRUCTIONS CF 51/55 1. Delivery CF 51/55-1 calculator with battery (optionally with mains power supply) - 1 wall mounting bracket - package with material for sealing, screws, wall AXIS 291 1U Video Server Rack Installation Guide AXIS 291 1U Video Server Rack Installation Guide About This Document This document describes how to install Axis blade video servers in the AXIS 291 1U Video Server Rack. Updated versions of this document Wireless Alarm System. Window/Door Sensor. User s Manual. Choice ALERT. Control all Sensors & accessories from one location 45131 Wireless Alarm System Window/Door Sensor User s Manual Choice ALERT Control all Sensors & accessories from one location Table of Contents Important Safeguards 4 Introduction 5 Installation 6 Assigning. WIRELESS STATUS MONITOR INSTALLATION INSTRUCTIONS WIRELESS STATUS MONITOR (WSM or AUWSM) The most current version of this document is available for download at: P/N: M053-032-D Schlage 245 W. Roosevelt Road,... DIVISION 28 ELECTRONIC SAFETY AND SECURITY SECTION 28 13 00 SECURITY AND ACCESS CONTROL SYSTEM DIVISION 28 ELECTRONIC SAFETY AND SECURITY PART 1 GENERAL 1.01 DESCRIPTION A. Division 28 Contractor shall extend a complete Matrix Systems Access Control System as shown on the Drawings and as specified WEB log. Device connection plans WEB log LIGHT+ 20 BASIC 100 PRO unlimited Device connection plans Version 20151210* Copyright Copyright for this manual remains with the manufacturer. No part of this manual may be reproduced or edited, AXIS T81B22 DC 30W Midspan INSTALLATION GUIDE AXIS T81B22 DC 30W Midspan ENGLISH About this Document This document includes instructions for installing AXIS T81B22 on your network. Previous experience of networking will be beneficial SPL 2-00/-01 OPERATION INSTRUCTIONS SPL 2-00/-01 OPERATION INSTRUCTIONS Powerline Ethernet Adapter 500 Mbps EN Read and keep Operation Instructions SPL 2-00/-01 Safety Notes Do NOT use this product near water, for example, in a wet basement User and installation manual User and installation manual aquaero 5 The information contained in this manual is subject to change without prior notice. All rights reserved. Current as of April 2011 ENGLISH: PAGE 1 DEUTSCH: SEITE A-307. Mobile Data Terminal. Android OS Platform Datasheet A-307 Mobile Data Terminal Android OS Platform Datasheet Revision 1.1 July, 2013 Introduction A-307 Platform Overview Introduction A-307 Platform Overview The A-307 provides Original Equipment Manufacturers Manual. Simrad StructureScan LSS-1 Sonar Module. English Manual Simrad StructureScan LSS-1 Sonar Module English A brand by Navico - Leader in Marine Electronics Disclaimer As Navico is continuously improving this product, we retain the Advantium 2 Plus Alarm ADI 9510-B Advantium 2 Plus Alarm INSTALLATION AND OPERATING INSTRUCTIONS Carefully Read These Instructions Before Operating Carefully Read These Controls Corporation of America 1501 Harpers Road Virginia INSTALLATION & OPERATION MANUAL MODEL 430TM SWITCH CONTROL Contents: Introduction... 2 Safety First...3 Unpacking & Pre-Installation... 3 Installation... 4 Wiring... 5 Parts List... 6 Warranty... 8 The Switch Box switch control panel is designed IQ151 CONTROLLER DATA SHEET IQ151 CONTROLLER DATA SHEET The IQ151 is a controller in the Trend range with 64 inputs and 32 outputs. Full DDC (direct digital control) with PID control loops is provided. The output channels may be Mercury Helios 2 ASSEMBLY MANUAL & USER GUIDE Mercury Helios 2 ASSEMBLY MANUAL & USER GUIDE TABLE OF CONTENTS INTRODUCTION...1 1.1 MINIMUM SYSTEM REQUIREMENTS 1.1.1 Apple Mac Requirements 1.1.2 PC Requirements 1.1.3 Supported PCIe Cards 1.2 PACKAGE Installation & User Manual Radio Remote RC-12E Installation & User Manual Radio Remote RC-12E SLEIPNER MOTOR AS P.O. Box 519 N-1612 Fredrikstad Norway Tel: +47 69 30 00 60 Fax: +47 69 30 00 70 sidepower@sleipner.no Made in Norway Options for ABB drives, converters and inverters. User s manual FDPI-02 diagnostics and panel interface Options for ABB drives, converters and inverters User s manual FDPI-02 diagnostics and panel interface Table of contents Table of contents 3 1. FDPI-02 diagnostics and panel interface Safety.............................................. NAS-1000 AIS-SART USER S MANUAL NEW SUNRISE NAS-1000 AIS-SART USER S MANUAL NEW SUNRISE NOTICE TO USERS - Thanks for your purchasing this product NAS-1000 AIS-SART. - Please read this manual carefully to ensure proper use before installation and
http://docplayer.net/638515-Factory-automation-manual-mtt3000-f180-b12-v45-mon-system-mt.html
CC-MAIN-2017-30
refinedweb
20,352
52.39
Asked by: How to use class library? Question - Hi, i want to write programs with C# language and Visual studio , But i can't do it correctly. for example i want to see usage information of network card but i don't know where to use these classes and parameters and propertise. another example that : i want to use GatewayIPAddressInformation but i can't use this class its somehow hard to understand. where can i find solution for my problem? Thanks. All replies Hello Armin, Probably the best way to start is looking at some tutorials: Also, performance counters might also be a way of solving this: Cheers, Jeff I'll add reply for the "How to use the libraries" part. First, I'll point you to the documentation for the function GatewayIPAddressInformation class. As you can see, it tells you the namespace the class is located (System.Net.NetworkInformation). Now scroll to the top of your source file. If there are no "using System.Net.NetworkInformation;" statement, add the line there. If the class still does not show up in Intellisense, now check the "Assembly" information and see if the listed DLL is in your project's reference, and add it if it's not there. Since this class is from System.dll which is included by default for projects, this is unlikely to be required. And then if the class does not show up, you'll want to check the version information. Some class are only included for some version of .NET framework and you may want to check and see if it matches. Some class are for WPF only and you can't use it unless you're writing WPF project, or hosting a WPF control inside your WinForm. Added to the mix is UWP/Xamarin/.NET Core/.NET standard framework projects, but I'm not going to dive in detail for now to avoid further confusing you. - Edited by cheong00Editor Monday, June 19, 2017 1:55 AM - Proposed as answer by Zhanglong WuMicrosoft contingent staff, Moderator Monday, June 19, 2017 6:02 AM Hi Armin.Programmer, As cheong00 said this class is from System.dll which is included by default for projects, you don't need to add related reference. Just move your mouse to the code and add related using (System.Net.NetworkInformation). For usage of this class. please refer to:.
https://social.msdn.microsoft.com/Forums/en-US/9f7829a3-fc6a-4acd-a0f8-d19aea8098ec/how-to-use-class-library?forum=netfxbcl
CC-MAIN-2020-50
refinedweb
396
65.52
Computer Programming - File I/O Computer Files A computer file is used to store data in digital format like plain text, image data, or any other content. Computer files can be organized inside different directories. Files are used to keep digital data, whereas directories are used to keep files. Computer files can be considered as the digital counterpart of paper documents. While programming, you keep your source code in text files with different extensions, for example, C programming files end with the extension .c, Java programming files with .java, and Python files with .py. File Input/Output Usually, you create files using text editors such as notepad, MS Word, MS Excel or MS Powerpoint, etc. However, many times, we need to create files using computer programs as well. We can modify an existing file using a computer program. File input means data that is written into a file and file output means data that is read from a file. Actually, input and output terms are more related to screen input and output. When we display a result on the screen, it is called output. Similarly, if we provide some input to our program from the command prompt, then it is called input. For now, it is enough to remember that writing into a file is file input and reading something from a file is file output. File Operation Modes Before we start working with any file using a computer program, either we need to create a new file if it does not exist or open an already existing file. In either case, we can open a file in the following modes − Read-Only Mode − If you are going to just read an existing file and you do not want to write any further content in the file, then you will open the file in read-only mode. Almost all the programming languages provide syntax to open files in read-only mode. Write-Only Mode − If you are going to write into either an existing file or a newly created file but you do not want to read any written content from that file, then you will open the file in write-only mode. All the programming languages provide syntax to open files in write-only mode. Read & Write Mode − If you are going to read as well as write into the same file, then you will open file in read & write mode. Append Mode − When you open a file for writing, it allows you to start writing from the beginning of the file; however it will overwrite existing content, if any. Suppose we don’t want to overwrite any existing content, then we open the file in append mode. Append mode is ultimately a write mode, which allows content to be appended at the end of the file. Almost all the programming languages provide syntax to open files in append mode. In the following sections, we will learn how to open a fresh new file, how to write into it, and later, how to read and append more content into the same file. Opening Files You can use the fopen() function to create a new file or to open an existing file. This call will initialize an object of the type FILE, which contains all the information necessary to control the stream. Here is the prototype, i.e., signature of this function call − FILE *fopen( const char * filename, const char * mode ); Here, filename is string literal, which you will use to name your file and access mode can have one of the following values − Closing a File To close a file, use the fclose( ) function. The prototype of this function is − int fclose( FILE *fp ); The fclose( ) function returns zero on success, or EOF, special character, provided by C standard library to read and write a file character by character or in the form of a fixed length string. Let us see a few of them in the next section. Writing a File Given below is the simplest function to write individual characters to a stream − − int fputs( const char *s, FILE *fp ); The function fputs() writes the string s into the file referenced by fp. It returns a non-negative value on success, otherwise EOF is returned in case of any error. You can also use the function int fprintf(FILE *fp,const char *format, ...) to write a string into a file. Try the following example − #include <stdio.h> text file character by character − int fgetc( FILE * fp ); The fgetc() function reads a character from the input file referenced by fp. The return value is the character read; or in case of any error, it returns EOF. The following function allows you to read a string from a stream − char *fgets( char *buf, int n, FILE *fp ); The function fgets() reads up to n - 1 characters from the input stream referenced by fp. It copies the read string into the buffer buf, appending a null character to terminate the string. If this function encounters a newline character '\n' or EOF before they have read the maximum number of characters, then it returns only the characters read up to that point including the new line character. You can also use int fscanf(FILE *fp, const char *format, ...) analyze what happened here. First, the fscanf() method reads This because after that, it encountered a space. The second call is for fgets(), which reads the remaining line till it encountered end of line. Finally, the last call fgets() reads the second line completely. File I/O in Java Java provides even richer set of functions to handle File I/O. For more on this topic, we suggest you to check our Java Tutorials. Here, we will see a simple Java program, which is equivalent to the C program explained above. This program will open a text file, write a few text lines into it, and close the file. Finally, the same file is opened and then read from an already created file. You can try to execute the following program to see the output − import java.io.*; public class DemoJava { public static void main(String []args) throws IOException { File file = new File("/tmp/java.txt"); // Create a File file.createNewFile(); // Creates a FileWriter Object using file object FileWriter writer = new FileWriter(file); // Writes the content to the file writer.write("This is testing for Java write...\n"); writer.write("This is second line...\n"); // Flush the memory and close the file writer.flush(); writer.close(); // Creates a FileReader Object FileReader reader = new FileReader(file); char [] a = new char[100]; // Read file content in the array reader.read(a); System.out.println( a ); // Close the file reader.close(); } } When the above program is executed, it produces the following result − This is testing for Java write... This is second line... File I/O in Python The following program shows the same functionality to open a new file, write some content into it, and finally, read the same file − # Create a new file fo = open("/tmp/python.txt", "w") # Writes the content to the file fo.write( "This is testing for Python write...\n"); fo.write( "This is second line...\n"); # Close the file fo.close() # Open existing file fo = open("/tmp/python.txt", "r") # Read file content in a variable str = fo.read(100); print str # Close opened file fo.close() When the above code is executed, it produces the following result − This is testing for Python write... This is second line...
https://www.tutorialspoint.com/computer_programming/computer_programming_file_io.htm
CC-MAIN-2018-05
refinedweb
1,248
71.75
DNA Toolkit Part 2: Transcription and Reverse Complement finally replicate a real biological process. DNA into RNA Transcription and Complement Generation (Reverse Complement for computational purpose). DNA is an amazing way for nature to store instructions, it is biological code. It is efficient for computational use in two ways. Firstly, by having just a single strand of DNA we can generate another strand using a complement rule, and secondly, that data is very compressible. We will look into DNA data compression in our future articles/videos. In the two images below, we can see these three steps: - DNA Complement generation. - DNA -> RNA Transcription. - RNA -> Polypeptide -> Protein Translation. In this article, we will implement the first two steps, marked 1 and 2 in the second image. We start by adding one new structure DNA_ReverseComplement to our structures.py file as a Python dictionary. This dictionary will be used when we go through a DNA string, nucleotide by nucleotide. The dictionary will then return a complementary nucleotide. This approach is easy to understand as we just used a dictionary and a for loop. There is a more Pythonic way of generating a complement string, which is discussed later, DNA_Nucleotides = ['A', 'C', 'G', 'T'] DNA_ReverseComplement = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'} Now, let’s add a function that will use this dictionary to give us a complementary DNA strand and reverse it. def reverse_complement(seq): """ Swapping adenine with thymine and guanine with cytosine. Reversing newly generated string """ return ''.join([DNA_ReverseComplement[nuc] for nuc in seq])[::-1] Here we use a list comprehension to loop through every character in the string, matching it with a Key in DNA_ReverseComplement dictionary to get a Value from that dictionary. When we have a new list of complementary nucleotides generated, we use ‘’.join method to glue all the characters into a string and reverse it with [::-1]. So this approach is easy to read and understand. The code looks more structured as we used our predefined structures file. It is also translatable to other programming languages that way. Let’s try using Pythonic, maketrans method to solve this problem without even using a dictionary. def reverse_complement(seq): """ Swapping adenine with thymine and guanine with cytosine. Reversing newly generated string """ # Pythonic approach. A little bit faster solution. mapping = str.maketrans('ATCG', 'TAGC') return seq.translate(mapping)[::-1] Python string method maketrans() returns a translation table that maps each character in the intabstring into the character at the same position in the outtab string. Then this table is passed to the translate() function. Note − Both intab and outtab must have the same length. You can learn more about this method here: Python String maketrans() Method Next, we define the Transcription function. It is a very simple, one-liner in Python: def transcription(seq): """ DNA -> RNA Transcription. Replacing Thymine with Uracil """ return seq.replace("T", "U") This code is self-explanatory as we are using standard Python language functionality so far. Here, we just find every occurrence of Thymine and replace it with Uracil. We also return a new RNA string, without effecting original DNA string, passed through seq. You might have noticed we started using an interesting code commenting approach. We wrap our comments into: """ comment """ instead of # comment This is called a Dockstring. It is super useful when you have to write a complex algorithm, or you have many different parameters your function accepts. By adding a description in a form of a Dockstring, the code editor will show you that information when you call that function. For a demonstration of how this works, check out this Video. This is it. We are done implementing our two new functions. Let’s test them by adding the output from both to our main.py file. We will use f-strings again to nicely format the output. print(f'[3] + DNA/RNA Transcription: {transcription(DNAStr)}\n') print(f"[4] + DNA String + Complement + Reverse Complement:\n5' {DNAStr} 3'") print(f" {''.join(['|' for c in range(len(DNAStr))])}") print(f"3' {reverse_complement(DNAStr)[::-1]} 5' [Complement]") print(f"5' {reverse_complement(DNAStr)} 3' [Rev. Complement]\n") So here is the output for all 4 functions we implemented so far: Sequence: CCGTTGGATGGGCTAGTTCGTCCTTCCTACACCAGTGCAGGTGCGGTTTA [1] + Sequence Length: 50 [2] + Nucleotide Frequency: {'C': 13, 'G': 15, 'T': 15, 'A': 7} [3] + DNA/RNA Transcription: CCGUUGGAUGGGCUAGUUCGUCCUUCCUACACCAGUGCAGGUGCGGUUUA [4] + DNA String + Complement + Reverse Complement: 5' CCGTTGGATGGGCTAGTTCGTCCTTCCTACACCAGTGCAGGTGCGGTTTA 3' |||||||||||||||||||||||||||||||||||||||||||||||||| 3' GGCAACCTACCCGATCAAGCAGGAAGGATGTGGTCACGTCCACGCCAAAT 5' [Complement] 5' TAAACCGCACCTGCACTGGTGTAGGAAGGACGAACTAGCCCATCCAACGG 3' [Rev. Complement] As a bonus I have added coloring to our code, into a new file: utilites.py. This is not Bioinformatics related, but if you want to practice your Python, and add a function like that, you can view a video version of DNA Toolkit. Part 2 to see how this is done. We will add many more helper functions to utilites.py in the future. Functions for reading/writing files, reading/writing databases, etc. Here is a GitLab Link for this article: Link Video version of this article can be viewed here: This is it for now. See you in the next article. 1 Comment From Python to Rust. Part 3. - rebelScience · June 23, 2020 at 16:12 […] Dictionaries (Python) and Hash Maps (Rust). After we compare both, we will implement a DNA reverse_complement […]
https://rebelscience.club/2020/03/bioinformatics-in-python-dna-toolkit-part-2-transcription-and-reverse-complement/
CC-MAIN-2020-45
refinedweb
871
57.77
Nathan Van Gheem wrote: > Hello all, > > I realize my opinion may not matter very much, but as one who uses many > of the repoze packages often, I often wondered why the repoze namespace > was used for many of the packages. Advertising Because we're lazy and unoriginal. And we like being able to name a package: repoze.cms Rather than needing to come up with a name like: PhantasmaCMS > I am of the opinion that it hurts the potential adoption of some of the > great packages and is a little misleading in some cases. It does, and it is. > So I am in agreement with Malthe on this. I have thought the very same > thing he is talking about here often. TBH, I'm not really very worried about it for middleware packages and such. For larger things like BFG, yeah. But we have bw compat concerns, and so on and so on. So.. it is what it is. - C _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org
https://www.mail-archive.com/repoze-dev@lists.repoze.org/msg01552.html
CC-MAIN-2017-51
refinedweb
170
83.15
A. This helps isolate your environments for different projects from each other and from your system libraries. Virtual environments are sufficiently useful that they probably should be used for every project. In particular, virtual environments allow you to: virtualenv is a tool to build isolated Python environments. This program creates a folder which contains all the necessary executables to use the packages that a Python project would need. This is only required once. The virtualenv program may be available through your distribution. On Debian-like distributions, the package is called python-virtualenv or python3-virtualenv. You can alternatively install virtualenv using pip: $ pip install virtualenv This only required once per project. When starting a project for which you want to isolate dependencies, you can setup a new virtual environment for this project: $ virtualenv foo This will create a foo folder containing tooling scripts and a copy of the python binary itself. The name of the folder is not relevant. Once the virtual environment is created, it is self-contained and does not require further manipulation with the virtualenv tool. You can now start using the virtual environment. To activate a virtual environment, some shell magic is required so your Python is the one inside foo instead of the system one. This is the purpose of the activate file, that you must source into your current shell: $ source foo/bin/activate Windows users should type: $ foo\Scripts\activate.bat Once a virtual environment has been activated, the python and pip binaries and all scripts installed by third party modules are the ones inside foo. Particularly, all modules installed with pip will be deployed to the virtual environment, allowing for a contained development environment. Activating the virtual environment should also add a prefix to your prompt as seen in the following commands. # Installs 'requests' to foo only, not globally (foo)$ pip install requests To save the modules that you have installed via pip, you can list all of those modules (and the corresponding versions) into a text file by using the freeze command. This allows others to quickly install the Python modules needed for the application by using the install command. The conventional name for such a file is requirements.txt: (foo)$ pip freeze > requirements.txt (foo)$ pip install -r requirements.txt Please note that freeze lists all the modules, including the transitive dependencies required by the top-level modules you installed manually. As such, you may prefer to craft the requirements.txt file by hand, by putting only the top-level modules you need. If you are done working in the virtual environment, you can deactivate it to get back to your normal shell: (foo)$ deactivate Sometimes it's not possible to $ source bin/activate a virtualenv, for example if you are using mod_wsgi in shared host or if you don't have access to a file system, like in Amazon API Gateway, or Google AppEngine. For those cases you can deploy the libraries you installed in your local virtualenv and patch your sys.path. Luckly virtualenv ships with a script that updates both your sys.path and your sys.prefix import os mydir = os.path.dirname(os.path.realpath(__file__)) activate_this = mydir + '/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) You should append these lines at the very beginning of the file your server will execute. This will find the bin/activate_this.py that virtualenv created file in the same dir you are executing and add your lib/python2.7/site-packages to sys.path If you are looking to use the activate_this.py script, remember to deploy with, at least, the bin and lib/python2.7/site-packages directories and their content. From Python 3.3 onwards, the venv module will create virtual environments. The pyvenv command does not need installing separately: $ pyvenv foo $ source foo/bin/activate or $ python3 -m venv foo $ source foo/bin/activate Once your virtual environment has been activated, any package that you install will now be installed in the virtualenv & not globally. Hence, new packages can be without needing root privileges. To verify that the packages are being installed into the virtualenv run the following command to check the path of the executable that is being used : (<Virtualenv Name) $ which python /<Virtualenv Directory>/bin/python (Virtualenv Name) $ which pip /<Virtualenv Directory>/bin/pip Any package then installed using pip will be installed in the virtualenv itself in the following directory : /<Virtualenv Directory>/lib/python2.7/site-packages/ Alternatively, you may create a file listing the needed packages. requirements.txt: requests==2.10.0 Executing: # Install packages from requirements.txt pip install -r requirements.txt will install version 2.10.0 of the package requests. You can also get a list of the packages and their versions currently installed in the active virtual environment: # Get a list of installed packages pip freeze # Output list of packages and versions into a requirement.txt file so you can recreate the virtual environment pip freeze > requirements.txt Alternatively, you do not have to activate your virtual environment each time you have to install a package. You can directly use the pip executable in the virtual environment directory to install packages. $ /<Virtualenv Directory>/bin/pip install requests More information about using pip can be found on the PIP topic. Since you're installing without root in a virtual environment, this is not a global install, across the entire system - the installed package will only be available in the current virtual environment. Assuming python and python3 are both installed, it is possible to create a virtual environment for Python 3 even if python3 is not the default Python: virtualenv -p python3 foo or virtualenv --python=python3 foo or python3 -m venv foo or pyvenv foo Actually you can create virtual environment based on any version of working python of your system. You can check different working python under your /usr/bin/ or /usr/local/bin/ (In Linux) OR in /Library/Frameworks/Python.framework/Versions/X.X/bin/ (OSX), then figure out the name and use that in the --python or -p flag while creating virtual environment. The. If you are using the default bash prompt on Linux, you should see the name of the virtual environment at the start of your prompt. (my-project-env) [email protected]:~$ which python /home/user/my-project-env/bin/python. Fish shell is friendlier yet you might face trouble while using with virtualenv or virtualenvwrapper. Alternatively virtualfish exists for the rescue. Just follow the below sequence to start using Fish shell with virtualenv. Install virtualfish to the global space sudo pip install virtualfish Load the python module virtualfish during the fish shell startup $ echo "eval (python -m virtualfish)" > ~/.config/fish/config.fish Edit this function fish_prompt by $ funced fish_prompt --editor vim and add the below lines and close the vim editor if set -q VIRTUAL_ENV echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " " end Note: If you are unfamiliar with vim, simply supply your favorite editor like this $ funced fish_prompt --editor nano or $ funced fish_prompt --editor gedit Save changes using funcsave funcsave fish_prompt To create a new virtual environment use vf new vf new my_new_env # Make sure $HOME/.virtualenv exists If you want create a new python3 environment specify it via -p flag vf new -p python3 my_new_env To switch between virtualenvironments use vf deactivate & vf activate another_env Official Links: A. Sometimes the shell prompt doesn't display the name of the virtual environment and you want to be sure if you are in a virtual environment or not. Run the python interpreter and try: import sys sys.prefix sys.real_prefix Outside a virtual, environment sys.prefix will point to the system python installation and sys.real_prefix is not defined. Inside a virtual environment, sys.prefix will point to the virtual environment python installation and sys.real_prefix will point to the system python installation. For virtual environments created using the standard library venv module there is no sys.real_prefix. Instead, check whether sys.base_prefix is the same as sys.prefix.
https://sodocumentation.net/python/topic/868/virtual-environments
CC-MAIN-2021-10
refinedweb
1,340
54.93
basically what i need to do is firstly: to modify the existing ListQueue class to implement a priority queue. This will involve changing the QueueNode class to store a priority value (an integer) with each item of data. You will need to change the add method to handle the priority values. You will also need to provide a method to retrieve the priority value of the item at the head of the queue. Note that the class you develop will no longer conform to the Queue interface, but should rather have the following methods: public void add (T item, int pri); // Add new item to a queue with given priority public T remove (); // Remove item from head of queue public T head (); // Return a copy of item at head of queue public int getPriority (); // Return priority of item at head of queue public boolean isEmpty (); // Return TRUE if no items in queue In this context, lower priority values are associated with larger integer values, so, for example, an item with priority value of 1 has a higher priority than an item with a value of 5, and should come before it in the queue. The ListQueue class is as follows...if any1 can help ill greatly appreciate it, pls also explain what the code is doing. public class ListQueue<T> implements Queue<T> { private class QueueNode { public T data; public QueueNode next; } // inner class QueueNode /** Reference to the head (front) of the queue. */ private QueueNode hd; /** Reference to the tail (back) of the queue. */ private QueueNode tl; /** Create an empty queue. * <BR><I>Postcondition:</I> The queue is empty. */ public ListQueue () { hd = tl = null; } /** Add an item to the tail of a queue. * <BR><I>Postcondition:</I> The queue is not empty. * @param item The item to be added to the queue. */ public void add (T item) { QueueNode newNode = new QueueNode(); newNode.data = item; newNode.next = null; if (tl != null) tl.next = newNode; tl = newNode; if (hd == null) // First item in queue hd = tl; } // add /** Remove an item from the head of a queue. * <BR><I>Precondition:</I> The queue is not empty. * <BR><I>Postcondition:</I> The item at the head of the queue is removed and returned. * @return The item from the head of the queue. * @throws Assertionerror If the queue is empty. */ public T remove () { assert hd != null; T tmpData = hd.data; hd = hd.next; if (hd == null) // Was last element tl = null; return tmpData; } // remove /** Return a copy of the item at the head of a queue. * <BR><I>Precondition:</I> The queue is not empty. * @return The value of the item at the head of the queue. * @throws Assertionerror If the queue is empty. */ public T head () { assert hd != null; return hd.data; } // head /** Tell if a queue contains any items. * @return <CODE>true</CODE> if there are no items in the queue, otherwise <CODE>false</CODE>. */ public boolean isEmpty () { return hd == null; } // isEmpty } // class ListQueue
http://www.dreamincode.net/forums/topic/160407-priority-queues-and-linked-lists/page__p__950909
CC-MAIN-2016-18
refinedweb
491
74.59