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
Closed Bug 727306 Opened 10 years ago Closed 10 years ago GC: specialize post write barrier for object slots Categories (Core :: JavaScript Engine, defect) Tracking () mozilla13 People (Reporter: terrence, Assigned: terrence) References Details Attachments (1 file, 2 obsolete files) Because we need to re-alloc the object slots pointers for slots growth and actively move it between objects in TradeGuts, we cannot safely store pointers to slots in our write buffer. Instead we want to store a pair of JSObject* + offset in the write buffer. This effectively means that we need to specialize the HeapValue::postWriteBarrier used when storing to slots. The simplest way to do this is to sub-class HeapValue and use this sub-class for object slots. This ended up being way less trouble than I thought it would be: there were only two operator= uses to replace. Comment on attachment 597506 [details] [diff] [review] v0 Talked to Terrence about this. Looks good with a few revisions. This is still quite nice. Making HeapSlot inconvertible basically just expands the quantity of stuff that we need to rename. The only large refactoring I did was removing InitValueRange. I would have had to copy and add InitSlotRange and make it take 3 new parameters. This left one user of InitValueRange and 3 users of the new, uglified InitSlotRange. Since it's a 2 liner, I just inlined it everywhere and deleted Init*Range. There also didn't appear to be users of ClearValueRange and DestroyValueRange, so I deleted them as well - did they already get inlined into jsobj in some other patch? Let me know if I'm missing something, and I'll add them back. Attachment #597506 - Attachment is obsolete: true Comment on attachment 599372 [details] [diff] [review] v1: Made HeapSlot inconvertable with HeapValue. Review of attachment 599372 [details] [diff] [review]: ----------------------------------------------------------------- This basically looks good, although I'm a little worried that more changes will be necessary after making operator= private. ::: js/src/gc/Barrier-inl.h @@ +176,5 @@ > } > > +inline void > +HeapSlot::init(JSCompartment *comp, const Value &v, const JSObject *obj, uint32_t slotno) > +{ Please change slotno here as well. Also, here and in ::set, I think we should be able to assert the following: JS_ASSERT(&obj->getSlotRef(slot) == this); ::: js/src/gc/Barrier.h @@ +369,5 @@ > > +/* > + * Provides specialized heap barriers for object slots. > + */ > +class HeapSlot How about having a class EncapsulatedValue that HeapValue and HeapSlot can derive from? It would have the value, and it would also have all the isX methods. This would cut down on the code duplication and it doesn't require templates. @@ +375,5 @@ > + Value value; > + > + public: > + inline void init(JSCompartment *comp, const Value &v, const JSObject *owner, uint32_t slotno); > + inline void set(JSCompartment *comp, const Value &v, const JSObject *owner, uint32_t slotno); I don't think we need to pass the compartment here, since it's easy to get it from the object. And I think that a better order for the arguments would be (owner, slot, v). Also, jsobj.h seems to use slot as the name, rather than slotno, so I'd rather use that. (Although sometimes it seems to use index.) ::: js/src/jsgcmark.cpp @@ +1028,5 @@ > * The function uses explicit goto and implements the scanning of the > * object directly. It allows to eliminate the tail recursion and > * significantly improve the marking performance, see bug 641025. > */ > + Value *vp, *end; This is my fault, but I just noticed that we only ever deal with HeapSlots for this function. So can you make these HeapSlot* and then remove the casts? ::: js/src/jsinterp.h @@ +352,5 @@ > #endif > } > > +static JS_ALWAYS_INLINE void > +Debug_SetValueRangeToCrashOnTouch(HeapSlot *vec, size_t len) Probably Debug_SetSlotRangeToCrashOnTouch would be a better name. ::: js/src/jsobj.h @@ +427,5 @@ > ObjectElements(uint32_t capacity, uint32_t length) > : capacity(capacity), initializedLength(0), length(length) > {} > > + HeapSlot* elements() { return (HeapSlot *)(uintptr_t(this) + sizeof(ObjectElements)); } The style isn't very consistent in this file, but we try to use |HeapSlot *elements() ...|. Please change this one and fromElements. ::: js/src/jsobjinlines.h @@ +633,2 @@ > for (unsigned i = 0; i < count; i++, dst++, src++) > *dst = *src; Uh oh. I think you probably want to make operator= private for HeapSlot. And these assignments should be converted to sets. Otherwise these assignments won't end up with any barriers at all. @@ +638,2 @@ > for (unsigned i = 0; i < count; i++, dst--, src--) > *dst = *src; Same here. @@ +1039,3 @@ > JSObject::initializeSlotRange(size_t start, size_t length) > { > + Why the extra line? ::: js/src/jsxml.cpp @@ +7535,5 @@ > > namespace js { > > bool > +GlobalObject::getFunctionNamespace(JSContext *cx, HeapSlot *sp) I don't understand why this needs to change. Why can't it just be a Value*? Thanks for all the help getting this whipped into shape! I think this version is looking pretty close to good. The only thing I'm not entirely sure about is what exact set of methods, overrides, and delete keywords I need and/or should have for the constructor, destructor, and operator= in the EncapsulatedValue class stack. It appears that these work a bit differently from other methods, in that C++ seems to prefer to create a default instead of calling the base class implementation. I've "solved" this by putting concrete instances of these methods in all the derived classes (even when identical) and making the base class implementations private and deleted. One exception is the base constructor and destructor, which appear to require an implementation, even if never called directly. All shell tests are passing locally and I've started another try build to test the browser: Attachment #599372 - Attachment is obsolete: true Attachment #600534 - Flags: review?(wmccloskey) Comment on attachment 600534 [details] [diff] [review] v2: With review feedback. Review of attachment 600534 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. Just a few small fixes. ::: js/src/gc/Barrier-inl.h @@ +220,5 @@ > + > +inline void > +HeapSlot::set(const JSObject *obj, uint32_t slot, const Value &v) > +{ > + JS_ASSERT_IF(!obj->isArray(), &const_cast<JSObject *>(obj)->getSlotRef(slot) == this); Could you additionally assert that if it is an array, then &obj->getDenseArrayElement(slot) == (const Value *)this ? And the same in the other ::set method. @@ +239,5 @@ > + js::gc::Cell *cell = (js::gc::Cell *)value.toGCThing(); > + JS_ASSERT(cell->compartment() == comp || > + cell->compartment() == comp->rt->atomsCompartment); > + } > +#endif You can remove this #ifdef block and replace it with JS_ASSERT(obj->compartment() == comp). ::: js/src/gc/Barrier.h @@ +399,5 @@ > + explicit inline HeapSlot(const JSObject *obj, uint32_t slot, const HeapSlot &v); > + inline ~HeapSlot(); > + > + inline void init(const JSObject *owner, uint32_t slot, const Value &v); > + inline void init(JSCompartment *comp, const JSObject *owner, uint32_t slot, const Value &v); I should have mentioned this earlier, but can you take out the const specified on the JSObject*? I'm not aware of any other place where we put const on a JSObject*. I don't think there's much benefit to having const here, and it will just cause additional casts and more consts down the road. Please fix this throughout the patch. ::: js/src/jsarrayinlines.h @@ +66,5 @@ > if (initlen < index + extra) { > + JSCompartment *comp = compartment(); > + size_t offset = initlen; > + for (js::HeapSlot *sp = elements + initlen; sp != elements + (index + extra); sp++) > + sp->init(comp, this, offset++, js::MagicValue(JS_ARRAY_HOLE)); Could you increment offset in the for loop, rather than in the init statement? That might be a little clearer. ::: js/src/jsobj.cpp @@ +3853,4 @@ > } > > inline void > JSObject::invalidateSlotRange(size_t start, size_t length) We might as well use getSlotRange here if you feel like changing it. ::: js/src/jsobjinlines.h @@ +595,5 @@ > { > JS_ASSERT(dstStart + count <= getDenseArrayCapacity()); > JSCompartment *comp = compartment(); > for (unsigned i = 0; i < count; ++i) > + elements[dstStart + i].set(comp, this, i, src[i]); Shouldn't this be dstStart+i as the argument to set? @@ +604,5 @@ > { > JS_ASSERT(dstStart + count <= getDenseArrayCapacity()); > JSCompartment *comp = compartment(); > for (unsigned i = 0; i < count; ++i) > + elements[dstStart + i].init(comp, this, i, src[i]); Same here. @@ +634,2 @@ > for (unsigned i = 0; i < count; i++, dst++, src++) > + dst->set(comp, this, dstStart + i, *src); It's probably safer to do this: dst->set(comp, this, dst - elements, *src); @@ +639,2 @@ > for (unsigned i = 0; i < count; i++, dst--, src--) > + dst->set(comp, this, dstStart + count - 1 - i, *src); ...and the same should work here. ::: js/src/jswrapper.cpp @@ +875,1 @@ > "wrappedObject"); The spacing here is slightly off. Attachment #600534 - Flags: review?(wmccloskey) → review+ Status: NEW → RESOLVED Closed: 10 years ago Resolution: --- → FIXED Target Milestone: --- → mozilla13
https://bugzilla.mozilla.org/show_bug.cgi?id=727306
CC-MAIN-2022-21
refinedweb
1,384
54.73
Answered by: Connecting to non-WiFi Direct device - The WiFi Direct spec allows backwards compatibility, that is it allows for a WiFi Direct device to connect to a "legacy" WiFi device, does Win8 support this functionality? If so, how do I go about doing this? I'm somewhat familiar with the Proximity namespace and PeerFinder and all that good stuff, but that all seems to be dependent on two WiFi Direct devices connecting. Friday, September 7, 2012 8:35 PM - Moved by Rob Caplan [MSFT]Microsoft employee, Owner Friday, September 7, 2012 9:01 PM (From:Building Windows Store apps with C# or VB ) Question Answers All replies I will look into this for you. Best Wishes - EricMonday, September 10, 2012 6:35 PMModerator - Thanks, I would greatly appreciate it. This has been holding us back a bit.Tuesday, September 11, 2012 4:43 PM I'm not sure I understand the question. Proximity is not limited to WiFi Direct, the PeerFinder will use infrastructure WiFi as well as Bluetooth to setup a socket between two apps. In terms of WiFi Direct support on legacy WiFi hardware, it is likely that many existing WiFi cards will support WiFi Direct in the near future. For many devices they merely require an updated driver from the hardware vendor. -Mike [MSFT] Friday, September 14, 2012 1:08 AM - Proposed as answer by Mike L [MSFT] Friday, September 14, 2012 1:08 AM - Marked as answer by Eric Hanson-MSFTMicrosoft employee, Moderator Friday, September 14, 2012 6:19 PM - Unmarked as answer by NokItOff Thursday, September 20, 2012 9:08 PM Hi Mike, I appreciate your response but unfortunately it doesn't answer my question. I'm aware that Proximity allows connecting through a WiFi network and over Bluetooth, my questions is specifically about the device-to-device connection over WiFi. WiFi Direct supports this scenario because one device will just act as an Access Point and the other will connect to it as it does to any other AP. So that second device doesn't need to support WiFi Direct. If I was able to get the Soft AP information (i.e. SSID and Key) then I could code it myself but as far as I can tell that information isn't available to us. Or is it? If not, does Win8 automate this process? Again, I'm specifically concerned about the device-to-device connection over WiFi where one device supports WiFi Direct and the other doesn't. Connecting over infrastructure WiFi is fine IFF both devices are connected to the same WiFi network but WiFi networks aren't always available and even if they are it's not guaranteed that both devices will have access. Connecting over Bluetooth would work when there aren't WiFi networks around, but Bluetooth connections are rather slow and aren't suited for transferring large amounts of data like WiFi is.Thursday, September 20, 2012 9:18 PM hi , can we able to connect two non wi-fi direct supporting device via wi-fi i mean if bith the devices are connected to same AP. Any hint would be highly appreciated! Thank you all. Wednesday, June 19, 2013 5:43 AM The Wifi Direct specification indicates that non-WFD enabled devices can connect to a WFD Group Owner as it were a traditional Access Point. Is there some documentation on how the Windows Wifi Direct implementation differs from the specification?Thursday, July 18, 2013 12:30 AM
https://social.msdn.microsoft.com/Forums/en-US/7d7f7c22-8739-41d2-9d3a-64091613a694/connecting-to-nonwifi-direct-device?forum=tailoringappsfordevices
CC-MAIN-2018-30
refinedweb
581
59.53
29 October 2008 15:10 [Source: ICIS news] By Ben Lefebvre HOUSTON (ICIS news)--For any chemical company composing a list of its Christmas wishes, the disappearance of the bisphenol A (BPA) controversy is probably near the top of the page. They may be in for a disappointment, however. BPA is going to stay in the news, no matter how good suppliers have been over the course of the year. Chemical companies have been beating the drums for about 10 years now that BPA, a necessary ingredient in polycarbonate (PC) products, is safe. Despite the steady release of studies showing at least hints of links to diabetes, cancer and developmental problems in foetuses, the industry has intoned a familiar mantra: more research is needed . But with the latest revelation that the US Food and Drug Administration (FDA) based its decision that BPA was safe on consultants with strong ties to the chemical industry - including Steven Hentges of the American Chemistry Council (ACC) - an already wary public has decided it would rather not trust the chemical sector when it comes to this particular issue. “Who says that science isn't for sale? Here's hoping the FDA gets it right, but I'm not holding my breath. In the meantime, I’ll do what I can to avoid BPA, from not using polycarbonate plastic to skipping canned foods and beverages,” a blogger at the Smart Mama website wrote on 24 October. A quick scan of the internet reveals this is not a lone voice. The ACC said it has done nothing wrong, and that the industry is “a stakeholder, just like everyone else” in the process. It has spent at least $1m (€790,000) in funding reports on BPA and at least another $1m in its successful fight against a bill in California that would have banned PC products for infants. But while the trade association has spent millions of dollars to ensure chemical companies can continue to sell products containing BPA unfettered, it has become clear that while they may be winning (or at least drawing out) the legislative battle, the industry may be losing the public relations war. Most of the controversy surrounds PC food-contact containers for infants. Buyers who have decided they cannot trust the industry are turning to glass baby bottles and other alternatives, while retailers such as Wal Mart have purged PC water bottles and the like from their shelves. Eastman Chemical may be the only company to have benefited from the controversy when it introduced water bottles made of its BPA-free Tritan monomer. David Rosner, professor of sociomedical science and history at Columbia University, said the industry had to realise that as the general public are increasingly sensitive to the presence of chemicals in everyday products, holding out that more research is needed is no longer a winning strategy. “They have to acknowledge a paradigm shift among toxicologists and the public as to what is acceptable risk,” Rosner said. "We’re undergoing a profound social discussion on the importance and safety of a whole range of materials that we couldn’t even measure before." Most PC and BPA suppliers continue to say publicly that BPA causes no detrimental effects and that consumers’ concerns are overblown. The ACC has deemed a growing number of reports inconclusive, including those by the National Toxicology Program and the Journal of the American Medical Association, that have indicated BPA may damage health. At the same time, it has trumpeted its own studies showing that the chemical is perfectly safe. Sarah Vogel, a fellow at the Chemical Heritage Foundation who has studied the history, politics and science of BPA, said that this sort of blanket reaction has made the public increasingly cynical about the chemical industry. “The industry's response of throwing money at the problem with the hopes that it will just go away has backed it into a corner where they are losing the public's trust,” Vogel said. "This is why consumers have begun making their own risk decisions by dumping polycarbonate bottles and demanding safer alternatives." Vogel added that for the industry to gain some credence on the issue, it would have to concede the possibility that BPA may cause health detriments and stop manufacturing PC products for children, infants and pregnant women. It would also have to provide funds for research conducted by independent laboratories. Having said that, however, Vogel doubted they would. BPA is too much of a money maker, and any admission that it could cause health problems could open companies to similar charges against other commercial products, she said. There are signs that the industry is fighting a losing battle. On 17 October, Canadian health agency Health ?xml:namespace> In the US, the influential House Committee on Energy and Commerce is in the midst of a feud with the FDA and has indicated it would like to see children’s products free of BPA and epoxy resins. On the issue of BPA, the chemical industry is taking much the same stance as it did when it upheld the safety of DDT (dichloro-diphenyl-trichloroethane) in the 1960s, and vinyl chloride and benzene in the 1970s. As 2009 approaches, producers may want to make their own New Year pledges: more pro-active solutions for the BPA problem and less money for preaching what the public clearly does not believe. ($1 = €0.79) For more information
http://www.icis.com/Articles/2008/10/29/9167028/INSIGHT-Industry-needs-new-BPA-strategy.html
CC-MAIN-2014-52
refinedweb
903
54.26
. def words_to_marks(s): word_list = list(s) a_z = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x','y', 'z'] sum = 0 for w in word_list: sum += a_z.index(w) + 1 return sum As you might guess, the above is just another question from CodeWars. Dear readers, I am working hard to build this website just for Python from now onward, if you like this post, do share the post on any social media site, thank you. Leave your comment or provide your own solution below this post. Please follow and like us: 3 Comments This solution is O(n*n) whereas it is easy to write an O(n) solution in at least 2 ways. Hello, Here is another solution: “` In [15]: def words_to_marks(s): …: letter_values = {letter: idx for idx, letter in enumerate(string.ascii_lowercase, 1)} …: return sum(map(lambda x: letter_values[x], s)) …: In [16]: words_to_marks(“python”) Out[16]: 98 “` nice
https://kibiwebgeek.com/summation-of-alphabet-position-with-python/
CC-MAIN-2021-04
refinedweb
166
66.67
Test for Normal Distribution of Data with Python: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy import stats Pandas will be used to handle the dataframe; numpy will be used to calculate a few key statistics such as median and standard deviation as well as to draw random samples from the dataset, matplotlib.pyplot and seaborn will be used together to generate the plot, and scipy will be used for the mathematical calculation of the normal statistics. Next, let's define a function that will generate plottable points: def ecdf(data): """Compute ECDF for a one-dimensional array of measurements.""" # Number of data points: n n = len(data) # x-data for the ECDF: x x = np.sort(data) # y-data for the ECDF: y y = np.arange(1, n+1) / n return x, y This function takes a list of sample readings (temperatures in this example) and sorts them from lowest to highest. It returns a set of (x,y) pairs that represent the temperature reading and the relative position in the sorted list, or percentile, of each reading. Next, we'll run that function on our sample data to get plottable datapoints. x, y = ecdf(df["temperature"]) We can then use matplotlib and seaborn to plot our sample data with the following code: plt.figure(figsize=(8,7)) sns.set() plt.plot(x, y, marker=".", linestyle="none") plt.xlabel("Body Temperature (F)") plt.ylabel("Cumulative Distribution Function") Running this will yield a chart that looks like the following: Excellent! We can really start to see the curve here. Now, in order to compare this to a perfect normal distribution, we'll need to plot a second series of data. This could be done in a number of ways, but in this tutorial, we'll use a technique called bootstrapping to accomplish the task. The following code will generate 10,000 'temperatures' that follow a normal distribution using the mean and the standard deviation of our dataset to scale the range. samples = np.random.normal(np.mean(df["temperature"]), np.std(df["temperature"]), size=10000) This data will just be a list of temperatures. We can transform this randomized data into x,y pairs using the same function we defined earlier, allowing us to plot the data alongside the actual samples with the following code: x_theor, y_theor = ecdf(samples) These theoretical examples represent how the data would look if we had 10,000 samples and the distribution of the readings were perfectly normal. It's a hypothetical we can use to compare reality. Let's plot this on the same chart as our earlier data with the following code and add a legend: plt.plot(x_theor, y_theor) plt.legend(('Normal Distribution', 'Empirical Data'), loc='lower right') And of course, don't forget the output function: periscope.output(plt) We should get a chart like this: Check that out! It looks like our sample data (blue) is very close to the true normal distribution! We can probably consider this data normally distributed. Let's add one more line of code to provide further insight into the distribution: print(stats.normaltest(df["temperature"])) Anything printed can be seen in the Stdout tab: This will run SciPy's normal test and print the results including a p representing A 2-sided chi squared probability for the hypothesis test. If the p value is less than our alpha (significance value), we can reject the hypothesis that this sample data is normally distributed. If greater, we cannot reject the null hypothesis and must conclude the data is normally distributed. Give it a try! Based on this examination of 130 samples, can we conclude that human body temperature is normally distributed?
https://community.periscopedata.com/t/18bzry/test-for-normal-distribution-of-data-with-python
CC-MAIN-2019-39
refinedweb
626
53.61
Microsoft's eMbedded Visual C compilers have no possibility for using inline assembly for the ARM family of microprocessors other than emitting the raw opcode. The macros of the Mono Jit for ARM can be rather easily used to do that in a more convenient manner. This article only deals with assembly for ARMV4 versions of Windows CE, which means versions before Windows Mobile 5. The methods used, in the exact form that they are presented here, may not work on ARMV4I and ARMV4T platforms; that has not been tested. Code written in machine language is often still faster than code written in C, but we generally don't use assembly anymore to compete with C for the purpose of speed. In the past couple of years, however, bytecode languages as Lua and Cil have become increasingly important and they can be dramatically sped-up with Jits. A Jit first translates the otherwise "bureaucratically" interpreted individual bytecodes to one or more assembly instruction(s), puts them together in a row, and only then executes them. This is one of the reasons that Jits start up slowly, but are subsequently real fast. I feel that abstract bytecode and Jits are the way to go for the future, because the combination is theoretically platform-independent and simpler to use for the common programmer. Unfortunately, no generally used standard for bytecode has yet surfaced: there are (way too) many variations on the same theme around, but hopefully this will change in time. I discovered that the macros of the Mono ARM Jit can be easily used for eVC by looking at the source code of an implementation of Ogl/Es for Windows CE that can be downloaded from Sourceforge. The author seems to have developed more general wrappers around the macros, but I will not use them here, although I think that an abstract machine language in itself could be very useful. Maybe it could even turn out to be a condition for developing a bytecode standard. The Mono ARM assembly macros are in a couple of header files; most notably arm-codegen.h and arm_dpimacros.h, and optionally arm-dis.h for disassembling the generated code, which I found real neat. I used Mono version 1.2.4, and corrected a bug for backward branches: #define ARM_DEF_BR(offs, l, cond) \ ((offs) | ((l) << 24) | (ARM_BR_TAG) | (cond << ARMCOND_SHIFT)) in arm-codegen.h should be: #define ARM_DEF_BR(offs, l, cond) \ ((offs & 0x00FFFFFF) | ((l) << 24) |(ARM_BR_TAG) | (cond << ARMCOND_SHIFT)) because branch offsets are 24 bit for the ARM, and negative offset numbers when using the branch macros extend to 32 bit, which interferes with the rest of the opcode. Possibly, Mono uses backward branches in a different way; I looked into that too briefly to tell. Branches are used by regarding the branch instruction itself as being at offset -2, the next instruction at -1 and the previous one at -3, etc. Some of the more complicated basic ARM operations are not implemented as macros but as functions; like arm_mov_reg_imm32(). In these functions, the index pointer to the instruction array is local and it is therefore not automatically updated, but its new value is returned. I put these functions, and the disassembler functions in a library named ArmJit.lib. In order to use the macros, you have to include the appropriate header files in your source code and if you need the functions, link with the lib. arm_mov_reg_imm32() ArmJit.lib To make the procedure more understandable, I made a small test program that implements the simple Fibonaccio benchmark in 13 ARM instructions. For fun, the speed is compared to the commonly used C implementation, and it turns out that the ARM version is over 30% faster, but, as stated, competing with C is generally not the purpose of using assembly anymore. Here's the program and I'll comment below it: #include <windows.h> #include <stdio.h> #include <arm-codegen.h> #include <arm-dis.h> unsigned long fib_c(unsigned long n) { if (n < 2) return(1); else return(fib_c(n-2) + fib_c(n-1)); } void setup_fib_jit (unsigned int *pins) { /* label1 */ ARM_CMP_REG_IMM8 (pins, ARMREG_R0, 2); /* is n < 2 ? */ ARM_MOV_REG_IMM8_COND (pins, ARMREG_R0, 1, ARMCOND_LO); /* if yes return value is 1 */ ARM_MOV_REG_REG_COND (pins, ARMREG_PC, ARMREG_LR, ARMCOND_LO); /* if yes return address in PC; */ /* and exit to main or previous recursive call */ ARM_PUSH2 (pins, ARMREG_R0, ARMREG_LR); /* save n and return address to the stack*/ ARM_SUB_REG_IMM8(pins, ARMREG_R0, ARMREG_R0, 2); /* n = n-2 */ ARM_BL (pins, -7); /* recurse to label1 for fib(n-2) */ ARM_LDR_IMM (pins, ARMREG_R1, ARMREG_SP, 0); /* load n from the stack */ ARM_STR_IMM (pins, ARMREG_R0, ARMREG_SP, 0); /* store result fib(n-2) */ ARM_SUB_REG_IMM8(pins, ARMREG_R0, ARMREG_R1, 1); /* n = n-1 */ ARM_BL (pins, -11); /* recurse to label1 for fib(n-1) */ ARM_POP2 (pins, ARMREG_R1, ARMREG_LR); /* pop result fib(n-2) and return address */ ARM_ADD_REG_REG (pins, ARMREG_R0, ARMREG_R0, ARMREG_R1); /* add both results */ ARM_MOV_REG_REG (pins, ARMREG_PC, ARMREG_LR); /* return address in PC; */ /* and exit to main or previous recursive call */ } int main (int argc, char *argv[]) { unsigned int n, ins[500], *pins = ins; unsigned long (*fib_jit)(int n) = (unsigned long (*)(int n)) ins; unsigned long r1, r2, t0, t1, t2; setup_fib_jit (pins); _armdis_dump (stdout, ins, 56); if (argc <= 2) { if (argc == 1) n=1; else n=atoi (argv[1]); t0 = GetTickCount(); r1 = fib_c (n); t1 = GetTickCount(); r2 = fib_jit (n); t2 = GetTickCount(); } else { fprintf (stderr, "%s: Wrong number of arguments\n", argv[0]); exit (-1); } printf (" fib_c(%d) result: %d\n\texcution time: %lf\n", n, r1, (t1-t0) / 1000.0); printf ("fib_jit(%d) result: %d\n\texcution time: %lf\n", n, r2, (t2-t1) / 1000.0); return 0; } Using the macros presupposes a great deal of basic knowledge of machine language programming in general, and some basic knowledge of the ARM microprocessor family in particular. The assembly instructions in the function setup_fib_jit() are commented in the program, and I will not get into that here; it is beyond the scope of this article. Comparing the comments to the C version above it will probably give an adequate impression of what goes on; it is virtually a 1 on 1 translation of the C algorithm. I will now rather concentrate on setting up the code and using the macros in practice. setup_fib_jit() First we need to have an array for the actual opcode instructions; in this case the array is named ins[]. The ARM opcodes are 32 bits each on the ARMV4 platform, which corresponds to unsigned int on my version of Windows CE. Use UINT32 as the type of the array instead if you want to be safe. An index pointer to this array, *pins is also needed for the macros to determine where to put the opcodes. The macros update this pointer themselves, so we can use them without having to care for that. Note that compared to normal programming, the actual assembly function is being "set up" rather than that the function *is* the code: the actual code will not be "in" setup_fib_jit(), but in the array ins[]! ins[] int UINT32 *pins After the opcode array has been filled with the instructions, we must enable ourselves to jump to it by casting the array to a function variable. That is done with the declaration: unsigned long (*fib_jit)(int n) = (unsigned long (*)(int n)) ins; We can then call fib_jit() as an ordinary function. The n argument will be passed to it in ARM register 0, which is usual for the first parameter of a __cdecl function on the ARM WinCE platform. Register 0 is also used to pass the return value to main() when the function exits. I think that the rest of main() is self-explanatory. Input and output of the benchmark are from/to the console; you need one to run this program. I personally use PocketConsole (that I adapted to work in VGA, hence hidpi.res in the project), which is available on the Internet. fib_jit() n __cdecl main() Once I got started, I found using the Mono code surprisingly easy and very interesting. I've been having plans for writing a C interpreter for my Toshiba E800 Pocket PC for a long time, and maybe this tool will get me to actually do it. Don't count on it though; rather write it yourself . The original zip file and the article have had a minor update: the ARM function of the test program has been speed.
http://www.codeproject.com/Articles/19027/ARM-Assembly-for-eVC-with-the-Mono-Jit-Macros?fid=424382&df=10000&mpp=10&sort=Position&spc=Relaxed&tid=2077985&noise=1&prof=True&view=Quick
CC-MAIN-2016-18
refinedweb
1,396
56.39
Convert InputStream to Byte Convert InputStream to Byte In this example we are going to convert input stream to byte. Here we are going to read input stream and converting array manipulation - Java Beginners [] nums, int val) { } Hi friend, Read in detail with array example at: manipulation We'll say that a value is "everywhere Java read binary file Java read binary file I want Java read binary file example code that is easy to read and learn. Thanks Hi, Please see the code at Reading binary file into byte array in Java. Thanks Hi, There is many array example - Java Beginners array example hi!!!!! can you help me with this question... dependents to Employee that is an array of Dependent objects, and instantiate a five-element array * while this isn't the best practice, there isn't a much better How do I initialize a byte array in Java? How do I initialize a byte array in Java? How do I initialize a byte array in Java How to read a byte. Description In the given Example, you will see how to use read method of CheckedInputStrem class. It reads single byte of data from the input stream and updates the checksum from that byte data which it read. When data transmit ARRAY SIZE!!! - Java Beginners ARRAY SIZE!!! Hi, My Question is to: "Read integers from the keyboard until zero is read, storing them in input order in an array A. Then copy them to another array B doubling each integer.Then print B." Which seems how to create a zip by using byte array how to create a zip by using byte array hi, How to convert byte array to zip by using java program.can u plz provide it...... Thanks, krishna What is the byte range? - Java Beginners What is the byte range? Hi, Please tell me range in byte. Thanks The range is: 128 to 127 Thanks Convert a string representation of a hex dump to a byte array using Java? Convert a string representation of a hex dump to a byte array using Java? Convert a string representation of a hex dump to a byte array using Java Core Java tutorial for beginners Core Java tutorials for beginners makes its simpler for novices to learn the basic of Java language. In order to make it simpler to understand... in java Java SimpleDateFormat Example How Java Array - Java Beginners Java Array Can someone help me to convert this to java? I have an array called Projects{"School", "House", "Bar"} I want all the possible combinations but only once each pair, for example ["House", "Bar"] is the SAME RandomAccessFile & FileInputStream - Java Beginners :// Thanks...("abc.txt"); byte[] b = new byte[(int)f.length()]; RandomAccessFile raf = new The byte Keyword ; The byte Java Keyword defines the 8-bit integer primitive type. The keyword byte in Java is a primitive type that designates with eight bit signed integer in java primitive type. In java keyword byte will be stored as an integer Array sorting - Java Beginners Array sorting Hello All. I need to sort one array based on the arrangement of another array. I fetch two arrays from somewhere and they are related. For example, String type[] = {"X","T","3","R","9"}; String java image converting to byte codes - Java Beginners java image converting to byte codes i want to convert an image to human unreadable format which is uploaded by client to server.How can i do SIZE. - Java Beginners ARRAY SIZE. Thanks, well that i know that we can use ArrayList... the elements in array A. Then doubled array A by multiplying it by 2 and then storing it in array B. But gives me error. import java.io.*; import  String Array - Java Beginners String Array From where can I get, all the functions that are needed for me to manipulate a String Array. For Example, I had a String Array ("3d4..., as to by which method can I separate the Integers from this Array of String xml using java read xml using java <p>to read multiple attributes... consumption shall not exceed 230 Byte The Runtime of the software shall... consumption shall not exceed 120 Byte The ROM consumption shall not exceed 16000 array - Java Beginners array Write a program that read 15 integers between 0 and 6 and a method to search, displays and returns the number that has the highest occurrence. Prompt the user if the number is not within this range. Hi Program to read a dynamic file content - Java Beginners Program to read a dynamic file content Hi, In a single.... For example: Folder name "Sample". Inside that "010209.txt... the database. Im using MySql Database and a standalone java program. I Read the File the data is read in form of a byte through the read( ) method. The read... Read the File As we have read about the BufferedInputStream class convert zip file to byte array convert zip file to byte array Hi,How to convert zip file to byte array,can you please provide program?? Thanks, Ramanuja Java Read File Line by Line - Java Tutorial Java example for Reading file into byte array... Java example for Reading file into byte array... Java Read File Line by Line - Example code of reading the text file sorting an array of string with duplicate values - Java Beginners sorting an array of string Example to sort array string read a file read a file read a file byte by byte import java.io.File... { FileInputStream fin = new FileInputStream(file); byte fileContent[] = new byte[(int) file.length()]; fin.read(fileContent How to Read file line by line in Java program having less amount of memory. In the example of Java Read line by line below... by line in Java. But there are various ways that can help read a larger file...()?. The output of read file line by line in Java is printed on console Read from a window - Java Beginners Read from a window HI, I need to open a website and read the content from the site using Java script. Please suggest. Thanks a zip file. zip_entry_read() In this example the function zip_entry_read() will help... file and direct the zipread command to read it through while loop. The zip_entry_read command will read one byte at a time. when it reads all the contents read image read image java code to read an image in the form of an array.  ... image = ImageIO.read(input); int array[]=getImagePixels(image); for(int i=0;i<array.length;i++){ System.out.println(array[i To read a excel with chart - Java Beginners To read a excel with chart Hi, I need to read the data in an excel which is in chart format using java. when I directly change the extention of excel file to CSV i am not getting the data in the chart.Please help me Array in Java ] = 80; int[4] = 90; Example of array in Java: import java.util.*; public.... Different types of array used in Java are One-dimensional, Two-dimensional and multi..., or an array of Objects. For example: int[][] i; int[][] i = new int[3][4]; int Example Code - Java Beginners Example Code I want simple Scanner Class Example in Java and WrapperClass Example. What is the Purpose of Wrapper Class and Scanner Class . when i compile the Scanner Class Example the error occur : Can not Resolve symbol array - Java Beginners array WAP to perform a merge sort operation. Hi Friend, Please visit the following link: Hope that it will be helpful for you. Thanks Java I/O Examples Byte Streams Example In this section we will discuss how to read one byte... the stream, byte stream and array of byte stream. Classes... provided by java. io package. This is a class that allows you to read How to read loops in Java How to read loops in Java Example that explains how to read loop in Java Read file in java Read file in java Hi, How to Read file in java? Thanks Hi, Read complete tutorial with example at Read file in java. Thanks example explanation - Java Beginners example explanation can i have some explanation regarding...(); } } } --------------------------------------------- Read for more information. Array - Java Beginners Array how to declare array of hindi characters in java ShortBuffer in java, Define the order of byte in short buffer. ShortBuffer in java, Define the order of byte in short buffer... byte array into byte buffer. abstrtact ShortBuffer ...; byte[] array=new byte[]{3,4,65};   array sort - Java Beginners array sort hi all, can anybody tell me how to sort an array... array[], int len){ for (int i = 1; i < len; i++){ int j = i; int tmp = array[i]; while ((j > 0) && (array[j-1] > tmp Read data again - Java Beginners Read data again OK my problem some like my first question.First i...","root","suprax"); //Read File Line By Line while ((strLine = br.readLine..."); //Read File Line By Line while ((strLine = br.readLine()) != null display the generated image from byte array - Struts display the generated image from byte array how to create image from byte array using struts and display it in struts html.please give me the sample code The Array Palindrome Number in Java The Array Palindrome Number in Java This is a Java simple palindrome number program. In this section you will read how to uses palindrome one dimensional array array - Java Beginners array Accept a two dimensional array from the user check if this array is symetric display a message yes,if it is symetric otherwise display it ,is not symetric int to byte in java int to byte in java How to convert int to byte in Java? int i =132; byte b =(byte)i; System.out.println(b); public static byte[] intToByteArray(int value) { byte[] b = new byte[4 java - Java Beginners (); // Serialize to a byte array ByteArrayOutputStream baos = new ByteArrayOutputStream...:// Thanks... in Filesystem that Object is to be Deserialize would u give and example source code Java read text file . Example of Read text File Line by Line: import java.io.*; class FileRead... to read file in java How to Read file line by line in Java program Java read file line by line - Java Tutorial Java How to read file in java How to read file in java Java provides IO package to perform reading and writing operations with a file. In this section you will learn how to read a text... a byte or array of bytes from the file. It returns -1 when the end-of-file has in javascript - Java Beginners :// Hope...array in javascript how to initialize array in javascript and can we increase the size of array later on? is Array class in javascript ? also Averaging an Array - Java Beginners the average of an array with the following headers. However, prompt user to enter 10 int and 10 doubles. a) public static int average(int[] array) b) public static double average(double[] array) Hi Friend, Try the following code
http://www.roseindia.net/tutorialhelp/comment/98723
CC-MAIN-2014-35
refinedweb
1,838
62.88
Buttonwood Paying the price Time to reassess how fund managers are rewarded FUND managers have been some of the biggest beneficiaries of the financial sector's growth over the past 30 years. Bankers may routinely earn million-pound bonuses but some hedge-fund and private-equity managers have become billionaires. Seldom has so much been earned by so few. These riches have been generated despite the ability of investors to take advantage of low-cost exchange-traded funds and index-trackers. Investors have surged off-piste in search of higher returns. In aggregate, however, they will merely end up paying higher fees (typically, a 2% annual fee plus 20% on performance), a phenomenon this column has described as “catch two-and-twenty”. Two new studies look at the way fund managers operate and suggest improvements in the way they are assessed. In the first report*, Peter Morris, a former banker at Morgan Stanley, is sharply critical of the private-equity industry. It “has been a huge success in terms of size, growth and profitability for its operators and for many intermediaries,” he writes. “It is less clear whether private equity has been a universal boon for its investors or for financial markets generally.”. The leverage point is very important... Of course, the private-equity groups claim that they have stockpicking and management skills, selecting the right companies to buy and then transforming them by judicious cost-cutting and investment. But it is those skills for which they should be afforded performance fees, Mr Morris argues, and those alone. The second study** looks at traditional fund managers, those who run mutual funds and stockmarket portfolios on behalf of pension funds. A lot of sophisticated-sounding benchmarks have been devised to measure their performance, such as the Sharpe ratio, which compares the volatility of a portfolio with its excess return (over the risk-free rate).. This approach has two advantages. First, it directly measures the impact of a manager's decisions: did his buying and selling add value to the portfolio, or subtract from it? Second, it discourages the excessive trading or churning of portfolios, an activity that incurs high transaction costs and diminishes the client's return. The authors conducted an experiment in which 12 groups of students were asked to pick 23 stocks from various national indices. The groups were allowed to change their portfolios over a three-year period. The “inertia” funds (those originally selected) performed better in two out of three cases, with an average outperformance of almost four percentage points. Who knows how many professionals would pass this test? Clients would face a lot of opposition if they tried to restrict managers' fees. But after a decade of dismal returns it is time for them to act. They cannot control the level of future returns but they can do something about costs. * “Private Equity, Public Loss?”, by Peter Morris, Centre for the Study of Financial Innovation, July 2010. ** “Economists' Hubris—The Case of Equity Asset Management”, by Shahin Shojai of Capco, George Feiger of Contango Capital Advisors and Rajesh Kumar of the Institute of Management Technology, April 2010. Economist.com/blogs/buttonwood From the print edition: Finance and economics Excerpts from the print edition & blogs » Editor's Highlights, The World This Week, and more »
http://www.economist.com/node/16702073?subjectid=2512631&story_id=16702073
CC-MAIN-2013-48
refinedweb
547
53.1
This chapter is a bottom-up look at the Ruby language. Unlike the previous tutorial, here we're concentrating on presenting facts, rather than motivating some of the language design features. We also ignore the built-in classes and modules where possible. These are covered in depth in Chapter 22, “Built-in Classes”. If the content of this chapter looks familiar, it's because it should; we've covered just about all of this in the earlier tutorial chapters. Consider this chapter to be a self-contained reference to the core Ruby language. Ruby programs are written in 7-bit ASCII. (Ruby also has extensive support for Kanji, using the EUC, SJIS, or UTF-8 coding system. If a code set other than 7-bit ASCII is used, the KCODE option must be set appropriately, as shown in the section on command-line options.) Ruby is a line-oriented language. Ruby expressions and statements are terminated at the end of a line unless the statement is obviously incomplete—for example if the last token on a line is an operator or comma. A semicolon can be used to separate multiple expressions on a line. You can also put a backslash at the end of a line to continue it onto the next. Comments start with `#' and run to the end of the physical line. Comments are ignored during compilation. a = 1 b = 2; c = 3 d = 4 + 5 + # no '\' needed 6 + 7 e = 8 + 9 \ + 10 # '\' needed Physical lines between a line starting with =begin and a line starting with =end are ignored by the compiler and may be used for embedded documentation (see Appendix A, “Embedded Documentation”). Ruby reads its program input in a single pass, so you can pipe programs to the compiler's stdin. echo 'print "Hello\n"' | ruby If the compiler comes across a line anywhere in the source containing just “ __END__”, with no leading or trailing whitespace, it treats that line as the end of the program—any subsequent lines will not be compiled. However, these lines can be read into the running program using the global IO object DATA. Every Ruby source file can declare blocks of code to be run as the file is being loaded (the BEGIN blocks) and after the program has finished executing (the END blocks). BEGIN { begin code } END { end code } A program may include multiple BEGIN and END blocks. BEGIN blocks are executed in the order they are encountered. END blocks are executed in reverse order. There are alternative forms of literal strings, arrays, regular expressions, and shell commands that are specified using a generalized delimited syntax. All these literals start with a percent character, followed by a single character that identifies the literal's type. These characters are summarized in Table 18.1; the actual literals are described in the corresponding sections later in this chapter.. %q/this is a string/ %q-string- %q(a (nested) string) Delimited strings may continue over multiple lines. %q{def fred(a) a.each { |i| puts i } end} The basic types in Ruby are numbers, strings, arrays, hashes, ranges, symbols, and regular expressions. Ruby integers are objects of class Fixnum or Bignum. Fixnum objects hold integers that fit within the native machine word minus 1 bit. Whenever a Fixnum exceeds this range, it is automatically converted to a Bignum object, whose range is effectively limited only by available memory. If an operation with a Bignum result has a final value that will fit in a Fixnum, the result will be returned as a Fixnum. Integers are written using an optional leading sign, an optional base indicator ( 0 for octal, 0x for hex, or 0b for binary), followed by a string of digits in the appropriate base. Underscore characters are ignored in the digit string. You can get the integer value corresponding to an ASCII character by preceding that character with a question mark. Control and meta combinations of characters can also be generated using ?\C-x, ?\M-x, and ?\M-\C-x. The control version of ch is ch&0x9f, and the meta version is ch | 0x80. You can get the integer value of a backslash character using the sequence ?\\. 123456 # Fixnum 123_456 # Fixnum (underscore ignored) -543 # Negative Fixnum 123_456_789_123_345_789 # Bignum 0xaabb # Hexadecimal 0377 # Octal -0b1010 # Binary (negated) 0b001_001 # Binary ?a # character code ?A # upper case ?\C-a # control a = A - 0x40 ?\C-A # case ignored for control chars ?\M-a # meta sets bit 7 ?\M-\C-a # meta and control a A numeric literal with a decimal point and/or an exponent is turned into a Float object, corresponding to the native architecture's double data type. You must follow the decimal point with a digit, as 1.e3 tries to invoke the method e3 in class Fixnum. 12.34 → 12.34 -.1234e2 → -12.34 1234e-2 → 12.34 Ruby provides a number of mechanisms for creating literal strings. Each generates objects of type String. The different mechanisms vary in terms of how a string is delimited and how much substitution is done on the literal's content. Single-quoted string literals ( 'stuff ' and %q/stuff/) undergo the least substitution. Both convert the sequence \\ into a single backslash, and the form with single quotes converts \' into a single quote. 'hello' → hello 'a backslash \'\\\'' → a backslash '\' %q/simple string/ → simple string %q(nesting (really) works) → nesting (really) works %q no_blanks_here ; → no_blanks_here Double-quoted strings ("stuff", %Q/stuff/, and %/stuff/) undergo additional substitutions, shown in Table 18.2. a = 123 "\123mile" → Smile "Say \"Hello\"" → Say "Hello" %Q!"I said 'nuts'," I said! → "I said 'nuts'," I said %Q{Try #{a + 1}, not #{a - 1}} → Try 124, not 122 %<Try #{a + 1}, not #{a - 1}> → Try 124, not 122 "Try #{a + 1}, not #{a - 1}" → Try 124, not 122. a = 123 print <<HERE Double quoted \ here document. Sum = #{a + 1} HERE print <<-'THERE' This is single quoted. The above used #{a + 1} THERE produces: Double quoted here document. Sum = 124 This is single quoted. The above used #{a + 1} Adjacent single- and double-quoted strings in the input are concatenated to form a single String object. 'Con' "cat" 'en' "ate" → "Concatenate" Strings are stored as sequences of 8-bit bytes, (for use in Japan, the jcode library supports a set of operations of strings written with EUC, SJIS, or UTF-8 encoding. The underlying string, however, is still accessed as a series of bytes) and each byte may contain any of the 256 8-bit values, including null and newline. The substitution mechanisms in Table 18.2 allow nonprinting characters to be inserted conveniently and portably. Every time a string literal is used in an assignment or as a parameter, a new String object is created. for i in 1..3 print 'hello'.id, " " end produces: 537765312 537765022 537764992 For more information, see the documentation for class String. Outside the context of a conditional expression, expr ..expr and expr ...expr construct Range objects. The two-dot form is an inclusive range; the one with three dots is a range that excludes its last element. See the description of class Range for details. Also see the description of conditional expressions for other uses of ranges. Literals of class Array are created by placing a comma-separated series of object references between square brackets. A trailing comma is ignored. arr = [ fred, 10, 3.14, "This is a string", barney("pebbles"), ] Arrays of strings can be constructed using a shortcut notation, %w, which extracts space-separated tokens into successive elements of the array. A space can be escaped with a backslash. This is a form of general delimited input, described on pages 200–201. arr = %w( fred wilma barney betty great\ gazoo ) arr → ["fred", "wilma", "barney", "betty", "great gazoo"] A literal Ruby Hash is created by placing a list of key/value pairs between braces, with either a comma or the sequence => between the key and the value. A trailing comma is ignored. colors = { "red" => 0xf00, "green" => 0x0f0, "blue" => 0x00f } There is no requirement for the keys and/or values in a particular hash to have the same type. The only restriction for a hash key is that it must respond to the message hash with a hash value, and the hash value for a given key must not change. This means that certain classes (such as Array and Hash, as of this writing) can't conveniently be used as keys, because their hash values can change based on their contents. If you keep an external reference to an object that is used as a key, and use that reference to alter the object and change its hash value, the hash lookup based on that key may not work. Because strings are the most frequently used keys, and because string contents are often changed, Ruby treats string keys specially. If you use a String object as a hash key, the hash will duplicate the string internally and will use that copy as its key. Any changes subsequently made to the original string will not affect the hash. If you write your own classes and use instances of them as hash keys, you need to make sure that either (a) the hashes of the key objects don't change once the objects have been created or (b) you remember to call the Hash#rehash method to reindex the hash whenever a key hash is changed..” Regular expression literals are objects of type Regexp. They can be created by explicitly calling the Regexp.new constructor, or by using the literal forms, /pattern/ and %r{pattern }. The %r construct is a form of general delimited input (described on pages 200–201). /pattern/ /pattern/options %r{pattern} %r{pattern}options Regexp.new( 'pattern' [,. ^ $ \A \z \Z \b, \B [characters ] |, (, ), [, ^, $, *,and ?, which have special meanings elsewhere in patterns, lose their special significance between brackets. The sequences \nnn, \xnn, \cx, \C-x, \M-x, and \M-\C-x have the meanings shown in Table 18.2. The sequences \d, \D, \s, \S, \w, and \Ware abbreviations for groups of characters, as shown in Table 5.1. The sequence c1-c2 represents all the characters between c1 and c2, inclusive. Literal ]or -characters must appear immediately after the opening bracket. An uparrow (^) immediately following the opening bracket negates the sense of the match—the pattern matches any character that isn't in the character class. \d, \s, \w .(period) /moption, it matches newline, too). * + {m,n} ? *, +, and {m,n}modifiers are greedy by default. Append a question mark to make them minimal. |re2 |has a low precedence. (...) /abc+/matches a string containing an “a,” a “b,” and one or more “c”s. /(abc)+/matches one or more sequences of “abc”. Parentheses are also used to collect the results of pattern matching. For each opening parenthesis, Ruby stores the result of the partial match between it and the corresponding closing parenthesis as successive groups. Within the same pattern, \1refers to the match of the first group, \2the second group, and so on. Outside the pattern, the special variables $1, $2, and so on, serve the same purpose. #{...} /ooption, it is performed just the first time. \0, \1, \2, ... \9, \&, \`, \', \+) (?:re) date = "12/25/01" date =~ %r{(\d+)(/|:)(\d+)(/|:)(\d+)} [$1,$2,$3,$4,$5] → ["12", "/", "25", "/", "01"] date =~ %r{(\d+)(?:/|:)(\d+)(?:/|:)(\d+)} [$1,$2,$3] → ["12", "25", "01"] (?=re) scanmethod matches words followed by a comma, but the commas are not included in the result. str = "red, white, and blue" str.scan(/[a-z]+(?=,)/) → ["red", "white"] (?!re) /hot(?!dog)(\w+)/matches any word that contains the letters “hot” that aren't followed by “dog”, returning the end of the word in $1. (?>re) /a.*b.*a/takes exponential time when matched against a string containing an “a” followed by a number of “b”s, but with no trailing “a.” However, this can be avoided by using a nested regular expression /a(?>.*b).*a/. In this form, the nested expression consumes) (?-imx) (?imx:re) (?-imx:re) Ruby names are used to refer to constants, variables, methods, classes, and modules. The first character of a name helps Ruby to distinguish its intended use. Certain names, listed in Table 18.3, are reserved words and should not be used as variable, method, class, or module names. In these descriptions, lowercase letter means the characters “a” though “z”, as well as “_”, the underscore. Uppercase letter means “A” though “Z,” and digit means “0” through “9.” Name characters means any combination of upper- and lowercase letters and digits. A local variable name consists of a lowercase letter followed by name characters. fred anObject _x three_two_one An instance variable name starts with an “at” sign (“ @”) followed by an upper- or lowercase letter, optionally followed by name characters. @name @_ @Size A class variable name starts with two “at” signs (“ @@”) followed by an upper- or lowercase letter, optionally followed by name characters. @@name @@_ @@Size A constant name starts with an uppercase letter followed by name characters. Class names and module names are constants, and follow the constant naming conventions. By convention, constant variables are normally spelled using uppercase letters and underscores throughout. module Math PI = 3.1415926 end class BigBlob Global variables, and some special system variables, start with a dollar sign (“ $”) followed by name characters. In addition, there is a set of two-character variable names in which the second character is a punctuation character. These predefined variables are listed in the section Predefined Variables. Finally, a global variable name can be formed using “ $-” followed by any single character. $params $PROGRAM $! $_ $-a $-. Method names are described in the section “Method Definition”.. As a somewhat pathological case of this, consider the following code fragment, submitted by Clemens Hintze. def a print "Function 'a' called\n" 99 end for i in 1..2 if i == 2 print "a=", a, "\n" else a = 1 print "a=", a, "\n" end end produces: a=1 Function 'a' called a=99. a = 1 if false; a Ruby variables and constants hold references to objects. Variables themselves do not have an intrinsic type. Instead, the type of a variable is defined solely by the messages to which the object referenced by the variable responds. (When we say that a variable is not typed, we mean that any given variable can at different times hold references to objects of many different types.) A Ruby constant is also a reference to an object. Constants are created when they are first assigned to (normally in a class or module definition). Ruby, unlike less flexible languages, lets you alter the value of a constant, although this will generate a warning message. MY_CONST = 1 MY_CONST = 2 # generates a warning produces: prog.rb:2: warning: already initialized constant MY_CONST Note that although constants should not be changed, you can alter the internal states of the objects they reference. MY_CONST = "Tim" MY_CONST[0] = "J" # alter string referenced by constant MY_CONST → "Jim" Assignment potentially aliases objects, giving the same object different names. Constants defined within a class or module may be accessed unadorned anywhere within the class or module. Outside the class or module, they may be accessed using the scope operator, “ ::” prefixed by an expression that returns the appropriate class or module object. Constants defined outside any class or module may be accessed unadorned or by using the scope operator “ ::” with no prefix. Constants may not be defined in methods. OUTER_CONST = 99 class Const def getConst CONST end CONST = OUTER_CONST + 1 end Const.new.getConst → 100 Const::CONST → 100 ::OUTER_CONST → 99 Global variables are available throughout a program. Every reference to a particular global name returns the same object. Referencing an uninitialized global variable returns nil. Class variables are available throughout a class or module body. Class variables must be initialized before use. A class variable is shared among all instances of a class and is available within the class itself. class Song @@count = 0 def initialize @@count += 1 end def Song.getCount @@count end end Class variables belong to the innermost enclosing class or module. Class variables used at the top level are defined in Object, and behave like global variables. Class variables defined within singleton methods belong to the receiver if the receiver is a class or a module; otherwise, they belong to the class of the receiver. class Holder @@var = 99 def Holder.var=(val) @@var = val end end a = Holder.new def a.var @@var end Holder.var = 123 a.var → 123 Instance variables are available within instance methods throughout a class body. Referencing an uninitialized instance variable returns nil. Each instance of a class has a unique set of instance variables. Instance variables are not available to class methods. Local variables are unique in that their scopes are statically determined but their existence is established dynamically. A local variable is created dynamically when it is first assigned a value during program execution. However, the scope of a local variable is statically determined to be: the immediately enclosing block, method definition, class definition, module definition, or top-level program. Referencing a local variable that is in scope but that has not yet been created generates a NameError exception. Local variables with the same name are different variables if they appear in disjoint scopes. Method parameters are considered to be variables local to that method. Block parameters are assigned values when the block is invoked. a = [ 1, 2, 3 ] a.each { |i| puts i } # i local to block a.each { |$i| puts $i } # assigns to global $i a.each { |@i| puts @i } # assigns to instance variable @i a.each { |I| puts I } # generates warning assigning to constant a.each { |b.meth| } # invokes meth= in object b sum = 0 var = nil a.each { |var| sum += var } # uses sum and var from enclosing scope If a local variable (including a block parameter) is first assigned in a block, it is local to the block. If instead a variable of the same name is already established at the time the block executes, the block will inherit that variable. A block takes on the set of local variables in existence at the time that it is created. This forms part of its binding. Note that although the binding of the variables is fixed at this point, the block will have access to the current values of these variables when it executes. The binding preserves these variables even if the original enclosing scope is destroyed. The bodies of while, until, and for loops are part of the scope that contains them; previously existing locals can be used in the loop, and any new locals created will be available outside the bodies afterward. The following variables are predefined in the Ruby interpreter. In these descriptions, the notation [r/o] indicates that the variables are read-only; an error will be raised if a program attempts to modify a read-only variable. After all, you probably don't want to change the meaning of true halfway through your program (except perhaps if you're a politician). Entries marked [thread] are thread local. Many global variables look something like Snoopy swearing: $_, $!, $&, and so on. This is for “historical” reasons, as most of these variable names come from Perl. If you find memorizing all this punctuation difficult, you might want to have a look at the library file called “English,”, which gives the commonly used global variables more descriptive names. In the tables of variables and constants that follow, we show the variable name, the type of the referenced object, and a description. These variables (except $=) are set to nil after an unsuccessful pattern match. The following constants are defined by the Ruby interpreter. Single terms in an expression may be any of the following. %x. The value of the string is the standard output of running the command represented by the string under the host operating system's standard shell. The execution also sets the $?variable with the command's exit status. filter = "*.c" files = `ls #{filter}` files = %x{ls #{filter}} Symbolobject is created by prefixing an operator, variable, constant, method, class, or module name with a colon. The symbol object will be unique for each different name but does not refer to a particular instance of the name, so the symbol for (say) :fredwill be the same regardless of context. A symbol is similar to the concept of atoms in other high-level languages. ::”). barney # variable reference APP_NAMR # constant reference Math::PI # qualified constant reference Expressions may be combined using operators. Table 18.4 lists the Ruby operators in precedence order. The operators with a Y in the method column are implemented as methods, and may be overridden. The assignment operator assigns one or more rvalues to one or more lvalues. What is meant by assignment depends on each individual lvalue. If an lvalue is a variable or constant name, that variable or constant receives a reference to the corresponding rvalue. a, b, c = 1, "cat", [ 3, 4, 5 ] If the lvalue is an object attribute, the corresponding attribute setting method will be called in the receiver, passing as a parameter the rvalue. anObj = A.new anObj.value = "hello" # equivalent to anObj.value=("hello") If the lvalue is an array element reference, Ruby calls the element assignment operator (“ []=”) in the receiver, passing as parameters any indices that appear between the brackets followed by the rvalue. This is illustrated in Table 18.5. An assignment expression may have one or more lvalues and one or more rvalues. This section explains how Ruby handles assignment with different combinations of arguments. Array, the rvalue is replaced with the elements of the array, with each element forming its own rvalue. Array, and this array is expanded into a set of rvalues as described in (1). a,b=b,aswaps the values in “a” and “b.” nilassigned to them. The tutorial has examples in the section “Parallel Assignment”. begin body end Expressions may be grouped between begin and end. The value of the block expression is the value of the last expression executed. Block expressions also play a role in exception handling, which is discussed in “Handling Exceptions”. Boolean expressions evaluate to a truth value. Some Ruby constructs (particularly ranges) behave differently when evaluated in a boolean expression. Ruby predefines the globals false and nil. Both of these values are treated as being false in a boolean context. All other values are treated as being true. The and and && operators evaluate their first operand. If false, the expression returns false; otherwise, the expression returns the value of the second operand. expr1 and expr2 expr1 && expr2 The or and || operators evaluate their first operand. If true, the expression returns true; otherwise, the expression returns the value of the second operand. expr1 or expr2 expr1 || expr2 The not and ! operators evaluate their operand. If true, the expression returns false. If false, the expression returns true. The word forms of these operators ( and, or, and not) have a lower precedence than the corresponding symbol forms ( &&, ||, and !). See Table 18.4 for details. The defined? operator returns nil if its argument, which can be an arbitrary expression, is not defined. Otherwise, it returns a description of that argument. For examples, see the “Defined?, And, Or, and Not” section in the tutorial. The Ruby syntax defines the comparison operators ==, ===, <=>, <, <=, >, >=, =~, and the standard methods eql? and equal? (see Table 7.1). All of these operators are implemented as methods. Although the operators have intuitive meaning, it is up to the classes that implement them to produce meaningful comparison semantics. The library reference describes the comparison semantics for the built-in classes. The module Comparable provides support for implementing the operators ==, <, <=, >, >=, and the method between? in terms of <=>. The operator === is used in case expressions, described in the section “Case Expressions”. Both == and =~ have negated forms, != and !~. Ruby converts these during syntax analysis: a!=b is mapped to !(a==b), and a!~b is mapped to !(a =~b). There are no methods corresponding to != and !~. if expr1 .. expr2 while expr1 ... expr2 A range used in a boolean expression acts as a flip-flop. It has two states, set and unset, and is initially unset. On each call, the range cycles through the state machine shown in Figure 18.1. The range returns true if it is in the set state at the end of the call, and false otherwise. The two-dot form of a range behaves slightly differently than the three-dot form. When the two-dot form first makes the transition from unset to set, it immediately evaluates the end condition and makes the transition accordingly. This means that if expr1 and expr2 both evaluate to true on the same call, the two-dot form will finish the call in the unset state. However, it still returns true for this call. The difference is illustrated by the following code: a = (11..20).collect {|i| (i%4 == 0)..(i%3 == 0) ? i : nil} a → [nil, 12, nil, nil, nil, 16, 17, 18, nil, 20] a = (11..20).collect {|i| (i%4 == 0)...(i%3 == 0) ? i : nil} a → [nil, 12, 13, 14, 15, 16, 17, 18, nil, 20] If a single regular expression appears as a boolean expression, it is matched against the current value of the variable $_. if /re/ ... is equivalent to if $_ =~ /re/ ... if boolean-expression [ then ] body elsif boolean-expression [ then ] body else body end unless boolean-expression [ then ] body else body end The then keyword separates the body from the condition. It is not required if the body starts on a new line. The value of an if or unless expression is the value of the last expression evaluated in whichever body is executed. expression if boolean-expression expression unless boolean-expression evaluates expression only if boolean-expression is true ( false for unless). boolean-expression ? expr1 : expr2 returns expr1 if boolean-expression is true and expr2 otherwise. case target when comparison [, comparison ]* [ then ] body when comparison [, comparison ]* [ then ] body ... [ else body ] end A case expression searches for a match by starting at the first (top left) comparison, performing comparison === target. When a comparison returns true, the search stops, and the body associated with the comparison is executed. case then returns the value of the last expression executed. If no comparison matches: if an else clause is present, its body will be executed; otherwise, case silently returns nil. The then keyword separates the when comparisons from the bodies, and is not needed if the body starts on a new line. while boolean-expression [ do ] body end executes body zero or more times as long as boolean-expression is true. until boolean-expression [ do ] body end executes body zero or more times as long as boolean-expression is false. In both forms, the do separates boolean-expression from the body, and may be omitted when the body starts on a new line. for name [, name ]+ in expression [ do ] body end The for loop is executed as if it were the following each loop, except that local variables defined in the body of the for loop will be available outside the loop, while those defined within an iterator block will not. expression.each do | name [, name ]+ | body end loop, which iterates its associated block, is not a language construct—it is a method in module Kernel. expression while boolean-expression expression until boolean-expression If expression is anything other than a begin/ end block, executes expression zero or more times while boolean-expression is true ( false for until). If expression is a begin/ end block, the block will always be executed at least one time. break, redo, next, and retry alter the normal flow through a while, until, for, or iterator controlled loop.. retry restarts the loop, reevaluating the condition. def defname [ ( [ arg [=val], ... ] [, *vararg ] [, &blockarg ] ) ] body end defname is both the name of the method and optionally the context in which it is valid. defname ← methodname expr.methodname A methodname is either a redefinable operator (see Table 18.4) or a name. If methodname is a name, it should start with a lowercase letter (or underscore) optionally followed by upper- and lowercase letters, underscores, and digits. A methodname may optionally end with a question mark (“ ?”), exclamation point (“ !”), or equals sign (“ =”). The question mark and exclamation point are simply part of the name. The equals sign is also part of the name but additionally signals that this method is an attribute setter (described in the section “Writable Attributes”). A method definition using an unadorned method name within a class or module definition creates an instance method. An instance method may be invoked only by sending its name to a receiver that is an instance of the class that defined it (or one of that class's subclasses). Outside a class or module definition, a definition with an unadorned method name is added as a private method to class Object, and hence may be called in any context without an explicit receiver. A definition using a method name of the form expr.methodname creates a method associated with the object that is the value of the expression; the method will be callable only by supplying the object referenced by the expression as a receiver. Other Ruby documentation calls these methods singleton methods. class MyClass def MyClass.method # definition end end MyClass.method # call anObject = Object.new def anObject.method # definition end anObject.method # call def (1.class).fred # receiver may be an expression end Fixnum.fred # call Method definitions may not contain class, module, or instance method definitions. They may contain nested singleton method definitions. The body of a method acts as if it were a begin/ end block, in that it may contain exception handling statements ( rescue, else, and ensure). A method definition may have zero or more regular arguments, an optional array argument, and an optional block argument. Arguments are separated by commas, and the argument list may be enclosed in parentheses. A regular argument is a local variable name, optionally followed by an equals sign and an expression giving a default value. The expression is evaluated at the time the method is called. The expressions are evaluated from left to right. An expression may reference a parameter that precedes it in the argument list. def options(a=99, b=a+1) [ a, b ] end options → [99, 100] options 1 → [1, 2] options 2, 4 → [2, 4] The optional array argument must follow any regular arguments and may not have a default. When the method is invoked, Ruby sets the array argument to reference a new object of class Array. If the method call specifies any parameters in excess of the regular argument count, all these extra parameters will be collected into this newly created array. def varargs(a, *b) [ a, b ] end varargs 1 → [1, []] varargs 1, 2 → [1, [2]] varargs 1, 2, 3 → [1, [2, 3]] If an array argument follows arguments with default values, parameters will first be used to override the defaults. The remainder will then be used to populate the array. def mixed(a, b=99, *c) [ a, b, c] end mixed 1 → [1, 99, []] mixed 1, 2 → [1, 2, []] mixed 1, 2, 3 → [1, 2, [3]] mixed 1, 2, 3, 4 → [1, 2, [3, 4]] The optional block argument must be the last in the list. Whenever the method is called, Ruby checks for an associated block. If a block is present, it is converted to an object of class Proc and assigned to the block argument. If no block is present, the argument is set to nil. [ receiver. ] name [ parameters ] [ block ] [ receiver:: ] name [ parameters ] [ block ] parameters ← ( [ param, ...] [, hashlist ] [ *array ] [ &aProc ] ) block ← { blockbody } do blockbody end Initial parameters are assigned to the actual arguments of the method. Following these parameters may be a list of key => value pairs. These pairs are collected into a single new Hash object and passed as a single parameter. Following these parameters may be a single parameter prefixed with an asterisk. If this parameter is an array, Ruby replaces it with zero or more parameters corresponding to the elements of the array. def regular(a, b, *c) # .. end regular 1, 2, 3, 4 regular(1, 2, 3, 4) regular(1, *[2, 3, 4]). Regardless of the presence of a block argument, Ruby arranges for the value of the global function Kernel::block_given? to reflect the availability of a block associated with the call. aProc = proc { 99 } anArray = [ 98, 97, 96 ] def block yield end block { } block do end block(&aProc) def all(a, b, c, *d, &e) puts "a = #{a}" puts "b = #{b}" puts "c = #{c}" puts "d = #{d}" puts "block = #{yield(e)}" end all('test', 1 => 'cat', 2 => 'dog', *anArray, &aProc) produces: a = test b = {1=>"cat", 2=>"dog"} c = 98 d = [97, 96] block = 99 A method is called by passing its name to a receiver. If no receiver is specified, self is assumed. The receiver checks for the method definition in its own class and then sequentially in its ancestor classes. The instance methods of included modules act as if they were in anonymous superclasses of the class that includes them. If the method is not found, Ruby invokes the method method_missing in the receiver. The default behavior defined in Kernel::method_missing is to report an error and terminate the program. When a receiver is explicitly specified in a method invocation, it may be separated from the method name using either a period “ .” or two colons “ ::”. The only difference between these two forms occurs if the method name starts with an uppercase letter. In this case, Ruby will assume that a receiver::Thing method call is actually an attempt to access a constant called Thing in the receiver unless the method invocation has a parameter list between parentheses. Foo.Bar() # method call Foo.Bar # method call Foo::Bar() # method call Foo::Bar # constant access The return value of a method is the value of the last expression executed. return [ expr, ... ] A return expression immediately exits a method. The value of a return is nil if it is called with no parameters, the value of its parameter if it is called with one parameter, or an array containing all of its parameters if it is called with more than one parameter. super [ ( [ param, ... ] [ *array ] ) ] [ block ] Within the body of a method, a call to super acts just like a call to that original method, except that the search for a method body starts in the superclass of the object that was found to contain the original method. If no parameters (and no parentheses) are passed to super, the original method's parameters will be passed; otherwise, the parameters to super will be passed. expr1 operator operator expr1 expr1 operator expr2 If the operator in an operator expression corresponds to a redefinable method (see Table 18.4), Ruby will execute the operator expression as if it had been written (expr1).operator(expr2) receiver.attrname = rvalue When the form receiver.attrname appears as an lvalue, Ruby invokes a method named attrname= in the receiver, passing rvalue as a single parameter. receiver [ expr [, expr ]* ] receiver [ expr [, expr ]* ] = rvalue When used as an rvalue, element reference invokes the method [] in the receiver, passing as parameters the expressions between the brackets. When used as an lvalue, element reference invokes the method []= in the receiver, passing as parameters the expressions between the brackets, followed by the rvalue being assigned. alias newName oldName creates a new name that refers to an existing method, operator, global variable, or regular expression backreference ( $&, $', $', and $+). Local variables, instance variables, class variables, and constants may not be aliased. The parameters to alias may be names or symbols. class Fixnum alias plus + end 1.plus(3) → 4 alias $prematch $` "string" =~ /i/ → 3 $prematch → "str" alias :cmd :` cmd "date" → "Sun Nov 25 23:44:19 CST 2001\n" When a method is aliased, the new name refers to a copy of the original method's body. If the method is subsequently redefined, the aliased name will still invoke the original implementation. def meth "original method" end alias original meth def meth "new and improved" end meth → "new and improved" original → "original method" class classname [ < superexpr ] body end class << anObject body end A Ruby class definition creates or extends an object of class Class by executing the code in body. In the first form, a named class is created or extended. The resulting Class object is assigned to a global constant named classname. This name should start with an uppercase letter. In the second form, an anonymous (singleton) class is associated with the specific object. If present, superexpr should be an expression that evaluates to a Class object that will be installed as the superclass of the class being defined. If omitted, it defaults to class Object. Within body, most Ruby expressions are simply executed as the definition is read. However: ::” to qualify their names. module NameSpace class Example CONST = 123 end end obj = NameSpace::Example.new a = NameSpace::Example::CONST Module#includemethod will add the named modules as anonymous superclasses of the class being defined. It is worth emphasizing that a class definition is executable code. Many of the directives used in class definition (such as attr and include) are actually simply private instance methods of class Module. Chapter 19, “Classes and Objects”, describes in more detail how Class objects interact with the rest of the environment. obj = classexpr.new [ ( [ args, ... ] ) ] Class Class defines the instance method Class#new, which: initializein the newly created object, passing it any arguments originally passed to new. If a class definition overrides the class method new without calling super, no objects of that class can be created. Class attribute declarations are technically not part of the Ruby language: they are simply methods defined in class Module that create accessor methods automatically. class name attr attribute [, writable ] attr_reader attribute [, attribute ]* attr_writer attribute [, attribute ]* attr_accessor attribute [, attribute ]* end module name body end A module is basically a class that cannot be instantiated. Like a class, its body is executed during definition and the resulting Module object is stored in a constant. A module may contain class and instance methods and may define constants and class variables. As with classes, module methods are invoked using the Module object as a receiver, and constants are accessed using the “ ::” scope resolution operator. module Mod CONST = 1 def Mod.method1 # module method CONST + 1 end end Mod::CONST → 1 Mod.method1 → 2 class|module name include expr end A module may be included within the definition of another module or class using the include method. The module or class definition containing the include gains access to the constants, class variables, and instance methods of the module it includes. If a module is included within a class definition, the module's constants, class variables, and instance methods are effectively bundled into an anonymous (and inaccessible) superclass for that class. In particular, objects of the class will respond to messages sent to the module's instance methods. A module may also be included at the top level, in which case the module's constants, class variables, and instance methods become available at the top level. Although include is useful for providing mixin functionality, it is also a way of bringing the constants, class variables, and instance methods of a module into another namespace. However, functionality defined in an instance method will not be available as a module method. module Math def sin(x) # end end # Only way to access Math.sin is... include Math sin(1) The method Module#module_function solves this problem by taking one or more module instance methods and copying their definitions into corresponding module methods. module Math def sin(x) # end module_function :sin end Math.sin(1) include Math sin(1) The instance method and module method are two different methods: the method definition is copied by module_function, not aliased. Ruby defines three levels of protection for module and class constants and methods: selfas the receiver). Private methods therefore can be called only in the defining class and by direct descendents within the same object. private [ aSymbol, ... ] protected [ aSymbol, ... ] public [ aSymbol, ... ] Each function can be used in two different ways. Access control is enforced when a method is invoked. A code block is a set of Ruby statements and expressions between braces or a do/ end pair. The block may start with an argument list between vertical bars. A code block may appear only immediately after a method invocation. The start of the block must be on the same logical line as the end of the invocation. invocation do | a1, a2, ... | end invocation { | a1, a2, ... | } Braces have a high precedence; do has a low precedence. If the method invocation has parameters that are not enclosed in parentheses, the brace form of a block will bind to the last parameter, not to the overall invocation. The do form will bind to the invocation. Within the body of the invoked method, the code block may be called using the yield method. Parameters passed to the yield will be assigned to arguments in the block using the rules of parallel assignment. The return value of the yield is the value of the last expression evaluated in the block. A code block remembers the environment in which it was defined, and it uses that environment whenever it is called. Code blocks are converted into objects of class Proc using the methods Proc.new and Kernel#proc, or by associating the block with a method's block argument. The Proc constructor takes an associated block and wraps it with enough context to be able to re-create the block's environment when it is subsequently called. The Proc#call instance method then allows you to invoke the original block, optionally passing in parameters. The code in the block (and the associated closure) remains available for the lifetime of the Proc object. If the last argument in a method's argument list is prefixed with an ampersand (“ &”), any block associated with calls to that method will be converted to a Proc object and assigned to that parameter. Ruby exceptions are objects of class Exception and its descendents (a full list of the built-in exceptions is given in Figure 22.1). The Kernel::raise method raises an exception. raise raise aString raise thing [, aString [ aStackTrace ] ] The first form reraises the exception in $! or a new RuntimeError if $! is nil. The second form creates a new RuntimeError exception, setting its message to the given string. The third form creates an exception object by invoking the method exception on its first argument. It then sets this exception's message and backtrace to its second and third arguments. Class Exception and objects of class Exception contain factory methods called exception, so an exception class name or instance can be used as the first parameter to raise. When an exception is raised, Ruby places a reference to the Exception object in the global variable $!. Exceptions may be handled within the scope of a begin/ end block. begin code... code... [ rescue [parm, ...] [ => var ] [ then ] error handling code... ]* [ else no exception code... ] [ ensure always executed code... ] end A block may have multiple rescue clauses, and each rescue clause may specify zero or more parameters. A rescue clause with no parameter is treated as if it had a parameter of StandardError. When an exception is raised, Ruby scans up the call stack until it finds an enclosing begin/ end block. For each rescue clause in that block, Ruby compares the raised exception against each of the rescue clause's parameters in turn; each parameter is tested using $!.kind_of?(parameter). If the raised exception matches a rescue parameter, Ruby executes the body of the rescue and stops looking. If a matching rescue clause ends with => and a variable name, the variable is set to $!. Although the parameters to the rescue clause are typically the names of Exception classes, they can actually be arbitrary expressions (including method calls) that return an appropriate class. If no rescue clause matches the raised exception, Ruby moves up the stack frame looking for a higher-level begin/ end block that matches. If an exception propagates to the top level without being rescued, the program terminates with a message. If an else clause is present, its body is executed if no exceptions were raised in initial code. Exceptions raised during the execution of the else clause are not captured by rescue clauses in the same block as the else. If an ensure clause is present, its body is always executed as the block is exited (even if an uncaught exception is in the process of being propagated). The retry statement can be used within a rescue clause to restart the enclosing begin/ end block from the beginning. The method Kernel::catch executes its associated block. catch ( aSymbol | aString ) do block... end The method Kernel::throw interrupts the normal processing of statements. throw( aSymbol | aString [, anObject ] ) When a throw is executed, Ruby searches up the call stack for the first catch block with a matching symbol or string. If it is found, the search stops, and execution resumes past the end of the catch's block. If the throw was passed a second parameter, that value is returned as the value of the catch. Ruby honors the ensure clauses of any block expressions it traverses while looking for a corresponding catch. If no catch block matches the throw, Ruby raises a NameError exception at the location of the throw..
http://www.ruby-doc.org/docs/ProgrammingRuby/language.html
CC-MAIN-2013-20
refinedweb
7,588
56.05
Yorj 0 Posted April 20 Share Posted April 20 😉Hello, excuse my English. I have been with Autoit since it was born and it has always seemed like a great job from jon. I just want with this installment to briefly explain the construction model of a java jar library and its subsequent handling through autoit. One of the benefits this brings is to bring some of the power of java to our scripts. This is really simple:First: create a "java application" project in an IDE (NetBeans for example). This will create the java file that has the input method "public static void main (String [] args) {...}" Here is a practical example of content the this file: package javaapplication1; /** * * @author */ public class JavaApplication1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here OutPrintInSTDOUT(args[0], args[1]); } private static void OutPrintInSTDOUT(String y, String code){ System.out.println(y + ":: "+ code); } Look in this example that the program handles two arguments per command line, which are obtained in "args [0]" and "args [1]". There can be many more as is convenient. An example method has been created (OutPrintInSTDOUT) that prints a result at the output of the system. This result is what we capture in Autoit as we will see later. This is the basic structure. From this idea you can build a whole library of methods and functions that process values by command line input or simply respond to those input values. Can you see it? Second: In autoIt, how to run the jar file, pass values to it by command line and get the output value: #include <AutoItConstants.au3> ; Script Start - Add your code below here ;java -jar JarExample.jar "arg 1" Global $iPID = Run("java -jar JavaApplication1.jar Arg1 Arg2","",@SW_HIDE, $STDOUT_CHILD) Global $sOutput = "" While 1 $sOutput = StdoutRead($iPID) If @error Then ExitLoop ; Exit the loop if the process closes or StdoutRead returns an error. ConsoleWrite( $sOutput) WEnd Output on Scite console: >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:D:\Nuevo AutoIt v3 Script.au3 +>01:21:48 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "D:\Nuevo AutoIt v3 Script.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. Arg1:: Arg2 +>01:21:48 AutoIt3.exe ended.rc:0 +>01:21:48 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.508 Some considerations: Obviously we must have java installed on our computer: Java donwload If the java IDE cannot generate the jar file try downgrading the java sdk. It worked for me in version 8. We must pass through the command line the amount of suitable parameters. If we pass less than those that are handled inside the main () of the java file it will give an error. I hope this little tutorial can help you. In the future I will work on a Spanish version of AutoIt Help. See you soon. <novi>. Link to post Share on other sites Recommended Posts You need to be a member in order to leave a comment Sign up for a new account in our community. It's easy!Register a new account Already have an account? Sign in here.Sign In Now
https://www.autoitscript.com/forum/topic/205688-java-library-and-command-line-management/?tab=comments#comment-1480276
CC-MAIN-2021-49
refinedweb
549
67.04
Hi. Can anyone help give info on the "->" and "?" ? I see them a lot in codes and don't have a clue to what they mean. This is a discussion on "->" and "?" operators within the C++ Programming forums, part of the General Programming Boards category; Hi. Can anyone help give info on the "->" and "?" ? I see them a lot in codes and ... Hi. Can anyone help give info on the "->" and "?" ? I see them a lot in codes and don't have a clue to what they mean. I would like info on the ? operator too. It still remains a part of coding I don't understand =) However, the -> operator is a pointer to an item in a class/struct. Such as BITMAP* mybit; return (mybit->bmWidthBytes); If you have a = b != c ? d : e; Its the short hand for if ( b != c ) { a = d; } else { a = e; } I think that explination was a bit harsh... the ? operator is like the if operator, it takes a boolean variable, and does something if its true / false. The difference here is this works more like the #define thing becouse you can use it anywere: bool lala = true; printf(lala ? "IT WAS TRUE!" : "IT WAS FALSE!"); or: bool lala = true; lala ? dothistrue() : dothisfalse(); About the '->' operator, its just like '.', exept for pointers: struct blah { int lala; }; blah *i = new blah; i->blah = 6; delete i; Hope this was helpfull, SPH -> would be the indirect equivalent of something.something in Java, You can do structures/classes jsut the same in C/C++: struct blah { int h; }; blah i; i.h = 6; '->' is for POINTERS to structures/classes. SPH the arrow operator is for dereferencing conglomerate user-defined types. they can be unions, struct, or classes. passing a pointer to an instance of a userdefined type as an argument to a function helps because it is less expensive on the stack when you call the function. deferencing it allows programmers a handier way to access the data members [and/or member functions] of the conglomerate data type, other than to use standard dereferencing using the asterisk. also, using the arrow operator ensures that correct deferencing is ensured, though the size of the user defined type is unknown. it's members will be correctly retrieved. hasafraggin shizigishin oppashigger... "'->' is for POINTERS to structures/classes." I thought -> was used as a pointer to an item in a structure/class..? >I thought -> was used as a pointer to an item in a >structure/class..? That's correct. Assume S is a structure which has an item called N. Let iS be a variable of type S, then N can be used as iS.N. Now assume pS is a pointer to S, then N can be used as pS->N. So: Code:struct blah { int h; }; blah i; blah *p; i.h = 6; p->h = 6; >I thought -> was used as a pointer to an item in a >structure/class..? That's correct. No it's not!!! if you have a pointer to an structure or class, then you use the -> operator to 'dereference' the pointer, and access a member that is part of the structure if you have this: typedef struct _p { int a; } P; and: P p; P* pp = &p; then: pp->a = 10; does the same as (*pp).a = 10; it's just friendlier notation... -> was used as a pointer to an item is wrong... that operator is used to reference an item within the structure... it's not a pointer to the item. U.
http://cboard.cprogramming.com/cplusplus-programming/9013-operators.html
CC-MAIN-2014-52
refinedweb
590
83.66
A plugin to share an image from your Flutter app via the platform's share dialog. Wraps the ACTION_SEND Intent on Android and UIActivityViewController on iOS. To use the plugin, add image_share as a dependency in your pubspec.yaml file. Add an NSPhotoLibraryAddUsageDescription key to the Info.plist file. No configuration to do. Import the library via import 'package:image_share/image_share.dart'; Then invoke the shareFile method anywhere in your Dart code to share a file given its path : ImageShare.shareFile(<PATH OF YOUR FILE>); Plugin has be rewritten in Objective-C and Java. Initial release. example/README.md Demonstrates how to use the image_share plugin. For help getting started with Flutter, view our online documentation. Add this to your package's pubspec.yaml file: dependencies: image_share: ^0.0.2 You can install packages from the command line: with Flutter: $ flutter packages get Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more. Now in your Dart code, you can use: import 'package:image_share/image_share. Package is pre-v0.1 release. (-10 points) While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.
https://pub.dartlang.org/packages/image_share
CC-MAIN-2019-04
refinedweb
207
60.92
Density Of States¶ The density of states is defined by where \(\varepsilon_n\) is the eigenvalue of the eigenstate \(|\psi_n\rangle\). Inserting a complete orthonormal basis, this can be rewritten as using that \(1 = \sum_i | i \rangle\langle i |\) and \(1 = \int\!\mathrm{d}r |r\rangle\langle r|\). \(\rho_i(\varepsilon)\) is called the projected density of states (PDOS), and \(\rho(r, \varepsilon)\) the local density of states (LDOS). Notice that an energy integrating of the LDOS multiplied by a Fermi distribution gives the electron density Summing the PDOS over \(i\) gives the spectral weight of orbital \(i\). A GPAW calculator gives access to four different kinds of projected density of states: - Total density of states. - Molecular orbital projected density of states. - Atomic orbital projected density of states. - Wigner-Seitz local density of states. Each of which are described in the following sections. Total DOS¶ The total density of states can be obtained by the GPAW calculator method get_dos(spin=0, npts=201, width=None). Molecular Orbital PDOS¶ As shown in the section Density Of States, the construction of the PDOS requires the projection of the Kohn-Sham eigenstates \(|\psi_n\rangle\) onto a set of orthonormal states \(|\psi_{\bar n}\rangle\). The all electron overlaps \(\langle \psi_{\bar n}|\psi_n\rangle\) can be calculated within the PAW formalism from the pseudo wave functions \(|\tilde\psi\rangle\) and their projector overlaps by [1]: where \(\Delta S^a_{i_1i_2} = \langle\phi_{i_1}^a|\phi_{i_2}^a\rangle - \langle\tilde\phi_{i_1}^a|\tilde\phi_{i_2}^a\rangle\) is the overlap metric, \(\phi_i^a(r)\), \(\tilde \phi_i^a(r)\), and \(\tilde p^a_i(r)\) are the partial waves, pseudo partial waves and projector functions of atom \(a\) respectively, and \(P^a_{ni} = \langle \tilde p_i^a|\tilde\psi_n\rangle\). If one chooses the states \(|\psi_{\bar n}\rangle\) as eigenstates of a different reference Kohn-Sham system, with the projector overlaps \(\bar P_{\bar n i}^a\), the PDOS relative to these states can simply be calculated by The example below calculates the density of states for CO adsorbed on a Pt(111) slab and the density of states projected onto the gas phase orbitals of CO. The .gpw files can be generated with the script top.py # Creates: pdos.png from gpaw import GPAW, restart import matplotlib.pyplot as plt # Density of States plt.subplot(211) slab, calc = restart('top.gpw') e, dos = calc.get_dos(spin=0, npts=2001, width=0.2) e_f = calc.get_fermi_level() plt.plot(e - e_f, dos) plt.axis([-15, 10, None, 4]) plt.ylabel('DOS') molecule = range(len(slab))[-2:] plt.subplot(212) c_mol = GPAW('CO.gpw') for n in range(2, 7): print('Band', n) # PDOS on the, dos = calc.get_all_electron_ldos(mol=molecule, spin=0, npts=2001, width=0.2, wf_k=wf_k, P_aui=P_aui) plt.plot(e - e_f, dos, label='Band: ' + str(n)) plt.legend() plt.axis([-15, 10, None, None]) plt.xlabel('Energy [eV]') plt.ylabel('All-Electron PDOS') plt.savefig('pdos.png') plt.show() When running the script \(\int d\varepsilon\rho_i(\varepsilon)\) is printed for each spin and k-point. The value should be close to one if the orbital \(\psi_i(r)\) is well represented by an expansion in Kohn-Sham orbitals and thus the integral is a measure of the completeness of the Kohn-Sham system. The bands 7 and 8 are delocalized and are not well represented by an expansion in the slab eigenstates (Try changing range(2,7) to range(2,9) and note the integral is less than one). The function calc.get_all_electron_ldos() calculates the square modulus of the overlaps and multiply by normalized gaussians of a certain width. The energies are in eV and relative to the average potential. Setting the keyword raw=True will return only the overlaps and energies in Hartree. It is useful to simply save these in a .pickle file since the .gpw files with wave functions can be quite large. The following script pickles the overlaps from gpaw import GPAW, restart import pickle slab, calc = restart('top.gpw') c_mol = GPAW('CO.gpw') molecule = range(len(slab))[-2:] e_n = [] P_n = [] for n in range(c_mol.get_number_of_bands()): print(, P = calc.get_all_electron_ldos(mol=molecule, wf_k=wf_k, spin=0, P_aui=P_aui, raw=True) e_n.append(e) P_n.append(P) pickle.dump((e_n, P_n), open('top.pickle', 'wb')) from ase.units import Hartree from gpaw import GPAW from gpaw.utilities.dos import fold import pickle import matplotlib.pyplot as plt e_f = GPAW('top.gpw').get_fermi_level() e_n, P_n = pickle.load(open('top.pickle', 'rb')) for n in range(2, 7): e, ldos = fold(e_n[n] * Hartree, P_n[n], npts=2001, width=0.2) plt.plot(e - e_f, ldos, label='Band: ' + str(n)) plt.legend() plt.axis([-15, 10, None, None]) plt.xlabel('Energy [eV]') plt.ylabel('PDOS') plt.show() Atomic Orbital PDOS¶ If one chooses to project onto the all electron partial waves (i.e. the wave functions of the isolated atoms) \(\phi_i^a\), we see directly from the expression of section Molecular Orbital PDOS, that the relevant overlaps within the PAW formalism is Using that projectors and pseudo partial waves form a complete basis within the augmentation spheres, this can be re-expressed as if the chosen orbital index \(i\) correspond to a bound state, the overlaps \(\langle \tilde \phi^a_i | \tilde p^{a'}_{i_1} \rangle\), \(a'\neq a\) will be small, and we see that we can approximate We thus define an atomic orbital PDOS by available from a GPAW calculator from the method get_orbital_ldos(a, spin=0, angular='spdf', npts=201, width=None). A specific projector function for the given atom can be specified by an integer value for the keyword angular. Specifying a string value for angular, being one or several of the letters s, p, d, and f, will cause the code to sum over all bound state projectors with the specified angular momentum. The meaning of an integer valued angular keyword can be determined by running: >>> from gpaw.utilities.dos import print_projectors >>> print_projectors('Fe') Note that the set of atomic partial waves do not form an orthonormal basis, thus the properties of the introduction are not fulfilled. This PDOS can however be used as a qualitative measure of the local character of the DOS. An example of how to obtain and plot the d band on atom number 10 of a stored calculation, is shown below: import numpy as np import pylab as plt from gpaw import GPAW calc = GPAW('old_calculation.gpw', txt=None) energy, pdos = calc.get_orbital_ldos(a=10, angular='d') I = np.trapz(pdos, energy) center = np.trapz(pdos * energy, energy) / I width = np.sqrt(np.trapz(pdos * (energy - center)**2, energy) / I) plt.plot(energy, pdos) plt.xlabel('Energy (eV)') plt.ylabel('d-projected DOS on atom 10') plt.title('d-band center = %s eV, d-band width = %s eV' % (center, width)) plt.show() Warning: You should always plot the PDOS before using the calculated center and width to check that it is sensible. The very localized functions used to project onto can sometimes cause an artificial rising tail on the PDOS at high energies. If this happens, you should try to project onto LCAO orbitals instead of projectors, as these have a larger width. This however requires some calculation time, as the LCAO projections are not determined in a standard grid calculation. The projections onto the projector functions are always present, hence using these takes no extra computational effort. Wigner-Seitz LDOS¶ For the Wigner-Seitz LDOS, the eigenstates are projected onto the function This defines an LDOS: Introducing the PAW formalism shows that the weights can be calculated by This property can be accessed by calc.get_wigner_seitz_ldos(a, spin=0, npts=201, width=None). It represents a local probe of the density of states at atom \(a\). Summing over all atomic sites reproduces the total DOS (more efficiently computed using calc.get_dos). Integrating over energy gives the number of electrons contained in the region ascribed to atom \(a\) (more efficiently computed using calc.get_wigner_seitz_densities(spin). Notice that the domain ascribed to each atom is deduced purely on a geometrical criterion. A more advanced scheme for assigning the charge density to atoms is the Bader Analysis algorithm (all though the Wigner-Seitz approach is faster). PDOS on LCAO orbitals¶ DOS can be also be projected onto the LCAO basis functions. A subspace of the atomic orbitals is required as an input onto which one wants the projected density of states. For example, if the p orbitals of a particular atom in have the indices 41, 42 and 43, and the PDOS is required on the subpspace of these three orbital then an array [41, 42, 43] has to be given as an input for the PDOS calculation. An example and with explanation is provided below. LCAO PDOS (see lcaodos_gs.py and lcaodos_plt.py): # Creates: lcaodos.png import matplotlib.pyplot as plt import numpy as np from ase.io import read from ase.units import Hartree from gpaw import GPAW from gpaw.utilities.dos import RestartLCAODOS, fold name = 'HfS2' calc = GPAW(name + '.gpw', txt=None) atoms = read(name + '.gpw') ef = calc.get_fermi_level() dos = RestartLCAODOS(calc) energies, weights = dos.get_subspace_pdos(range(51)) e, w = fold(energies * Hartree, weights, 2000, 0.1) e, m_s_pdos = dos.get_subspace_pdos([0, 1]) e, m_s_pdos = fold(e * Hartree, m_s_pdos, 2000, 0.1) e, m_p_pdos = dos.get_subspace_pdos([2, 3, 4]) e, m_p_pdos = fold(e * Hartree, m_p_pdos, 2000, 0.1) e, m_d_pdos = dos.get_subspace_pdos([5, 6, 7, 8, 9]) e, m_d_pdos = fold(e * Hartree, m_d_pdos, 2000, 0.1) e, x_s_pdos = dos.get_subspace_pdos([25]) e, x_s_pdos = fold(e * Hartree, x_s_pdos, 2000, 0.1) e, x_p_pdos = dos.get_subspace_pdos([26, 27, 28]) e, x_p_pdos = fold(e * Hartree, x_p_pdos, 2000, 0.1) w_max = [] for i in range(len(e)): if (-4.5 <= e[i] - ef <= 4.5): w_max.append(w[i]) w_max = np.asarray(w_max) Few comments about the above script. There are 51 basis functions in the calculations and the total density of state (DOS) is calculated by projecting the DOS on all the orbitals. The projected density of state (PDOS) is calculated for other orbitals as well, for example, s, p and d orbitals of the metal atom and s and p orbitals for the chalcogen atoms. In the subspace of orbitals the basis localized part of the basis functions is not taken into account and only the confined orbital part (larger rc) is chosen. There is a smarter way of getting the above orbitals in an automated way but it will come later. Last part of lcaodos_plt.py script: plt.plot(e - ef, w, label='Total', c='k', lw=2, alpha=0.7) plt.plot(e - ef, x_s_pdos, label='X-s', c='g', lw=2, alpha=0.7) plt.plot(e - ef, x_p_pdos, label='X-p', c='b', lw=2, alpha=0.7) plt.plot(e - ef, m_s_pdos, label='M-s', c='y', lw=2, alpha=0.7) plt.plot(e - ef, m_p_pdos, label='M-p', c='c', lw=2, alpha=0.7) plt.plot(e - ef, m_d_pdos, label='M-d', c='r', lw=2, alpha=0.7) plt.axis(ymin=0., ymax=np.max(w_max), xmin=-4.5, xmax=4.5, ) plt.xlabel(r'$\epsilon - \epsilon_F \ \rm{(eV)}$') plt.ylabel('DOS') plt.legend(loc=1) plt.savefig('lcaodos.png') plt.show()
https://wiki.fysik.dtu.dk/gpaw/documentation/pdos/pdos.html
CC-MAIN-2019-09
refinedweb
1,881
59.6
perlquestion prassi Hi Perl Monk, <p> I am re-posting the same question but with some changes in the code for which the earlier mentioned solution also dint work <code> #include <stdio.h> #include "report.h" void main() { #ifdef CHECK_REPORT report("This is good"); reports("This is also good") #endif #if defined (REPORT_ENABLE) report("This is not good"); #endif printf("The execution is completed\n"); } </code> <p> please see in the code report may end with colon or not that is intentional. The output has to be like this <code> #include <stdio.h> #include "report.h" void main() { #ifdef CHECK_REPORT #endif #if defined (REPORT_ENABLE) #endif printf("The execution is completed\n"); } </code> But the perl code which I have used below <code> $/ = undef; $_ = <file1>; s#\breport[s]?.*? \)\;|("[^"].*?")#defined $1 ? $1 :""#gsiex; print $_ </code> when the code encounters the line with REPORT_ENABLE then it removes the rest of the code including printf. <p> From the previous post the solution given was <code> s# .* report [s]? .* ; .* ##sx; </code> this works if the report was not in multiple lines. can you suggest what changes I need to do my regex to get the required answer. <p> Regards, <p> -Prassi
http://www.perlmonks.org/?displaytype=xml;node_id=976789
CC-MAIN-2015-48
refinedweb
198
71.44
Railways There is considerable information about railways, including mainline services, subways, heritage lines and trams in OpenStreetMap, together with details of railway stations, sidings and freight terminals. An extended railway tagging scheme is being developed within the OpenRailwayMap. Contents Types of railway line Railway lines should be tagged based on the type of operation. Where tracks are shared between multiple types of service, the more major service should be used (generally the longer distance or heavier line). Lines are generally assumed to be primarily for use by passenger unless tagged as usage=freight for freight only lines, usage=military for lines only used by the military, and usage=tourism for lines used only as a tourist attraction. The electrified=* key, together with frequency=* and voltage=* can be used to specify details of how the track is powered. Use electrified=no if the line is not electrified, electrified=contact_line if it is powered from an overhead wire and electrified=rail if it is powered from a '3rd (or 4th) rail'. For short sections of track used for storage of trains add a service=siding, for tracks within a place used for maintenance of trains use service=yard and for short spur lines leading to an industrial or military facility use service=spur. Add a node with railway=level_crossing for points where a road crosses a railway line at-grade and railway=crossing for a point where pedestrians may cross. The railway=turntable tag is used for turntables. The gauge can be specified using gauge=* which should contain the nominal width of the track in millimeters (1435 for standard gauge). Buffers can be marked with using railway=buffer_stop on a node. When modeling multi-track parallel railway lines in close proximity they can either be modeled as a single way with tracks=*, or as a number of parallel ways. If individual tracks have different tagging requirements (max-speed, electrification, gauge, etc.) then the tracks should be modelled appropriately. The tracks=* tag should be used to record the number of tracks with a default value of 1 being assumed where this is not supplied. Where a line goes over a bridge the relevant section should be tagged with either bridge=yes for shorter bridges or bridge=viaduct for long bridges and layer=1 or other value as appropriate. Where a track goes through a tunnel it should be tagged with tunnel=yes often at layer=-1. Where the tracks are on ground raised for the purpose use embankment=yes and when in a cutting use cutting=yes. If necessary split the way at the point where the bridge or cutting or whatever starts and ends. Track using embankments and cutting does not normally need a layer tag. Features (railway lines, footways,..) in railway stations that are tied to particular levels can be tagged with level=* instead of layer=*. Where a line has a recognised name this can be included in name=*. Routes Railway ways are commonly members of two types of relations: - railway route - a sequence of interconnected railway ways, often between two major junctions, sometimes including minor branches. - train route - a route of a train in regular service, including railway ways/routes traveled and stations served. Stations and stops Main article: Railway stations Please see the main article about station tagging as it is beyond the scope of this guide. Life-cycle Features in OpenStreetMap may be in a number of states - from planned to abandoned. For railways it is common to use combinations such as railway=disused + disused:railway=rail/light_rail/subway/tram to indicate that the railway is disused and which kind of railway it was. For other railway related features such as railway=station it is suggested (OpenRailwayMap/Tagging#Stations / Stops) to use just the lifecycle prefix such as disused:railway=station. - Proposed - For features that have a strong likelihood of being constructed. For a proposed railway line tag it with railway=proposed and also proposed=* where * is the type of railway being proposed (rail, subway,light-rail etc). An aspiration on the part of an authority or from an advocacy group which is not funded or approved should not be added. - Construction - features that are in the process of being constructed with actual work on the ground. For a railway line under construction tag it with railway=construction and also construction=* where * is the type of railway being constructed (rail, subway,light-rail etc). Often this will be a feature that has previously been 'proposed'. - Operation - the normal situation for most features. No additional tagging needed and the construction tags should be removed. Consider adding a start_date=* tag. - Preserved - a former mainline railway which is now operated as a tourist attraction. Use railway=preserved. - Disused - the feature is still in working order, or could be brought back to working order easily. Use railway=disused. - Abandoned - The track has been removed and the line may have been reused or left to decay but is still clearly visible, either from the replacement infrastructure, or purely from a line of trees around an original cutting or embankment. Use railway=abandoned. Where it has been reused as a cycle path then add highway=cycleway. Consider adding a end_date=* tag or more specifically a railway:end_date=* tag. - Obliterated (or dismantled/razed) - Some people use railway=dismantled or railway=razed where all evidence of the line has been removed, others prefer such lines not to be included at all. This is used where the alignment has been replaced by new buildings or by roads which don't refer to the old alignment. Alternatively where the alignment now crosses farmland. Proposals This section provides details of experimental tagging methods that have not yet been adopted and may not be supported by all rendering or tools. Tag life-cycle Some users are adding a lifecycle prefix such as 'proposed:', 'construction:', 'disused:' and 'abandoned:' to tags to indicate changes to the tag values over time. Examples: - An un-electrified line which it is being converted into an electrified line at 25KV at 50Hz using an overhead line might would be tagged with - A freight only line that is likely to be converted to passenger operation: - A former railway which was abandoned in 1965 and opened as a path in 2003: - railway=abandoned - historic:railway=narrow_gauge - historic:gauge=600 - historic:start_date=1845 - historic:end_date=1965 - old_name=Blar railway - highway=footway - name=The old railway path - start_date=2003 - etc More complicated changes over time can be recorded using the date namespace suffix: - railway:1835-1870=narrow_gauge - railway:1871-=rail - electrified:1954-=yes Rendering OpenRailwayMap OpenRailwayMap (ORM) is a dedicated map for railways. Released in mid 2013, the project is already available in numerous languages. In addition to. Mapnik Besides the basic railway=rail line style, Mapnik renders railway=construction and railway=disused with a dotted line. railway=spur, railway=rail+service=siding, railway=rail+service=spur, and railway=rail+service=yard in a thinner form of the normal railway=rail line style. railway=abandoned is no longer rendered on the main map discussion ITO Map ITO Map has a selection of layers which display many of the more common railway=* tags. railway=rail is shown in all layers. The Former Railways layer focuses on railway=dismantled, railway=disused, railway=preserved and railway=abandoned. The Railway tracks layer exists to show tracks=*, including tracks=1 in the case of showing two parallel, separately mapped, tracks. The Railways layer focuses on the types of rail that are shown, such as railway=light_rail and the relevant service=* tags. A Metro layer also exists for metro systems. The Railway electrification layer shows the electrical status of the rail tracks, highlighting the use of the tags: electrified=no, electrified=contact_line, electrified=rail, voltage=*, and frequency=*. Whilst the Railway electrification missing layer highlights places where there is information missing with regard to the electrification of the railways. Railway systems by country Europe - Belgium - Czech Republic - railways, stations - Finland - France - Germany - Netherland - Poland - Sweden - United Kingdom North America South America Asia
http://wiki.openstreetmap.org/wiki/Railways/Proposals
CC-MAIN-2016-50
refinedweb
1,335
51.58
Places the terminal into or out of raw mode. Curses Library (libcurses.a) #include <curses.h> raw( ) noraw( ) The raw or noraw subroutine places the terminal into or out of raw mode, respectively. RAW mode is similar to CBREAK mode (cbreak or nocbreak (cbreak, nocbreak, noraw, or raw Subroutine) subroutine). In RAW mode, the system immediately passes typed characters to the user program. The interrupt, quit, and suspend characters are passed uninterrupted, instead of generating a signal. RAW mode also causes 8-bit input and output. To get character-at-a-time input without echoing, call the cbreak and noecho subroutines. Most interactive screen-oriented programs require this sort of input. raw(); noraw(); These subroutines are part of Base Operating System (BOS) Runtime. The getch (getch, mvgetch, mvwgetch, or wgetch Subroutine) subroutine, cbreak or nocbreak (cbreak, nocbreak, noraw, or raw Subroutine) subroutine Curses Overview for Programming, List of Curses Subroutines, Understanding Terminals with Curses in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.
http://ps-2.kev009.com/wisclibrary/aix51/usr/share/man/info/en_US/a_doc_lib/libs/basetrf2/raw.htm
CC-MAIN-2022-40
refinedweb
167
50.63
Accessing X-Function Origin has many built-in X-Functions for handling a variety of tasks. X-Functions can be called from both LabTalk and Origin C. This Section will show you how to call X-Functions from Origin C by using Origin C's XFBase classXFBase Class. This mechanism also can be used in calling one X-Function in another X-Function. The XFBase class is declared in the XFBase.h header file located in the Origin C System folder. The XFBase.h header file is not included in the Origin.h header file so it has to be included separately in any Origin C file for the use of XFBase class. #include <XFBase.h> The procedure to use X-Functions in Origin C is as following: The following Origin C code defines a general function for importing files into Origin. The function has two arguments: data file name and import filter file name. Additional arguments of the impFile X-Function will use their default values. bool call_impFile_XF(LPCSTR lpcszDataFile, LPCSTR lpcszFilterFile) { string strDataFile = lpcszDataFile; string strFilterFile = lpcszFilterFile; // Create an instance of XFBase using the X-Function name. XFBase xf("impFile"); if (!xf) return false; // Set the 'fname' argument. if (!xf.SetArg("fname", strDataFile)) return false; // Set the 'filtername' argument. if (!xf.SetArg("filtername", strFilterFile)) return false; // Call XFBase's 'Evaluate' method to execute the X-Function if (!xf.Evaluate()) return false; return true; } The following Origin C code shows how to call the call_impFile_XF function defined above and use it to import an image file. // Import the Car bitmap located in Origin's Samples folder. string strImageFile = GetAppPath(TRUE) + "Samples\\Image Processing and Analysis\\Car.bmp"; // Import the bitmap using the Image import filter. string strFilterFile = GetAppPath(TRUE) + "Filters\\Image.oif"; // Call the function that will use the impFile X-Function. call_impFile_XF(strImageFile, strFilterFile);
https://www.originlab.com/doc/OriginC/guide/Accessing-X-Function
CC-MAIN-2019-04
refinedweb
306
50.43
A tip to keep in mind when translating C/C++ headers: Advertising --- enum Sass_Tag { SASS_BOOLEAN, SASS_NUMBER, SASS_COLOR }; --- is best translated as --- alias Sass_Tag = int; enum : Sass_Tag { SASS_BOOLEAN, SASS_NUMBER, SASS_COLOR } --- That way your enum isn't namespaced. On Saturday, 22 November 2014 at 13:15:47 UTC, Mike Parker wrote: However, I do recommend you combine all the files into one -- sass.d. When I first started Derelict, I separated everything out into multiple modules for every binding. Over time, I found it makes maintenance easier to implement a binding in one module if it is feasible. Going to keep that in mind.
https://www.mail-archive.com/digitalmars-d-announce@puremagic.com/msg21612.html
CC-MAIN-2018-34
refinedweb
102
51.78
From: Peter Dimov (pdimov_at_[hidden]) Date: 2003-01-05 10:23:05 From: "Joel de Guzman" <djowel_at_[hidden]> > From: "Peter Dimov" <pdimov_at_[hidden]> > [...] > > ref(x)(...) can mean two different things, both reasonable. One is to simply > > return x. The other is to return x(...). The convention we have adopted so > > far in bind and function is to treat ref as if ref(x)(...) returns x(...). > > This has nothing to do with spirit using bind, function, or lambda. It's > > about the semantics of ref. > > > > In fact, if you use ref(b) as above, you now have no way to express the > > other operation, make if_p store a reference to the function object: > > > > if_p(ref(f)) > > [ > > ] > > > > This is necessary when f has state or cannot be copied. > > Ok, I understand. Anyway, do you have a suggestion? Perhaps > what I need then is a low-fat var(x) and val(x). > > Thoughts? My thoughts with my "independent observer/low-tolerance library user" hat on are: * A good lambda library should already have a low-fat, low-dependency var(x), something like template<class E> struct basic_lambda_expression {}; // tag template<class T> class var_expression: public basic_lambda_expression< var_expression<T> > { public: typedef T & result_type; // obvious implementation }; * Two good lambda libraries sharing the same boost:: namespace will share basic_lambda_expression<> and recognize each other's lambdas. ;-) 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/2003/01/41782.php
CC-MAIN-2021-31
refinedweb
240
58.18
Box(3I) InterViews Reference Manual Box(3I) NAME Box, HBox, VBox - tile interactors in a box SYNOPSIS #include <InterViews/box.h> DESCRIPTION A box is a scene of interactors that are tiled side-by-side in the available space. Interactors are placed left-to-right in a horizontal box, and top-to-bottom in a vertical box. A box will try to stretch or shrink the interactors inside it to fit the available space. The natural size of a box is the sum of its ele- ments along the major axis, and the maximum along its minor axis. A box's stretchability (shrinkability) is the sum of its elements along its major axis and the minimum of its elements along its minor axis. PUBLIC OPERATIONS HBox(...) VBox(...) Create a new box. Zero to seven interactors may be passed as arguments; the interactors are inserted into the box. void Align(Alignment) Set the alignment mode that the box uses to place elements along the minor axis. The default alignment for an hbox is Bottom; other choices are Top and Center. The default alignment for a vbox is Left; other choices are Right and Center. void Insert(Interactor*) Append an interactor to the box. Components of an hbox (vbox) will appear left-to-right (top-to-bottom) in the order in which they are inserted. void Change(Interactor*) Notify the box that the given interactor's shape has changed. If change propagation is true, the box will modify its own shape to reflect the change and notify its parent. Regardless of propagation, the box will recompute the positions of the component interac- tors and update any that have changed. void Remove(Interactor*) Take an element of out a box. Remove does not cause any immediate change to the other components in the box; the Change operation must be called after one or more Removes to update the component positions. SEE ALSO Glue(3I), Interactor(3I), Scene(3I), Shape(3I) InterViews 15 June 1987 Box(3I)
https://www.unix.com/302140674-post1.html?s=2d5c88a81a69406f62a0eefa202a2d33
CC-MAIN-2021-43
refinedweb
333
55.84
Many programming languages have the concept of the lambda function. In Python, the lambda is an anonymous function or unbound function. The syntax for them looks a bit odd, but it's actually just taking a simple function and turning it into a one-liner. Let's look at a regular simple function to start off: #---------------------------------------------------------------------- def doubler(x): return x*2 All this function does is take an integer and double it. Technically, it will also double other things too since there's no type checking but that is its intent Now let's turn it into a lambda function! Fortunately, turning a one-line function into a lambda is pretty straight-forward. Here's how: doubler = lambda x: x*2 So the lambda works in much the same way as the function. Just so we're clear, the "x" here is the argument you pass in. The colon delineates the argument list from the return value or expression. So when you get to the "x*2" part, that is what gets returned. Let's look at another example: >>> poww = lambda i: i**2 >>> poww(2) 4 >>> poww(4) 16 >>> (lambda i: i**2)(6) 36 Here we demonstrate how to create a lambda that takes an input and squares it. There's some arguments in the Python community about whether or not you should assign a lambda to a variable. The reason is that when you name a lambda, it's no longer really anonymous and you might as well just write a regular function. The whole point of the lambda is to use it once and throw it away. The last example above shows one way to call a lambda anonymously (i.e. use it once). Besides, if you name the lambda, then you might as well just do this: >>> def poww(i): return i**2 >>> poww(2) 4 Let's move on and see how to use a lambda in a list comprehension! I've always had a hard time coming up with good uses for lambdas besides using them for event callbacks. So I went looking for some other use cases. It seems that some people like to use them in list comprehensions. Here's a couple of examples: >>> [(lambda x: x*3)(i) for i in range(5)] [0, 3, 6, 9, 12] >>> tripler = lambda x: x*3 >>> [tripler(i) for i in range(5)] [0, 3, 6, 9, 12] The first example is a bit awkward. While it calls the lambda anonymously, it's also a bit difficult to read. The next example assigns the lambda to a variable and then we call it that way. The funny thing about this is that Python has a built-in way to call a function with an iterable called map. Here's how you would normally use it: map(function, interable) And here's a real example using our lambda function from earlier: >>> map(tripler, range(5)) [0, 3, 6, 9, 12] Of course, in most cases the lambda is so simple that doing the same thing inside the list comprehension is probably easier: >>> [x*3 for x in range(5)] [0, 3, 6, 9, 12] My readers have suggested some other uses of lambda. The first example is returning a lambda from a function call: >>> def increment(n): return lambda(x): x + n >>> i = increment(5) >>> i(2) 7 Here we create a function that will increment whatever we give to it by 5. One of my other readers suggested passing a lambda to Python's sorted function: sorted(list, key=lambda i: i.address) The idea here is to sort a list of objects with the property "address". However, I still find the best use case for lambda is still for event callbacks, so let's look at how to use them for that using Tkinter. Tkinter is a GUI toolkit that comes built-in with Python. When you want to interact with your user interface, you would normally use a keyboard and mouse. These interactions work via events, which is where the lambda makes its appearance. Let's create a simple user interface so you can see how lambda is used in Tkinter! import Tkinter as tk ######################################################################## class App: """""" #---------------------------------------------------------------------- def __init__(self, parent): """Constructor""" frame = tk.Frame(parent) frame.pack() print_btn = tk.Button(frame, text='Print', command=lambda: self.onPrint('Print')) print_btn.pack(side=tk.LEFT) close_btn = tk.Button(frame, text='close', command=frame.quit) close_btn.pack(side=tk.LEFT) #---------------------------------------------------------------------- def onPrint(self, num): print "You just printed something" #---------------------------------------------------------------------- if __name__ == "__main__": root = tk.Tk() app = App(root) root.mainloop() So here we have a simple user interface with two buttons. One button calls the onPrint method using a lambda while the other uses a Tkinter method to close the application. As you can see, Tkinter's use of the lambda is as it was intended. The lambda here is used once and then thrown away. There is no way to reference it other than by pressing the button. As my long time readers likely know, I wrote about the lambda in another article over five years ago. At that time, I didn't have much use for lambdas and frankly I still don't. They're a neat feature of the language, but after programming in Python for over 9 years, I've hardly ever found the need to use them, especially in the way that they are meant to be used. But to each their own. There's certainly nothing wrong with using lambdas, but I hope you'll find this article useful for figuring out whether or not you really do need to use them in your own work.
https://www.blog.pythonlibrary.org/2015/10/28/python-101-lambda-basics/
CC-MAIN-2022-27
refinedweb
950
70.94
Difference between revisions of "SWTBot/Testing Custom Controls" Revision as of 17:12, 22 February 2011 Thomas Py wrote: > hI! > i´ve got a rcp-application with own swt-items.. for example there is a "QCombo extends Composite" how can i access this combobox with the swtbot? it´s not a ccombobox and not a combobox so i dont know how can i change the selected item with the swtbot. can swtbot list all widgets? > thnx for any help Finding the widget is quite easy. Using it is something else... To find your QCombo widget, do this: QCombo widget = bot.widget(widgetOfType(QCombo.class)); Now to use it, you can't just do QCombo.setSelectedItem() (or whatever API it might have), you must ensure that the code that needs running in the UI thread be run in the UI thread, using sync or async execution. For some quick testing, you could do this: asyncExec(new VoidResult(){ void run(){ widget.setSelectedItem(); } } but it quickly burdens your test code. What you should do instead is use the page object pattern: make a wrapper for your widget. Ex: public class SWTBotQCombo extends AbstractSWTBot<QCombo>{ public SWTBotQCombo(QCombo w) throws WidgetNotFoundException { this(w, null); } public SWTBotQCombo(QCombo w, SelfDescribing description) throws WidgetNotFoundException { super(w, description); } public void setSelectedItem() { asyncExec(new VoidResult(){ void run() { widget.setSelectedItem(); } } } ... } Hope this helps. -- Pascal Gélinas | Software Developer - Nu Echo Inc.* | - Because performance matters.*
http://wiki.eclipse.org/index.php?title=SWTBot/Testing_Custom_Controls&diff=239653&oldid=187901
CC-MAIN-2016-30
refinedweb
234
50.33
The Java Specialists' Newsletter Issue 141 2007-03-13 Category: Language Java version: 5 Subscribe RSS Feed Welcome to the 141st edition of The Java(tm) Specialists' Newsletter, written at the Athens airport. Olympic Airlines cancelled my later flight, so I have about 4-5 hours waiting time, unpleasant at any airport! As mentioned in my last newsletter, this week Sun Tech Days is happening in London, so please let me know if you are going. Last year I had the good fortune of attending more Java conferences than most Java developers do in a lifetime. At JavaPolis 2006, Ted Neward interviewed me. Ted is an excellent interviewer and seems to draw out thoughts. One of the things we talked about was a little hack that made it possible to add new enum instances. Stephan Janssen asked me to expound on this idea, so here is newsletter demonstrating how to do it. Before showing how it is done, please note that this has zero practical use. We are just having some fun with Java, and perhaps learning something in the process. I made some comments about Java 6 actually being a type of Java 5.1. This was related to the syntax of the actual language, not the utilities and libraries. There are a lot of new libraries, some of which used to be separate and are now bundled (e.g. JAXB). There is sufficient new material to cover a two day course, but fortunately the language stayed the same. The trick presented here only works with Java 5. We will have to continue searching to find a way to construct enum instances in Java. Enums are very well protected flyweight classes. The constructor is private. You cannot construct them with reflection. You cannot clone them. If you serialize and then deserialize them, they return the flyweight. So where is the chink in the armor that I can put my arrow through? To understand how to construct instances of enums, we need to go back a few generations of Java. In Java 1.0, there were no inner classes. In Java 1.1, these were added without significantly changing the compiled Java classes. You could access private members from within an inner class, for which the compiler would add "package access" static access methods to the outer class. All nice and tidy. The problem came in with private constructors. These are simply changed to "package access" without as much as a warning. If you can thus slip a class into the same package, you will be able to subclass it without difficulties. Back to Java 5. Enums allow us to add methods, even abstract ones. We then implement these methods in the actual enum values. Something like this: public enum Word { HELLO { public void print() { System.out.println("Hello"); } }, WORLD { public void print() { System.out.println("World"); } }; public abstract void print(); } public class AbstractEnumExample { public static void main(String[] args) { for (Word e : Word.values()) { e.print(); } } } The compiler now generates anonymous inner classes from each of the enum values. Since these are essentially separate classes, the constructor of the superclass enum Word has become package access. Here is what the generated code for HELLO looks like: final class Word$1 extends Word { Word$1(String s, int i) { super(s, i, null); } public void print() { System.out.println("Hello"); } } We now use the well known compile and switch trick to sneak in our own enum value. We start by writing a test case that should always fail if ever we were able to create an enum (seeing that we cannot create instances of enums): public class Test { public static void main(String[] args) { System.out.println("isEnum() = " + Word.class.isEnum()); boolean found = false; Word test = WordFactory.fetchWord(); for (Word word : Word.values()) { if (word != test) { System.out.println("OK, it's not " + word); } else { System.out.println("Ahh, it's " + word); found = true; break; } } if (!found) { System.out.println("So what is it? " + test); } } } We then write a WordFactory that returns word instances. We will change this later to return the hacked enum (and thereby break the test): public class WordFactory { public static Word fetchWord() { return Word.HELLO; } } We create an ordinary Java class Word (not an enum) in another directory (but the same package structure). This would have the same constructor signature as the Word enum, like this: public class Word { public Word(String s, int i) {} } We then create the COOL enum by simply subclassing Word: public class Cool extends Word { public Cool() { super("COOL", 2); } public void print() { System.out.println("Cool!"); } } Lastly, we create our own WordFactory that returns our Cool Word: public class WordFactory { public static Word fetchWord() { return new Cool(); } } We now compile our special classes and copy Cool.class and WordFactory.class into the same directory where the other classes are (Test, Word, WordFactory). When we now run Test (using Java 5, remember, not Java 6), we see the following output: isEnum() = true OK, it's not HELLO OK, it's not WORLD So what is it? COOL Not at all what we expected, is it? Nice to see how Sun cleared up that last loophole in enums in Java 6. We will need to now find a new hole to peep through. Gotta run, I have a plane to catch (literally :-)) Kind regards Heinz Language Articles Related Java Course Would you like to receive our monthly Java newsletter, with lots of interesting tips and tricks that will make you a better Java programmer?
http://www.javaspecialists.eu/archive/Issue141.html
CC-MAIN-2017-09
refinedweb
922
65.52
A few months ago we released client libraries for PHP, Ruby, Python, and Perl and today we add another to the family, JavaScript! This new client runs in Node.js and modern browsers, and aims to solve the same problems that the others do: - provide access to the entire Elasticsearch REST API - play nice with clusters - automatically discover nodes when desired - intelligently handle node failure - be easily extendable, so that you can really have it behave just the way you want If you didn’t know that we are developing our own clients you should check out this post from the first round of releases. In that post Clint explains why we decided to go down this road, as well as some of the goals of the project. Just like our other clients, Elasticsearch.js is licensed under Apache 2.0 and hosted on Github. Getting started with Elasticsearch.js is almost easier than getting started with Elasticsearch itself. Getting the Node.js module To install the module into an existing Node.js project use npm: npm install elasticsearch Getting the browser client For a browser-based projects, builds for modern browsers are available here. Download one of the archives, and extract it. Inside you’ll find three files, pick the one that best matches your environment: - elasticsearch.jquery.js – use this build if you are already using jQuery - elasticsearch.angular.js – use this build in Angular projects - elasticsearch.js – in all other cases, use this build Each of the library specific builds tie into the AJAX and Promise creation facilities provided by their respective libraries. This is an example of how Elasticsearch.js can be extended to provide a more opinionated approach when appropriate. Setting up the client Now you are ready to get busy! First thing you’ll need to do is create an instance of elasticsearch.Client. Here are several examples of configuration parameters you can use when creating that instance. For a full list of configuration options see the configuration docs. var elasticsearch = require('elasticsearch'); // Connect to localhost:9200 and use the default settings var client = new elasticsearch.Client(); // Connect the client to two nodes, requests will be // load-balanced between them using round-robin var client = elasticsearch.Client({ hosts: [ 'elasticsearch1:9200', 'elasticsearch2:9200' ] }); // Connect to the this host's cluster, sniff // for the rest of the cluster right away, and // again every 5 minutes var client = elasticsearch.Client({ host: 'elasticsearch1:9200', sniffOnStart: true, sniffInterval: 300000 }); // Connect to this host using https, basic auth, // a path prefix, and static query string values var client = new elasticsearch.Client({ host: '' }); Setting up the client in the browser The params accepted by the Client constructor are the same in the browser versions of the client, but how you access the Client constructor is different based on the build you are using. Below is an example of instantiating a client in each build. // elasticsearch.js adds the elasticsearch namespace to the window var client = elasticsearch.Client({ ... }); // elasticsearch.jquery.js adds the es namespace to the jQuery object var client = jQuery.es.Client({ ... }); // elasticsearch.angular.js creates an elasticsearch // module, which provides an esFactory var app = angular.module('app', ['elasticsearch']); app.service('es', function (esFactory) { return esFactory({ ... }); }); Using the client instance to make API calls. Once you create the client, making API calls is simple. // get the current status of the entire cluster. // Note: params are always optional, you can just send a callback client.cluster.health(function (err, resp) { if (err) { console.error(err.message); } else { console.dir(resp); } }); // index a document client.index({ index: 'blog', type: 'post', id: 1, body: { title: 'JavaScript Everywhere!', content: 'It all started when...', date: '2013-12-17' } }, function (err, resp) { // ... }); // search for documents (and also promises!!) client.search({ index: 'users', size: 50, body: { query: { match: { profile: 'elasticsearch' } } } }).then(function (resp) { var hits = resp.body.hits; }); Entering Construction Zone This release of Elasticsearch.js should be considered beta. Please install it, try it out and give us feedback. What doesn’t work? What is missing? What can we do better? We are excited to receive your issues and pull requests! We will be actively working to squash bugs as soon as they pop-up, and plan to do a full performance audit (it’s quick already, but we want to be certain that it’s also efficient as possible). We are also interested in creating wrappers for this library which might include plugins for other ORM modules like Mongoose or Bookshelf, helpers for some of the more complex parts of the API. If you would like to see anything specific let us know in a Github issue!
https://www.elastic.co/blog/client-for-node-js-and-the-browser
CC-MAIN-2020-40
refinedweb
772
67.25
* A friendly place for programming greenhorns! Big Moose Saloon Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP) Author instanceof Jini Varghese Ranch Hand Joined: Dec 06, 2000 Posts: 58 posted Dec 22, 2000 07:44:00 0 type.. I think 3 is the answer. Is there any other possibility ?. Ajith Kallambella Sheriff Joined: Mar 17, 2000 Posts: 5782 posted Dec 22, 2000 08:00:00 0 I think answer 3 is wrong. Take a look at the following code and try running it class Fruit {} class Apple extends Fruit{} class RedApple extends Apple{} public class InstanceOfTest { public static void main( String[] s) { RedApple washingtonApple = new RedApple(); if ( washingtonApple instanceof RedApple ) System.out.println("washingtonApple is an instance of RedApple" ); if ( washingtonApple instanceof Apple ) System.out.println("washingtonApple is an instance of Apple " ); if ( washingtonApple instanceof Fruit ) System.out.println("washingtonApple is an instance of Fruit " ); if ( washingtonApple instanceof Object ) System.out.println("washingtonApple is an instance of Object" ); } } The correct answer is 4. Ajith Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA). Sivaram Ghorakavi Ranch Hand Joined: Nov 30, 2000 Posts: 56 posted Dec 22, 2000 08:19:00 0 I too agree it's 4 that is CLOSE. But the question is slightly confusing.. The RHS of the instanceof operator is always validates the Class name up in the hierarchy not the instance. Currect me if wrong. Jini Varghese Ranch Hand Joined: Dec 06, 2000 Posts: 58 posted Dec 22, 2000 08:58:00 0 Thanks guys.. Ajith Kallambella Sheriff Joined: Mar 17, 2000 Posts: 5782 posted Dec 22, 2000 09:01:00 0 You are right Sivaram, but you can arrive at the answer using method of elimination. Infact the answer 4 depicts a typical usage of the instance operator. If ref1 and ref2 are instances of the same class, you can use the instanceof operator to infer the type of the class these objects belong to. However, in situations where you have a multiple inheritance relationship, you will have to be little care because you will get similar results if one of the two objects is actually and instance of a superclass. Sorry for digression, but I'd prefer to use the getClass() on the references and compare the Class objects returned instead of using the instanceof operator. The Class object approach, IMHO is far more accurate than the instanceof approach. Hope that helps, Ajith Rajpal Kandhari Ranch Hand Joined: Aug 26, 2000 Posts: 126 posted Dec 23, 2000 03:57:00 0 Hello Jini, Explanation given by Ajith is very good. And I would like to tell you in General about instanceof operator (hoping it will help you in clearing you're funda), I have taken these lines from RH: "The instanceof operator tests the class of an object at runtime. The left-hand argument can be any object reference expression, usually a variable or an array element, while the right hand operand must be a class, interface, or array type. You cannot use a java.lang.Class object or its string name as the right-hand operand. The instanceof operator return true is the class of the left-hand argument is the same as, or is some subclass of, the class specified by the right-hand operand. The right hand operand may equally well be an interface. In such a case, the test determines if the object at the left-hand argument implements the specified interface. You can also use the instanceof operator to test if a reference refers to an array. Since arrays are themselves objects in Java, this is natural enough, but the test that is performed actually checks two things: First it will check if the object is an array and then it checks if the element type of that array is some subclass of the element type of the right-hand argument." As mentioned by Ajith, using of getClass() method of Class class to find if the object belongs to the class. It can be done to find out if an object is in fact an array, without regard to the base type. You can do this using the isArray() method of the Class class. For ex Regards,<P>Raj.<BR>-------------------------<BR>Afforts should be Appriciated.<BR>------------------------- I agree. Here's the link: subject: instanceof Similar Threads question on instanceof operator.. Using instanceof operator instanceof Marcus Mock 3 No. 6 Test Question - Explanation? A Question from Marcus exam 3 about instanceof All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/196337/java-programmer-SCJP/certification/instanceof
CC-MAIN-2014-42
refinedweb
778
54.52
. Objects Like tuples, objects are a means to pack different values together in a structured way. However, objects provide many features that tuples do not: They provide inheritance and information hiding. Because objects encapsulate data, the T() object constructor should only be used internally and the programmer should provide a proc to initialize the object (this is called a constructor). Objects have access to their type at runtime. There is an of operator that can be used to check the object's type:[] Object fields that should be visible from outside the defining module have to be marked by *. In contrast to tuples, different object types are never equivalent. New object types can only be defined within a type section.. Methods avoids these problems by not assigning methods to a class. All methods in Nim are multi-methods. As we will see later, multi-methods are distinguished from procs only for dynamic binding purposes.): typed =. Macros Macros enable advanced compile-time code transformations, but they cannot change Nim's syntax. However, this is no real restriction because Nim's syntax is flexible enough anyway. Macros have to be implemented in pure Nim code if the foreign function interface (FFI) is not enabled in the compiler, but other than that restriction (which at some point in the future will go away) you can write any kind of Nim code and the compiler will run it at compile time. There are two ways to write a macro, either generating Nim source code and letting the compiler parse it, or creating manually an abstract syntax tree (AST) which you feed to the compiler. In order to build the AST one needs to know how the Nim concrete syntax is converted to an abstract syntax tree (AST). The AST is documented in the macros module. Once your macro is finished, there are two ways to invoke[untyped]): typed = # `n` is a Nim AST that contains a list of expressions; # this macro returns a list of statements (n is passed for proper line # information): result = newNimNode(nnkStmtList, n) # iterate over any argument that is passed to this macro: for x in n: # add a call to the statement list that writes the expression; # `toStrLit` converts an AST to its string representation: result.add(newCall("write", newIdentNode("stdout"), toStrLit(x))) # add a call to the statement list that writes ": " result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": "))) # add a call to the statement list that writes the expressions value: result.add(newCall("writeLine", newIdentNode("stdout"), x)) var a: array[0..10, int] x = "some string" a[0] = 42 a[1] = 45 debug(a[0], a[1], x) The macro call expands to: write(stdout, "a[0]") write(stdout, ": ") writeLine(stdout, a[0]) write(stdout, "a[1]") write(stdout, ": ") writeLine(stdout, a[1]) write(stdout, "x") write(stdout, ": ") writeLine(stdout, x) Statement Macros Statement macros are defined just as expression macros. However, they are invoked by an expression following a colon. The following example outlines a macro that generates a lexical analyzer from regular expressions: macro case_token(n: varargs[untyped]): typed = # Building your first macro To give a footstart to writing macros we will show now how to turn your typical dynamic code into something that compiles statically. For the exercise we will use the following snippet of code as the starting point: import strutils, tables proc readCfgAtRuntime(cfgFilename: string): Table[string, string] = let inputString = readFile(cfgFilename) var source = "" result = initTable[string, string]() for line in inputString.splitLines: # Ignore empty lines if line.len < 1: continue var chunks = split(line, ',') if chunks.len != 2: quit("Input needs comma split values, got: " & line) result[chunks[0]] = chunks[1] if result.len < 1: quit("Input file empty!") let info = readCfgAtRuntime("data.cfg") when isMainModule: echo info["licenseOwner"] echo info["licenseKey"] echo info["version"] Presumably this snippet of code could be used in a commercial software, reading a configuration file to display information about the person who bought the software. This external file would be generated by an online web shopping cart to be included along the program containing the license information: version,1.1 licenseOwner,Hyori Lee licenseKey,M1Tl3PjBWO2CC48m The readCfgAtRuntime proc will open the given filename and return a Table from the tables module. The parsing of the file is done (without much care for handling invalid data or corner cases) using the splitLines proc from the strutils module. There are many things which can fail; mind the purpose is explaining how to make this run at compile time, not how to properly implement a DRM scheme. The reimplementation of this code as a compile time proc will allow us to get rid of the data.cfg file we would need to distribute along the binary, plus if the information is really constant, it doesn't make from a logical point of view to have it mutable in a global variable, it would be better if it was a constant. Finally, and likely the most valuable feature, we can implement some verification at compile time. You could think of this as a better unit testing, since it is impossible to obtain a binary unless everything is correct, preventing you to ship to users a broken program which won't start because a small critical file is missing or its contents changed by mistake to something invalid. Generating source code Our first attempt will start by modifying the program to generate a compile time string with the generated source code, which we then pass to the parseStmt proc from the macros module. Here is the modified source code implementing the macro: The good news is not much has changed! First, we need to change the handling of the input parameter (line 3). In the dynamic version the readCfgAtRuntime proc receives a string parameter. However, in the macro version it is also declared as string, but this is the outside interface of the macro. When the macro is run, it actually gets a PNimNode object instead of a string, and we have to call the strVal proc (line 5) from the macros module to obtain the string being passed in to the macro. Second, we cannot use the readFile proc from the system module due to FFI restriction at compile time. If we try to use this proc, or any other which depends on FFI, the compiler will error with the message cannot evaluate and a dump of the macro's source code, along with a stack trace where the compiler reached before bailing out. We can get around this limitation by using the slurp proc from the system module, which was precisely made for compilation time (just like gorge which executes an external program and captures its output). The interesting thing is that our macro does not return a runtime Table object. Instead, it builds up Nim source code into the source variable. For each line of the configuration file a const variable will be generated (line 15). To avoid conflicts we prefix these variables with cfg. In essence, what the compiler is doing is replacing the line calling the macro with the following snippet of code: const cfgversion = "1.1" const cfglicenseOwner = "Hyori Lee" const cfglicenseKey = "M1Tl3PjBWO2CC48m" You can verify this yourself adding the line echo source somewhere at the end of the macro and compiling the program. Another difference is that instead of calling the usual quit proc to abort (which we could still call) this version calls the error proc (line 14). The error proc has the same behavior as quit but will dump also the source and file line information where the error happened, making it easier for the programmer to find where compilation failed. In this situation it would point to the line invoking the macro, but not the line of data.cfg we are processing, that's something the macro itself would need to control. Generating AST by hand To generate an AST we would need to intimately know the structures used by the Nim compiler exposed in the macros module, which at first look seems a daunting task. But we can use as helper shortcut the dumpTree macro, which is used as a statement macro instead of an expression macro. Since we know that we want to generate a bunch of const symbols we can create the following source file and compile it to see what the compiler expects from us: import macros dumpTree: const cfgversion: string = "1.1" const cfglicenseOwner = "Hyori Lee" const cfglicenseKey = "M1Tl3PjBWO2CC48m" During compilation of the source code we should see the following lines in the output (again, since this is a macro, compilation is enough, you don't have to run any binary): StmtList ConstSection ConstDef Ident !"cfgversion" Ident !"string" StrLit 1.1 ConstSection ConstDef Ident !"cfglicenseOwner" Empty StrLit Hyori Lee ConstSection ConstDef Ident !"cfglicenseKey" Empty StrLit M1Tl3PjBWO2CC48m With this output we have a better idea of what kind of input the compiler expects. We need to generate a list of statements. For each constant the source code generates a ConstSection and a ConstDef. If we were to move all the constants to a single const block we would see only a single ConstSection with three children. Maybe you didn't notice, but in the dumpTree example the first constant explicitly specifies the type of the constant. That's why in the tree output the two last constants have their second child Empty but the first has a string identifier. So basically a const definition is made up from an identifier, optionally a type (can be an empty node) and the value. Armed with this knowledge, let's look at the finished version of the AST building macro: Since we are building on the previous example generating source code, we will only mention the differences to it. Instead of creating a temporary string variable and writing into it source code as if it were written by hand, we use the result variable directly and create a statement list node (nnkStmtList) which will hold our children (line 7). For each input line we have to create a constant definition (nnkConstDef) and wrap it inside a constant section (nnkConstSection). Once these variables are created, we fill them hierarchichally (line 17) like the previous AST dump tree showed: the constant definition is a child of the section definition, and the constant definition has an identifier node, an empty node (we let the compiler figure out the type), and a string literal with the value. A last tip when writing a macro: if you are not sure the AST you are building looks ok, you may be tempted to use the dumpTree macro. But you can't use it inside the macro you are writting/debugging. Instead echo the string generated by treeRepr. If at the end of the this example you add echo treeRepr(result) you should get the same output as using the dumpTree macro, but of course you can call that at any point of the macro where you might be having troubles. Example Templates and Macros] Identifier Mangling proc echoHW() = echo "Hello world" proc echoHW0() = echo "Hello world 0" proc echoHW1() = echo "Hello world 1" template joinSymbols(a, b: untyped): untyped = `a b`() joinSymbols(echo, HW) macro str2Call(s1, s2): typed = result = newNimNode(nnkStmtList) for i in 0..1: # combines s1, s2 and an integer into an proc identifier # that is called in a statement list result.add(newCall(!($s1 & $s2 & $i))) str2Call("echo", "HW") # Output: # Hello world # Hello world 0 # Hello world 1.
https://nim-lang.org/docs/tut2.html
CC-MAIN-2018-51
refinedweb
1,916
57.3
table of contents NAME¶ fcft_glyph_rasterize - rasterize a glyph for a wide character SYNOPSIS¶ #include <fcft/fcft.h> const struct fcft_glyph *fcft_glyph_rasterize( DESCRIPTION¶ fcft_glyph_rasterize() rasterizes the wide character wc using the primary font, or one of the fallback fonts, in font. wc is first searched for in the primary font. If not found, the fallback fonts are searched (in the order they were specified in fcft_from_name(3)). If not found in any of the fallback fonts, the FontConfig fallback list for the primary font is searched. subpixel allows you to specify which subpixel mode to use. It is one of: enum fcft_subpixel { FCFT_SUBPIXEL_DEFAULT, FCFT_SUBPIXEL_NONE, FCFT_SUBPIXEL_HORIZONTAL_RGB, FCFT_SUBPIXEL_HORIZONTAL_BGR, FCFT_SUBPIXEL_VERTICAL_RGB, FCFT_SUBPIXEL_VERTICAL_BGR, }; If FCFT_SUBPIXEL_DEFAULT is specified, the subpixel mode configured in FontConfig is used. If FCFT_SUBPIXEL_NONE is specified, grayscale antialiasing will be used. For all other values, the specified mode is used. Note that if antialiasing has been disabled (in FontConfig, either globally, or specifically for the current font), then subpixel is ignored. The intention is to enable programs to use per-monitor subpixel modes. Incidentally, enum fcft_subpixel matches enum wl_output_subpixel, the enum used in Wayland. Note: you probably do not want anything by FCFT_SUBPIXEL_NONE if blending with a transparent background. RETURN VALUE¶ On error, NULL is returned. On success, a pointer to a rasterized glyph is returned. The glyph is cached in fcft, making subsequent calls with the same arguments very fast (i.e. there is no need for programs to cache glyphs by themselves). The glyph object is managed by font. There is no need to explicitly free it; it is freed when font is destroyed (with fcft_destroy(3)). struct fcft_glyph { wchar_t wc; int cols; pixman_image_t *pix; int x; int y; int width; int height; struct { int x; int y; } advance; }; wc is the same wc from the fcft_glyph_rasterize() call. cols is the number of "columns" the glyph occupies (effectively, wcwidth(wc)). pix is the rasterized glyph. Its format depends on a number of factors, but will be one of PIXMAN_a1, PIXMAN_a8, PIXMAN_x8r8g8b8, PIXMAN_a8r8g8b8. Use pixman_image_get_format() to find out which one it is. PIXMAN_a8 corresponds to FT_PIXEL_MODE_GRAY. I.e. the glyph is a grayscale antialiased bitmask. use as a mask when blending. PIXMAN_x8r8g8b8 corresponds to either FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V. pixman_image_set_component_alpha() has been called by fcft for you. Use as a mask when blending. PIXMAN_a8r8g8b8 corresponds to FT_PIXEL_MODE_BGRA. I.e. the glyph is a plain RGBA image. Use as source when blending. x is the glyph's horizontal offset, in pixels. Add this to the current pen position when blending. y is the glyph's vertical offset, in pixels. Add this to the current pen position when blending. width is the glyph's width, in pixels. Use as 'width' argument when blending. height is the glyph's height, in pixels. Use as 'height' argument when blending. advance is the glyph's 'advance', in pixels. Add this to the pen position after blending; x for a horizontal layout and y for a vertical layout. EXAMPLE¶ SEE ALSO¶ fcft_destroy(3), fcft_kerning(3)
https://manpages.debian.org/bullseye/libfcft-doc/fcft_glyph_rasterize.3.en.html
CC-MAIN-2022-40
refinedweb
496
60.41
IRC log of ws-addr on 2006-04-03 Timestamps are in UTC. 19:53:38 [RRSAgent] RRSAgent has joined #ws-addr 19:53:38 [RRSAgent] logging to 19:53:52 [bob] zakin, this will be ws_addrwg 19:53:58 [hugo] hugo has joined #ws-addr 19:54:09 [bob] Meeting: Web Services Addressing WG Teleconference 19:54:15 [bob] Chair: Bob Freund 19:55:11 [bob] Agenda: 19:55:12 [hugo] hugo has joined #ws-addr 19:55:24 [bob] zakim, this will be ws_addrwg 19:55:24 [Zakim] ok, bob; I see WS_AddrWG()4:00PM scheduled to start in 5 minutes 19:56:14 [prasad] prasad has joined #ws-Addr 19:56:23 [Zakim] WS_AddrWG()4:00PM has now started 19:56:29 [David_Illsley] David_Illsley has joined #ws-addr 19:56:30 [Zakim] +Bob_Freund 19:57:01 [Zakim] +David_Illsley 19:58:23 [Zakim] +Gilbert_Pilz 19:59:24 [Gil] Gil has joined #ws-addr 19:59:25 [Zakim] +Nilo 20:00:07 [Zakim] +Paul_Knight 20:00:11 [Zakim] +Mark_Little 20:00:39 [Zakim] +Andreas_Bjarlestam 20:00:46 [Gil] Gil has joined #ws-addr 20:00:50 [Zakim] +Vikas_Deolaliker 20:00:55 [Zakim] +Hugo 20:00:57 [Zakim] +Tom_Rutt 20:01:01 [Katy] Katy has joined #ws-addr 20:01:53 [vikas] vikas has joined #ws-addr 20:02:03 [Zakim] +Dave_Hull 20:02:17 [dhull] dhull has joined #ws-addr 20:02:20 [andreas] andreas has joined #ws-addr 20:02:59 [Zakim] +Mark_Peel/Katy_Warr 20:03:03 [TonyR] TonyR has joined #ws-addr 20:03:05 [Zakim] +Prasad_Yendluri 20:03:52 [Zakim] +Jonathan_Marsh 20:03:59 [TRutt] TRutt has joined #ws-addr 20:04:09 [Katy] zakim, mute Katy_Warr 20:04:09 [Zakim] sorry, Katy, I do not see a party named 'Katy_Warr' 20:04:19 [Zakim] +??P16 20:04:34 [TonyR] zkaim, ??p16 is me 20:04:39 [Katy] zakim, mute Katy 20:04:39 [Zakim] sorry, Katy, I do not see a party named 'Katy' 20:04:45 [TonyR] zakim, ??p16 is me 20:04:45 [Zakim] +TonyR; got it 20:05:16 [TRutt] me tony how many hours different are you now vs last week 20:05:31 [Katy] zakim, who's here 20:05:31 [Zakim] Katy, you need to end that query with '?' 20:05:41 [Katy] zakim, who's here? 20:05:41 [Zakim] On the phone I see Bob_Freund, David_Illsley, Gilbert_Pilz, Nilo, Paul_Knight, Mark_Little, Andreas_Bjarlestam (muted), Vikas_Deolaliker, Hugo, Tom_Rutt, Dave_Hull, 20:05:44 [Zakim] ... Mark_Peel/Katy_Warr, Prasad_Yendluri, Jonathan_Marsh, TonyR 20:05:45 [Zakim] On IRC I see TRutt, TonyR, andreas, dhull, vikas, Katy, Gil, David_Illsley, prasad, hugo, RRSAgent, Zakim, bob, PaulKnight, Jonathan 20:06:07 [Katy] zakim, Mark_Peel/Katy_Warr is Katy_Warr 20:06:07 [Zakim] +Katy_Warr; got it 20:06:17 [Katy] zakim, mute Katy_Warr 20:06:17 [Zakim] Katy_Warr should now be muted 20:06:23 [Katy] phew! 20:07:17 [bob] Scribe: Paul Knite 20:07:29 [bob] Scribe: Paul Knight 20:07:40 [Jonathan] RRSAgent, where am I? 20:07:40 [RRSAgent] See 20:07:48 [hugo] scribeNick: PaulKnight 20:08:31 [PaulKnight] minutes accepted 20:08:48 [PaulKnight] that is, minutes of previous meeting 20:09:18 [PaulKnight] hugo: headup on change of contact person . I am leaving the WG and W3C by the end of May 20:09:48 [PaulKnight] Bob: Hugo has been a tremendous help to me and the WG. We will misshim and wish him the best. 20:09:51 [Zakim] +Dave_Orchard 20:09:53 [dhull] +1 20:10:15 [PaulKnight] Hugo: I will go to yahoo to do some web-servicey "stuff" 20:10:37 [PaulKnight] Bob: reviewing action items: 20:11:07 [PaulKnight] 1- editors to remove edotorial notes, text from hugo accepted... 20:11:22 [Zakim] +GlenD 20:12:35 [PaulKnight] Bob: we will come back 20:12:49 [PaulKnight] proposed and new issues 20:13:16 [PaulKnight] * lc123 - Example Improvement suggestion Owner: ??? Proposal 1: < > 20:14:52 [PaulKnight] ideal would be to align examples with WSDL document and use hotel reservations 20:16:09 [PaulKnight] dhull: describing the example suggestions 20:16:24 [GlenD] GlenD has joined #ws-addr 20:16:27 [PaulKnight] bob: any objections to regularizing the examples? 20:16:37 [Zakim] -GlenD 20:16:44 [PaulKnight] no objections 20:16:56 [PaulKnight] ACTION: editors to modify text accordingly 20:17:26 [Zakim] +GlenD 20:17:34 [PaulKnight] issue: * lc124 - Conformance section Owner: ??? 20:17:53 [PaulKnight] bob: Hugo, is this due to the new document policy? 20:18:21 [Jonathan] q+ 20:19:05 [bob] ack jon 20:19:07 [PaulKnight] hugo: W3C had a QA discussion, not really a new rule, but looking from a QA perspective 20:20:02 [hugo] s/discussion/Activity/ 20:20:36 [Zakim] +Marc_Hadley 20:20:58 [PaulKnight] bob: should we add a conformance section, or change how we use the word "conform" ? 20:21:01 [marc] marc has joined #ws-addr 20:22:24 [dhull] q+ to ask if there are any non-trivial interactions among the various optional features? 20:22:31 [Zakim] +Anish 20:22:33 [dhull] q- 20:22:56 [anish] anish has joined #ws-addr 20:25:28 [PaulKnight] Jonathan: When we talk about supporting usingAddressing, the use of anonymous or Action is implied.... 20:26:14 [dorchard] dorchard has joined #ws-addr 20:26:24 [TRutt] q+ 20:26:30 [PaulKnight] jonathan: for optional features, it is not clear exactly how you specify conformance 20:27:01 [PaulKnight] bob: there are some general statements in the doc style guide which contain some canned conformance statements 20:27:17 [bob] ack tr 20:27:28 [Zakim] -Mark_Little 20:27:35 [PaulKnight] trutt: lots of specs have "conformance points" which we can consider 20:28:01 [PaulKnight] trutt: we need to clarify what are the conformance points - are they grouped or separarte? 20:28:14 [PaulKnight] s/separarte/separate/ 20:28:35 [Jonathan] 20:30:01 [PaulKnight] bob: any volunteers for writing a conformance section? 20:30:29 [TRutt] q+ 20:30:31 [PaulKnight] bob: do we need a conformance section? We should explore that. 20:30:55 [PaulKnight] trutt: are the optional points sufficiently clear now, which ones are needed? 20:31:30 [PaulKnight] jona: it is clear to me, but maybe it is not clear in the spec which individual items are required 20:32:23 [PaulKnight] bob: can we get an issue owner? 20:32:37 [anish] i see only two occurances of 'conforms to' and they all point to ws-addr (core/soap), i think 20:33:06 [PaulKnight] Jonathan: I can do it, suggest some clarifying text. If others want to work in parallel, that is fine. 20:33:38 [PaulKnight] ACTION: Jonathan to work on clarifying conformance points 20:34:00 [PaulKnight] topic: * lc125 - Define the class of products of your specification Owner: ??? 20:35:13 [bob] ref: 20:35:33 [dhull] q+ 20:35:58 [bob] ack tr 20:36:02 [bob] ack dh 20:36:04 [GlenD] I think that what we did in WSDL was actually a mistake, and that a lot of people are going to be confused when they try to understand how to correctly use extensibility. :( 20:36:08 [PaulKnight] Jonathan: metadata is an issue - diferent use cases - hard to deal with 20:37:18 [PaulKnight] dhull: WS-A is used for messages... it cuts out databases, other interesting things... just say a sentence in that direction, may address the issue...? 20:37:26 [dorchard] I tend to agree with Glen. I especially don't like that the conformance seems related to fluffing up an abstract component model... 20:37:58 [anish] is this comment against all the specs or just the wsdl binding? 20:38:16 [PaulKnight] s/dhull/glenD/ 20:39:48 [dhull] q+ 20:40:15 [dhull] paul, that was me ("WS-A is used for messages") 20:40:40 [Zakim] -GlenD 20:41:13 [PaulKnight] dhull: is there any product that this would not apply to? 20:41:27 [bob] ack dh 20:42:05 [PaulKnight] dhull: if there is no meaningful kind of process it does not apply to, we can say it applies to all.. 20:42:24 [bob] definition: 20:42:27 [bob] class of products 20:42:27 [bob] The generic name for the group of products or services that would implement, for the same purpose, the specification, (i.e., target of the specification). A specification may identify several classes of products. 20:43:22 [Zakim] -Nilo 20:43:36 [PaulKnight] we can say it is applicable everywhere, not have a canonical list of products it applies to. 20:44:09 [PaulKnight] bob: we can say: we heard your comment, but it does not apply because of the following, or we can address it 20:44:35 [PaulKnight] bob: the class of product we can describe here might be as simple as "web services" 20:44:52 [PaulKnight] jonathan: or a class of systems which consume WSDL 20:45:43 [PaulKnight] bob: wouldn't the class of products be WSDL consumers? 20:46:20 [PaulKnight] hugo: we can say WSDL or EPR consumers. it does not need more than that. 20:46:56 [PaulKnight] hugo: the conformance item was useful, but this item does not bring a lot of value. 20:47:22 [PaulKnight] bob: any objections to "WSDL or EPR consumers"? 20:47:59 [PaulKnight] jona: I agree, 20:48:09 [PaulKnight] bob: no objections, 20:48:57 [PaulKnight] ACTION: bob to respond to author and craft response, class of consumers is EPR and WSDL consumers 20:49:22 [PaulKnight] topic: * lc126 - WS-Addressing typo 3.1 Using Owner: ??? 20:49:33 [PaulKnight] bob: not sure what is the point 20:49:54 [PaulKnight] jona: usingAddressing 20:50:17 [PaulKnight] ACTION: Bob to respond to author. 20:50:35 [PaulKnight] hugo: possibly use a code font to mark element names 20:51:04 [PaulKnight] jona: or add a namespace prefix lowercase wsa-w 20:52:02 [hugo] in XMLSpec, <el> can be used to surround element names and <att> can be used to surround attribute names 20:52:37 [PaulKnight] ACTION: editors to investigate ways to typographically clarify how to depict our intent 20:52:55 [PaulKnight] topic: * lc127 - Application choice of synchronicity Owner: ??? 20:53:57 [PaulKnight] bob: ways for the application to determine how to use Anon? Is this an implementation issue? 20:54:30 [bob] 20:55:33 [PaulKnight] bob: the comment is in end of the third paragraph of the link posted 20:57:19 [PaulKnight] bob: the answer may be: "yes, you are right, but..?" 20:57:59 [PaulKnight] jonathan: don't quite see the problem with a single endpoint, using non-anonymous, sending it on... 20:58:24 [PaulKnight] bob: asynchronously with respect to the lifetime of the backchannel? 20:58:49 [anish] i didn't understand what he meant by creating a new binding type. And how would that address his problem 20:58:50 [PaulKnight] jona: at the application level? 20:59:47 [PaulKnight] bob: using a non-anonymous replyTo, you allow a future response to come on that channel 21:00:35 [yinleng] yinleng has joined #ws-addr 21:01:28 [PaulKnight] bob: can someone craft a response? it is an overall WS-Adderessing question in some ways. Can someone try to take ownership to tease out what Todd means? 21:02:05 [PaulKnight] Anish: like jonathan, I'm not sure what the issue is... 21:02:43 [PaulKnight] jonathan: I will respond to him and try to get more detail, and explain our thinking. 21:02:52 [TRutt] q+ 21:03:06 [PaulKnight] ACTION: jonathan to respond to author (Todd) 21:03:30 [Zakim] -Dave_Orchard 21:03:46 [PaulKnight] Bob: We will need two hours for the meeting next week, things are piling up 21:03:58 [PaulKnight] Bob: I have opened registration for the F2F 21:04:20 [PaulKnight] Bob: planning a Wednesday PM activity, possibly at Museum of Fine Arts 21:04:37 [PaulKnight] bob: it would need to be fairly early, by 6:30 21:04:54 [Zakim] -Katy_Warr 21:04:55 [Zakim] -Anish 21:04:56 [Zakim] -Jonathan_Marsh 21:04:57 [Zakim] -Tom_Rutt 21:04:58 [PaulKnight] bob: adjhourning now, prepare for 2 hours next week! 21:04:59 [Zakim] -Hugo 21:05:00 [Zakim] -Marc_Hadley 21:05:01 [Zakim] -Andreas_Bjarlestam 21:05:02 [Zakim] -Vikas_Deolaliker 21:05:03 [Zakim] -Bob_Freund 21:05:05 [Zakim] -David_Illsley 21:05:06 [Zakim] -Prasad_Yendluri 21:05:07 [Zakim] -TonyR 21:05:13 [Zakim] -Gilbert_Pilz 21:05:16 [Zakim] -Paul_Knight 21:06:16 [Gil] Gil has left #ws-addr 21:06:48 [hugo] RRSAgent, make log public 21:06:54 [hugo] RRSAgent, draft minutes 21:06:54 [RRSAgent] I have made the request to generate hugo 21:06:54 [yinleng] yinleng has left #ws-addr 21:08:45 [GlenD] GlenD has joined #ws-addr 21:09:36 [GlenD] I assume call is over? 21:11:59 [GlenD] I'll take that as yes :) 21:32:33 [TRutt] TRutt has left #ws-addr 21:34:29 [dhull] dhull has joined #ws-addr 22:05:00 [Zakim] disconnecting the lone participant, Dave_Hull, in WS_AddrWG()4:00PM 22:05:01 [Zakim] WS_AddrWG()4:00PM has ended 22:05:04 [Zakim] Attendees were Bob_Freund, David_Illsley, Gilbert_Pilz, Nilo, Paul_Knight, Mark_Little, Andreas_Bjarlestam, Vikas_Deolaliker, Hugo, Tom_Rutt, Dave_Hull, Prasad_Yendluri, 22:05:06 [Zakim] ... Jonathan_Marsh, TonyR, Katy_Warr, Dave_Orchard, GlenD, Marc_Hadley, Anish 22:14:58 [pauld] pauld has joined #ws-addr 23:16:15 [Zakim] Zakim has left #ws-addr
http://www.w3.org/2006/04/03-ws-addr-irc
CC-MAIN-2015-27
refinedweb
2,265
61.29
This instead of the "manual" approach in my old post. I also discuss Quartz.NET in the second edition of my book, ASP.NET Core in Action. For now you can even get a 40% discount by entering the code bllock2 into the discount code box at checkout at manning.com. I show how to add the Quartz.NET HostedService to your app, how to create a simple IJob, and how to register it with a trigger. three main concepts: - A job. This is the background tasks that you want to run. - A trigger. A trigger controls when a job runs, typically firing on some sort of schedule. - A scheduler. This is responsible for coordinating the jobs and triggers, executing the jobs as required by the triggers. ASP.NET Core has good support for running "background tasks" via way of hosted services. Hosted services are started when your ASP.NET Core app starts, and run in the background for the lifetime of the application. Quartz.NET version 3.2.0 introduced direct support for this pattern with the Quartz.Extensions.Hosting package. Quartz.Extensions.Hosting can be used either with ASP.NET Core applications, or with "generic host" based worker-services. There is also a Quartz.AspNetCore package that builds on the Quartz.Extensions.Hosting. It primarily adds health-check integration, though health-checks can also be used with worker-services too! of these by using a Cron trigger. Quartz.NET also allows you to run multiple instances of your application in a clustered fashion, so that only a single instance can run a given task at any one time. The Quartz.NET hosted service takes care of the scheduler part of Quartz. It will run in the background of your application, checking for triggers that are firing, and running the associated jobs as necessary. You need to configure the scheduler initially, but you don't need to worry about starting or stopping it, the IHostedService manages that for you. a worker service project. You can install the Quartz.NET hosting package using dotnet add package Quartz.Extensions.Hosting. If you view the .csproj for the project, it should look something like this: <Project Sdk="Microsoft.NET.Sdk.Worker"> <PropertyGroup> <TargetFramework>net5.0</TargetFramework> <UserSecretsId>dotnet-QuartzWorkerService-9D4BFFBE-BE06-4490-AE8B-8AF1466778FD</UserSecretsId> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" /> <PackageReference Include="Quartz.Extensions.Hosting" Version="3.2.3" /> </ItemGroup> </Project> This adds the hosted service package, which brings in the main Quartz.NET package with in. Next we need to register the Quartz services and the Quartz IHostedService in our app. Adding the Quartz.NET hosted service You need to do two things to register the Quartz.NET hosted service: - Register the Quartz.NET required services with the DI container - Register the hosted service In ASP.NET Core applications you would typically do both of these in the Startup.ConfigureServices() method. Worker services don't use Startup classes though, so we register them in the ConfigureServices method on the IHostBuilder in Program.cs: public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { // Add the required Quartz.NET services services.AddQuartz(q => { // Use a Scoped container to create jobs. I'll touch on this later q.UseMicrosoftDependencyInjectionScopedJobFactory(); }); // Add the Quartz.NET hosted service services.AddQuartzHostedService( q => q.WaitForJobsToComplete = true); // other config }); } There's a couple of points of interest here: UseMicrosoftDependencyInjectionScopedJobFactory: this tells Quartz.NET to register an IJobFactorythat creates jobs by fetching them from the DI container. The Scopedpart means that your jobs can use scoped services, not just singleton or transient services, which is a common requirement. WaitForJobsToComplete: When shutdown is requested, this setting ensures that Quartz.NET waits for the jobs to end gracefully before exiting. You might be wondering why you need to call AddQuartz()and AddQuartzHostedService(). That's because Quartz.NET itself isn't tied to the hosted service implementation. You're free to run the Quartz scheduler yourself, as shown in the documentation. If you run your application now, you'll see the Quartz service start up, and dump a whole lot of logs to the console: info: Quartz.Core.SchedulerSignalerImpl[0] Initialized Scheduler Signaller of type: Quartz.Core.SchedulerSignalerImpl info: Quartz.Core.QuartzScheduler[0] Quartz Scheduler v.3.2.3.0 created. info: Quartz.Core.QuartzScheduler[0] JobFactory set to: Quartz.Simpl.MicrosoftDependencyInjectionJobFactory info: Quartz.Simpl.RAMJobStore[0] RAMJobStore initialized. info: Quartz.Core.QuartzScheduler[0] Scheduler meta-data: Quartz Scheduler (v3.2.3.0) 'QuartzScheduler' with instanceId 'NON_CLUSTERED' Scheduler class: 'Quartz.Core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'Quartz.Simpl.DefaultThreadPool' - with 10 threads. Using job-store 'Quartz.Simpl.RAMJobStore' - which does not support persistence. and is not clustered. info: Quartz.Impl.StdSchedulerFactory[0] Quartz scheduler 'QuartzScheduler' initialized info: Quartz.Impl.StdSchedulerFactory[0] Quartz scheduler version: 3.2.3.0 info: Quartz.Core.QuartzScheduler[0] Scheduler QuartzScheduler_$_NON_CLUSTERED started. info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. ... At this point you now have Quartz running as a hosted service in your application, but you don't have any jobs for it to run. In the next section, we'll create and register a simple job. Creating an IJob For the actual background work we are scheduling, we're just going to use a "hello world" implementation that writes to an ILogger<T> (and hence to the console). You should implement the Quartz.NET. Now we've created the job, we need to register it with the DI container along with a trigger. Configuring the Job Quartz.NET has some simple schedules for running jobs, but one of the most common approaches is using a Quartz.NET Cron expression. Cron expressions allow complex timer scheduling so you can set rules like "fire every half hour between the hours of 8 am and 10 am, on the 5th and 20th of every month". Just make sure to check the documentation for examples as not all Cron expressions used by different systems are interchangeable. The following example shows how to register the HelloWorldJob with a trigger that runs every 5 seconds: public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { services.AddQuartz(q => { q.UseMicrosoftDependencyInjectionScopedJobFactory(); // Create a "key" for the job var jobKey = new JobKey("HelloWorldJob"); // Register the job with the DI container q.AddJob<HelloWorldJob>(opts => opts.WithIdentity(jobKey)); // Create a trigger for the job q.AddTrigger(opts => opts .ForJob(jobKey) // link to the HelloWorldJob .WithIdentity("HelloWorldJob-trigger") // give the trigger a unique name .WithCronSchedule("0/5 * * * * ?")); // run every 5 seconds }); services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true); // ... }); In this code we: - Create a unique JobKeyfor the job. This is used to link the job and its trigger together. There are other approaches to link jobs and trigger, but I find this is as good as any. - Register the HelloWorldJobwith AddJob<T>. This does two things - it adds the HelloWorldJobto the DI container so it can be created, and it registers the job with Quartz internally. - Add a trigger to run the job every 5 seconds. We use the JobKeyto associate the trigger with a job, and give the trigger a unique name (not necessary for this example, but important if you run quartz in clustered mode, so is best practice). Finally, we set a Cron schedule for the trigger for the job to run every 5 seconds. And that's it! No more creating a custom IJobFactory or worrying about supporting scoped services. The default package handles all that for you—you can use scoped services in your IJob and they will be disposed when the job finishes. If you run you run your application now, you'll see the same startup messages as before, and then every 5 seconds you'll see the HelloWorldJob writing to the console: That's all that's required to get up and running, but there's a little too much boilerplate in the ConfigureServices method for adding a job for my liking. It's also unlikely you'll want to hard code the job schedule in your app. If you extract that to configuration, you can use different schedules in each environment, for example. Extracting the configuration to appsettings.json At the most basic level, we want to extract the Cron schedule to configuration. For example, you could add the following to appsettings.json: { "Quartz": { "HelloWorldJob": "0/5 * * * * ?" } } You can then easily override the trigger schedule for the HelloWorldJob in different environments. For ease of registration, we could create an extension method to encapsulate registering an IJob with Quartz, and setting it's trigger schedule. This code is mostly the same as the previous example, but it uses the name of the job as a key into the IConfiguration to load the Cron schedule. public static class ServiceCollectionQuartzConfiguratorExtensions { public static void AddJobAndTrigger<T>( this IServiceCollectionQuartzConfigurator quartz, IConfiguration config) where T : IJob { // Use the name of the IJob as the appsettings.json key string jobName = typeof(T).Name; // Try and load the schedule from configuration var configKey = $"Quartz:{jobName}"; var cronSchedule = config[configKey]; // Some minor validation if (string.IsNullOrEmpty(cronSchedule)) { throw new Exception($"No Quartz.NET Cron schedule found for job in configuration at {configKey}"); } // register the job as before var jobKey = new JobKey(jobName); quartz.AddJob<T>(opts => opts.WithIdentity(jobKey)); quartz.AddTrigger(opts => opts .ForJob(jobKey) .WithIdentity(jobName + "-trigger") .WithCronSchedule(cronSchedule)); // use the schedule from configuration } } Now we can clean up our application's Program.cs to use the extension method: public class Program { public static void Main(string[] args) => CreateHostBuilder(args).Build().Run(); public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { services.AddQuartz(q => { q.UseMicrosoftDependencyInjectionScopedJobFactory(); // Register the job, loading the schedule from configuration q.AddJobAndTrigger<HelloWorldJob>(hostContext.Configuration); }); services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true); }); } This is essentially identical to our configuration, but we've made it easier to add new jobs, and move the details of the schedule into configuration. Much better! Note that although ASP.NET Core allows "on-the-fly" reloading of appsettings.json, this will not change the schedule for a job unless you restart the application. Quartz.NET loads all its configuration on app startup, so will not detect the change. Running the application again gives the same output: the job writes to the output every 5 seconds. Summary In this post I introduced Quartz.NET and showed how you can use the new Quartz.Extensions.Hosting library to easily add an ASP.NET Core HostedService which runs the Quartz.NET scheduler. I showed how to implement a simple job with a trigger and how to register that with your application so that the hosted service runs it on a schedule. For more details, see the Quartz.NET documentation. I also discuss Quartz in the second edition of my book, ASP.NET Core in Action.
https://andrewlock.net/using-quartz-net-with-asp-net-core-and-worker-services/
CC-MAIN-2022-05
refinedweb
1,827
51.85
Questions For Java Interview – Crack Java Interview 1. Java Interview Questions and Answers Earlier we discussed the 4 parts of Best Questions For Java Interview. Today, we will see 5th part of frequently asked Questions for Java Interview. These Questions for Java Interview specially designes for both freshers and experienced. So, let’s start exploring tricky Questions for Java Interview. 2. Top Questions For Java Interview Below, we are discussing mostly asked Questions for Java Interview: Q.1 Platform dependent values like Line separator, Path separator, etc. achieve by what ways? Using Sytem.getProperty(…) (line.separator, path.separator, …) Q.2 Is “abc” a primitive value? The string literal “abc” isn’t a primitive value. It’s a String object. Q.3 What’s a singleton? It is one among the design pattern. This falls within the creational pattern of the design pattern. There’ll be just one instance for that entire JVM. You’ll achieve this by having the private constructor within the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() public static Singleton getInstance() {return s; } // all non-static methods … } Q.4 Are you able to instantiate the math class? You can’t instantiate the math class. All the methods in this class are static and the constructor isn’t public. Q.5 What are the methods in object? clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString. Follow the link to learn more about Java Methods Q.6 What’s an aggregation? It is a special type of composition, when you expose all the methods of a composite class and route the method call to the composite method through its reference. Q.7 What’s a composition? Holding the reference of the opposite category inside another category called as composition. Q.8 What’s Inner Class? If the ways of the inner class will solely access via the instance of the inner class, then we call it inner class. Questions for Java Interview for Freshers – Q. 2,3,5,6,7,8 Questions For Java Interview for Experienced – Q. 1,4 Q.9 Explain Nested Class? If all the ways of an inner class is static then it’s a nested class. Q.10 What’s the main difference between Linkedlist and Arraylist? LinkedList means for sequential accessing. ArrayList mean for random accessing. Q.11 What’s the importance of Listiterator? You can iterate back and forth. Q.12 What’s the final keyword denotes? Final keyword denotes that it’s the final implementation for that method or variable or class. You can’t override that method/variable/class any more. Q.13 What’s Skeleton and Stub? What’s the purpose of those? A stub is a client-side representation of the server, and it takes care of communicating with the remote server. Skeleton is that the server side representation. However, that’s no more in use… it depreciated long before in JDK. Q.14 Why much time is needed to access an applet having swing components the first time? Much time need because behind each swing part are several Java objects and resources. This takes time to make them in memory. JDK 1.3 from Sun has some enhancements which can result in quicker execution of Swing applications. Q.15 State the difference between instanceof and isinstance. instanceof is used to check to see if an object is cast into a such type without throwing a cast class exception while isInstance() Determines if the specified Object is assignment-compatible with the object represented by this class. This method is that the dynamic equivalent of the Java language instanceof operator. Q.16 What will the “final” keyword mean before of a variable? A method or a class? FINAL for a variable: value is constant. It is a method: cannot be overridden. FINAL for a class: cannot be derived. Q.17 Describe what happens once an object is made in Java? Memory allotes from heap to hold all instance variables and implementation-specific data of the object and its superclasses. And the next step, to implement-specific data includes pointers to class and method data. The instance variables of the objects initializes to their default values. The builder for the foremost derived class invoke. The first thing a constructor will is call the constructor for its superclasses. This method continues till the constructor for java.lang.Object is termed, as java.lang.Object that the base class for all objects in java. Questions for Java Interview for Freshers – Q. 9,10,11,12,14,16 Questions For Java Interview for Experienced – Q. 13,15,17 Q.18 What’s the difference amongst JVM spec, JVM Implementation, JVM Runtime? The JVM spec is the blueprint for the JVM generated and in hand by Sun. JVM runtime is the actual running instance of a JVM implementation. Q.19 How will Java handle integer overflows and underflows? Java uses the low order bytes of the result that can fit into the scale of the type allowed by the operation. Q.20 Why are there no global variables in Java? Global variables considers bad form for a variety of reasons: Adding state variables breaks referential transparency (you now not will understand a statement or expression on its own: you need to understand it in the context of the settings of the worldwide variables), State variables reduce the cohesion of a program: you would like to know more how one thing works. a serious point of Object-Oriented programming to break up global state into additional simple collections of native state, once you add one variable, you limit the employment of your program to 1 instance. What you thought was global, somebody else may think about as local: they’ll need to run 2 copies of your program quickly. For these reasons, Java determined to ban global variables. Q.21 What’s the distinction between notify() and notifyall()? notify() is used to unblock one waiting thread; notifyAll() is used to unblock all of them. Using notify() is preferred (for efficiency) when only one blocked thread will benefit from the change (for example, once freeing a buffer back to a pool). notifyAll() is critical (for correctness) if multiple threads ought to resume (for example, when releasing a “writer” lock on a file may permit all “readers” to resume). Q.22 How will my application get to know when we remove an Httpsession? Define a class HttpSessionNotifier that implements HttpSessionBindingListener and implement the practicality what you would like in valueUnbound() method. Q.23 Name Interface must an object implement before Writing a stream as an object? Before writing a stream as an object an object should implement the Serializable or Externalizable interface. Q.24 What’s your platform’s default character encoding? If you’re running Java on English Windows platforms, it’s most likely Cp1252. If you’re running Java on English Solaris platforms, it’s possibly 8859_1. Q.25 What is an I/O filter? This type of filter is an object that reads from one stream and writes to another, usually altering the data, as it passes from one stream to another. Questions for Java Interview for Freshers – Q. 18,19,21,23,24,25 Questions For Java Interview for Experienced – Q. 20,22 So this was all in Questions For Java Interview. Hope you like our explanation. Have a look at Java StringBuffer 3. Conclusion Hence, you have completed Answers and Questions for Java Interview. Hope these questions for java Interview helped you to boost your knowledge. Still if any doubt regarding Java Interview Questions and Answers, ask in the comment tab. See also – Java Interview Questions Part 1 Java interview Questions Part 2 For reference
https://data-flair.training/blogs/questions-for-java-interview/
CC-MAIN-2019-35
refinedweb
1,292
59.4
NAME Send a message to a channel and await a reply. SYNOPSIS #include <zircon/syscalls.h> zx_status_t zx_channel_call(zx_handle_t handle, uint32_t options, zx_time_t deadline, const zx_channel_call_args_t* args, uint32_t* actual_bytes, uint32_t* actual_handles); DESCRIPTION zx_channel_call() is like a combined zx_channel_write(), zx_object_wait_one(), and zx_channel_read(), with the addition of a feature where a transaction id at the front of the message payload bytes is used to match reply messages with send messages, enabling multiple calling threads to share a channel without any additional userspace bookkeeping. The write and read phases of this operation behave like zx_channel_write() and zx_channel_read() with the difference that their parameters are provided via the zx_channel_call_args_t structure. The first four bytes of the written and read back messages are treated as a transaction ID of type zx_txid_t. The kernel generates a txid for the written message, replacing that part of the message as read from userspace. The kernel generated txid will be between 0x80000000 and 0xFFFFFFFF, and will not collide with any txid from any other zx_channel_call() in progress against this channel endpoint. If the written message has a length of fewer than four bytes, an error is reported. When the outbound message is written, simultaneously an interest is registered for inbound messages of the matching txid. deadline may be automatically adjusted according to the job's timer slack policy. While the slack-adjusted deadline has not passed, if an inbound message arrives with a matching txid, instead of being added to the tail of the general inbound message queue, it is delivered directly to the thread waiting in zx_channel_call(). If such a reply arrives after the slack-adjusted deadline has passed, it will arrive in the general inbound message queue, cause ZX_CHANNEL_READABLE to be signaled, etc. Inbound messages that are too large to fit in rd_num_bytes and rd_num_handles are discarded and ZX_ERR_BUFFER_TOO_SMALL is returned in that case. As with zx_channel_write(), the handles in handles are always consumed by zx_channel_call() and no longer exist in the calling process. ZX_CHANNEL_WRITE_USE_IOVEC option When the ZX_CHANNEL_WRITE_USE_IOVEC option is specified, wr_bytes is interpreted as an array of zx_channel_iovec_t, specifying slices of bytes to sequentially copy to the message in order. num_wr_bytes specifies the number of zx_channel_iovec_t array elements in wr wr_READ and have ZX_RIGHT_WRITE. All wr_handles of args must have ZX_RIGHT_TRANSFER. RETURN VALUE zx_channel_call() returns ZX_OK on success and the number of bytes and count of handles in the reply message are returned via actual_bytes and actual_handles, respectively. ERRORS ZX_ERR_BAD_HANDLE handle is not a valid handle, any element in handles is not a valid handle, or there are duplicates among the handles in the handles array. ZX_ERR_WRONG_TYPE handle is not a channel handle. ZX_ERR_INVALID_ARGS any of the provided pointers are invalid or null, or wr_num_bytes is less than four, or options is nonzero. If the ZX_CHANNEL_WRITE_USE_IOVEC option is specified, ZX_ERR_INVALID_ARGS will be produced if the buffer field contains an invalid pointer or if the reserved field is non-zero. ZX_ERR_ACCESS_DENIED handle does not have ZX_RIGHT_WRITE or any element in handles does not have ZX_RIGHT_TRANSFER. ZX_ERR_PEER_CLOSED The other side of the channel was closed or became closed while waiting for the reply. ZX_ERR_CANCELED handle was closed while waiting for a reply. TODO(fxbug.dev/34013): Transferring a channel with pending calls currently leads to undefined behavior. With the current implementation, transferring such a channel does not interrupt the pending calls, as it does not close the underlying channel endpoint. Programs should be aware of this behavior, but they must not rely on it. ZX_ERR_NO_MEMORY Failure due to lack of memory. There is no good way for userspace to handle this (unlikely) error. In a future build this error will no longer occur. ZX_ERR_OUT_OF_RANGE wr_num_bytes or wr_num_handles are larger than the largest allowable size for channel messages.. ZX_ERR_BUFFER_TOO_SMALL rd_num_bytes or rd_num_handles are too small to contain the reply message. ZX_ERR_NOT_SUPPORTED one of the handles in handles was handle (the handle to the channel being written to). NOTES The facilities provided by zx_channel_call() can interoperate with message dispatchers using zx_channel_read() and zx_channel_write() directly, provided the following rules are observed: A server receiving synchronous messages via zx_channel_read()should ensure that the txid of incoming messages is reflected back in outgoing responses via zx_channel_write()so that clients using zx_channel_call()can correctly route the replies. A client sending messages via zx_channel_write()that will be replied to should ensure that it uses txids between 0 and 0x7FFFFFFF only, to avoid colliding with other threads communicating via zx_channel_call(). If a zx_channel_call() returns due to ZX_ERR_TIMED_OUT, if the server eventually replies, at some point in the future, the reply could match another outbound request (provided about 2^31 zx_channel_call()s have happened since the original request. This syscall is designed around the expectation that timeouts are generally fatal and clients do not expect to continue communications on a channel that is timing out.
https://fuchsia.dev/fuchsia-src/reference/syscalls/channel_call
CC-MAIN-2021-31
refinedweb
799
50.57
Plant Physiol, May 2000, Vol. 123, pp. 255-264 Department of Brassica and Oilseeds Research, John Innes Centre, Norwich Research Park, Norwich NR4 7UH, United Kingdom We report the characterization of two members of a gene family from Arabidopsis that encode, respectively, cytosolic (cPMSR) and plastid-targeted (pPMSR) isoforms of the oxidative-stress-repair enzyme peptide methionine sulfoxide reductase. Overexpression of these proteins in Escherichia coli confirmed that each had PMSR enzyme activity with a synthetic substrate, N-acetyl-[3H]-methionine sulfoxide, or a biological substrate, -1 proteinase inhibitor. The pPMSR was imported into intact chloroplasts in vitro with concomitant cleavage of its approximately 5-kD N-terminal signal peptide. The two PMSR isoforms exhibited divergent pH optima, tissue localization, and responses to developmental and environmental effects. Analysis of the Arabidopsis database indicated that there are probably at least two p-pmsr-like genes and three c-pmsr-like genes in the Arabidopsis genome. Expression of the p-pmsr genes and their protein products was restricted to photosynthetic tissues and was strongly induced following illumination of etiolated seedlings. In contrast, the c-pmsr genes were expressed at moderate levels in all tissues and were only weakly affected by light. Exposure to a variety of biotic and abiotic stresses showed relatively little effect on pmsr gene expression, with the exception of leaves subjected to a long-term exposure to the cauliflower mosaic virus. These leaves showed a strong induction of the c-pmsr gene after 2 to 3 weeks of chronic pathogen infection. These data suggest novel roles for PMSR in photosynthetic tissues and in pathogen defense responses in plants. Oxygen is essential to all aerobic organisms but can also have many harmful effects (Davies, 1995). Oxidative stress is manifested by tissue damage caused by the oxidation of compounds such as proteins, lipids, and nucleic acids. Potentially destructive reactive oxygen species (ROS) can be produced during normal metabolic processes such as photosynthesis in plants and some bacteria (Salin, 1987), or it can result from a wide range of both biotic (Berlett and Stadtman, 1997) and abiotic stresses (Dann and Pell, 1989). Despite the presence of antioxidant defenses in cells, ROS such as hydroxyl radicals and superoxide ions can readily oxidize protein amino acid residues, in particular Met, often with a consequent loss of enzymatic activity (Dann and Pell, 1989). Oxidation of Met residues has been implicated in several serious conditions in humans, including adult respiratory distress syndrome, rheumatoid arthritis, smokers' emphysema, and Alzheimer's disease (Abrams et al., 1981; Vogt, 1995; Moskovitz et al., 1996a; Gabitta et al., 1999). The best-characterized response to the oxidation of peptide residues in both plants and animals is the induction of proteases that cause the complete breakdown of the oxidized protein and its eventual replacement by a protein synthesized de novo (Davies, 1995; Grune and Davies, 1997; Grune et al., 1997). The repair of oxidized proteins, rather than their breakdown, has generally been regarded as a minor component of the response of organisms to ROS. Nevertheless, there is now growing evidence that enzymatic repair of oxidized Met may play a key role in organisms ranging from bacteria to humans (Moskovitz et al., 1995, 1996b; Wizemann et al., 1996, 1997, 1998; El Hassouni et al., 1999). In addition to being the most common form of oxidative damage to proteins, the oxidation of Met to Met sulfoxide (MetSO) is unique in being readily reversible by the enzyme peptide-Met sulfoxide reductase (PMSR; EC 1.8.4.6), suggesting that PMSR may be able to repair oxidatively damaged proteins (Brot et al., 1982a, 1982b) in vivo. Indeed, pmsr-null mutants of yeast (Moskovitz et al., 1997) and Escherichia coli (Moskovitz et al., 1995) are significantly more susceptible to oxidative stress than wild-type controls, and this phenotype in yeast can be reversed by re-addition of further copies of the pmsr gene (Moskovitz et al., 1998). In mammals, pmsr gene expression and enzyme activity are localized in tissues such as kidneys (Moskovitz et al., 1996b), neutrophils (Fliss et al., 1983), macrophages (Moskovitz et al., 1996a), and the retina (Moskovitz et al., 1996a), where high levels of oxidative stress may be expected. A role for PMSR in microbial pathogenicity is suggested by the reduced binding of pmsr-deficient mutants of E. coli, Neisseria gonorrhoea, and Streptococcus pneumoniae to eukaryotic host cell receptors (Wizemann, et al., 1996). More recently, it has been shown that a pmsr gene is a major virulence determinant in the plant pathogen Erwinia chrysanthemi (El Hassouni et al., 1999). Studies with the artificial substrate N-acetyl-MetSO have shown PMSR activity in plants (Ferguson and Burke, 1994), where it was particularly strong in photosynthetic tissues (Sanchez et al., 1983). We have previously isolated a pmsr gene from Brassica napus and demonstrated that the corresponding protein had PMSR activity (Sadanandom et al., 1996). In the present study we report the discovery of a complex family of at least five pmsr genes encoding two different protein isoforms in the model plant Arabidopsis. Comparison of the subcellular and tissue localization and regulation of the two plant PMSR isoforms suggests that they play different roles in response to oxidative stress caused by factors such as pathogen infection and photosynthesis. Isolation and Genomic Organization of Arabidopsis pmsr Genes An Arabidopsis genomic fragment of 3.4 kb contained a pmsr reading frame within an oleosin gene promoter in a similar orientation to that described for Brassica napus (Sadanandom et al., 1996). A specific DNA probe based on the Arabidopsis genomic sequence was used to screen an Arabidopsis leaf cDNA library. The longest clone isolated contained a cDNA of 1,059 nt having a 40-nt poly(A+) tail and a putative polyadenylation site 130 nt from the translational stop codon. Primer extension using 5'-RACE showed that the 5' end of the cDNA was 43 nt upstream from the start of the translation codon. Comparison of this cDNA sequence with the sequence of the pmsr-oleosin genomic clone allowed us to elucidate the structure of this entire genomic fragment. The intergenic distance (as defined by the transcriptional start sites) between the pmsr and oleosin genes was 414 nt. Arabidopsis pmsr has a single intron of 422 nt and two exons of 522 and 252 nt, respectively. There were no obvious TATA boxes near the pmsr transcriptional start site, although a GATA box, which has been shown to play an important role in regulating light-controlled genes (Teakle and Kay, 1995), was observed 48 nt upstream of the transcriptional start site. This gene encoded a 258-residue, 28,568-D protein with a putative plastidial targeting signal and was termed p-pmsr. Since the previously reported PMSR proteins in other organisms lack organelle-targeting sequences and are therefore probably cytosolic, we re-screened the Arabidopsis leaf cDNA library for putative c-pmsr genes, but only obtained additional p-pmsr clones. However, screening of the Arabidopsis Expressed Sequence Tag (EST) database revealed several more divergent pmsr-like clones that were only 59% identical at the DNA level but 70% identical at the protein level to the p-pmsr. One of these clones, EST t125, was used in a RACE-PCR strategy to isolate an 847-nt cDNA encoding a full-length c-pmsr containing 88 nt upstream of the ATG codon, a 612-nt open reading frame, and a 147-nt downstream region extending to a poly(A+) tail. This cDNA was used to isolate a corresponding genomic clone from an Arabidopsis GEM II library. A 7-kb clone was isolated and restricted to a 2.7-kb NcoI-BglII fragment that contained the entire c-pmsr open reading frame and flanking regions. The sequence of this fragment included a 627-nt promoter region followed by two exons of 354 and 258 nt, separated by a 917-nt intron. No TATA or CAAT boxes were found, but there was a putative GATA box (Teakle and Kay, 1995) 20 nt upstream of the transcription start site. The two exons encoded a 204-residue, PMSR-like protein of 22,705 D. These data are summarized in Figure 1A, and the full genomic sequences are filed as GenBank accession nos. x97236 (p-pmsr) and aj133753, aj133754 (c-pmsr). Comparison of the derived amino acid sequences of the p-pmsr and c-pmsr genes shows 70% identity and 82% similarity in the region of overlap (Fig. 1B). The p-PMSR sequence contains an additional 54-residue N-terminal domain that is rich in Ser, is relatively hydrophobic, and can potentially form an amphipathic -strand, all of which are attributes of plastidial targeting signals (Von Hijne et al., 1989). Database analysis confirmed that the locus corresponding the p-pmsr gene isolated in this study was located on overlapping bacterial artificial chromosome (BAC) clones F13M23 and F24A6 on chromosome 4, with seven ESTs corresponding to this sequence (H37471, AA712385, N37941, N65094, F13739, H36504, and N96968). A second p-pmsr-like sequence was found on two ESTs of unknown location (W43259 and W43286). We were unable to locate the genomic region corresponding to the c-pmsr genomic clone isolated in this study (containing a 917-nt intron), but preliminary RFLP analysis (Sadanandom, 1998) indicates that it was in an unsequenced region on the upper half of chromosome 5. This gene was highly expressed, as shown by the presence of seven corresponding ESTs (AA042165, AA005830, T45651, T44845, T44422, AI099810, and Z18051). A second c-pmsr gene (containing a 428-nt intron) was on a previously sequenced region (BAC clone K11 J9) on the lower half of chromosome 5, encoded a 77% identical, 86% similar cPMSR-like protein, and had a single corresponding EST (N97091). A third c-pmsr-like sequence was found in BAC clone T27K22 from chromosome 2 and had one corresponding EST (T45426). We conclude that there are at least two p-pmsr and three c-pmsr-like genes in the Arabidopsis genome. Comparison with Other PMSR Sequences The relationship between the Arabidopsis pPMSR and cPMSR sequences and some of the other reported genes encoding proteins having similar domains in other plant species was analyzed using public databases. In addition to the Arabidopsis and B. napus PMSRs shown here, there is a relatively tight cluster of other putative higher plant PMSR sequences. For example, the PMSR-like sequences from tomato (gi100204) and strawberry (gi1310665) are 61% identical and 73% similar to the Arabidopsis cPMSR and also lack plastidial targeting sequences. Database searches with the Arabidopsis PMSR also revealed significant hits (60%-80% identity over 85-150 residues) with partial sequences from alfalfa, kidney bean, rice bean, loblolly pine, and rice. The core PMSR domains that were compared are each about 150 residues in length, and the non-plant sequences are 35%-52% identical and 51%-65% similar to the overlapping Arabidopsis PMSR domain. Activity of the Overexpressed PMSRs The biological activities of the putative Arabidopsis p-PMSR (minus the targeting sequence) and c-PMSR were demonstrated by overexpression and purification of the recombinant proteins in E. coli. The PMSRs were initially expressed with N-terminal poly-His tags to allow purification by affinity chromatography, as shown in Figure 2A. Both recombinant PMSR proteins exhibited apparent molecular masses on SDS-PAGE about 4 to 5 kD higher than predicted, as did the PMSR from plant tissue extracts, as detected by immunoblotting. This was probably due to the relatively acidic nature (pI = 5) of these proteins. The N-terminal His tag of the p-PMSR was removed by thrombin cleavage to generate a single polypeptide running at 28 kD. This protein was used to raise anti-PMSR antibodies in rabbits. The purified His-tagged c-PMSR, which ran at 27 kD, was enzymatically active and was used directly for assays. The activities of the purified recombinant PMSRs were assayed with either a protein substrate (oxidized -1 protease inhibitor) or a synthetic substrate (N-acetyl-[3H]-MetSO). As shown in Table I, both substrates were efficiently reduced by the Arabidopsis PMSRs, using dithiothreitol as an electron donor. Using the synthetic substrate, it was also shown that PMSR activity was a linear function of enzyme concentration and time over the range of conditions used in this study (data not shown). The targeting of the p-PMSR to the chloroplast stroma was demonstrated by the in vitro transcription-translation of the full-length p-pmsr cDNA (including targeting sequence) to yield a polypeptide with an apparent mass of 33 kD in this gel system, as shown in Figure 2B. This full-length polypeptide was imported into intact chloroplasts, with an associated cleavage of its approximately 5-kD targeting sequence. The mature 28-kD protein was shown by protease protection and fractionation assays to be located in the soluble, stromal compartment of the chloroplast. Control experiments (not shown) demonstrated that in the absence of the N-terminal signal sequence, the p-PMSR was not imported into intact chloroplasts. The c-PMSR had a pH optimum of about 7.0 to 7.2, while that of p-PMSR was 8.0 (Fig. 2C). This is consistent with the localization of p-PMSR in the stromal compartment of chloroplasts, which also has a pH of 8.0 during photosynthesis (Neumann and Jagendorf, 1964). Tissue Localization and Regulation of PMSR Isoforms All tissues expressed the mRNA encoding c-pmsr, with the highest levels occurring in leaves and roots (Fig. 3). The c-PMSR protein was also present in all tissues, although its distribution was not exactly the same as that of the corresponding mRNA. Expression of the p-pmsr mRNA was largely confined to green tissues and was particularly prominent in the rosette and cauline leaves, which are the major sites of photosynthesis in Arabidopsis. The p-PMSR protein distribution largely, but not exactly, mirrored that of its mRNA. Subcellular fractionation of leaf homogenates using Suc density gradient centrifugation confirmed the finding in Figure 2B that the pPMSR was localized in the chloroplast fraction, while the c-PMSR was confined to the soluble, cytosolic fraction (data not shown). The differing responses of the two PMSR isoforms during developmental and environmental regulation are shown in Figure 4. Figure 4A shows expression of the PMSRs at the four developmental stages of leaves, ranging from immature to almost senescent. The mRNA levels of both pmsr isoforms peaked at stage 3, although the c-pmsr mRNA was consistently expressed at higher levels than that of the p-pmsr. In contrast, the protein levels of both isoforms peaked at stage 2, after which the p-PMSR protein declined rapidly to very low levels by stage 4, while the c-PMSR levels decreased more gradually. Figure 4B shows the response of both PMSR isoforms to the illumination of dark-grown Arabidopsis seedlings. The c-pmsr mRNA was present at relatively high levels, even in etiolated leaves, and increased only moderately (about 2-fold) over 3 h of greening. The p-pmsr mRNA was relatively less abundant (but not absent) in etiolated leaves but showed a dramatic induction of expression within 20 to 40 min of greening. After 3 h of illumination the p-pmsr mRNA had almost reached levels present in light-grown leaves. Despite its relatively rapid induction by light, the p-pmsr gene was not activated by a phytochrome-mediated pathway, since it showed no response to red and far-red light treatments (data not shown). Western-blotting studies showed that p-PMSR protein levels increased more slowly than the mRNA, with only a slight increase after 6 h of greening but a more rapid and sustained increase after 15 h. We tested the response of both p-pmsr and c-pmsr genes to a variety of stresses that have been associated with increased levels of ROS production. Treatments included high (52°C) and low (4°C) temperatures, wounding, application of jasmonic acid, and infection with the virulent pathogen Pseudomonas syringae. Northern analysis of leaves from affected plants failed to show any consistent or statistically significant effect on the levels of either p-pmsr or c-pmsr mRNAs. The only exception noted in this study was the pronounced induction of the c-pmsr gene in response to infection of Arabidopsis leaves by the pathogen CaMV, as shown in Figure 4C. Some response was seen within 7 d after inoculation, but the major response occurred at 21 to 35 d, as the symptoms of infection by this relatively slow-acting virus (Cecchini et al., 1997) became more pronounced. Note that mock inoculations of leaves with 10 mM MgC12 did not result in similar increases in c-pmsr gene expression, which rules out an effect due to tissue damage alone. Parallel blots probed with the p-pmsr cDNA showed no response to viral infection (data not shown). The data presented here show that the genome of Arabidopsis contains at least five pmsr-like genes. This contrasts with all animal and microbial genomes described to date, which only contain a single pmsr gene (Kuschel et al., 1999). The relatively large number of pmsr genes in Arabidopsis is particularly significant, since it has one of the smallest genomes (120 Mb) of any higher eukaryote (Meinke et al., 1998). Our analysis of the Arabidopsis EST database indicates that all five of the identified pmsr genes are indeed expressed, and the relative abundance of such ESTs (totaling 18) indicates that pmsr genes are expressed at high levels in plants. Higher plants are also unique in having two different PMSR isoforms that we have shown to be localized in separate subcellular compartments. The two isoforms are differentially expressed in various plant tissues and in response to both development and stress, indicating that PMSR may play additional and perhaps more complex roles in plants than in other organisms. Such roles may be necessary because of the increased exposure of plants to oxidative stress due to oxygenic photosynthesis (Salin, 1987) and their lack of motility, which precludes their avoidance of many environmental sources of oxidative stress such as drought, salt, high light and temperature (Demmig-Adams and Adams III, 1992; Prasad, 1996; Foyer et al., 1997), and pathogen attack (Wojtaszek, 1997). A role for PMSR in the alleviation of oxidative stress is strongly indicated by studies of pmsr-null mutants of E. coli (Moskovitz et al., 1995) and yeast (Moskovitz et al., 1997) and the greatly enhanced resistance to oxidative stress of yeast or human T cells transfected with additional copies of pmsr genes (Moskovitz et al., 1998). Several protein substrates for PMSR have been investigated in animal and microbial systems. These include the -1-proteinase inhibitor (Abrams et al., 1981), calmodulin (Sun et al., 1999), apolipoprotein A1 (Sigalov and Stern, 1998), and /-spore proteins (Hayes et al., 1998). We found that both plant PMSR isoforms were able to repair the bovine oxidized -1-proteinase inhibitor protein at rates comparable to those reported in the literature for non-plant PMSRs. This is interesting in view of our observation of a strong but gradual dramatic induction of c-pmsr gene expression in response to infection with the slow-acting viral pathogen CaMV. One of the most highly expressed classes of pathogen-induced genes in many plants encodes proteinase inhibitor (pin) proteins (Johnson et al., 1989; Cordero et al., 1994), and it is possible that PMSR can also repair oxidized pin proteins from plants. Plants can also respond to pathogen attack by inducing a relatively rapid hypersensitive response (HR), which involves localized apoptotic cell death in the affected region and is accompanied by a release of ROS (Doke, 1983a, 1983b; for reveiws, see Lamb and Dixon, 1997; Wojtaszek, 1997). This phenomenon, termed the "oxidative burst," may be analogous to the oxygenic response of mammalian neutrophils to microbial infection, in which PMSR may repair proteins damaged by the ROS (Moskovitz et al., 1996a). The relative slowness of c-pmsr induction by CaMV and the lack of strong induction by more virulent pathogens indicates that c-pmsr is probably not involved in the HR. Some particularly virulent plant pathogens, such as Erwinia chrysanthemi, do not elicit HR and their major virulence determinants were formerly believed to encode extracellular lytic enzymes that allow invasion of the host tissue. However, a recent report showed that a hitherto unrecognized virulence gene in E. chrysanthemi encodes a PMSR, and that pmsr-null mutants were non-virulent on plants and extremely susceptible to oxidative stress (El Hassouni et al., 1999). This surprising finding indicates that, even in the absence of HR, plants attempt to mount a defense against virulent pathogens by generating ROS. The more successful pathogens, such as E. chrysanthemi, can overcome this oxidative defense thanks to their PMSR-based repair system. Our data on the gradual induction of c-pmsr expression following infection by a slow-acting viral pathogen (i.e. one that does not induce an HR) imply that plants may also protect themselves from the long-term consequences of their release of anti-pathogenic ROS. Therefore, both the plant host and the microbial pathogen are able to deploy the PMSR protein repair system to mitigate oxidative damage during pathogenesis. Other roles for cPMSR can be inferred from results obtained in different plant species. The putative c-pmsr homologs in tomato (Cordes et al., 1989) and strawberry (GenBank accession no. gi1310664) are both strongly induced during fruit ripening. This process involves the production of large amounts of ROS, and the PMSR may be required to protect key proteins from oxidative damage. In this study we found relatively high levels of cPMSR (but not pPMSR) in roots and maturing seed (siliques) of Arabidopsis. Differential screening studies have also revealed c-pmsr homologs that are highly up-regulated during root nodulation in alfalfa (GenBank accession no. gi1310665), seed maturation in rice (GenBank accession no. gi3760326), and xylem formation in loblolly pine (Allona et al., 1998). These processes all involve an increase in ROS, even during normal metabolism levels, and demonstrate the possible manifold functions of the cPMSR isoform in plants. We have shown that expression of the p-pmsr gene in Arabidopsis is largely restricted to actively photosynthesizing tissues. The chloroplasts of such tissues are the most oxygenic sites of any biological system and are therefore uniquely exposed to damage by ROS, even during normal daytime metabolism. It is believed that the principal defense mechanism of plants and animals involves scavenging of ROS by antioxidants or via enzymes such as catalase or glutathione reductase (Davies, 1995). Oxidative damage to proteins has previously been regarded as largely irrepairable, resulting in their turnover by proteolysis (Mehta et al., 1992; Davies, 1995; Grune and Davies, 1997; Grune et al., 1997; Pell et al., 1997). However, the presence of two light-inducible p-pmsr genes in Arabidopsis strongly indicates that PMSR performs an important repair function for chloroplast proteins that are oxidized during normal photosynthesis. It is noteworthy that the levels of the plastidial PMSR protein declined significantly immediately prior to leaf senescence. During this pre-senescent stage, there are elevated levels of proteolysis of key enzymes such as the CO2-fixing protein Rubisco (He et al., 1997; Oh et al., 1997; Desimone et al., 1998), followed by a buildup of ROS levels leading to the more visible symptoms of leaf senescence such as chlorophyll loss and yellowing. It is therefore tempting to speculate about a link between the sudden decline in pPMSR levels and the onset of senescence in plants. In some plants, ethylene modulates the activation of senescence-related genes in tissues such as fruits and leaves (Buchanan-Wollaston, 1997; Oh et al., 1997). The tomato cPMSR homolog E4 is strongly induced by ethylene during fruit ripening, and it would be interesting to investigate its regulation during leaf senescence. In conclusion, we have demonstrated that the two PMSR isoforms investigated in this study are involved in various developmentally and environmentally regulated processes in Arabidopsis, some of which are unique to plants. It will now be important to clarify the roles of PMSRs in more detail and in particular to elucidate its various protein substrates. Since plant PMSRs are encoded by a multigene family and are only one component of a highly redundant system for dealing with oxidative stress, it will not necessarily be easy to assess their physiological importance in vivo. Nevertheless, the clear impact of pmsr-null mutations on the oxidative stress response of yeast (Moskovitz et al., 1997), E. coli (Moskovitz et al., 1995), and E. chrysanthemi (El Hassouni et al., 1999) demonstrates that PMSR does have a significant function in these organisms. We are therefore using a pmsr gene-knockout strategy based on transposon mutagenesis in order to elucidate more fully the biological roles of PMSR in higher plants. Overexpression and Purification of Arabidopsis pmsr Gene Products The plastidial PMSR protein (pPMSR) was overexpressed without its N-terminal targeting sequence, i.e. from Met-54. Ligation of the DNA containing the truncated p-pmsr coding region to the pET vector resulted in the fusion of six His residues to the N terminus of the mature pPMSR protein. This construct was then under the control of isopropylthio--galactoside-inducible lac promoter linked to the T7 polymerase. Cultures of E. coli C41 were transformed with the pET expression vector, and the size of the fusion protein was determined by SDS-PAGE. The fusion protein was affinity-purified on a nickel-agarose column and the His tag removed by thrombin cleavage, as described in the pET system manual (Novagen, Madison, WI). For production of the cytosolic PMSR protein (cPMSR), the cDNA corresponding to the Arabidopsis c-pmsr gene was cloned into the pQE expression vector. The construct was transformed into either XL1B or C41 strains of E. coli, and overexpression of the His-tagged cPMSR was induced by isopropylthio--galactoside. The cPMSR was affinity-purified as described above, and both pPMSR and cPMSR were dialyzed and concentrated to about 1 mg mL1. Long-term storage was at 80°C, and both PMSR isoforms retained >80% specific activity for at least 6 months. Assays PMSR assays were performed using a bovine -1-proteinase inhibitor substrate (0.044 unit), which was oxidized with 30 µmol of chloramine-T in 500 µL of buffer (160 mM Tris-HC1, pH 8.0) at 20°C for 120 min, and dialyzed overnight against 1.5 L of 20 mM Tris-HC1, pH 7.5, at 4°C to remove the chloramine-T. After the PMSR reaction, the amount of -1-proteinase inhibitory activity was measured with an elastase assay. To 100 µL of reaction medium containing -1-proteinase inhibitor, porcine pancreatic elastase (0.003 unit) in 400 µL of buffer (Tris-HC1, pH 8.0, 0.1% [v/v] Triton X-100) was added and mixed. Alternatively, the synthetic substrate MetSO was used in PMSR assays (Brot et al., 1982b). Chloroplast import assays were performed by translating p-pmsr mRNA in 200 µL of wheat germ cell-free lysate with [35S] Met. Along with the translation product, the import sample contained 200 mM MgC12, 100 mM ATP, and 60 µL (1 mg ml1 chlorophyll) of intact pea chloroplasts in sorbitol resuspension medium (250 mM 4-[2-hydroxyethyl]-1-piperazineethanesulfonic acid [HEPES] and 1.65 M sorbitol, pH 8.0). Protease treatment and lysis of chloroplasts was carried out essentially as stated in Robinson and Ellis (1984). Samples were analyzed on SDS-PAGE gels. Plant Growth and Treatments Arabidopsis ecotype Columbia plants were grown in a climate chamber with a 6-h photo period, a photon flux density (PFD) of 200 µmol photons m2 s1, a temperature of 22°C, and a relative humidity of 75%. For the light treatment, plants were grown from seed on Murashige and Skoog medium in darkness for 5 d, and then illuminated as above. For viral treatments, fully expanded rosette leaves from 6-week-old plants were inoculated with a purified cauliflower mosaic virus (CaMV) (Gardner and Shepherd, 1980) isolate, Cabb-B-JI. The inoculum (1 µL) was applied with a trace of celite abrasive to the surface of leaves 2, 3, or 4 followed by gentle rubbing with a Pasteur pipette tip flattened into a spatula shape. Control mock inoculations were performed with 10 mM MgCl2 and celite in the same manner. Protein and RNA Analyses All operations to prepare protein extracts from Arabidopsis plants were performed on ice. Various tissues were ground in liquid nitrogen and extracted as in Sadanandom et al. (1996). Protein amounts were determined as in Bradford (1976), analyzed by SDS-PAGE on acrylamide gels (Laemmli, 1970), and transferred to PVDF membranes according to the instructions of the manufacturer (electrophoresis manual, Bio-Rad Laboratories, Hercules, CA). Membranes were incubated with anti-PMSR primary antibodies at 1:500 dilution and developed using a western-blotting detection system (ECL PLUS, Amersham, Buckinghamshire, UK). Total RNA from various plant tissues was extracted (Prescott and Martin, 1987), and 10-µg aliquots were separated on 1.6% (v/v) agarose gels and probed with gene-specific c-pmsr or p-pmsr cDNAs as in Sadanandom et al. (1996). We thank Uli Bechtold, Kanu Patel, Jo Ross, and Steve Rawsthorne for advice and help. Received October 13, 1999; accepted January 26, 2000. 1 This work was supported by the Biotechnology and Biological Science Research Council grant (to John Innes Centre), by a John Innes Foundation studentship (to A.S.), and by Vavilov Frankel and Royal Society fellowships (to Z.P.). 2 These authors contributed equally to the paper. 3 Present address: Sainsbury Laboratory, John Innes Centre, Norwich NR4 7UH, UK. 4 Present address: School of Biological Sciences, University of East Anglia, Norwich, UK. 5 Present address: ForBio Research Pty Ltd., Indooroopilly, Queensland 4068, Australia. * Corresponding author; e-mail murphy.denis{at}talk21.com This article has been cited by other articles:
http://www.plantphysiol.org/cgi/content/full/123/1/255
crawl-002
refinedweb
4,959
51.07
See also: last week's Kernel page. The current stable kernel release remains 2.2.13. The indications are that this kernel is indeed stable, there have been few complaints out there. Nonetheless there are several fixes out there; these are currently available as 2.2.14pre4, which will eventually become the next stable release. Alan Cox has put out a separate set of patches as 2.2.13ac3; this is a more developmental patch which contains some features (i.e. RAID 0.90, Raw I/O) which will not make it into 2.2 soon, if ever. Kernel crash dump analyzer released. SGI has finally released its Linux kernel crash dump analyzer. It's not a tool that most Linux users should have to use, but those of us working on kernel and driver development may find it invaluable. SGI has done the developer community a service by creating and releasing this code. ext3 0.0.2c has been released by Stephen Tweedie; details in the announcement. Ext3, of course, provides journaling to the standard ext2 filesystem. This release fixes some difficulties and features improved documentation. Journaling for ReiserFS has been released, some details can be found in this press release. Linux now has two journaling filesystems that can be downloaded and used now (though perhaps with a bit of caution still), and another one (XFS) coming someday. But what is this ReiserFS? This filesystem is the result of a persistent effort by Hans Reiser and his company Namesys; more details than many would ever want can be found on the Namesys web page. Mr. Reiser has a short-term goal, being a higher-performance filesystem, and a longer-term one: completely changing the way operating systems, data structures, and name spaces are handled. The short-term performance goals are mostly being pursued through the use of balanced tree data structures. Most current filesystems maintain directories as linear lists of file entries, perhaps with some hashing to speed lookups. ReiserFS uses a tree structure instead not just for directory information, but for the files themselves as well. In some situations, especially those where thousands of small files exist, the performance improvements can be large. (There is also a tree implementation for the standard ext2 filesystem being worked on by Ted Ts'o, but no code is currently available). Hans Reiser's long-term vision is more ambitious. He sees a couple of sources of evil in the way current systems are designed: the compartmentalization of namespaces and the imposition of structure on data. Unix (and Linux) systems use the filesystem as a wide-ranging namespace, but it is far from the only one. Network devices have their own space; each separate relational database or structured file is also its own namespace. Mr. Reiser's central point is that the utility of a system is not determined by the number of components it has, but by the number of possible interconnections between those components. Distinct namespaces keep components from talking to each other, and thus greatly reduce the capabilities of the system as a whole. If everything could be pulled together into a single namespace (the filesystem), the result should be a vastly more powerful operating system. Despite the presence of a great many words on the web site, getting a firm grasp on how the ultimate ReiserFS-based system would look is not an easy thing. The system would look something like a single, large, amorphous object database with keyword addressing. Things like relational databases or dbm files would no longer exist; instead each individual item would live directly in the filesystem, which would provide powerful indexing and searching mechanisms so that they could be found. Thus the emphasis on performance with small files. This vision of the operating system could easily result in millions of tiny entities being poured into the filesystem. It had better be fast. Numerous other features to support this mode of operation are envisioned as well: powerful searching mechanisms, inheritance of attributes (and data) between files, etc. The result is expected to be a system with a much greater expressive power - if users can understand and learn how to make use of it. This discussion oversimplifies things to the point that people who actually understand the long term ReiserFS vision are probably pretty upset. Those interested in the full picture should really just set aside a substantial block of time and wander through the Namesys web pages. Meanwhile, developing even the current ReiserFS is a lot of work. Mr. Reiser intends to fund this work through commercial consulting and support fees. The ReiserFS license has drawn a bit of criticism which appears to be unjustified: all it really says is that (1) ReiserFS is under the GPL and can only be distributed with GPL kernels, and (2) if you don't like that other licensing terms are available for a fee. Currently SuSE appears to have engaged their services, and will be shipping ReiserFS with its 6.3 release. TiVo's kernel mods available. TiVo, which sells a Linux-based "digital VCR" box, has made its modifications to the Linux PPC kernelavailable on the web. Other patches and updates released this week include: Section Editor: Jon Corbet For other kernel news, see:KernelnotesKernel trafficKernel Newsflash Next: Distributions
http://lwn.net/1999/1111/kernel.php3
crawl-002
refinedweb
883
54.12
502 Full Text NEWS HAPPENINGS DINING SPORTS REAL ESTATE ISLANDER I ml I i A UlB l Island tourism warms up after chilly start By Rick Fleury Islander Reporter Island tourism was down in January from previous years, but the slow start to '94 seems to be over, accord- ing to an unofficial Islander poll of more than a dozen area motels, hotels and apartments. The findings contradict a report published last week by local daily which claimed this year's season "was not necessarily off to a less-than spectacular start," according to figures released by the county's Convention and Visi- tors Bureau. Many Island innkeepers, including some on Longboat Key, say business was slightly off last month as compared By Bob Ardren The spirit of Cortez shown brightly last week as author Peter Matthiessen visited the historic village - and he clearly had a wonderful time. Loping through the village over to Calvin Bell's back yard where he inspected a wood hull under wraps riding around the harbor and "kitchen" in a real Cortez kicker boat and snacking on Fulford-fam- ily mullet salad (the world's best), the internationally famous writer couldn't quite wipe the grin off his face. He obviously likes Cortez and Cortezians. Toured through the Taylor Boat Works (now a local heritage museum) by Alcee Taylor, who busily pointed out the 1938 "donkey boat" and marine rail- way, Matthiessen almost seemed more interested in Taylor himself than many of the artifacts on display. In a speech at New College in Sarasota the evening before, the author of "Killing Mr. Watson" explained that he enjoyed talking with older residents because "it helps me to understand the history and heritage of Southwest Florida." In that same speech, he called Cortez "one of the last non-plastic places left in Florida." For a full report to last year but season seems to be in full swing now, with accommodations nearly filled to capacity through mid-April. Lucette Gerry, owner of the White Sands Apartment Motel in Holmes Beach, says, "I'm lucky because we have a regular return (of customers) year after year." But, she says, "The phone was slow in January. We usually have more people popping in." Anthony Pacheco, manager of the Silver Sands on Longboat Key, agrees. "It's been slower. Quite a bit slower. We're just getting busier now." He says he's even noticed fewer tourists from driving around in his car. "I thought the cold weather up North would have on his talk at New College, see page 20. Accompanied by a small group of Cortezians and at least three local dogs, Matthiessen paused at the one- time one-room schoolhouse and remarked that theirs was still in use on the eastern tip of Long Island, "But not much longer," he commented, "Like so many things." He seemed genuinely interested in the plans for res- toration of the net camp in the harbor and asked ques- tions about the mural planned for the east wall of the Bell Fish Company. Other plans to help protect the Cortez heritage in- clude application for placement on the National Historic Register and obtaining FEMA variences to replace structures so local residents aren't forced off their his- toric lands. Matthiessen's visits was wrapped up with a visit to the thoroughly modem A.P. Bell Fish Company where he again compared experiences with local fishermen prior to leaving for another speech in Tampa. His appearance at New College and also at Cortez was initiated by Karen Bell and the A.P. Bell Fish Co. and co- sponsored by the Florida Institute for Saltwater Heritage. Pierola asked to step down from MPO In a rash attempt to remove Bradenton Beach Mayor Katie Plerolafrom the Metropolitan Planning Organiza- tion, Manatee County Commissioner Joe McClash wrote to Pierola stating that MPO members who represent a mu- nicipality must alternate on an annual basis. McClash claims that to ensure compliance with Florida law, "only an elected official from Holmes Beach can be rec- ognized as a voting member of the MPO for this year." Other representatives to the Island Transportation Planning Organization are the mayors of Holmes Beach and Anna Maria. McClash said he will contact Holmes Beach Mayor Pat Geyer to "inform her of their municipal- PLEASE SEE MPO, NEXT PAGE brought us more (business), but it didn't," said one desk clerk in Anna Maria. The slow start seems to be over, however, with heavy bookings for the next eight to 10 weeks, according the Chamber of Commerce a peak season Inn owners seem to be able to count on year after year. It's the off months that can make or break a good season, however. And with a dip in January's business thermometer, motel managers and owners are wondering if it has been the plummeting mercury, interest rates or publicity affecting travelers to the Sun Coast this year. Whatever the reason, it has left a chilly Island look- ing forward to sunnier, warmer days in the months ahead. Simches, Shumard, Znika, Wolfe win Anna Maria election Incumbents and one newcomer swept the Anna Maria City election Monday. Re-elected was Mayor Ray Simches, defeating chal- lenger George McKay. Simches received 61 percent of the vote, or437 ballots, while McKay received 39 percentof the vote with 280 ballots. For the commission seats, it was Chuck Shumard, incumbent Commissioner Max Znika and incumbent Vice Mayor Doug Wolfe who garnered the most votes and will be seated on the commission. Shumard received the most votes with 32 percent of the electorate favoring him. Znika received the next-highest vote with 25 percent of the vote. Wolfe came in third, with 24 percent of the vote. Challenger Leon Kramer was last with 18 percent. A total of 731 votes were cast, or 54 percent of the city's 1,361 registered voters. Islander Bystander sponsors coloring contest A coloring contest for students at the Anna Maria Elementary School and the School for Constructive Play will be sponsored by The Islander Bystander. A drawing of a circus elephant will be distributed this week to stu- dents at both schools. Entries will have to be submitted by Feb. 17 to be eligible for the contest The grand prize winner will be honorary ringmaster at the 5:30 circus performance on Feb. 28. The winner in each class will receive a family pass to the circus. Judges for the contest include Sarah Nicholas of Holmes Beach, Phoenix Frame owner Bren Jackson, and Anna Maria City Commissioner Dorothy McChesney. Bridge Street festival this weekend details, page 16 SKIMMING THE NEWS ... Bridge debate continues.......... Page 2 It's 10 units per acre ................ Page 2 Opinions ................................. Page 6 The Way We Were .............. Page 7 Valentine's Day.................. Page 12 Streetlife................................. Page 18 Outdoors .................................Page 20 AUTHOR MATTHIESSEN VISITS CORTEZ: 'ONE OF THE LAST NON-PLASTIC PLACES IN FLORIDA' History in the making Islander Photo: Paul Roat Cortez native Alcee Taylor points out a few historical artifacts to author Peter Matthiessen during his visit last Thursday to the fishing village. For more about his visit, see page 20. FEBRUARY 10, 1994 THE BEST NEWS ON ANNA MARIA ISLAND I[] PAGE 2 M FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Additional Cortez Bridge repair airing to be held By Paul Roat More meetings and more input will take place before any action occurs on the proposed rehabilitation of the Cortez Bridge. That was the consensus reached last week between representatives of the Florida Department of Transporta- tion and the Bradenton Beach City Council after a public workshop on proposed closure of the bridge during next year's repair work. Representatives from DOTs consultants for the job, Parsons Brinckerhoff, proposed two options for the repair job: Close the bridge completely to motorists for be- tween 20 and 40 days, with 26 weeks of partial closure. Total cost: $2.2 million. Close the bridge between midnight and 6 a.m. for about 25 weeks, one lane of traffic during daytime hours, with total construction to take about 31 weeks. Total cost: about $3 million. Work is expected to begin in February 1995 and stretch through hurricane season, Jim Englert of Parsons Brinckerhoff said. The period of time for complete closure is subject to modification, he added, but original plans call for the bridge to be barricaded between Easter and Memo- rial Day. 'Tm notready to make decision today without discuss- ing this with the other cities," Bradenton Beach Mayor Katie Pierola said. DOT officials agreed, and another workshop on the proposed bridge work will be scheduled. The bridge repair will be centered on the draw span. Work will include replacement of the metal grate, the elec- trical system, locking pins and the lifting mechanism. New motorist barricades will also be installed, and light- ing added to the bridge spanning Anna Maria Sound be- tween Bradenton Beach and Cortez. DOT's Gerald Carrigan told the 30 people attending the workshop that, if the 30-day complete closure option was approved, he hoped the contractor would be able complete the job in less time. Carrigan said DOT officials planned to offer a $10,000-per-day incentive for each day the work was ... and data collection continues on Although the 30-day trial for changing the timed bridge openings at Cortez and Anna Maria Island Bridges is over, it may be another month before the findings are compiled. John Winslow, traffic operations manager for the U.S. Coast Guard in Miami, told the Islander Bystander Mon- day he was awaiting 14-day traffic counts from the Florida Department of Transportation on the two bridges. Once that materialis-in hand, and the written comments from motorists and boaters compiled, a recommendation would be made, Winslow said. "We received a large number of letters," Winslow said: "We won't make any conclusions until we get the impacts [the timed openings had] on highway and waterway traffic." He said he hoped to have the results within 30 days. Bridge openings had been set on the hour, 20 past and 40 past on both bridges. Due to efforts by Bradenton Beach Mayor Katie Pierola and Councilman Jim Kissick, Coast Guard officials authorized a 30-day trial period for the month of January for the bridges to have staggered opening sched- ules twice an hour. The change, as Kissick has explained, will w~~w3 - p'1 '-.- ~ -~ ~ completed under the 30-day deadline. Most attending the meeting favored the 30-day com- plete closure, apparently fearful that the other option would jeopardize evacuation of the Island in the event of a hurricane. "Option One [with the 30-day complete closure] is the only option we can live with," Councilman Jim Kissick flatly told the audience. "Extending the work through the hurricane season would be catastrophic." Although the matter of which option to choose ap- peared resolved, a remaining sticking point is the time period in which the 30-day complete closure will occur. Jane Von Hahmann of Surfing World in Cortez said the slowest time of the year for-businesses is in the fall, not spring, and urged DOT officials to consider closing the bridge in October, November or December. "We realize timing is critical [for the closure]," Carrigan said. "We're trying to limit the time to between Easter and Memorial Day. We realize there is no good time to close a bridge." timed openings allow boaters to travel unimpeded between the two bridges as well as allowing a 50-percentreductionin bridge openings. Critics ofthe timed bridge openings have included bridge tenders, according to Kissick. He has charged the tenders of "constant lecturing of boatowners via radio that the current 'test period' is 'a mess" and that boaters upset with the wait should write the Coast Guard to complain. Kissick has called the radio calls "pro-FDOT politi- cal activity, obviously adverse to the preferences and best interests of an overwhelming majority of Island citizens." Bradenton Beach: the walled city?. A six-fool maze-like fence snakes its way around property owned by Alan Bazi along-the canal at the Cortez Bridge and Bay Drive South, providing a checkerboard look to the Island Along Bridge Street, lattice fencing has been added as part of the A revitalization effort. Painters have added a new coat of paint to the rear of Key West Willy's Restaurant fence as well. All the fences have been installed legally. MPO CONTINUED FROM PAGE 1 ity membership on the MPO Board and ask them to ap- point a representative immediately." According to Pierola, the ITPO interlocal agreement states that the chairman may represent the ITPO up to two years if the board elects to do so. In January, the ITPO ap- proved Pierola as their MPO representative for another year. Pierola said that according to the agreement, a re- placement would have to be voted on by the ITPO board, not appointed by McClash. Elizabeth Woodford, Sarasota assistant county attorney, suggests that if a current member (representing a municipal- ity) has been on the MPO for more than one year, then im- mediate steps should be taken to alternate that membership. McClash stated in his letter to Pierola that statutes require MPO members who represent a municipality al- ternate annually with other municipalities that do not have a member on the MPO within the designated urban area. The statute says "the Governor may also provide for MPO members who represent municipalities to alternate..." MPO's Executive Director Mike Guy said he is not certain whether the Island municipalities not represented have to rotate among themselves, or whether the municipalities in the entire urban area will have to rotate. Guy said, "this may cause us to go back and look at our total apportionment. Our (MPO) by laws establish only one voting member from Anna Maria Island. The ITPO is an entity created for their own purposes." However, Woodford said, "that may be subject to fur- ther discussion. If in fact there is some agreement, there may be some circumstances we want to look into further." County considers Gulf Drive maintenance In response to a request by the City of Holmes Beach, the Manatee County Commission directed its staff to look into the maintenance of Gulf Drive. The county engineer and highway maintenance de- partment have investigated the present condition of Gulf Drive and within the city and have prepared cost estimates for the improvements required to bring the roadway into conformity with county standards. Estimated costs are: Roadway repair and improvement $114, 663 Drainage repair and improvement $75,000 Annual maintenance cost for years two to 20 $7,000 THE ISLANDER BYSTANDER 0 FEBRUARY 10, 1994 M PAGE 3 Ef Holmes Beach planning commission settles on 10 units per acre in A-1 district By Pat Copeland Islander Reporter After two sessions last week, the Holmes Beach Plan- ning Commission decided that it was the intent of the comprehensive plan to limit hotels and motels in the A-1 district to 10 units per acre. The commission will make that recommendation to city council on Feb. 15. The second part of the recommendation is that city attorney Patricia Petruff be directed to make changes in the city's land development code to clarify that position, Thirdly, the planning commission is open to considering changes in the district as it takes on the task of reviewing the entire comprehensive plan and accompanying land development regulations. Three members of the five-member commission voted affirmatively on the recommendations. Commis- sioner Frank Davis, a hotelier in the A-1 district, abstained from voting. Commissioner Dr. Francis Smith-Williams is In Los Angeles with the American Red Cross aiding earthquake victims. The A-1 district, which extends from the Martinique Maddox given hearing deadline Tehearng for former Holmes Beach Police Chief Rick Maddox will be held Tuesday, Feb. 22 at 10 am. at City Hall Maddox was terminated by Mayor Pat Geyer with the concurrence of the council on July 28, 1993. Maddox then sought a hearing to appeal the decision. The appeal boards made up of a member selected by Maddox, a member selected by the city and a mem- ber selected by these two members. Maddox selection to represent his interests in the appeal is Pinellas Park Police Chief David Milchan; the city selected Council- man Rich Bohnenberger; and the pair selected former Florida Representative Peggy Simone. condominiums at 52nd Street to 74th Street, from Gulf Drive to the water, is classified as multi-family residential/seasonal tourist. In the district, a hotel/motel is currently defined as a dwelling unit, with a density of 10 units per acre. In reviewing district regulations, city attorney Patricia Petruff told council that unless the definitions of dwelling unit and hotel/motel unit are clarified, motels may be able to rebuild at a density of 60 units per floor per acre. She said council could also add language to limit the number of hotel/motel units that can be built or re-built. Council agreed to removehotel/motel from the definition of dwelling unit, but controversy arose over how to limit the number of hotel/motel rooms and whether theintent of prior councils was to limitmotels to 10units per acre. The issue was passed to the planning commission for study. Commission Chairman Gabe Simches concluded that the intent was to limit hotels and motels to 10 units per acre after reading minutes of the 1989 comprehensive plan hearings, reviewing the history of district downsizing through the years, talking with former council persons and hearing testimony from hoteliers and residents. Commissioners Bruce Golding and Mike Farmp agreed. Davis, who was permitted to participate in the discus- sion, noted, "If there's a need to change it, it should be brought to council. If the intent was there at the time, there may be a need to change it now, but that's a different pro- cess. We should look at it in the total plan." Don Howard, councilman and hotelier in the A-1 dis- trict, reminded commissioners that other commercial dis- tricts are not regulated by density. He also said that the nature of the business has changed from long-term tour- ists to short-term tourists and hoteliers now need more and smaller rooms to accommodate that change. David Bouziane of the Bali Hai Resort pointed out that only nine of the district's 36 acres are in hotel/motel operations. 'Try not to be influenced by people who would want to write articles saying there's 36 acres in the A-l district with the ability to build4,000 units," hecautioned. "That scares the heck out of me, andl'min the business. At the worst scenario, the total increase would be 1,080 units, providing each unit were built at 200 square feet. I would hope that we would be enlightened enough or want to seek the proper answers to make sure that any decision doesn't hurt someone." Mary Ann Sipe of the Coconuts Resort added, "I don't think any of the hoteliers here would ever put in 200- square-foot motel rooms. We live here. We invest our money on this Island." She also noted that considering the regulation on 30 percent land coverage, 10 units on an acre would result in 1,300 square-foot motel rooms. "Don't you think that's little ludicrous?" she asked. City Clerk Leslie Ford said hoteliers can seek a com- prehensive plan amendment if they feel the 10 units per acre is unfair. Anna Maria City Tuesday, 2/15,7 p.m., Swearing in of commissioners and mayor Tuesday, 2/15, 7:30 p.m., Commission work session Bradenton Beach Tuesday, 2/15,7 p.m., Planning and Zoning Board meeting Holmes Beach Friday, 2/11, 9 am., Code Enforcement Board hearing Tuesday, 2/15, 3 p.m., Planning Commission meeting Tuesday, 2/15, 7:30 p.m., Council meeting Of Interest Monday, 2/14,7 p.m., Anna Maria Fire District Commission meeting, Station 1, Holmes Beach Wednesday, 2/16, 9:30 p.m., Coalition of Barrier Island Elected Officials meeting, Anna Maria City Hall Wednesday, 2/16, 7:30 p.m., Citizen's Advisory Committee of the Island Transportation Planning Organization meeting, Bradenton Beach City Hall CASUAL WATERFRONT ATMOSPHERE Valentine Weekend Specials February 12 13 & 14 - Saturday Sunday- Monday Served from 5:00 to 10:00 pm *.95 PASTA APPETIZER SHRIMP MORE Sauteed shrimp and broccoli in a light Alfredo sauce served over angel hair pasta. $6.95 ENTREES SALMON Poached in a court bouillon and finished with lemon and saffron sabayon and topped with salmon caviar ... $15.75 PASTA ENTREE SHRIMP AMORE Sauteed shrimp and broccoli in a light Alfredo sauce served over angel hair pasta. ... $12.95 CARPETBAGGER STEAK A Black Angus strip steak cooked to order, stuffed with crisp fried oysters and topped with Bernaise sauce ... $16.95 DESSERT White Chocolate Mousse and raspberries in a puff pastry heart with chocolate Chambord sauce. '_ v., Free with Valentine specials or ... $3.50 Y-" . BY LAND ... 760 Broadway St., Longboat Key BY SEA ... Marker 39, Intracoastal Waterway Call for Preferred Seating (813) 383-2391 FULL BEVERAGE SERVICE HI PAGE 4 A FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Council to provide for in-home artistic teaching By Pat Copeland Islander Reporter The Holmes Beach Council intends to modify the land development code to include occupational licenses for in- home artistic teaching, such as piano and dance lessons. The request for change was made by piano teacher Paulette Kilts last year. After the issue went back and forth between the council and the planning commission several times, the council decided to tackle the problem. At last week's work session, Councilwoman Mary Ellen Reichard said cultural endeavors for children in the community should be encouraged. Council Chairman Don Howard asked about requir- ing public notice for property owners within 400 feet of the applicant. City Clerk Leslie Ford said the administra- tive expense for such notice would be $200. Councilman Rich Bohnenberger said the applicant should just obtain permission from his/her neighbors. Island to have first ever health fair From screenings to nutritional information, mammograms to blood pressure checks, aerobics to hear- ing tests there will be something for everyone at the Anna Maria Health Fair. A variety of health-related businesses and organiza- tions as well as medical experts and technicians will par- ticipate in the event scheduled for Saturday, Feb. 19, at the Anna Maria Island Community Center. Demonstrations, testing and presentations will take place from 10 a.m. to 4 p.m. in the center's gymnasium. Mobile units will be set up outdoors for more complicated testing and screening. The fair will offer blood pressure checks, hearing Some Health Fair services require registration and fees Quickscreen mammograms and carotid screenings to be administered at the Anna Maria Health Fair on Satur- day, Feb. 19 require a fee and advance registration. To schedule a mammogram, phone Quick Screen for Women, 795-2161. Fee: $50. To schedule a carotid scan, phone the Community Center, 778-1908. Fee: $20. Medicare will pay for the tests and screenings for anyone eligible. screenings, glaucoma exams, glasses adjustment, and pre- scription checks (bring your medications to check for medication interactions). Presentations will be made on nutrition, podiatry, prostrate cancer, osteoporosis and acupuncture. Peer counseling, drug counseling, massage therapy and stress management will be discussed. There will be jazzercise, gentle aerobic demonstrations and informa- tional talks from home care representatives. Organizations participating include Meals on Wheels, Health Watch Response, the American Dental Associa- tion, Hospice, the Alzheimer's Association and the Coun- cil on Aging. There is no admission charge but some tests and screenings may require payment and pre-registration (see related story). Anyone interested in registering for space should phone 778-1908. Volunteers interested in assisting the committee prior to or during the event are asked to con- tact the center during daytime hours. AMI Forever Young, a group of active retirees, is organizing the fair. The newly formed volunteer group represents the Island's active retired population. The Community Center is located at 407 Magnolia Ave. in Anna Maria City. A LA S K A Denali Park, Hubbard Glacier, Domeo Rail BOOK NOW & SAVE Cars, Fairbanks, Anchorage. Must be booked MAJOR DOLLARS by Feb. 14 to obtain this price .............. $799 PANAMA CANAL 11-Day Cruise San Juan to Acapulco including St. Thomas & Curacao. March 15 .......... only $1,445 SPECIAL ... SINGAPORE TO HONG KONG with stops at Kuala Lumpur, Koto Kinabalu, Bangkok 13 days. March 27 only. This is a luxurious cruise on a 5-star ship. Howard noted that the license will be renewable yearly and any complaints can be considered at the time of renewal. After some discussion about class size, council settled on five students for any one class. Howard asked about regulating class hours. Gabe Simches, chairman of the planning commis- sion, cautioned, "If you try to be all-inclusive, I think you could run into difficulty, but there are certain concerns I think could be legitimately raised." Howard said that each applicant will have to come before council and can be questioned at that time. He also felt that tutoring should be added to such a license. Council agreed to add in-home artistic/tutoring to residential district regulations governing "other accessory uses." Included under this designation are home occupa- tional licenses, temporary uses and family day care homes all of which require council review. Council also decided not to make home occupational license applications an administrative procedure, as sug- gested by Bohnenberger. Councilwoman Carol Whitmore said she likes to have applicants come before council so she knows what's going on in the city. Councilwoman Billie Martini agreed. Howard said he had been in favor of the change origi- nally but had reconsidered. "When you get down to it, a home occupational li- cense is a privilege a privilege to conduct a business without the added expense of being in a commercial dis- trict," he explained. In other business, council will vote on a resolution seeking a sunset provision for the county's environmen- tal action commission on Feb. 15 and will begin review of the city's salary step plan at the Feb. 17 work session. Council accepted the mayor's appointment of Howard to the police study committee. Howard will take this position following the election March 8. He is not running for re-election. S The Hair .GIFTS, ,Co a e, ... Sarasota Club SWe wish you a SHOW, ~ Happy Exhibit Hall -rail, Sarasota Valentine's un., Feb. 19 & 20 Holmes Beach Day! the ibmy FULL SERVICE SALON 211 -O' OPEN: Tues. thru Sat. CE S ALE Facials by Appointment Gift Certificates Available c.t~ot-* LCotPr'ces 5500 Marina Dr. IOPPE ss51 Manatee Holmes Beach Ave. W. Bradenton 7 swear 794-0235 7 Good Sete( ARVIS SH dresses sports Come to our Annual.. THE pZjAC -co DVO &U JJfAjI O 9 At Alice's BLUE GOWN GIFT SHOPPE 1-813-778-0793 Alice Davison 125 Bridge Street Owner-Artist Bradenton Beach, FL 34217 B EACH 778-4506 ARN JEv = "Everything for the beach" Shells Gifts Clothing Swimsuits Inflatables Bait & Tackle Hats Much More All New Panama Jack. Swimwear and Hats Also Sperry Beach Walkers! 200 GULF DR. SO. BRADENTON BEACH (JUST NORTH OF COQUINA BEACH) D bra Alterations Dress Making and more The Bridge Street Emporiumn 129 Bridge St., Bradentorn Beach 778-3794 ISLAND UPHOLSTERY Otto Jorgensen 121.Bridge St. Bradenton Beach, FL 34217 778-433555 '' It's 4 Take Out Casual! 0' Available GREAT FOOD, LOW PRICES Home of the 200 Oyster 107 Gulf Dr. Bradenton Beach 778-7272 L 1 MW S PAGE 5 M FEBRUARY 10, 1993 M THE ISLANDER BYSTANDER Iio iturday and Sunday, Feb. 12 & 13 OF EVENTS: " SATURDAY 10:00 Grand Opening Ceremony Ribbon Cutting/Balloon Release. 1:00 Anna Maria Island Privateers capture Bridge Street. 3:30 Musicians Jam Session Key West Willy's. "Anna Maria String Band" Roaming Minstrals 12 to 5:30. 8 to 11:30 Bradenton Beach Festival Dance "Connie and Dave." SUNDAY 12:00 "Island Classics" String Ensemble. 2:00 Anna Maria Island Privateers capture Bridge Street 2:30 to 5:00 "Drive South" at center stage. Corbin's Cloggers roving entertainment 11 to 2:30. FESTIVAL HOURS: Saturday 10AM to 11:30PM Sunday 11AM to 6PM "MISS CORTEZ FLEET" will run boat shuttle service from remote parking at Coquina Bayside Park to the Bridge Tender Inn dock. Round trip $2.50 adults, $1.00 children. LONGBOAT PASS PARASAIL will offer rides from the Beach Barn Gulfside 10 to 5 daily. * Juried Art Displays Delicious Food * Arts & Crafts Exhibits * Clowns & Face Painting * Anna Maria Island Privateers * Community Interest Groups * Free Blood Pressure Testing Proceeds from Festival benefit the Bradenton Beach Historical Preservation. For additional Information call 778-3794. Lunch Dinner Spirits Sde Casual old Florida style Bayfront Dining INSIDE OR "DOCKSIDE" Sea7ooadSteaks 778-4849 i35 Bridge Street Bradenton Beach Drift on in to the DRIFT INN LIQUORS AND LOUNGE 120 Bridge Street Bradenton Beach 778-9088 Joe's Eats & Sweets The Best Homemade Ice Cream and Yogurt made by Joe on premises. Sugar Free, Fat Free Sundaes Great food too! Enjoy Our Open Deck 1 Block South of Bridge St. Comer of 3rdSt. S. & Gulf D 778-0007 Pve4 T'4 ~ 44tec~, 119 Bridge Street I Bradenton Beach 778-4665 MEMBER MILLION DOLLAR CLUB 105 BRIDGE STREET BRADENTON BEACH, FL 34217 E GfeHh oU e7 200 Gulf Drive North, Bradenton Beach, FL 34217 813-779-2222 I T SSBRIE STTEMP Bradenton Beach City Pier and Dockside Restaurant with Complete Menu Fishing Pier & Tackle Shop 200 Bridge Street Bradenton Beach 778-3845 Pier Walk Cafe 4 Handmade Apparel Treasures & Accessories of Fantasy and Glass Blowing Demonstrations 119 Bridge St., Bradenton Beach 778-5353 779-2044 TOWNE & SHORE REALTY Real Estate *Exchangers *Property Management Sermon & fAustrian 'Restaurant Lunch 11 to 4 Dinner 5 to 10 101 Bridge Street Bradenton Beach 778-6189 I J[] PAGE 6 E FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER 9 em Island 'door mat' philosophy must end 'Anna Maria Island is again receiving "door mat" sta- tus from Longboat Key- thanks to the Manatee County Commission and this time the Island is really being treated like trash. Longboat Key has renegotiated its garbage hauling business. The key ended it's Waste Management agreement to dump trash at the Sarasota County Landfill. Continued and expanded is the dumping of trash at the Manatee County landfill expanded because the entire population of Longboat Key will now have its trash dumped in Manatee. Where will they recycle? And, of course, all of those trucks will have to pass through the Island to reach the landfill. More traffic. More huge trucks. More demands on our roads. We've watched our roadways crumble from the con- tinued use of heavy machinery on its way to Longboat Key during the building boom of the past few decades. We've watched as Longboat Key residents exit their Island on the Cortez Bridge while about half of the population of Bradenton Beach has to leave the Island on the Anna Maria Island (Manatee Avenue) Bridge during hurricane evacuations. We've watched as Longboat Key residents caught the ear of county officials and vetoed the Island trolley bus concept because Key residents didn't want additional traf- fic on their island in the form of mass transit vehicles. And now we're watching the same people again use Anna Maria Island as a pass-through for their garbage without a care. With the approval (blessing?) of the Mana- tee County Commission. In June, regional transportation planners will begin a study of an additional bridge to the barrier islands. The study includes the area between the Cortez Bridge and the Ringling Causeway bridge in Sarasota. Our suggestion: stick the new bridge on Longboat Key. It should be obvious by now that they need it. Blast representatives over pro-bridge stand We are being told by our elected representatives that we are too insignificant to count, to small for them to pay attention. Stan Stephens, who supposedly "represents" us on the IISLANDE R FEBRUARY 10, 1994 VOLUME TWO, NUMBER 12aria Becker V Advertising Services and Accounting Susan Runfola county commission, has reportedly said as much. Joe McClash, the "At Large" representative, refers to us as "a few people." Julie McClure has been quoted to the effect that "busi- ness" wants a high fixed-span bridge, and so she has to support it Not only is she our state representative, she also serves on the transportation committee in the legislature. We must tell these people how we feel about the bridge. They have not yet gotten the message that we don't want megabridges to our Island. Stephens and McClash have important votes to cast on the MPO, a~d so far they have consistently voted against our best inter- ests. McClure has done no discernible thing to help us or to justify the votes we cast for her. We do have a powerful weapon to use against these people our votes. I urge you now, before it is too late, to contact these people who supposedly represent us. Tell them that you vote and will vote against anyone who does not represent you. If you are not a registered voter, let them know that you will register so you can vote against them. A simple letter can make the point; an ava- lanche of letters will let them know that we are united on this issue. Our beaches are the major tourist attraction in the county. It is about time that we started dealing with these politicians from a position of strength. So please write to all te people who are elected to represent us. If you cannot write, phone their local offices and be counted. Then, when the elections come, remem- ber who has supported us and who has thwarted us. Get out and vote when the times comes, and send them the message that our Island counts and that it demands to have honest, responsive representation. Politi- cal power is the strongest voice we have. Let's use it. Please write or phone today. You're better at those things than you think and your letter or your phone call could be the difference in saving our cherished Island's way oflife. Alarge citizen response will demand and get attention. Kay Hoey, Bradenton Beach Better time for Cortez closing The deadest time for business on Anna Maria Island is the last week in November and the first three weeks in December. That would be my choice for a 30-day clos- ing of the Cortez bridge. If the majority rules for six months of inconvenience, than somewhere between June to Dec. 24 is the best. The businesses at each end of the bridge should get the most consideration as to when the Cortez bridge should close because to everyone else it's just an incon- venience. -to business people it could mean bankruptcy. R. R. Russell, Rotten Ralph's, Anna Maria City 'Judas Joe' needs outvotee In a recent article (in the county's other newspaper) on the Islander's forming an independent county, Joe McClash was quoted as saying, "I wonder, if it a knee-jerk reaction because a few people didn't get their way?" His referenced "few" are 80 to 90 percent of the Island population of 8,000 or more, to whom he has turned deaf ear. This quote is coming from the man who, in order to get the vote of the Islanders, changed his position from beingfor a 65-foot high fixed-span bridge to one of op- posing it. The moment he was elected, he changed back to beingfor this bridge. If "Judas Joe" cannot understand why we feel we are not getting proper representation for the Manatee County Commission or the Metropolitan Planning Organization (which he now chairs), he has only to look at the reams of ignored paperwork presented to him time and time again. The Islanders have done their homework. We can- not say the same for Mr. McClash. If our barrier islands cannot get suitable representa- tion from the elected officials who are supposed to serve us, then other measures have to be considered. Fighting taxation without representation is not a new concept "Judas Joe" seems to forget that Whatever it takes to be properly represented, we will do. Bunny Garst Anna Maria City Thanks I just wanted you to know how much my family en- joyed Katherine's article on Ted Swank. Both my sons had him as a teacher and, of course, I worked with him for several years. She captured memories beautifully, and we were all able to laugh despite the loss we felt. Please let Katherine know what a nice job we thought she did and include our thanks for bringing us back to happy times with Mr. Swank. Linda Shanafelt, Bradenton Editor's Note: Ted Swank was a teacher at Anna Maria Elementary School He died of a heart attack Jan. 19. m IBYSANDE THfSE WEE THE AY By June Alder__ __ _ The historic freeze of 1894-95 crippled Florida's citrus industry but gave Tampa Bay a boost. THE FREEZE OF '94-'95 You think this winter weather is bad? Let me tell you about the Big Freeze of 1894-95-a hundred years ago when -the pioneer families were settling this Is- land of ours. The freeze all but killed the citrus in- dustry in the northern part of Florida but, as it turned out, did a good turn for this part of the state. There was no warning whatsoever in those days before there was telephone, or radio or scientific weather forecasting. Old-timers who "felt it in their bones" when bad weather was on the way, were taken by surprise by the sudden cold snap. December '94 had been chilly and there had been a near-freezing night during Christmas Week. On Anna Maria Island new leaves on Captain John Jones's mango and guava trees were browned off and dead fish washed up on the Gulf shore creating an awful stink. But nothing worse. The weather warmed up the paper said. Water pipes burst and "icicles hung from almost every roof." To the despair of citrus growers, what had managed to survive the famous two- day freeze was killed off in another below freezing two days on Valentine's Day week. The freeze drove many grove owners out of the state. Others went south and the John R. Jones wrote in November 1895: '1 have settled permanently here (Anna Maria Island) and can truthfully say that for health, beauty of location and productiveness in agriculture this Manatee section of the state is ahead of any district ever visited by me.' nicely after that, bringing out the more daring of the winter tourists who boated to the Island tb picnic and perhaps take a dip in the Gulf. Thursday, Feb. 7, was perfect for swimming and sunning and work in the homesteaders' gardens-a balmy 77 degrees in the morning. But in the evening the Island home- steaders, like everyone else across the state, were shivering under their bed quilts. And in the dark early morning hours of Feb. 8, they were out in their farm and garden plots with blankets and smudge pots, trying desperately to save what they could. For, incredibly, that night around Tampa Bay the thermometer had dropped some 50 degrees to the low 20's. And worse was to come. Next day, the temperature plummeted from a high of 36 degrees to a record low of 14 above zero, the Tampa Tribune reported. There were snowball fights in the city that day, pickers along with them. But along Tampa Bay, where the freeze wasn't so severe, most of the groves recovered within a year. "Hardly a day passes that Tampa is not visited by some country merchant who since the freeze finds his business unprofitable," the Tampa Tribune reported on Aug. 8, 1895. "Since the great disaster of last winter, there has been a steady and unbroken movement of population to Tampa from the entire state." To John R. Jones, an amateur horticulturist who had been coming to Anna Maria Island from Tampa off and on for several years to do agricul- tural experiments, the experience of 1894- 95 was proof positive that the economic future of Manatee County was as sunny as its weather. He wrote to the Tribune in November 1895: "I have settled permanently here (Anna Maria Island) and can truthfully say that for health, beauty of location and productiveness in agriculture this Mana- tee section of the state is ahead of any dis- trict ever visited by me." Incidentally, the Irish-born lawyer/ former sea captain was the only early Is- land homesteader who recorded for his- torical purposes the date he formally took residence on the Island. He wrote in a memoir he penned in 1927 that he "made permanent settlement on Feb. 28, 1895." Next: Anna Maria in the movies MEMBER: ANNA MARIA & LONGBOAT KEY CHAMBERS OF COMMERCE j S" WE MAIL THE NEWS! We mail the Islander Bystander weekly for a nominal $26 per year. It's S the perfect way to stay in touch with what's happening on Anna Maria Island. S We bring you all the news about three city governments, community hap- S openings, people features and special events... even the latest real estate trans- S El 3 Months: $10 U.S. FIRST CLASS AND CANADIAN SUBSCRIPTIONS * L0 One Year: $125 CL 6 Months: $75 * MAIL TO: * ADDRESS . CITY STATE ZIP _ START DATE:__ ISLANDER[ THE BEST NEWS ON ANNA MARIA ISLAND Island Shopping Center 5400A Marina Drive Holmes Beach Fla 34217 Between D. Coy Ducks and the Laundromat 778-7978 Dry Foam, Dries Fast! We never use steam! We have happy customers ... "I looks brand new!." Ginny & Bill Francisco Cortez & Fredon, New Jersey Clean Carpet Looks Better & Lasts Longer For fast, thorough, friendly service call me Jon Kent, Island resident and owner of Fat Cat. Call 778-2882,8 AM to 5 PM. CALL TODAY! 4, THE ISLANDER BYSTANDER M FEBRUARY 10, 1994 I PAGE 7 [ RELAX We can help! art UoCAT Carpet Upholstery Cleaning 'Il PAGE!8 M FEBRUARY 10, 1994 U THE ISLANDER BYSTANDER It's Food, Drink and a chance to win an art prize at island Gallery West Open House February 12th 4 p.m. to 7 p.m. 5348 East Bay Drive Holmes Beach 778-6648 509 Pine Ave., Anna Maria Open Tues.-Sat. 10-5 Closed Monday An Art Gallery exhibiting an extensive collection by the most talented Florida Artists. Painting, Sculpture, Three Dimensional Art, Glass & Pottery. Now Open OVER THE EDGE 119 Bridge Street Tues-Sat 10-5 778-4655 FLEA MARKET SPONSORED BY ROTARY CLUB OF ANNA MARIA ISLAND SATURDAY MARCH 19 9AM TO3 PM*IN HOLMES BEACH AT THE First Union National Bank Parking Lot r - RESERVE YOUR SPACE NOW! -- =e $15.00 PER SPACE PHONE 792-5615 NAME I I Phone I SType ____ No. of Spaces___ I OI DROP THIS RESERVATION OFF AT Walgreen's Pharmacy Counter, Holmes Beach OR MAIL TO: Bob Kral, 903 Waterside La., Bradenton FL 34209 By Pat Copeland Islander Reporter The Holmes Beach Planning Commission began its review of the city's setback regulations last week. Dis- cussion on the matter will continue this week. The problem, originally with side setbacks, surfaced in December when Alan Bouziane applied to add a sec- ond story to a conforming structure. Side setbacks for new residential is further complicated by the fact that on a non-conforming structure, it is possible to add a sec- ond story with a side setback of 15 feet. The council instructed its attorney to draft an ordi- nance removing setback discrepancies between one and two-story dwellings in all residential districts. However, at the first reading of the ordinance in January, several members of council had second thoughts and sent the matter to the planning commission for study. Bouziane told commissioners, "This is an attempt to try to eliminate the inequities in the existing code. The existing code is for new construction only. The only place in the code you find reconstruction or additions is for non-conforming homes. Nothing in the existing code addresses additions to conforming homes." Resident Lee Edwards suggested a variance proce- Tom Turner is a member of the ad hoc committee charged with the task of reviewing codes and building regulations in Anna Maria City. The purpose of the review is to ensure that the city is in compliance with regulations set by the Federal dure to address the problem. Resident Luke Courtney agreed and noted if a home has 10-foot setbacks and a three-foot overhang on the balcony, there's only seven feet to the next property. Councilman Don Howard said there are others with the same problem as Bouziane. Bouziane cited the case of a couple who want to build on a 50 by 100-foot lot. "He's trying to build a home large enough to bring in his family," Bouziane related. "The setbacks for two story are 15 feet on each side. He'll have a home 20 feet wide. You'll get a box 36 feet high." Bouziane added that a variance procedure would pe- nalize those who have conforming homes. Howard pointed out that when people look at the first floor in an elevated home, "in our mindset, it's actually the second floor. As far as the third floor being the second living floor, I don't know if we really see that so much when we're looking at it." Edwards said the result of uniform 10-foot setbacks would be high "castles" next to ground floor homes. Commission Chairman Gabe Simches replied, "What we're looking at now (with a one-story elevated home) is 10 feet (setback). They'd only be adding another floor." Howard said the council considered the option of mak- ing a second floor addition to a conforming one-story home meet a 15-foot setback, but realized there would be no load bearing wall to build upon."You're better off putting it on an outside wall as a load bearing wall," he explained. Commissioner Bruce Golding said he would like to have Fernandez at the next session to answer questions. Emergency Management Act. Turner is a former commissioner, chairman of the city's code enforcementboard and a member ofthe advisory devel- opment committee. Turner's name was inadvertently omit- ted from an article about the committee appointments Jan. 13. Foggy fun Islander Photo: BonnerPresswood Windsurfers on Palma Sola Bay were nearly lost in the heavy fog that blanketed the area for several days last week. Setback regulations go to Holmes Beach planners Pierola wants Bradenton Beach representatives for county list Bradenton Beach Mayor Katie Pierola is urging "At this point in time, there is only one Bradenton residents of her city to apply for appointments to Beach resident on this list," she wrote. "This is your op- county boards and committees on the county level. portunity as a citizen of Bradenton Beach to apply for an Pierola issued a memo last week advising citizens 'appointment to aboard or committee in Manatee County." of a master list of citizens interested in serving on Applications are available at Manatee County Depart- various advisory boards, committees and commis- mentofCommunity Affairs and Intergovernmental Rela- sions in the Manatee County area. tions, P.O. Box 1000, Bradenton, FL 34206. Anna Maria reviews code THE ISLANDER BYSTANDER E FEBRUARY 10, 1994 E PAGE 9 [ A 6$- StyleArst 0 Style/Image Consulting 000000 ooc Photography Make-Up/Hair >o00 "c Private Studio Atmosphere 00 0 C c "A Drive Worthwhile" o000 00 \ .-OO6/OOOC nOOOOCI Intimate details of the Names Project AIDS quilt display. AIDS awareness in the area has heightened due to the recent exhibition of the quilt, sponsored by the AIDS Council of Mana- tee. Islander Photo courtesy Frank Brucato Island father is awakened twice to HIV By Rick Fleury Islander Reporter First in a series "AIDS Does it affect this island? "How many people here have family members they never talk about because (AIDS) has the stigma as a gay disease?" These are the questions Bob Woods is asking his neighbors and friends on Anna Maria Island. But, he says, "They don't want to talk about it." He does. Bob Woods has two sons. His eldest sonis living with "full-blown" AIDS in California. His younger son, who lives in Tampa, recently tested positive for HIV, the vi- rus that causes AIDS. Both are in their early 30's. While visiting his son in southern California several years ago, Bob began learning about the gay community. Lying on the beach, the two were admiring the wide variety of scant- ily-clad, tanned, healthy people Californiaprides itself for. At that point, while Bob was enjoying the sight of two women walking by, his son explained that he preferred to look at the two men that were walking behind them. Having had it presented to him so clearly, Bob began to understand. Now, with an estimated 2 million people who are HIV positive in the United States, and two sons living at two dif- ferent levels of HIV infection, he is learning about AIDS. Facts HIV can only be transmitted through the bodily flu- ids of semen, vaginal secretions, mothers' milk and blood. The virus must enter the bloodstream. The concentration of HIV in saliva is not considered high enough for transmission through normal contact. There is yet no known case where such a transmission of But, on Anna Maria Island, he is feeling alone. "We're not talking about gay, we're talking about AIDS," says Bob. "It's something we don't talk about here. There's no awareness. I just know it's affected the hell out of me." He points to area newspapers that avoid the issue in obituaries by saying a 30-year-old man "died of natural causes." Or the deceased is "survived by a friend." "If my son was dying of heart disease or cancer, there'd be more understanding," he says. "More sympathy." What he resents, he says, are those with conserva- tive standards on the Island that are not sympathetic to people with AIDS. Those who speak of the disease with blame or a joke attached. "We're very much in a medieval syndrome here - we don't understand it, so we're afraid of it," Bob says. "I question how many of my friends would donate to AIDS causes. I may be all wrong. They may rally around the flagpole. "I have a son dying of AIDS. Why should I be ashamed of it. I love my son. I'm not ashamed that he has AIDS. I'm just sorry..." Editor's Note:Bob Woods has lived on the Island for more than 15 years, owning and operating a local lock- smith business. This is the first in a series exploring how HIV and AIDS is impacting residents of Anna Maria Island. of HIV HIV has occurred. Because of universal precautions that have arisen due to AIDS prevention, the amount of transmissions between health care workers and patients has diminished "enor- mously," according to recent studies. As a result, contrac- tions of Hepatitis B have diminished considerably as well. ORDER ROSES NOW ~' Specially designed arrangements - in silk or fresh flowers. Just for your Valentine. 6011 Cortez Road W. Bradenton 794-6196 BOOKS MUSIC TOYS GAMES GIFTS Whole Brain Goodness! 5340-F Gulf Drive Holmes Beach 778-5990 S&S Plaza next to the Sweet Spoon Dance Aerobics*- Calorie Burning Resistance Training Body Sculpting Anna Maria Island Community Center Mon. & Thurs. 7 P.M. Sat. 9:30 A.M. NOTICE: Classes are Cancelled for February 10, 12 and 19 1- .AMInstructing 12 yrs. at S AMICC. Sheree jUz ri sel/* Welch 798-3729 .< I l ll!r---I1[][Oll-ii UK Ladies' & Men's Sportswear LADIES New Spring Fashions Arriving Each Day! G.W. Graff Regal Joyce REGULARS AND PETITES Florida Seat Covers 100% COTTON TOPS, SLACKS AND SHORTS DEPARTMENT- HIGGINS-Lightweight Slacks and Shorts SLIDERS-REGULAR AND LONG RISE IN \ NEW COLORS AND PLAIDS -_ YES we have Gift Certificates ) ) and Free Valentine hd. W Gift Wrap. S & S Plaza, Holmes Beach 778-4505 MEN'S l]G PAGE 10 N FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Local firefighters meet challenge By Pat Copeland Islander Reporter A team of fire fighters from the Anna Maria and Westside fire districts place 11th overall out of 40 teams at the 1994 Firefighter Combat challenge. The challenge, held in Orlando on Jan. 9, was one of 11 regional competitions that test the limits of a fire fighter's physical fitness. The challenge course consists of five tasks representing what fire fighters perform in the line of duty. All tasks are performed in full gear helmet, coat, pants with liners, boots and gloves with fire fighters also carrying air packs. Thd weight of the gear is about 50 pounds. The national average for completing the course is seven minutes, and each fire fighter who completes it in under five minutes receives a gold target medal. All fire fighters on the local team received gold med- als. In addition, Capt. Dennis Dotson placed 12th in the Jurassic Division. Fire fighters trained for the challenge for two months at the Martinique, a six-story condominium in Holmes Beach. Task 2 Hose Hoist From the top of the tower, using a hand-over-hand motion, the fire fighter must pull the 5/8-inch rope to hoist a 50-foot donut roll of 1/2-inch hose with brass couplings (about 50 pounds) to the top of the tower. The donut roll must clear.the rail and drop on the floor. Task I Stair Climb with High Rise Pack The firefighter must carry two 50-foot sections of 1 1/ 2-inch hose weighing 50 pounds to the top of the drill tower. The hose must be deposited on a square marked on the fifth floor. Islander Photos courtesy of Dennis Dotson Task 4 Hose Advance After walking a distance of 140 feet, the fire fighter must pick up the nozzle and move a one-and-one-half-inch charged hose straightforward 75 feet to a box marked on the ground, crack the nozzle, show water, place the nozzle in the box on the pavement, then walk 30 feet to the next event. Task 3 Forcible Entry Using the Keiser Force Machine and a nine-pound shot hammer, the firefighter must drive a 165 pound I- beamfive feet. Combat Challenge Team Left to right, front row: Fire Fighter Larry Revel, Capt. Dennis Dotson, Fire Fighter Tim Hyden, Capt Randy Roth (Westside), Fire Figher Brent Cruz (Westside). Left to right, back row: Fire Fighter Carl Bennett, Fire Fighter and Paramedic Tony Barrett, Capt. Rich Losek, Fire Fighter Jeff Lonzo, Fire Fighter Chris Kierney (Westside), Fire Fighter John Flinn (Westside), Fire Fighter and Paramedic Brett Polleck (Westside) and LL Tom Owen. Westside Fire District team members are indicated; all other team members are from the Anna Maria Fire District T-H:EiLAN BYSTTV n 7(A 171NR !T FEoBr UAr 1V0A Ioo13 19 rP r P3nAGo 1Mrn THE ISLANDER BYSTANDER M FEBRUARY 10, 1994 A PAGE 11 E On behalf of the Tingley Memorial Library Juan Freudenthal, a native of Chile, has a Ph.D in Library and Information Science. He has written the feature below to commefnorate the opening of the, Tingley Memorial Library at 111 2nd Street in Bradenton Beach. The library will be open this weekend for viewing and a used book sale. Libraries protect freedom By Jeannie Friedman Islander Reporter "Libraries will get you through in times of no money bet- ter than money will get you through times of no libraries." (From a sign hanging in a small Massachusetts library.) Juan Freudenthal is a native of Chile who has been in the United States since 1965. He is passionate about his belief that the library system in the United States is a cor- nerstone of democracy. "The libraries in this country keep liberty and free- dom alive," he said. "Without information you are in no position to question." "It is appalling how little access people in other coun- tries have to information. It would make Americans ap- preciate their libraries if they knew how hard it is to get information in other countries. In Africa, Latin America, as in most other places around the world, libraries are in disarray. "Americans need to remember that libraries are bea- cons that keep ideas alive." Freudenthal has a Ph.D in Library and Information Science and is a former college professor and translator. He is also an artist and a photographer. He and his wife, Patricia, co-authored and published a library reference book entitled Index to Anthologies of Latin American Literature in English Translations. (Curd1 of tir (IAnmrumatrmt q f White Elephant SALE SATURDAY, FEB. 12 l9:00 A.M. to 1:30 P.M. Appliances Collectibles Food Furniture Linens Plants 4408 Gulf Drive Holmes Beach -Featuring Antiques & Collectibles Dolls & Bears NO We've Moved to a New Location! 9801 Gulf Dr. Alexis Plaza Anna Maria Hrs: Mon-Sat 10-5 778-4456 FAX: 778-1906 After Hours by Appointment USED BOOK SALE Saturday & Sunday Feb. 12 & 13 IN THE CONFERENCE ROOM AT THE TINGLEY LIBRARY 111 2nd St. N. Bradenton * Beach NOTE: The library will be open for viewing only. A J I Celebrating a new public library in Bradenton Beach By Juan R. Freudenthal That this country is one of the great democracies of the world is no surprise. That its democratic principles have been so effectively sustained for more than two cen- turies is indeed surprising. One of the underpinnings of such a vast experiment in the pursuit of a good life and liberty has been, in my opinion, the existence of public libraries. Nowhere has democracy's impact been more subtle and pervasive than in this nation, and yet nowhere have these repositories of knowledge been taken so much for granted. Public librar- ies have struggled to survive because Americans have never known what it is to live without them. With the addition of the Tingley Memorial Library in Bradenton Beach, we celebrate that community spirit which led Benjamin Franklin and a group of neighbors to establish the Library Company of Philadelphia in 1731, and it is still in operation. In hisAutobiography of 1784, Franklin wrote:"... librar- ies have improved the general conversation of Americans, made the common tradesman and farmer as intelligent as most gentlemen from other countries, and perhaps have con- tributed ... to the stand so generally made throughout the colonies in defense of their privileges." Businessmen financed "mechanics' institutes" and "mercantile libraries," and a "book boai" traveled the Erie Canal betweenAlbany and Buffalo after 1830, lending books for two cents an hour. Greater promise came when a small lad from Scot- land, who worked as a bobbin boy in a cotton farm near Allegheny, Pa., was allowed to borrow books from a leading citizen's library. "It was when reveling in the treasure which opened to us that I resolved, if ever wealth came to me, that it should be used to establish free libraries that other poor boys might receive similar opportunities." The poor lad who said this, named Andrew Carnegie, became a millionaire and, through farsighted philanthropy, gave the United States, Canada and En- gland more than 2,500 public libraries by his death in 1919. These and other types of libraries proved to be the greatest boon for the new waves of immigrants touch- ing our shores. Education- the flow of ideas, entertainment, infor- mation, research of the most sophisticated kind is all offered in the nation's public libraries. Any addition, however humble, to this network of life-enriching pos- sibilities is cause for celebration. May the Tingley Memorial Library nourish an individual's right to acquire knowledge and may it con- tinue to sustain those democratic principles which allow us to interact with every possible idea. By Jeannie Friedman Islander Reporter Five years ago, Genevieve Novicky Alban had a vi- sion for unifying and promoting all forms of artistic en- deavors on Anna Maria Island. On Feb. 20, from 1-4 p.m., Alban will be honored for her vision and her work in the artistic community at a re- ception given by the Anna Maria Island Artists Guild. The Guild was formed as a result of Alban's vision. Their reception will feature work of the present and past presidents of the organization. In 1989, Alban called together a few fellow artists to explore the possibility of forming a group to promote all art forms and to share experiences with other art lovers The result was the formation of the Artists Guild which now has its own gallery and 150 members. The original gathering of artists and those who later joined the Guild also gave birth to the Island's Fine Arts Festival and Heritage Arts Week. Though the Guild is dominated by painters using all mediums in their work including oils, water colors, pas- tels and acrylic, all art forms are welcome. Other artists represented in the group are potters, photographers, writers, graphic artists, wood carvers and jewelry makers. Even opera singers and mimes have performed for the organization. The public is invited to attend the Guild's reception. There is no admission charge. Information, call 778-6694. Classic Travel Senior Coupons* "BRING 4 Coupon 8 Coupon FOR $596.00 $1032.00 REBATE CRUISE SPECIALS: 5 Nights, Miami to Mexico from $299. P.P.D.O. 4 Nights, Port Manatee to Mexico from $299.00. P.P.D.O. 5 Nights, Port Tampa to Mexico from $395.00. P.P.D.O. BEACHWAY PLAZA 7318 Manatee Ave. W., Bradenton, FL 34209 813-794-6695 800-873-2157 Join us for a special evening at the beach! The Beach Shop Gonw etex fRemvcleled Wednesday Feb. 9 3 to 9 PM 20% OFF All Merchandise 'T Register to win $200 in PRIZES and Special Dining Certificates 'T Enjoy FREE DESSERT with your meal at Cafe on the Beach (Wednesday evening only) Sometingfor Everyone 'Women's Boutique Souvenirs Men's & 'Womens Swimnsuits Towels BeachiToys Lotions Sungfasses 4000 Gulf Drive, Manatee Public Beach Holmes Beach 778-5442 OPEN 9 TO 5 7 DAYS A WEEK Artist with vision to be honored PEG PAGE 12 0 FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Roses, roses everywhere! By Jeannie Friedman Islander Reporter Carnations, mums or daisies won't do. For that spe- cial someone, most sweethearts believe that only roses properly say "Be My Valentine." On Mother's Day, Easter or Christmas, bouquets of carnations, mixed flowers or a green plant are acceptable tokens of thoughtfulness and affection. It's even perfectly okay to deliver a floral gift well in advance of the actual holiday. But not on Valentine's Day. Delivery can only be made on Feb. 14 and roses are definitely the flower of the day. Usually, only red roses will do. K.F. (Smitty) and Roberta Smith, owners of the Island Florist, say their busiest period is the week before Mother's Day. But Valentine's Day is the by far the single busiest day of the year. "Most Valentine flowers are sent by men who are noto- rious last minute shoppers. We have more walk-ins than we do for any other holiday. Most of them wait until that day to make up their minds to send flowers," Smitty said. .. ... . Even the women who send flowers for this holiday are likely to do so on impulse and customers don't want to spoil the effect of the romantic gesture by allowing the flowers to be sent even one day early. To complicate things further, this year Valentine's Day falls on Monday. "In the 10 years we've owned our business, this is the first time we've had a Monday Valentine's Day," Smitty said. He will keep his shop open on Sunday, Feb. 13, but he anticipates more than the usual amount of last minute orders. On a typical.day, even at the height of the tourist sea- son, the local florist has a staff of three and averages 25 deliveries. On Valentine's Day, 13 people will work. The computer will be buzzing and the phone will likely ring constantly. Smitty estimates he will make at least 600 deliveries next Monday. He will sell between 1,600 to 1,800 roses which all have to be refrigerated until the last minute. Though it will be hectic and exhausting for the Smiths and their staff, they aren't complaining about the problems created by the sentimental day. They will gladly deliver roses to anybody's sweetheart. MANATEE WEST SHOPPING CENTER MANOTEE OVE. WEST AT 75TH STREET, BRAIDENTON ...just off the beaches." YYYYYYY ., ...,= *BASKETS .) '-" -7' :CARDS GIFTS Come see our new items for Valentines Day Also Sweetheart Balloon Bouquets...$8.00 7465 Manatee Ave. W., Bradenton 792-2046 I Il MANATEE AVE. WEST 'U (a ___ -. J :-- : -r "( -=II__________________________ "Convenient Shopping next to Albertsons" WOMEN'S FINE APPAREL WINTER CLEARANCE SALE NOW THRU FEB. 15 EXCLUDING NEW ARRIVALS S70% OFF [ Jewelry 20% OFF 7463 Manatee Ave. W. Next To Albertsons 794-5599 A Valentine Offer for Your SSweetheart Why go to a club designed for men? Join the Bradenton Health Club We Specialize in: Certified Women Trainers. Equipment designed for women. * Aerobic & Step Classes just for women. Fitness programs designed to achieve results Women Crave! Bring this Ad & receive * 50% Off your Enrollment Good until 2/15/94 7451 Manatee Ave. 794-2111 OFFER GOOD NOW THRU FEBRUARY 14th 1 7437 Manatee Avenue Westr (in the Shopping Center with Albertsons) SPECIAL PURCHASE FAMOUS FLORIDA MAKER PANTSETS EASY CARE LIGHT WEIGHT WASHABLE COOL AND COMFORTABLE Misses Petites Regular $6800 to $7000 NOW $4500 to 4900 Hurry in for the best selection! THE ISLANDER BYSTANDER M FEBRUARY 10, 1994 N PAGE 13 iS The circus is coming to the Island Complete with a gigantic red, white and blue striped tent, cotton candy, clowns and calliopes, the Great Ameri- can Circus is coming to town. For the third consecutive year, the Anna Maria Island' Need A Plumber? Full Service plumbing company offering new construction and remodeling service. 24 HOUR SERVICE LaPensee Plumbing, Inc." 778-5622 IC. #RF0049191 5348-B Gulf Dr.* Holmes Beach __ ~ A~ Community Center is bringing the circus to the Island. The Island engagement will be.the premier performance of the circus' 1-994 tour of 250 U.S. cities. The tent will be raised on the grounds of the Holmes Beach City Hall for two performances on Monday, Feb. 28. Shows will be at 5:30 and 7:45 p.m. Advance-issue coupons will admit children 12 and under for free with a paying adult. Day-of show children's admission will be $5. Adult tickets purchased in advance will be $8 $12 if purchased on the day of the show. The Community Center receives half of all advance ticket proceeds, and a percentage of the gate on show day. Loretta Yearwood & Sandy Hawley, formerly of Just Hair are NOT lost! They can be found at: BoboKqs hair e Co. SWe wish to welcome their friends to come see them along with Bob, Monica, Nellie & Ellen. 778-3724 778-1660 Mon.-Sat. 9a.m. 'til 9701 Gulf Drive Anna Maria The percentage depends on the amount of tickets volun- teers sell prior to Feb. 28. Advance discount tickets are available in Bradenton Beach at the Beach House restaurant, 200 Gulf Drive; in Holmes Beach at Island Foods, 3900 East Bay Drive, and Home True Value Hardware, Island Shopping Center; in Anna Maria at the Community Center, 407 Magnolia Ave. In Bradenton tickets are available at Crowder Bros. Hardware, 3933 Manatee Ave. West; and on Longboat Key at the Sea Stable, 3170 Gulf of Mexico Drive. For information, please call the center's circus hotline, 778-1908 or phone 778-9511. Valentine's Day is February 14. Don't forget your sweetheart. Perhaps a subscription would be the perfect gift ISLANDER QP s I!] PAGE 14A FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER AID honors local humanitarians All Island Denominations (AID) has honored a Citi- zen of the Year with their Humanitarian Award annually since 1984. This year's winner, Burrell J. Maschek, was announced at the All Island Denomination Ecumenical service, Jan. 23, at St. Bernard Catholic Church. Maschek, of Holmes Beach, has been president of AID for two years. AID is an ecumenical out-reach program, es- tablished to help families in need on a year-round basis. Not only does AID provide food, clothes and toys for Christmas, but gives food baskets on Easter and Thanksgiving, and are prepared to help any family at any time. ai- lf^;I /T William A. Larkin Herman A. Larkin, 74, of Bradenton died Feb. 3 at HCA/L.W. Blake Hospital. No memorial service is planned. Donations may be made to the local chapter of the Anerican Cancer Society or Anerican Lung Association. Burial was in Ardsley, Penn. Born in Ardsley, Penn., Mr. Larking moved to this area in 1981. He served in the U.S. Navy in the Seabees Division during World War II. He retired in 1979 from Hurst & Company. He was a member of the American Legion, Kirby Stewart Lodge 24, and the Bradenton Elks Lodge 1511. He is survived by his wife, Jeano of Bradenton; broth- ers Kit Bigham of Cortez and William Larkin of West Palm Beach; five stepchildren and 16 stepgrandchildren. Elizabeth M. Miller Elizabeth M. Miller, 72, of Bradenton Beach, "died Feb. 4 in HCA/L.W. Blake Hospital. Born in New England, N.D., Mrs. Miller came to the area from Mansfield, Ohio, 25 years ago. She was a re- tired beautician. She was a Lutheran. She is survived by her husband, Joseph W.; a daugh- ter, Lisa Miller Hoffman of Chicago; three sons, Joseph W. Jr., of Perrysville, Ohio, John F. Miller and Jerry A. Miller, both of Ontario, Ohio; twd sisters, Katherine Meyers of Palmetto and Tess Zavier of Des Plaines, Ill.; four grandchildren and a great-grandchild. No local visitation was held. A memorial service was held at Toale Brothers Funeral Home in Bradenton, with the Rev. George Thum officiating. O FUNERAL HOMES KEITH L GRUENDL General Manager BRADENTON HOLMES BEACH 720 Manatee Avenue W. 6000 Marina Drive 3904 Cortez Road West (813) 778-4480 (813)748-1011 FAX 746-6459 Organized through a gathering of six Island churches, their ministers and lay representatives, AID consists of the Episcopal Church of the Annunciation, Roser Memorial Community Church, Christian Science First Church of Christ Scientist, St. Bernard Catholic Church, Gloria Dei Lutheran Church and Harvey Memorial Community Church call themselves All Island Denominations. Besides serving as president of AID, Maschekis a mem- ber of the Church of the Annunciation, and their outreach program. He is also a member of the Artists Guild of Anna Maria Island, the Manatee County Band and the Florida Suncoast Band. A retired school principal, Maschek is a graduate of both Roosevelt University (BA) and Northwest- MASSAGE THERAPY . of < Specializing in Corrective Muscle Therapy * Rachel Barber, LMT MAOOI5 167. G Insomnia And More Gift Certificates 9801 Gulf Dr. Alexis Plaza S' Burrell Maschek receives the All Island Denominations Citizen of the ' Year Humanitarian Award from I Father Richard Fellows, Church of the Annunciation. AID is an ecu- * medical out-reach program. ern University (MA) and a WWII Navy veteran. The AID honor of humanitarian, started by the Rev. Myron Bunnell (who won it himself in 1991), is accom- panied by a plaque from AID. The following Island community leaders have been honored: 1984: Ann Snell 1985: Hal Pierce 1986: Gladys Athorne 1987: Joe Kane 1988: Brendan Greene 1989: Coletta Sundstrom 1990: Dr. Edgar Huth 1991: Rev. Myron Bunnell 1992: Jeanette Cashman 1993: Pierrette Kelly 1994: Burrell J. Maschek Now Accepting Appointments Qift Certificates Available SHouse Calls MM0003995 MA0792-3758 Island Pobiatrq CLARE H. STARRETT, D.P.M. Announcing the Opening of her office for PODIATRIC MEDICINE and SURGERY A convenient Island location 104 Crescent Dr., Anna Maria Accepting Medicare Assignments Office Hours Daily Home Visits by Appointment '1 So now Valentine's Day comes around once more, 0 And folks will write poems and send candy as never before. And will buy all those pretty cards to get their love across, ~" But find their gestures may be a total loss. - Mg 'Cause all those gifts may miss their marks by a mile, O If they find that those are things that are no longer in style. - For what may be appreciated more by each Miss or Mrs., .C Would be for them to receive some hugs and kisses. I- Bud Atteridge lRuser fenmavriai (maununitt 0Ihurch The Rev. An Interdenominational Christian Church FrankW. Serving the Community Since 1913 Hutchison, Pastor Saturday 5 PM Seaside Worship postponed until March 5 Sunday 9 a.m. Sunday School 9 a.m. -1st Worship 10:30 a.m. 2nd Worship 10:30 a.m. Children's Church 512 Pine Avenue, Anna Maria Transportation & Nursery Available Come, Celebrate Christ 778-0414 J A Ar THE ISLANDER BYSTANDER M FEBRUARY 10, 1994 A PAGE 15 JiM [:. Cortez Village fish fry this Friday The Fishing Village of Cortez will have a fish fry on Friday, Feb. 11 from 4:30 to 7:30 p.m. at the Cortez Fire Station, 123rd Street Court. In addition to fried mullet, grits, baked beans, cole slaw, hush puppies and coffee will be served. Soft drinks and desserts will also be available. The fish fry is being given by the Anna Maria Vol- unteer Fire Department, the Cortez Historic Society and the Florida Institute of Saltwater Heritage. Admission is a $5 donation. Proceeds will be split by the three groups. Church of Annunciation holds pancake supper The Episcopal Church Men of the Church of the Annunciation will have their annual Shrove Tuesday pan- cake supper on Feb. 15 from 5 to 7 p.m. The men of the parish will prepare and serve pan- cakes, sausages, apple sauce, orange juice, coffee and tea. Tickets may be purchased at Lowe Hall on Sunday, Feb. 6, and Sunday, Feb. 13. Tickets can also be pur- chased from the church office from 9 a.m. to 5 p.m. Mon- day through Friday or at the door on the Feb. 15. The church and Lowe Hall are located at 4408 Gulf Dr., Holmes Beach. Phone 778-1638. High Twelve to meet Feb. 10 All Masons and friends are invited to meet Thursday, Feb. 10, at Pete Reynard's Restaurant for lunch, fellowship and an interesting discussion. Call 778-1260 for information. League to hold arts and crafts show An Arts and Crafts Show and Sale will be held on Saturday, Feb. 19, from 9 a.m. to 3 p.m. at the Anna Maria Island Art League, 5312 Holmes Blvd., Holmes Beach. Artists and crafts people are invited to participate. Booth space is $20 and the registration deadline is Mon- day, Feb. 14. Call the league to register or for more information at 778-2099. KEY INCOME TAX & Business Services, Inc. Individual, Partnership and Corporate TAX PREPARATION 5500 Marina Drive Holmes Beach FOR APPOINTMENT 778-5710 "Same Island Location Since 1971" Valentine's Day is February 14. Make those romantic dinner reservations, order your flowers, pick up a gift and do It right now! The Islander Bystander advertisers have it all. IDS FINANCIAL SERVICES INC. America's Leading Financial Planning Company Retirement Investment Planning Portfolio Reviews Estate Planning Educational Seminars Call us for a free introductory consultation An Amencan Express company " Cynthia Olcolt, CFP John Sharp 3653 Cortez Road West Bradenton 755-7000 Casino Night coming up St. Joseph Home & School Association will sponsor a Casino Night at the St. Joseph Church Parish Center on Saturday, Feb. 11, at 7 p.m. The dress is casual. A $20 donation per person in- cludes $10 in playing chips, drink tickets, food, music, prizes and one raffle ticket. Tickets are available from the school office at 2990 26th St. W., Bradenton. Call the school office at 755-2611 for details. Iron Mountain luncheon scheduled Feb. 16 There will be an Iron Mountain-Kingsford area lun- cheon on Wednesday, Feb. 16, at 12:30 p.m. at the Danc- ing Bear Restaurant and Pub, 7423 Manatee Ave. W. Reservations need to be made by Saturday, Feb. 12, by calling Georgina Johnson at 778-3832. Mark calendar for art sidewalk sale The Artists Guild of Anna Maria Island is sponsoring a sidewalk sale of arts and crafts to the held at the Island Shopping Center in Holmes Beach on Thursday and Fri- day, Feb. 17 and 18, from 9 a.m. to 4 p.m. Artisans needs to reserve space now. The fee is $10. Call 778-6694 or 778-6331 to reserve a space or more information. LET US DO YOUR TAXES COMPUTERIZED Individuals, Corporations, i l Partnerships & Estates k11_ 'We're Here Year-Round." AT OUR NEW LOCATION Otey & Associates 3909 E. Bay Dr. (Suite 110) Holmes Beach Shirley Otey, E.A. Ucensed by the U.S. Government to represent taxpayers before the IRS. 778-611 8 t'...... ... 'The Grass Harp' Truman Capote's comedy- fantasy "The Grass Harp" will be presented by the Players of Sarasota, from Friday, Feb. 11, through Feb. 20. The cast features two Anna Maria Island theatrical favorites, actress and director Sara Marshall (left), and Allan Kolar, who almost stole the show in the Island Players' recent production of "Little Shop : of Horrors." Paula Farlin Right) plays the part of e he c Catherine Creek. Informa- -tion, call 365-2494. Rummage sale at Center The Anna Maria Island Community Center will hold its annual Winter Rummage Sale indoors at the center on Saturday, Feb. 12, from 8 a.m. to 1:30 p.m. The center is located at 407 Magnolia Ave., at the north end of the Island. All proceeds will benefit the center's year-round pro- grams and services for all ages. For more information, call the center at 778-1908. Historical society to meet The Anna Maria Island Historical Society will meet at 7:30 p.m. on Feb. 17 in Anna Maria City Hall. The special guest speaker is Peggy Blassingame Diamant of Alabama. She is the daughter of noted author Wyatt Blassingame. She will talk about her years grow- ing up on Anna Maria Island, attending school in the one- room school house. While in the area, Diamant plans to attend her class of 1947 Manatee High School reunion. Bird rescue classes set The Pelican Man's Bird Sanctuary will offer a wild bird rescue training class at the Anna Maria Island Com- munity Center Sat., Feb. 26, from 1-3 p.m. Admission is free but due to limited seating, confir- mation is requested though not required. Please phone 388-4444 to enroll in the class. Electronic Tax Filing AND RAPID REFUNDS At the: Bridge Street Emporium 129 Bridge Street, Bradenton Beach PHONE 778-3794 for information Get your money back as quick as two days! 778-9622 Holmes Beach WE SERVICE ALL MAKES & MODELS FPL PARTICIPATING CONTRACTOR EUG PAGE 16 M FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER By Tomara Kafka Islander Reporter The Bradenton Beach Festival is the big event to put on your calendar -happening this weekend. The Satur- day and Sunday festival takes place along and around historic Bridge Street, in the heart of Bradenton Beach. Events include a juried art show, art and craft exhib- its, community booths, and lots of food and entertainment Studio 121, a Bridge Street consortium of artists, will present an outdoor themed art exhibit entitled "Project Loeece on Obesity." The Miss Cortez Fleet will provide a shuttle between Coquina Bayfront Park and the Bridgetender Inn. The round-trip fee is $2.50 for adults and $1 for kids. Saturday's daytime entertainment schedule includes a jam session at Key West Willy's and the Anna Maria Island String Band will be roving and playing on the street. In the evening, there's an 8 p.m. street dance with music by Connie and Dave. On Sunday, Corbins's Cloggers will perform fol- lowed by the Island Baptist Church Vocals and Orches- tra String Ensemble. A live concert featuring Drive South takes place on center stage at 2:30 p.m. In conjunction with the Bradenton Beach Festival, the Tingley Library will be open for preview on both festival days, Saturday and Sunday, 10 a.m. to 3 p.m. Check out the new library but no checking out books for a couple of weeks. A used book sale on Saturday and Sunday in the new conference room includes editions from the old library. In Holmes Beach, the lounge at Pete Reynard's is open and the parking lot is packed full of cars almost ev- FINE MEXICAN CUISINE Brunch Lunch Dinner ery night. The community seems happy about the "Re- Pete" performance. Spanky, the manager, says the restau- rant will open this week or next. Meanwhile, there's en- tertainment withrSons of the Beach and Chuck Senrick at the piano bar. Ches's Pasta Plus (their stromboli is great) has evening entertainment by Glen Bauer Wednesday through Saturday during the dinner hour. Bauer (from Sarasota) plays old standards, soft jazz and quiet dinner music. You might want to drop by the open house at Island Gallery West on Saturday from 4 to 7 p.m. for wine and hors d'oeuvres. The independent cooperative gallery art- ists have all contributed art for raffle prizes to be given away throughout evening. In Anna Maria, the Chapel Players are busy re- hearsing for the Feb. 18 opening of You Can't Take it With You. It's a big cast and a funny play directed by one of our finest local directors, Dorothy McChesney. The perfor- mances are at Roser Chapel and tickets are $6 for adults and $3 for students. Ato's Restaurant, formerly Candy Cain's, is open for breakfast. Not your usual bacon and eggs, however. Owners Edgar and Ato Kelly are serving a Polynesian breakfast from 7 a.m. 'til 1 or 2 p.m. every day, depend- ing on demand. The Kellys plan to begin serving lunch soon, and sometime :in the future they will stay open for dinner. If you're curious what Polynesians eat for breakfast, let me clue you in. There's Mahi-Mahi,'.fried rice, Hawaiian sweetbreads, fried bananas, and banana pancakes with coconut syrup. You might be surprised to be entertained by Hula dancers, too. - On Longboat Key, Poco Loco's Fine Mexican Cui- sine celebrated their first anniversary last Sunday. Own- ers and chefs Estela and Javier Curiel were happy with the large crowds that showed up to try free samples of their Mexican cooking: ~G Cafe Robar Finest Steaks Freshest Seafood Early Bird 4-6 p.m. Entertainment 6 Nights Bob Comeau-Feb. 10,.11 & 12 Rich Kendall Feb. 15 & 16 Special Valentine Menu Make Your Reservations Now! 204 Pine Ave. 778-6969 Anna Maria Recipes, by request I would love it if you could "wrangle" the recipe out of the chef at Tia Lena's on Gulf Drive in Bradenton Beach for their fantastic garlic soup. It's certainly worth climbing up the stairs. Lynn Carney, Cortez 'Roasted Garlic Soup' Tia Lena's Sous Chef Michael Bates provided this recipe for Ms. Carney and the rest of The Islander By- stander readership. Six to eight servings 1/2 cup pureed garlic cloves 1/2 cup olive oil 1 cup bread crumbs (preferable unseasoned Cuban bread) 2 qts. chicken stock or boullion 1/4 cup sherry 1/4 cup brandy Saute garlic in olive oil until golden, stirring constantly. Remove from heat and add bread crumbs. Return to heat and stir constantly until golden brown. Add sherry and brandy and mix well. Add stock, stir to bring to a boil. Then add: 1 1/2 tsp. cayenne pepper pinch of nutmeg 1/2 tsp. ground oregano 1/2 tsp, cumin 1 tsp. white pepper Beat in 2 large eggs. Place into serving bowl and serve topped with melted Monterey Jack cheese. by Tomara Kafka, Islander Reporter 1- S.V A* .V A* .V A* V A TV A* .A 01S4 ,4 T.4 ~f AWRDWNNN GUFFRN DNN A EERTO FNE LRD USN Hidnaaya h CATBEAC RESOR 132.Glf rie Nrt 0nonBec V. A V778-.536.2! . Open for Lovers Valentines Day February 14th Something Innvativefy 9'Ji w Intimate Dining for an Intimate Occasion Roses for the Ladies Piano & Vocal Consort by BemTe Roy Serving Dinner 5:00-10:00* Tuesday thru Sunday Eary 'Dinner Menu 5-6 9RsservationsSuggested SSunday Brunch 10-2 605iManatee Ave. at East Bay Dr, Hoimes Beach (813) 778-5440 F Bridge Tender Inn Come CELEBRATE our 1 Year Anniversary Daily Specials all thru Month of February Dec -O-r-ok-g- Bo Mon.-Sat. 10-10 Deck Overlooking Bayou Sun. 11-3 387-0161 S6808Guf. M e B THE BEST STRAWBERRIES AT THE BEST PRICE 4qAsk Fo-r- BANANAS I9 " AYur COUNTRY PRODUCE & SEAFOOD Aays 19 b. Neighborhood 5016 MANATEE AVE. W. Discount (Corner of 51st & Manatee) OPEN DAILY FRESH LOUISIANA Card. 749-1785 8 AM to 7 PM BAYOU OYSTERS VINE RIPENED FLORIDA STONE CRAB LARGE 9 TOMATO -SWEET A GULF V LITTLE NECK TOMATOF NIONS HM CLAWS SHRLAMS 69" 6.99 MEIUM 5.99 LB 3.99 Doz. Dine out often! And when you do, please mention The Islander Bystander. -M IOPENs Commendable job These are the "Students of the Week" at Ann to right, are Taylor Bernard Dustin Andricks Kinney, Lorenzo Rivera, Madison Hoatland, j Bobo, Barrett Andricks, Taylor Bernard, Lau ISLAND SPECIALTIES Fresh Live Maine Lobster & Ne directly from Kittery Pt.,l.M Stop In to See Usfor the Fre Special Prices on ' Also Available ~ Si Open 10 to 6 Mon 5704 Marina Drive Ho "If you haven't tried it yet, y in for a very pleasant surpr CAFE ON THE c I in,1i .- 1 ; ?!, i -1 ,I 2 1 o- o rv t r i AI 13(i:; o ;.r c "1' Frf 1.l THE ISLANDER BYSTANDER N FEBRUARY 10, 1.994,N PAGE 17 KI' School Daze . ... MAnna Maria SSchool menu Monday, 2114/94 SValentine's Day SBreakfast. Bagel w/Jelly or Cereal, Juice S Lunch: Steak Love Nuggets, or Cheese Pizza, S_ Sweetheart Buttered Noodles, Green Beans, . Brownie, Juice dy Tuesday, 2/15/94 * SBreakfast: Scrambled Egg, Toast or Cereal, Juice Lunch: Hot Dog on Bun or Cheese Croissant, A Tater Tots, Broccoli & Cheese, Cookie .* Wednesday, 2/16/94 Breakfast: Waffles w/Syrup or Cereal, Fruit Juice Lunch: Nachos & Cheese or Power Slice, Italian Salad, Fresh Fruit, Cake . B Thursday, 2/17/94 Breakfast: Toast, Pineapple Chunks, Sausage " Link or Cereal . SFILunch: Rib Shapes or Mini-Salad, Mashed Potatoes, Hot Roll, Applesauce So Friday, 2118/94 . Breakfast: Peanut Butter Cup, Toast or Cereal, Fruit Juice . a Maria Elementary School for the week ending Jan. 28. Kneeling, left 0 Lunch: Fiestada or Burrito, Corn, Strawberry Fruit andAshley Eannarino. First row, left to right are Kate Gazzo, Misty Cup, Pudding - Trey Andricks and Mark Sankey. Back row, left to right, are Erik All meals served with milk . ren Bucci and Kellie Cobb. .... . Best Homemade Breakfast & Lunch Specials on the Island! Fresh Baked Thursday: PRIME RIB SPECIAL EGGS BENEDICT Pies & Biscuits Full cut, potato, $69 All Day...7 Days a Week -.vegetable, salad, rolls U09 E YE OPENER ...-2eggs, toast, home fries and coffee...On'y $1 SL UIsfandInn Rfestaurant AG.EOIQUORSOPEN 7 DAYS A WEEK 7AM-2PM 778-3031 w BEER *ICE1701 Gulf Dr. N., Bradenton Beach 778-3031 service Low Prices __ ;* Holmes Beach ?507 w England Fish shest Fish Available Whole Fish .- moked Fish day thru Saturday RESTAURANT & LOUNGE lmes Beach- 778-0333 f E:778-96a11 ANL'f AND ou're Yn OYSTER BAR ONs eBEACH FO778-0475 VeLunch Specials From $5.95 .Early Birds From $6.95 S"Pu yourotoes i the Dinner Specials From $8.95 . 7.177 CAUGHT DAILY FROM OUR BOATS STONE CRAB CLAWS 1 LB. DINNER OR TRY OUR WHOLE STUFFED FLORIDA LOBSTER DINNER -s SWING BAND TUESDAYS DANCE BAND FRI & SAT DIXIELAND with SONS OF THE BEACH THURSDAYS = = 101 S. BAY BLVD. ANNA MARIA 778-9611 NE = sand and then enjoy dining S- on our casual outside patio." ! I B[] PAGE 18 M FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Island police reports Anna Maria City Jan. 29, burglary, 800 block of South Bay Boule- vard. Subject unknown entered the garage and removed items from a tool box. Jan. 29, larceny, various locations. Twenty-four campaign signs and stakes belonging to candidate Chuck Shumard were removed by a person unknown. Jan. 30, theft and criminal mischief, various loca- tions. One campaign sign belonging to candidate Doug Wolfe was removed and four were damaged and left on the ground by a person unknown. Jan. 31, criminal mischief, 200 block of Gladiolus. A person unknown damaged the driveway. Feb. 1, theft and criminal mischief, various locations. Campaign signs belonging to candidate Leon Kramer were damaged and removed by a person unknown. Bradenton Beach Jan. 28, stolen automobile and burglary, 1400 block of Gulf Drive South. A person unknown entered the resi- dence through the kitchen window and removed a stereo, CD player and microwave oven and a 1978 Cadillac out- side the residence. Jan. 28, stolen vehicle recovery, 67th Street West and 1st Avenue West, Bradenton. The Cadillac in the above incident was recovered. Jan. 28, criminal mischief, 2650 block of Gulf Dr. S., Coquina Beach concession stand. A person unknown used an unknown object to break a round, concrete patio table valued at $250. Jan.29, theft of bicycle, 200 block Gulf Drive North. Jan. 31, possession of marijuana less than 20 grams, possession of drug paraphernalia, possession of drug para- phernalia with drug, 2800 block of Gulf Drive North. While on patrol, the officer observed Christopher B. Lynch, 20, of Bradenton, driving without headlights. After pulling the vehicle over and asking for identification, the officer noticed a pack of rolling papers and a partial mari- juana cigarette between the seats. He ordered Lynch and his passenger, Brian S. Clowes, 21,.of Bradenton, out of the vehicle. A search revealed a film canister filled with marijuana, two packs of rolling papers and several partial marijuana cigarettes. The pair was placed in custody. Jan. 31, criminal mischief, 1906 Gulf Dr. N., Co- quina Beach Club. A person unknown scratched the paint on a vehicle. The deep scratches ran the length of the ve- NLBO'S S10519 CortezRoad ". 792-5300 BUFFET HOURS: 11AM 9PM SUN. 12:00 Noon 8 PM LUNCH PIZZA BUFFET $3.99 00 o 0^ DINNER PIZZA BUFFET .$4.49 T~~T F~ ~ma 5702 MARINA DR. HOLMES BEACH 778-8363 SPIRITS FOOD OPEN DAILY AT 4 PM HAPPY HOUR: 4 to 8 PM ENTERTAINMENT 5 NIGHTS A WEEK KITCHEN OPEN DAILY 6 PM TIL MIDNIGHT 1/3 Lb. Hamburger, Large Fries and a Draft Beer $3.95 (6 Feb. 9. Reggae "Democracy" Feb. 10, 11, 12 Hammerheads Feb. 13* The DTs Beach Bash 4-8 Feb. 14 Valentine's Day Party with Tim Bamboo Feb. 16* Reggae "Jam-iya" *4-8 Feb. 17, 18, 19 -Will II Feb. 20 606 Beach Bash 4-8 hicle and onto the roof. Feb. 3, DUI, 100 block of 26th Street North. The officer was dispatched to a possible drunk driver and ob- served a vehicle that matched the description traveling north in the 2400 block of Gulf Drive. The officer ob- served the driver, Terry Westfall, 46, of Bradenton Beach, cross the center line and almost strike another vehicle, return to the lane, then drift off the side of the road almost striking a telephone pole. While in the process of stopping the vehicle, the vehicle came across the center line and almost struck the officer's vehicle. Westfall failed perfor- mance tests and was placed in custody. Feb. 3, grand theft auto, 200 block of Gulf Drive North. A person unknown removed the victim's vehicle from his residence. A friend called the victim and said she saw his vehicle in a ditch in the 11900 block of Cortez Road. The victim went to that location and claimed his vehicle. Holmes Beach Jan. 28, found bicycle, 300 block of Clark Drive. Jan. 29, suspicious person, 3232 East Bay Dr., Sub- way. An employee of Subway reported that a very intoxi- cated man was annoying customers and was told to leave. The man remained outside the shop and was bothering passersby. The officer called a cab after finding the sub- ject outside the shop seeking a ride home. Jan. 30, drunk, 3007 Gulf Dr., Anchor Inn. The of- ficer observed a disturbance outside the bar involving the subject who appeared very intoxicated and was disorderly and screaming profanities. The subject gave the officer false information as to his name and date of birth and had to be forcibly placed in the patrol car. After arriving at the jail, the subject became threatening and had to be wrestled to the floor and handcuffed, said the report. Jan. 30, petty larceny of a bicycle, 3200 block of Gulf Drive. Jan. 30, loose dog, 5400 block of Holmes Boulevard. Jan. 30, loose dog, 5600 block of Guava. Jan. 30, spouse battery, 3000 block of Avenue E. Two subjects were involved in a violent domestic dispute and battered each other. Both were placed in custody. Jan. 30, petty larceny of a mailbox, 6400 block of Holmes Boulevard. The mailbox was located down the street the next day. Jan. 30, petty larceny of a mailbox, 500 block of 67th Street. Jan. 30, petty larceny of a mailbox, 500 block of 67th Street. Feb. 3, service, 3600 block of Gulf Drive. The officer Counterfeit bills passed in Holmes Beach Holmes Beach Detective Nancy Rogers warned business owners, residents and visitors to be on the lookout for counterfeit $50 and $20 bills being passed in Holmes Beach.. Rogers said a white female entered Eckerd's Drug Store at 5313 Gulf Dr. in Holmes Beach last Thursday and attempted to purchase $9 worth of mer- chandise with a counterfeit $50 bill. The suspect is described as 5 foot 3 inches tall, 110 pounds and hav- ing long, red hair and a Canadian accent She left the parking lot in a 1980-1982, burgundy Oldsmobile. Rogers said five counterfeit $50 bills have been received by First Union in Holmes Beach from vari- ous Island businesses in the last two weeks. She said the bills appear real but feel slick. Two juveniles arrested for burglaries Holmes Beach Detective Nancy Rogers announced Friday that two 17-year-old juveniles were arrested and charged with a series of burglaries in Holmes Beach. Two burglaries occurred on White Avenue and-one on 67th Street. In another burglary in Anna Maria, the pair is charged with taking an automobile with New Jersey plates and replacing them with Florida plates from a Homes Beach automobile. The pair then drove to Califor- nia and replaced the Florida plates with California plates. According to the police, the manager of the motel where the pair was staying thought they acted suspiciously and checked their room. In the room, he found what turned out to be stolen property from the Island burglaries. assisted the complainant who was locked out of his car. Feb. 3, petty larceny of three real estate signs, vari- ous locations. Feb. 3, vandalism, 3800 block of East Bay Drive. Paint was scratched on a vehicle. Feb. 3, petty larceny, 6300 block of Flotilla Drive. A hood emblem was removed from a Cadillac. BISTRO ANClHOR INN BEER WINE LIQUOR 7AM to 2:30AM 3007 Gulf Drive Holmes Beach 778-3085 D.T.s Thursday, Friday & Saturday Feb. 10. 11 & 12 9:30 pm 1:30 a.m. Sunday Reggae Bash! Feb. 13 Democracy 1-5 p.m. Ambush 6-10 p.m. V Valentine's Day V Mon. Feb. 14 V Lifeguard am S9:30 p.m.-1:30 a.m. C,\,\5I HAPPY HOURI j Mon-Fri 4-7PM Nightly Entertainment 795-8083 Tuesday: Customer Appreciation. Night TIM BAMBOO WEDNESDAY SATURDAY FEB 9-12 9PM to 1AM KITCHEN OPEN DAILY 11 AM BANTAM PLAZA 10104 CORTEZ RD. WEST 1.5 MILES EAST FROM BEACH ON CORTEZ RD. The Finest Italian/Spanish/American restaurant that does breakfast too! A SAMPLING OF OUR MENU 2 for 1 Early Bird Specials 4:30-6:00pm Daily Ches's Delicious Nightly Specials OPEN 7 DAYS Hours: Breakfast, Bam-Noon; Lunch, 11am-2pm; Dinner, 4.30pm-10pm S&S PLAZA 5348 Gulf Drive, Holmes Beach THE ISLANDER BYSTANDER U FEBRUARY 10, 1994 0 PAGE 19 Ii Summary of fire calls January, 1993 Incident/Calls Dollar Loss Property value Structure fires -0 Brush fires 0 Vehicle fires 1 $10 $40,000 Miscellaneous fire calls 1 Investigations/good intent- 10 False calls 0 Fire alarm/alarm calls 8 Power line calls- 1 Emergency medical calls 48 Rescue calls 1 Service calls 0 Motor vehicle accidents 6 Hazardous material calls 2 Mutual aid calls 2 Total calls- 78 $10 $40,000 Year to date- 78 $10 $40,000 Average number of personnel per call: 4.80 Average response time: 5.47 Simply ... the soul of Europe in the heart of Longboat Key. Award winning Italian Continental Cuisine 383-8898 Ivo Scafa, Proprietor ROD 4 REEL "Likely The Best Fishing Spot in Florida"T ISLAND COOKING BEER -FUN WINE 778-1885 875 NORTH SHORE DR. ANNAMARIA ROD 4RREEL "Upstairs". Open Daily * Million Do .llar VI EW for 75 cents (Cup of Coffeel. Island Cooking Draft Beer Wine- * Full Breakfast * Heated or A/C INEW.7ECRDI For the month of January 1994 Anna Maria City Building permits: New construction: $150,000. Additions & alterations: $109,308. No new business or rental licenses were issued. Bradenton Beach Building permits: New construction: none issued Additions & alterations: $37,094. Business Occupational Licenses: *Aqua Sports, Unltd., 105 7th St. N., diving equipment, Leila Dorr. *Income Tax Service, 129 Bridge Street, Chuck Casher. *One Stop Shell Shop, 2509 Gulf Dr. N., shell gifts retail, David Davis Holmes Beach Building permits: New construction: $463,700. Additions & alterations: $85,850. , No new business or rental licenses were issued. Full Scoop SI- Ice Cream Shoppe ICE CREAM & WAFFLE CONES Made on Location Ice Cream Pies & Cakes Soft Serve Colombo Yogurt Diabetic Surfing World Village FULL SERVICE ICE CREAM PARLOR 11904 Cortez Road W.. Daily Noon to 10 p.m. 794-5333 S"- "-" "- COUPON ',... - Better than Ever... MARCO POLO'S SD NEW YORK A STYLE. S501 VILLAGE GREEN PARKWAY BEHIND THE VIDEO 7 1l LIBRARY ON MANATEE AVE. 7 I 92-0160 WITH THIS AD Thru Feb.16 '94 *1.00 OFF Any Size Pizza i NEW YORK FRESH VEG. WHITE WE DELIVER ANNA L SICILIAN MEATSA 12" AND 18" MARIA & BRADENTON I- - - COUPON --- -- "The best hamburgers'ana the coldest mugs of beer- this side of Heaven." li ssi. Elluffg, Pat Geyer, Owner. - Across from Manatee Public Beach Mon-Sat 11 am-7pm Sun 12-7pm Closed Tuesday Takeout 778-2501 r THE HUNT CLUB RESTAURANT Lunch & Dinner Daily Early Birds from $5.95 4:30 to 6 p,m. Sunday Brunch 1 Iam. 3 pn.. AfternoonTea Wed & Sat 2-4 p.m. Adjoining Four Winds Beach Resort An elegant resort on the Gulf of Mexico 2065 Gulf of Mexico Drive, Longboat Key .. UNCLE DANS PLACE ON WHITNEY BEACH 0 383-0880/383-0881 Sunday-Thursday 4PM--11PM Friday & Saturday 4PM-1AM featuring CHICAGO STYLE THIN CRUST HOMEMADE PIZZA BBQ BABY BACK RIBS In Our Own Special Sauce FISH & CHIPS 21 SHRIMP HOT SANDWICHES: MEAT BALL ITALIAN BEEF ITALIAN SAUSAGE ITALIAN GRINDER Salads Garlic Bread & Cheese Bread DELIVERY AVAILABLE to the furthest reaches of Anna Maria Island and Longboat Key (Delivery charge: $1.50) Cafe Robar Finest Steak House in Manatee County Taking Reservations Now Dinner for Two $49.95 Choice of 1lb. Lobster Tail & Stak for Two or Chateaubriand for Two Served with a Sampler Appetizer Platter for Two And Soup or Salad Fresh Rolls and our own Herb Butter Choice of Baked Potato or Red New Potatoes S Vegetable Coffee or Tea Dessert or Cappuccino or Expresso Rolls & Butter, Dessert, Coffee or Tea Complimentary Glass of Champagne 4-6PM $1295 -, Complete dinner menu wTil be seed 4-10 PM Complete mrly bird menu 4-6 PM Glass of Wine: Chablis Rose Burgundy Lobster Salad, Fresh Rolls Cup of Soup, Coffee or Tea $9.95 Open daily for lunch 11-2 PM Dimner4-10PM* 7DaysaWeek Seasonal: Early Bird 4- 6PM Mon. thru Sat, 11-7PMSun. Sunday Breakfast Buffet $5.95 10AM to 1PM Eggs Benedict, Scrambled Eggs, Potato, Grits, Ham, Sausage, Bacon, Biscuits & Gravy, French Toast, Fruit, Danish, etc. All you can eat. Bloody Marys & Mimosas ... $1.25 204 Pine Ave. Anna Maria 778-6969 Va.I Is:1_W Centennial parade applications due March 1 The Anna Maria Island Privateers are official spon- sors of the May 21 Island Centennial Parade. Due to the anticipated size of the parade, applications for parade entries are due by March 1. The parade will begin at 10 a.m. at Coquina Beach and continue through the three island cities to Bayfront Park. The parade will be followed by an old fashioned family picnic in the park. The parade is part of a host of activities planned for the three-day centennial celebration to be held May 20-22 in the three Island cities. Other activities include a street dance, beard and costume contests, boats rides, Little League exhibition games, an Island restaurant taste fair with entertainment, a sportsarama and an arts and crafts fair, Parade applications including trailer rental, sign and design information are available from Will Stokes, parade chairman, 794-6889. AM PAGE 20 I FEBRUARY 10, 1994 M THE ISLANDER BYSTANDER Matthiessen speaks unpopular truths By Bob Ardren Outdoor perspectives Carrying on their proud tradition of seldom marching in the mainstream, New College down in Sarasota invited in National Book Award-winning author and naturalist Peter Matthiessen February 4 for a lecture to students and the community. Clearly shocking a few audience members, but de- lighting members of Organized Fishermen of Florida in attendance, the author of "Killing Mister Watson," "Snow Leopard" and many other books spoke to the plight of commercial fishermen, which is far more than a local is- sue and so pervasive it makes me a little ashamed of still being a so-called sports fisherman. "Reduction in the fish stocks here in Florida has very little to do with small-scale commercial fishing such as you have here, but rather with pollution of spawning grounds, shoreline hardening, habitat destruction and a general degrading of the environment," soft-spoken, smil- ing, but clearly intense Matthiessen said. He accused local outdoor writers naming Jerry Hill of the Bradenton Herald by name of "pure propaganda, acting as though the sarcasm they write directed at commer- cial fishermen is some sort of a real argument It's nonsense. "It honestly baffles me how these paid propagandists can call themselves sportsmen," he added. "All the so-called sports fishermen knows that there aren't many fish around, so they're looking for someone to blame." And the supreme irony, he said, was "they don't know or care about Cortez and our heritage - they're busy trying to pass a net ban that will only benefit the people responsible for the problem in the first place - developers, tourism promoters and the like." In his native New York state, Matthiessen said com- mercial fishermen "are almost gone," the victims of both "green fundamentalists" and "real estate values of water- front commercial fishing facilities that have gone way, way up with resulting taxes, forcing out the working people, and of course, their children. "Our world will be a lessened place when we lose the grit, traditions and independence of the people we call 'commercial fishermen,'" Matthiessen continued, adding that places like Cortez "stand against the biggest interests in the state. Itis also one of the last non-plastic places left in Florida." Turning to what he called "green fundamentalists," Matthiessen said that like the "so-called sports fishermen," they are also simply being used by others such as Green Peace and other groups like the Sea Shepherds who be- lieve that any means justifies their ends. "The truth is these groups have become top-heavy with management. They are now big organizations and .o. PROFESSIONAL ROD & REEL rIND REPAIRS, DISCOUNT TACKLE R so TANY MAKE Y OR MODEL 3240 East Bay Drive Anna Maria Island Center Holmes Beach 778-7688 If you have a great catch on film ... haul it in to The Islander Bystander. Family Owned and Millwork & Operated for Over Wood Cut 12 Years fL 3 jv To Size Peter Mattiessen, center, with Marine Extension Agent John Stevely on the docks of Cortez. someone has to pay the bills, so again, it all comes back to money. They've milked the killing of baby seals on the open ice as long as they can, and now commercial fish- ermen are the last big target left for these groups." Matthiessen said he developed a love for the tradi- tions and values of commercial fishermen in the early 1950s when he worked aboard boats early in his writing career. He made his first trip to Southwest Florida "when I was eight years old. I like Florida, especially this part of the state, and I've been running around here all my life." He said his father pointed out the house of E.J. Watson at Chatham Bend in the Ten Thousands Islands one day as the two of them were bringing a boat up the west coast of Florida. His father told him the sketchy leg- end a story he always remembered and it resulted in his most recent novel, "Killing Mister Watson," pub- lished in 1990. Matthiessen is presently working on a sequel to that book "and a book on cranes, and since there are just 15 species, I think I have time left to finish it." A reception in his honor, hosted by the Florida Insti- tute for Saltwater Heritage, followed the talk at the Sainer Music and Arts Pavilion: Matthiessen spentThursday morning touring the historic fishing village of Cortez. There, he mingled with local fish- ermen, rode around the harbor and had quiet talks with sev- eral of the oldest local residents as he "tries to better under- stand the history and heritage of southwest Florida." Signs available for Little League advertisers The Anna Maria Island Little League is holding its annual sale for advertising signs at the baseball stadium at the Anna Maria Island Community Center. The 2- by 4-foot signs, advertising local businesses and organiza- tions, will decorate the fences above the bleachers and around the playing field. Sign space is available until June for $100. Businesses may provide their own signs or the Little League will pro- p wmp,4* (evttena OFFSHORE FISHING ALL BAIT, TACKLE & EQUIPMENT INCLUDED NO LICENSE REQUIRED Fishing Diving Island Excursions Anna Maria Island t(13) 77?-5419 Snook Trout Redfish Flounder * LIGHT TACKLE r oN S P O R T F I S H I N G - CAPT. RICK GROSS /2 DAY FULL DAY CHARTERS : Bradenton, Florida (813) 794-3308 Grouper Snapper Kingfish Cobia * DOLPHIN DREAMS CHARTERS GULF, BAYAND BACKWATER FISHING PROFESSIONAL GUIDE all bait, gear & equipment supplied - no fishing license required - CAPT. TOM CHAYA (813) 778-4498 U.S. COAST GUARD LICENSED ANNA MARIA ISLAND vide one for a one-time fee of $25. Mixon Insurance and Air and Energy are the first two Island businesses to sign up for sign space this season. Funds from the signs are used to purchase and main- tain baseball equipment and maintain the playing field. Approximately 200 Island youth participate in Little League games. To arrange for sign space, call 778-5405. 778-2761 Sightseeing WaterTaxi ' VALENTINE CRUISE SPECIAL i On our Covered 28 ft. Pontoon Boat (with bathroom) S Tee to 6iran Golf 1 Custom Clubs Club Repair. New & Used Clubs FEBRUARY SPECIALS S. Uc. Capt. 1 1/2Hours1 1 We specialize in custom cabinet making * formica tops entertainment centers *vanities kitchens 213 54th Street Holmes Beach 778-3082 We are located just west of the Island Shopping Center $10 per person THE ISLANDER BYSTANDER M. FEBRUARY 10, 1994 M PAGE 21 Ei3 Redfish revolution in backwaters; amberjack offshore By Capt. Mike Heistand Sheepshead are peaking this week, so if you haven't caught your limit of those striped rascals yet, now's your chance. Offshore, amberjack still seem to be coming on strong. As for the catch of the week: look for flounder in the backwater, and bluefish in the passes. Capt Zack on the Dee Jay II said fishing action has finally started to pick up. His charters are bringing in big catches of 6- to 7-pound sheepies, but Capt. Zack warns that the sheepshead catches are starting to peak. Redfish are around the canals and docks, but should start to move onto the flats when the water temperature nudges up a few more degrees. Trout of 14- to 24-inches in length are re- ally starting to show up on the end of fishermen's lines. Capt Zack offers a tip as well: there are a few mackerel moving through the Gulf waters. Karen at the Rod & Reel Pier said anglers there have been catching a lot of flounder, drum, sheepshead and a few skates in the past few days. There have also been a lot of redfish spotted moving under the pier. Capt Todd Romine with the Oscar H said his char- ters have been catching lots of mangrove snapper, sheep- shead, and they've been able to "limit" on redfish on ev- ery charter. Dave attheAnnaMariaCityPiersaidfishermenthere have been catching alot of sheepshead, as well as a few reds. Arkee at the Bradenton Beach Pier said fishermen at the pier have been loading up on all kinds of different varieties of trout, with sea trout and those tasty sugar trout being especially plentiful. A whopper of a whiting 16 1/2 inches long was landed Saturday, he added. Capt Dave Pinkham with the Miss Neva-Miss said charters on his half-day trips have been picking up, 'with good catches of sheepshead, porgies, mangrove snapper, sea bass and small gag grouper. The day-long trips are bringing back good catches of amberjack up to50-pounds in size, plus black and red grouper weighing in at 20- pounds, and plenty of mangrove and lane snapper, plus yellow tails. Ruth at the Miss Cortez Fishing Fleet said the four- hour trip is averaging 130-head of Key West grunts, por- gies and sea bass. The six-hour trip is averaging 180-head of rudder fish, grunts, porgies, sea bass and sand perch. The nine-hour trip averaged 25-head of red grouper, man- grove snapper and porgies. Chris at Galati Yacht Basin said night fishing at the last full moon produced a bunch of snapper. He said the sheepshead season is peaking, with a mess of the convict Gag grouper galore Dick Bloomerstock and Phil Bowers were able to land some big gag grouper while fishing recently with Capt. Phil Shields offshore. fish being found around bridges and docks. Offshore, look for good-sized amberjack in the 105-foot depth range. Capt. Mitch on the Fish Hoek said mangrove snap- per, sheepshead and some small trout were to be had around north Sarasota Bay. Bill at Island Discount Tackle said there are plenty of sheepshead at the bridges and piers. Offshore, he sug- gested you try to catch one of the 70-pound amberjack cruising the deep waters.. On my boat Magic, we've spent the last week off- shore, landing some 40-pound amberjack, black grouper, mangrove snapper and yellowtail. Capt. Rick Gross said he's been able to get a few reds and a mess' of sheepshead in the last few days. He suggests that if the weather holds as it has earlier this week, fishing action should really heat up. Capt. Phil Shields on the Reef Reacher said that amberjack, red grouper, mangrove snapper and yellow tail were all the best bets by his vessel's charters. Good luck and good fishing. - - - Island represented Local businessman Frank Davis has been appointed to a second term on the Manatee Chamber of Commerce board of directors. Steve Dye, attorney for the city of Holmes Beach, is also a member of this year's board. Davis owns the Harrington House bed-and-breakfast on Manatee board inn and is a real estate agent. Dye is with Scott and Dye, a Bradenton law firm. The Manatee Chamber of Commerce represents the cities of Anna Maria, Bradenton Beach, Holmes Beach, Longboat Key, Bradenton and Palmetto. .. HOBIE GALATI SUN YACHT BASIN GLASSES OPEN AND COVERED BOAT SLIPS AVAILABLE! ... with each slip rental, receive a DISCOUNT on gas or diesel. GAS & DIESEL 10 OFF per gallon with the purchase of 100 gallons or more. 5S OFF per gallon with a purchase of $50 or more. BEER ICE SODA SNACKS LIVE & FROZEN BAIT -* TACKLE OVERNIGHT DOCKAGE PUMP-OUT STATION 0 OPEN 7 DAYS A WEEK *8 TO 5 * (813) 7:6 '85 02:SO.BAY ABLAN Check us out If you demand the best! U^J Competitive prices on topflight boats & motors ([c The newest and largest rental fleet in the area ] Family owned and operated since 1955 SALES SERVICE RENTALS OPEN 7 DAYS 8AM 6PM SM IYAMAHA B13OATS I I BE A GOOD SPORT! Send The Islander Bystander to your distant friends and relatives. It's the best news on the Island. Subscription form on page 7. I ALES & SKviCE Walk-Around and Center Console Fishing Boats from 18' to 25' Five O'Clock Marine 05 R "Quality Services and Products at Affordable Prices" ,,5) "/ a P.O. Box 775 *412 Pine Ave Anna Maria Island, FL 34216 813-778-5577 ANNA MARIA ISLAND TIDE TABLES DAY AMHIGH AMLOW PMHIGH PMLOW Fuel Live Bait Thu 2/10 11:43p'1.9ft 6:01 -0.3ft 1:02 1.2ft 5:16 0.7ft Ship's Store Fri 2/11 6:22 -0.2ft 1:14 1.3ft 5:56 0.6ft Bottom Painting Sat2/12 12:22 1.8ft 6:44 0.0ft 1:29 1.4ft 6:38 0.4ft Boat Storage Sun 2/13 1:04 1.7ft 7:05 0.1ft 1:44 1.5ft. 7:21 0.3ft Bulk Oil Mon2/14 1:47 1.5ft 7:25 0.3ft 2:08 1.7ft 8:10 0.2ft Consignment/ Tue2/15 2:34 1.3ft 7:49 0.4ft 2:38 1.8ft 9:06 0.2ft Brokerage Wed2/16 3:30 1.1ft 8:10 0.6ft 3:13 1.8ft 10:12 0.1ff BOAT RENTAL * Cortez High Tides 7 minutes later lows 1:06 later. . m a I I[j] PAGE 22 E FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Canal Front Homes * Key Royale $238,900 Flamingo Cay $158,900 Perico Bay Club Grand Cayman Model Villa 2Bd / Den / 2Ba / 2Car Garage Townhouse 2Bd / 2Ba $123,000 neaL fmannausa [ REALTY REALOR* )R 778-6665 501 Manatee Ave. W. Holmes Beach Exclusive Waterfront Estates REjTO Video Collection MLS Associates After Hours: Barbara A. Sato...778-3S There's simply no better service or lower rates available! Rate us for yourself. Call Randy Smith today at (813) 957-3616. SINCE 1988 1290 PALM AVE., SARASOTA, FL 34236 --------- 419 Watch for ourW 419 Pine Avenue, Anna Maria, Florida listings on (813) 778-2291 P O Box 2150 U Classivision, EVENINGS 778-2632 FAX (813) 778-2294 channel 19. ( Valentine Special... Beautiful Bayou Condominium Just Listed! This lovely 2 bedroom, 1 bath, fully furnished apartment comes complete with boat dock and tranquil water views. Amenities include new central air and heat, freshly painted in- terior, new beige carpeting, washer, dryer and new window screens and water heater. Preferred downstairs unit. Immaculate in ev- ery way! Only $92,000. 50 Christine T. Shaw...778-2847 Marcella Coett...778-919 Nancy Gulford...778-2158 ONE YEAR IS9 Christine T. Shaw...778-2B47 Marcella Comett...778-5919 Nancy Gullford...778-2158 WARRANT Y TAN NA MARIA ISLAN D BEST BUY IN KEY ROYALE! Canal on 2 sides, room for a pool and/or additions. Open floor plan, 2BR/2B. New seawall in '92, large yard. $189,000. Jean Sears, 778-5045. ISLAND HOME REDUCED! Walk to beach from this elevated 2BR/2B home in prime Holmes Beach location. Ga- rage, whirlpool tub, stone fireplace and more. Now only $145,000. Wendy Foldes, 755-0826. LARGE LOT IN HOLMES BEACH Good area to build your dream home! 8415 sq ft and only 3 blocks to best beach. $67,500. Terry Robertson, 795-2676. CONDO ON DEEP WATER CANAL Comer unit with water & pool views, 2 screened lanais, turnkey furnished, 2BR/2B. 26' Beach cat included in price. $167,500. Jean Sears 778-5045, Wendy Foldes 755-0826. PERICO BAY CLUB 2BR/2B unit features garage, screened porch, gated community, pool, tennis and a beautiful turnkey furniture package. $114,900. Bob Fittro, 778-0054. SAnna Maria Island Centre 813-778-6654 3224 East Bay Drive /IHolmes Beach, FL 34217 WONDERFUL GULF VIEW! $140,000 Have fun in the sun and enjoy the beach lifestyle! 2BR/ 1 BA, family room, oversized 1 car garage. Fresh Paint, tile floors, newer appliances. Room for a 3rd bedroom and 2nd bath. Call Yvonne Higgins at Island Real Estate, 778-6066 or after hours at 795-0105. I I FRANK AND C~ffTT? Michigan ... full-time REALTOR ... member of the Manatee County Board of Realtors and Island Co-Listing Service ... music enthu- siast ... guitarist and Professionally an Island Property Specialist Frank, along with the entire SMITH team, wants to serve you bet- ter than anyone on the Island. If what you need has anything to do with selling, buying, renting or managing real estate, Call Frank, 778-2262 eves. REALTORS 5910 Marina Dr. Holmes Beach, FL 34217 (813) 778-0777 Rentals 778-0770 OPEN SEVEN DAYS A WEEK S Drive by and take a look at ... .* Cute Beach Cottage- 301 23rd St. Luxury Key Royale lot Ivanhoe Lane 209 Coconut, Anna Maria Beach House _~_When you demand excellence in REAL ESTATE SERVICE ... Great Duplex, Great investment 208 Pea- -402 & 404 Magnolia. 1930s cottage with Another one sold! cock, Holmes Beach, 2BR/2BA each side of extra 50x145' buildable lot. Check out the REACH RICHARD AT upgraded duplex. Close to wide beach. Good details by "Reaching Richard." 778-6066. 77 8-6066 rental history. $135,000 (~) K~2 c~) Fran Maxon C LICENSED REAL ESTATE BROKER SALES AND RENTALS 9701 Gulf Drive *P 0 Box 717 -Anna Maria; FL 34216 (813) 778-1450 or 778-2307 FAX# 778-7035 S "Be My Valentine'" LIST YOUR PROPERTY WITH THE BEST Over 6 Million Dollars In Total Sales In 1993. Since January 1st, 1994 ... SOLD .................... 520 SPRING AVE., ANNA MARIA SOLD ............................7204 PALM DR., HOLMES BEACH CONTRACT PENDING ......... 5400 CONDO #3, HOLMES BEACH CONTRACT PENDING ......... BAYOU CONDO #5A, ANNA MARIA CONTRACT PENDING ......... 243 S. HARBOR DR., HOLMES BEACH CONTRACT PENDING ......... 524 BAYVIEW PLACE, ANNA MARIA CONTRACT PENDING ......... 501 MAGNOLIA AVE., ANNA MARIA CONTRACT PENDING ....... 825 NORTH SHORE, BEAN POINT, LOT #31, ANNA MARIA CONTRACT PENDING ......... 2814 2816 AVE C, HOLMES- BEACH ) CONTRACT PENDING ......... 201 SHERWOOD, WILDEWOOD SPRINGS, BRADENTONPM SATURDAYS 9A.M. to N00N -M BUSINESS CENTER C3 ZONING RENTAL SPACES AVAILABLE Office Suites Mini Storage Retail or Service CALL NOW 778-2924 5347 Gulf Drive Holmes Beach I I I I See news happen? ... call 778-7978. The Islander wants to know! THE ISLANDER BYSTANDER M FEBRUARY 10, 1994 0 PAGE 23 I[I 7 vwmAll M C S HOLMES BEACH RESIDENCE gated en- trance way, 3 bedroom, 2 bath, eat-in kitchen, formal dining room, garage. Located on natu- ral canal. To see, call Robert St. Jean, 778- 6467. #53686 ... $159,900. CORTEZ VILLAS CONDO! Preferred location, close to pool, clubhouse & 43rd Street en- trance. Newer carpeting & window treatment. 2 or 3 bedrooms, 1 bath. Call Sally Schrader, 792-3176 anytime. #51626 ... $49,900. SUNNY SHORES Trailer Park perfect for the season and priced right to fit your needs. Ma- rina privileges. Furnished. 1 bedroom, 1 bath. Newer carpet & drapes. Ask for Sally Schrader, 792-3176. #53161 ... $29,500. LOOKING FOR A GREAT bargain & dock space for 30' boat? 2 bedroom, 2 bath. Needs some TLC. Fantastic view on canal. Call Robert St. Jean, 778- 6467. #54844 ... $76,900. Neal & Neal Realtors 778-2261 or Toll Free 1-800-422-6325 U MIS iD DICK 2217 Gulf Drive ASSOCIATES AwFTRHOURS RLHKRlst C [ BiWgrBk..... .T.. .6 -78-5914 1 I~t ~a~ B ^ Broker -a-1. EdB O'iveira................ 78151. GULFFRO this great h beach in a anxious. C MAGNIFICI with open f 3BR-2BA I Buyerwouk Call Dave IV HOLMES B 2BA waterfr cathedral ce appliances. dock with de Moynihan fo )NTI Magnificent views from all rooms of DIRECT GULFFRONT Turnkey 1 BR/1.5BA fur- house. Popular rental. Expansive, sandy nished apartment in popular Sunset Terrace Condo- II directions. Priced at $299,000. Owner minium. Experience the best of Gulffront living for ohly all Stan Williams for details. $128,500. Call Dave Moynihan. lENT GULF VIEWS and excellent design FIRST CLASS COMPLEX 2BR-2BA fully fumished, loor plan for a DNR, approved/permitted: second floor unit in complex with pool, tennis, club- home just a few steps from the beach. house, sauna and on site management. Deeded d have final selections. Priced at $238,500. beach access and excellent rental program. Priced 4oynihan for further details, at $98,500. Call Dave Moynihan. EACH WATERFRONT Spacious 3BR- BEAUTIFULLY LANDSCAPED Elevated 2BR - ont residence, beautifully renovated with 2BA canalfront home with specimen plants and great filings, new modern kitchen with top end deck area adjacent to large dock and davits. Bay view Lovely new pool and 30 foot concrete from the living room with cathedral ceiling. Skylights, Ital- ep water. Offered at $259,500. Call Dave ian tile floors, central alarm system and an automatic >r details. sprinkler system. Priced at $199,800. Call Tom Eatman. STOP IN FOR 1994 RENTAL BROCHURES AND CALENDARS. The Prudential Florida Realty 5340-1 Gulf Drive, Holmes Beach FL 34217 (813) 778-0766 -9 (813) 778-0426 HORIZON REALTY - ofAnna Maria, Inc. 4420 PINE AVENUE BOX 155 ANNA MARIA, FL 34216 *We ARE the Since Island.' .AI A RR nJ 1957 202 LAKEVIEW 2 bedroom, 3 bath home with 2 car garage. Heavy duty boat davits. Seawall and dock, fireplace, central vacuum. Renova- tions done ready for offer. Asking $100,000, $17,00, $17,1000, $19;3,30. $165,000. SALES RENTALS PROPERTY MANAGEMENT TheONLY Island Real Estate Group AND we offer you ALL REAL ES- TATE SERVICES! Anna Maria Island Real Estate Specialists extend- ing both Personal AND Professional Services In New Construction & SDesign, Existing Property Sales, Lot Sales, Free Market Analysis, Home Warranty, Free Network to Other Areas, Best Property Manage- ment and Annual & Vacation Rentals. Over 75 Yrs. Combined Expe- rience AND SmIlesl MARTINIQUE!! $179,900 Call me today! Carol Heinze CRS Realtor Million Dollar Club 778-7246 Proud corporate sponsors of Mote Marine Laboratory. Call us for a brochure and discount coupon. Buy it or sell it in an ISLANDER classified ad ... it really works! CL CD :3 ,n CL 0) m (D 2) (D (D ,n CL LET US SHOW YOU THIS PRETTY HOME that has two bedrooms, two baths a family .room, screened pool & lanai, and is just a short walk to Anna Maria's beautiful Gulf beach. $159,900. Please call for an appointment.BA fully furnished. Two screened porches & Roof Top Sun Deck overlooking entire Gulf, Intracoastal Waterway & .Island.$189,000. Call Mary Ann Schmidt 778-4931 or Janis Van Steenburgh 778-4796 WHAT A BUYI 407 S. BAY BLVD. ANNA MARIA Walk to the Bay and the City Pier. This 2 bedroom house has a view of the Bay from the living room. This charming home is located in an area of superior properties. A real buy at $138,000. Call Rosemary Schulte eves. at 794-6615. Fran Maxon LICENSED REAL ESTATE BROKER SALES AND RENTALS 9701 Gulf Dive- P 0 Box 717* Anna Maria, FL 34216 FAX# 778-7035 (813) 778-1450 or 778-2307 GULFFRONT COMPLEX DESIRABLE TIFFANY PLACE-2 BR/2BA, all the amenities, elevator and turnkey furnished. $169,900. jIE -M.. k aS0KT-^ ^1' *"' IB PAGE 24 A FEBRUARY 10, 1994 Anna Maria Bradenton Beach Holmes Beach ADDRESS/lot 220 Chilson 75xl48-canal 746 Jacaranda 50x100 106 Oak 64x139 -Gulf 600 Fern/Gladiolus 50x113 301 22nd StN 75x100 203 22nd St 50x100 304 60th St 90x100 5400 Gulf Dr 5414 Gulf Dr-condo 700 Gulf Dr 17 Gulf Place 211 N Harbor Dr 258 S Harbor Dr 50x100 3208 6th Av 50x100 6200 Flotilla 316 Westbay P&M 6700 Gulf Dr 1 A Gulf Place STYLE/rooms ground home 2bed/2bath/lcar elevated home 3bed/2bath/2car ground duplex 4bed/4bath/cp residential lot 2 story duplex 4bed/2bath ground home 2bed/lbath/lcp ground home 2bed/2bath/lcar ground condo lbed/lbath ground condo 3bed/2bath residential lot 60x97-canal elevated home 3bed/2bath/2car elevated duplex 4bed/2bath/2car condo 2bed/2bath condo 3bed/2bath -Gulf AGE/size 1957 1327 sfla 1985 1515 sfla 1974 2100 sfla 1935 1874 sfla 1955 925 sfla 1972 1333 sfla 1964 750 sfla 1976 1400 sfla 1993 1500 sfla 1976 1824 sfla 1980 1450 sfla 1979 1400 sfla SELLER/BUYER/when Rosin/Kallin 12/21/93 Cornett/Armstrong 12/21/93 Dye/Abrunzo 12/29/93 Pennell/Albert 12/29/93 LaMantia/Hansford 12/21/93 Zimmer/Pettee 12/29/93 Bennett/Nardi 12/21/93 Gehl/Davis 12/21/93 Bedrosian/Yatros 12/21/93 Johnson/Buckelew 12/29/93 Roberts/Ware 12/29/93 Oswald/Murphy 12/29/93 Olson/Zeller 12/29/93 Miller/Bracken 12/29/93 Call ... TOM NELSON Realtoi/Associate Office 778-2261 Evenings 778-1382 . MLs E I-/i Perico Bay Club 626 Estuary Dr. Bradenton, FL Spacious 3BR/2BA end unit with screened porch, water view, close to beach. Pool, Tennis, Clubhouse CALL 813-778-0777 for information PREVIEW: Two hours prior to Auction TERMS: $5,000 deposit. Balance in 45 days 10% Buyer's Premium WHEN IN PARADISE SEE... [3 5203 Gulf Drive Holmes Beach, FL 34217 (813) 778-4800 Toll Free 800-327-2522 1 ' Pick Your Heart's Delight Gulf to Bay complex with pool and covered parking. This 2 bedroom, 2 bath, 1200 square feet is a turnkey furnished condo. Enjoy relaxing by the pool or walking along new beach only steps away. Starting at $92,500. Call Lynn Hostetler. 778-4800. Luxurious Spanish Style Villa Unique design 3 bed- room, 3 bath Mexican tile and carpet, custom wood moldings, large spiral staircase to private rooftop terrace with expansive views of the Gulf. Top of the line appliances. Fireplace on 1st and 2nd levels. $299,500. Lynn Hostetler. 778-4800. Affordable Island Condo This 2 bedroom, 1 bath condo has a view of the new beach and is turnkey fur- nished. $60 per month maintenance fee and an asking price of only $59,000. Lynn Hostetler. 778-4800 Bayfront Unit with a Great View This turnkey fur- nished unit has one of the best scenic views available. Watch the birds and the boats as you enjoy the quiet set- ting in this small complex (12 units). 2 bedroom, 2 bath only $93,500. Dennis McClung. 7784800. Picture Perfect 3 bedroom, 2 bath canal home at prime Anna Maria location. Near the beach. Home features fruit trees, hot tub, boat lift and much more. MUST SEE! $229,000. Ken Rickett 778-3026. ISLAND --- - "REDUCED" BEACH HOUSE 3 BEDROOMS, 2 BATHS. Gulf view from five rooms, garage, glass lighted bar in private fenced area by heated pool. Lots of wonderful added decor features; white tile, kitchen cabinets and counter tops. $.158;9 $149,900. Call Rose, 778-2261. Toll-free 1-800-422-6325. ROSE SCHNOERR Realtor. GRI, LTG, RRC * Experience * Commitment * Service * Results _ MLS E SALES/LISTS $106,000 list uk $175,000 list $179,900 $360,000 list $408,500 $64,000 list uk $87,700 list $109,500 $94,000 list 94,900 $133,000 list $142,500 $75,300 list $83,000 $162,500 list uk $90,000. list $89,900 $150,000 list uk $90,000 list uk $120,000 list uk ,$250,000 list uk NEW LISTING: Very spacious custom built two bed- room plus two bath waterfront home with approx. 1800 sq ft living area. Deep water canal with view of Bay. Fireplace in den/3rd bedroom, enclosed porch, patio. Potential unlimited. $225,000. Call frank Migliore, 778-2662 truly entertaining home. Priced at $395,000. For more information or personal tour call Debbie Walther, 778-0777 or 794-6295 eves. ENJOY A CAREFREE LIFESTYLE: in this three bedroom, two bath home with a caged pool and deep water canal. Other amenities include boat dock, sprinkler system, 70% stone lawn, fruit trees, double garage. Room for expansion. Now reduced to $225,000. Please call Carol Williams, DICK WAGNER Licensed REALTY iNc. Real Estate Broker SISLAND LOT: Build four units across the street from the beach on this 100' x 100' lot. $99,000. m THE ISLANDER BYSTANDER [snu't THE ISlANDER BYSTANDER 0 FEBRUARY 10, 1994 1 PAGE 25 B L9- N4 E. C AS SI FI ED*. WANTED OLD ORIENTAL Rugs. All sizes, any condi- tion. Call Robert Adamsky 383-9211. BOAT MOTOR Solo 6 HP, outboard engine long shaft, $250. Gas edgier, $90. 778-7414. BUNK BEDS $150. Single bed, mattress and box springs, dresser and mirror $300. Some bedding. Excellent condition. 778-4043. FOR SALE Bedroom suite. Queen bed, nine drawer dresser with mirror, two drawer night stand. $350. 778- 1952. ITEMS FOR SALE Whirlpool 30" electric range with ceramic cook top. Almond with black surface and front. Used less than 2 years. New condition. Cost $739, sell for $400. Also: GE microwave oven with above range space save with built in vent. Black. used less than 2 years. New condition. Cost $479, sell $200. Both $550. 778-4363. Free home delivery? Call The Islander at 778-7978 to find out if you qualify. DON'T MISS THIS Gigantic Sale. Sat., Feb. 19.8 am to 2 pm. Appliances, clothing, bakery, collectibles, housewares, jewelry and linens. Bar-B-Q Chicken din- ner. Carryout available Island Chapel 6200 Gulf of Mexico Dr., Longboat Key. BRADENTON BEACH Feb.11. Annie Silver Commu- nity Center. Comer 23rd St., N. Rummage Sale. 9 am to 3 pm. Something for everyone. YARD SALE Refrigerator, furniture, lamps, water pump, boat davits, lots, misc. Fri. & Sat., Feb. 11 & 12. 9 to 2 or call 778-6537. 110 Temrn St., Anna Maria. GARAGE-MOVING Sale. Toro lawn mower, garden and household items. Fri., Feb. 11 and Sat., Feb. 12. 9 am to 3 pm. 680 Compass Rd., Longboat Key, Em- erald Harbor subdivision 5820 Gulf of Mexico Dr. MULTIPLE DWELLINGS Shell Pointe Clubhouse, 6300 Flotilla Dr., Holmes Beach. Many goodies. Sat., Feb. 12. 8 am to 1 pm. CONTINUED ON-THEWEXT PAGE. I ^WF ~ ELEVATED ELEGANCE: Bright and breezy 3BR/ 2BA home on sailboat canal, easy access to Bay. Gourmet kitchen, cathedral ceiling in greatroom, wraparound decking and 4-car parking. Bring your boat there's a dock and boat lift, too! All for $229,000. Please call , Vacation Rentals Anna Maria Island Great Selection of Seasonal Properties Beachfront Bayview Gardenview Weekly rates from $500.00 Monthly rates from $1,200.00 Contact: Debbie Dial 800/881-2276 813/778-2275 Michael Saunders & Company Licenwd Real Estate Broker 3222 East Bay Dr., Holmes Beach FL 34217 (813) 778-2275 KEY ROYALE 624 Foxworth Lane 100 feet on deep water canal. 3 bedrooms, 2.5 baths, eat-in kitchen and formal dining room. 1,880 sq. ft. New sea wall and dock. 778-7837 QUALITY HAS ITS PRICE ... AND ITS REWARDS. Key Royale, 631 Foxworth Lane. $525,000 Doug Dowling Realty. 778-1222." SINCE 1939 Island Relocation Specialist ED OLIVEIRA 1 REALTOR When Buying or Selling, Ed can make your Island Dream come true!I 778-1751 Evenings 2217 Gulf Drive Bradenton Beach FL 34217 778-2246 Office TOUR OF FINE HOMES Sunday, February 13th 1 -4 PM 697 Key Royale Dr., Holmes Beach .. $550,000 Gorgeous Bayfront home overlooking Tampa Bay. Heated pool, new kitchen & appliances. Your Host, Dick Rowse. 674 Key Royale Dr., Holmes Beach ..$259,000 4BR/2BA pool home, dining room, morning room, parlor and more. Your hostess, Carol Williams. 611 Dundee Lane, Holmes Beach .. $210,000 2BR/2BA deep water canalfront home. Florida Room, Lanai, Jacuzzi, boat dock. Your host, Bill Donnelly. 207 W. 71st St., Holmes Beach .........$125,000 2 BR/2BA elevated villa close to beach. Home Warranty. Your host, Frank Migliore. 504 59th St., Holmes Beach.............. $214,900 Carefully kept, top notch, 3BR/2BA waterfront home vaulted ceilings dock, 3 walk-in closets. Your hostess Debbie Walther. 404 Bay Palms Dr., Holmes Beach .... $139,900 To settle estate, 2BR/2BA home with family room, large screened porch & updated kitchen. Your host- ess, Carla Price. 2409 Ave C, Bradenton Beach .........$119,000 Elevated duplex with 2BR/2BA each side. Walk to bay and beach. Your hostess, Marion Ragni. 730 Estuary Dr., Perico Bay Club... $159,900 3BR/2BA unit with gourmet kitchen, glass en- closed lanai and many enhancing upgrades. Your hostess Judy Duncan. 880 Audubon Dr., Perico Bay Club ... $115,500 2BR/2BA Kingfisher model with a view of 3 lakes. Turnkey furnished, model perfect. Your hostess, Zee Catanese. REALTORS 5910 Marina Dr. Holmes Beach, FL 34217 Call (813) 778-0777 or Rentals 778-0770 1-800-741-3772 OPEN SEVEN DAYS A WEEK MLS I [snu, [snu, Ii( PAGE 26 u FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER bCp Commercial Residential Free Estimates g sandy's Lawn Mowing Trimming Edging SLaWn Hauling By the cut or by the month. service 12 YEARS EXPERIENCE INSURED 7 .1345 GUARANTEED LOWEST PRICES 7 8 AND SATISFACTION 778-2586 MARy RY y_ Eve: 778-6771 20% OFF WITH THIS AD ONLY- EXP. 2/16/94 I-I 't Painting by Elaine Deffenbaugh "Professional Excellence" INTERIOR & EXTERIOR RESIDENTIAL & COMMERCIAL SWe repair popcorn ceilings ? Serving the Islands Since 1969 f*. ~Licensed and Insured 778-5594 778-3468 ^ ISLAND CLEANING RESIDENTIAL & COMMERCIAL NOW OFFERS... VACUUM SALES & SERVICE We carry all makes & models We take trades Small Appliance Repair Senior Discount Same Dependable, Prompt, Quality Service at a New Location. 5600 Marina Dr Holmes Beach Mon-Frl 10-4, Sat 9-2 778-4988 STATE REGISTERED CONTRACTOR State Reg. RC0043740 RESIDENTIAL ROOFING CONTRACTOR -* 4 ,:,_T--1 -. A- f/,! ' ISANDR LASIIE CHRISTIE'S PLUMBING ,COMPANY Commercial & Residential Open Saturday 24-Hour Service No Overtime Charges! 778-3924 or 778-4461 "Remember, it pays and saves to get a second estimate." 5508 Marina Drive, Holmes Beach (RF0038118) MOVING Glass & marble dining set, white sectional sofa, XL twin beds, dressers, sofa bed, desks, files, crib, porch furniture, entertainment cabinet, lots more. Sat., Feb. 12. 9 am to 5 pm. 617 North Point, Key Royale, Holmes Beach. ESTATE SALE Entire contents in Frank Kelly's apart- ment. Fri., Feb. 11 and Sat., Feb. 12. 9 am to 1 pm. Bayou Condo 5A, Pine Ave., Anna Maria. Do not park on condo premises. YOGA now offered in Holmes Beach at the Magic Closet. Beginning, advanced, senior and yoga-dance classes. Call 778-3892 for enrollment information. TO MY SPECIAL furry friends. I will miss you all. Many thanks for your loyal following and support. I wish you peace. Jan Grushoff Welch, Island Grooming.. FIREBIRD CAMARO or Grand Am seats. Front and rear. Charcoal. Fits '82 to '87. $110 OBO. 778-4084 or 778-6541 days. 15' 6" RIVIERA Tri hull with open bow. 35 HP Johnson. Magic tilt trailer. $1200 OBO. 778-6569. the new Tingley Memorial Library in Bradenton Beach. Part-time or full- time. 778-9413 or 778-6247. MEDICAL OFFICE RECEPTIONIST Part-time for front office. Insurance claims experience. Computer knowl- edge helpful. Send resume to: Island Podiatry, P.O. Box 2234, Anna Maria FL 34216. Martha Stewart, 778-4362 or Carolyne Norwood, 778- 1514 if you can give a few hours of community service. WANTED: Babysitter. Our home. Mon., Wed. & Fri. 9 am to 5 pm. References required. 778-1237. WANTED: DAY wait staff and line cook. Rotten Ralph's 902 S. Bay Blvd., Anna Maria. PEACHES DELI Part time. 778-7386. PINE-SOL PATTY & CO We do everything! Light clean- ing, spring cleaning, WINDOWS, moving help, organiz- ing, whatever! 18 1/2 years on this Island! (20% dis- count to Tom Selleck). 778-9217. HOME REPAIR-Kitchen & Bath, handyman and home repairs. Island resident, 23 years experience, local ref- erences. Call Mark at 778-5354. AUTO & BOAT DETAILING at your home, office, or dock-at your convenience. Complete detailing includes wash, wax, shampoo, engine & underbelly cleaning, leather & vinyl conditioned, tires & trim dressed and much more. Protect your investment. Call Damon on mobile number 356-4649. PROFESSIONAL YACHT & Boat cleaning by Carleen. 15 years experience. No job to small. For free estimates call voice pager 813-252-0080. Island resident. THE ISLANDER It's the best news in town! ref. Call Brewers 778-7790. TAX PREPARATION and small business accounting. 25 years experience. Certified. Your neighborhood rep- resentative in Holmes Beach, Pat Kenney. Kenney Tax Service. 778-6024. GOLDEN CARPET cleaning specialists. Take advan- tage of our 25% special Spring prices and save. Living room, dining and hall, $34.95. Sofa, love seat and chair, $45. Full house up to 900 sq. ft., $74. Free estimates. 813-833-0119. HOUSE/CONDO CLEANING Experienced profes- sional couple with impeccable local references and cli- ents. Call Sharon 778-3989. DANA DOES IT ALL: House cleaning, shopping, laun- dry, cooking, driving & so on & so on & so on. Excel- lent references. 15 year Island resident. Call Dana 778- 1201 after 6 pm. HEALTH CARE PROFESSIONALS (Admn. & RN) 54 & 51. Relocating to Island area. Desire positions pro- viding in-home assisted living or small group care. Posi- tive, sensitive, energetic. Contact us evenings at our home. 618-466-7092. ref- erences. 778-2993. Lic# CRC 035261. MONTGOMERY'S. GULFFRONT Wonderful views from this furnished,. GULFFRONT Beautiful 3/2. Best on beach. Valentine special thru Feb. $600 week. 778-3171. \ 7,\ THE ISLANDER BYSTANDER M FEBRUARY 10, 1994 K PAGE 27 Ji1 JS ANDERC AS I ED IRNALSI ENALI SEASONAL Gulffront/canal homes and condos. Weekly and monthly. Call Debbie Thrasher, Anna Maria Realty, Inc. 778-2259. QUIET 1/1 fumished. 1.5 blocks to beach. Cable TV and microwave. Available beginning March 16. Wk/SntBR home furnished. 1/ .2 block to gulf beach/city pier. 114 3rd St., S. 778-2896. Bayfront w/gorgeous view of Gulf & Bay plus boat dock. 2/2 with bonus loft and 2 decks. Small pet OK. Excel- lent location. Must see.. FOR RENT former space of Isfaider Bystander in Is-,. land Shopping Center. Approx. 300 sq. ft..Next to Holmes Beach Laundromat. $350 month. 778-6772 or 778-3757.. COTTAGES ON the beach in Anna Maria City. Wk/. Mo/Sn. 813-735-1488. FOR RENT Art studio. 2 rooms. 10' X 10' with connect- ing door and outside entrance. Located in'Art League building. $180 month includes utilities. 778-4457. ROOMMATE WANTED to share. 2/2, pool, cable.'bal- conies and laundry. 778-6074. ANINA MARIA 2/2, turnkey 1/2 block to beach/pier.: Cable TV, central A/C, W/D, Florida room. Comfort- able, reasonable, negotiable. 778-2934. MARCH SEASONAL Modem 2/2 home. W/D, Jacuzzi, decks, views. 778-4010. SIMPLY CHARMING Newly renovated 3/2 ground level cottage in north Anna Maria. Taking reservations for Jan. thru Apr. 1995. Drive by 806 Jacaranda, then call 746-6269. WOMAN WANTED to rent large bedroom irr nice NW Bradenton home. House privileges. 10 minutes from island. $300 month includes utilities. References re- quired. 778-6541 days/794-6553 eves. . FIND THE HOME of your dreams in The Islander By- stander. Call 778-7978 to find out if you qualify for FREE delivery to homes & apartments on Anna Maria Island. ISLANDER PRIVATE COTTAGE 1/1, across street to beach.Avail- able March and April. $1000 per month includes all. Will consider weekly. 778-2832. GULFFRONT VACATION condo. 1/1, ground floor, end unit, sleeps 5. Open sundeck, screened lanai, heated whirlpool and great beach. $495 per week Some week- ends available at $80 per night. 778-2832. ANNUAL RENTALS *1/1 apartment, clean, good location. $400 month. Charming 2/1 with Gulfview, new paint, kitchen and Berber carpet. No pets. $650 month. Gorgeous Bayfront home. 3/2. Spectacular view, Ask- ing $1200 monthly. FISHERMAN'S PARADISE 2/2, elevated on bay with dock. $1650 monthly. Gulf Bay Realty of Anna Maria, Inc. 778-7244. KEY ROYALE 624 Foxworth. 100 ft. canalfront. 3/2.5, living room, dining room, kitchen with eating area. 2 car garage. $225,000. 778-7837. RARE FIND Walking beach. Gulf. 1/1, enclosed lanai, elevator and secured building. Covered parking. Martinique Condo. $129,500. Towne & Shore Realty. 778-2940 or 779-2044. BRADENTON Large 2/2 villa. Pool, clubhouse. Minutesto Gulf beaches. Close to shopping, etc. $49,900.794-6293. GULF OF MEXICO HOME 3+2+2+. Divorce sale. By, owner. New air, great walking beach, rock fireplace, etc. 619-329-0193. Reduced below appraisal. LOVELY 4BR/2,5BA, two story brick home. Com- pletely renovated. Separate studio. 7704 20th Ave. NW., Bradenton. 795-8169. OPEN HOUSE 812 South Bay Blvd., Holmes Beach. Sun.,'Feb. 13. 2 to 4 pm. Come and, see this beautiful beachfront home in Anna Maria. 3/2 house with one of the finest walking beaches and gorgeous views. Fam- ily room, stone fireplace, deck, garage and fruit trees. $425,00O.~Jeanette Rampone, Michael Sauriders & Company. 747-2244. HOLMES BEACH LOT Deep water canal, view of Skyway. Approx. 6600 sq. ft. Excellent seawall. 66' on water. $149,000. Some financing possible. 778-0019. WATERFRONT 2/1 in Holmes Beach. Deep water canal, view of Skyway. Excellent seawall. Dock. Some financing possible. $149,000. 778-0019. HOLMES BEACH LOT by owner. Great neighbor- hood, short walk to beach. 90 X 90. Zoned single fam- ily. Call collect 412-794-3422; i IW-I V .^ 10Mi. Soffit and Fascia Screen Rooms Gutters and Siding Rescreening Installation and Repair Vinyl Windows ALL PHASE ALUMINUM Ken Marshall .753-1279 UL. #RX0052425 Anna Maria Pest Control CALL (813) 778-1630 Li. No. 4467 Island Typing Service FX- Computer Operated - g FAX Service: Send & Receive FAX # 778-8390 310 Pine Avenue Anna Maria 778-8390 Free Estimates Donnie Rivera ? f ANATEE 4JA I LOWERCSE ISLAND LAWN SERVICE (813) 778-7508 P POBox 352* Anna Maria FL34216 SABAL PALM CARPENTRY A FLORIDA COMPANY SMALL HOME REPAIRS CUSTOM FENCES DECKS SIDING FASCIA SOFFITS DOORS WINDOWS ODD JOBS Fully Insured Reasonable Rates S -77.8-7603 Rick Lease 32-Year Island Resident details J.B. Painting * Interior/Exterior *'20 Years- Experience Husband/Wife Team * Free Estimates 778-2139. ME PAGE 28 E FEBRUARY 10, 1994 A THE ISLANDER BYSTANDER Island " 3900 East Bay Drive Holmes Beach OPEN 7 DAYS A WEEK 7 AM to 10 PM SUNDAY 7 AM to 9 PM* PHONE 778-4100 We Welcome Food Stamps PRICES EFFECTIVE NOW THROUGH TUESDAY, FEBRUARY 15, 1994 I %I3 Mi. i ----- ------- L.-.1 FRESH Asparagus RIGHT HERE ON THE ISLAND! SPRING LAKE I Drinking I Water I I 1/2 WITH THIS COUPON NOW THRU FEB 15 LIMIT TWO PER CUSTOMER PLEASE NUTRITIOUS Cucumbers 3 oR 19o F 3, _qa'i~^^^6~et USDA CHOICE Strip Steak OSCAR MAYER WIENERS PKG. MARIE'S Salad Dressing ,.~~r 12 0 Z. JA R FRESH otted Baking Potatoes Russet or :t:.h Idaho '.LB. THANK YOU FOR SHOPPING ISLAND FOODS ... Foods FREE BLOOD PRESSURE CHECK Every Friday 11 A.M. to NOON N / 4 Contact Us | Permissions | Preferences | Technical Aspects | Statistics | Internal | Privacy Policy © 2004 - 2011 University of Florida George A. Smathers Libraries.All rights reserved. Terms of Use for Electronic Resources and Copyright Information Powered by SobekCM
http://ufdc.ufl.edu/UF00074389/00502
CC-MAIN-2017-47
refinedweb
24,292
74.29
static keyword is used to store some data, variables, methods, blocks, and nested class in memory permanently during the execution of the applications. static can be useful if we want to access the given programming language structures or provide access from other parts of the application. Static Keyword Use Cases static keyword is supported programming languages like PHP, Java, C#, C/C++. We can use static keyword for different purposes where all of their behavior are the same. Here some use cases of the static keyword. - Access to the class properties or methods without an instance of the class - Share a given variable with other code blocks and namespaces - Access variables inside a function - Set values for functions which will not change during different calls implicitly PHP Static Keyword Usage PHP provides the static keyword with all types of usage. We can declare variables, function variables, class variables, etc static. Then we can access these variables without an instance and their value is stored during the execution of the applications. PHP Static Variable We can make a variable static by using static keyword before the variable definition like below. In this example, we will define a variable named total_number which can be accessed from different variable scopes. <?php namespace MyScope; static $total_number=0; ?> We can access this variable from other namespaces or scopes like below. We will use ::. As an example, if the static variable scope name is MyScope we can access it like below. <?php echo MyScope::$total_number; ?> PHP Static Variable and Function In Class We can also use statickeyword in class definitions. In order to use static elements like variable, function, etc we do not need to initialize an object of the given class. We will just use the class name, :: operator, and the variable or function name. In this example, we will create a variable named name and function calculate() as static. <?php class MyClass{ public static $name; public static $calculate($a){ return a*a; } } MyClass::$name="This is my name"; MyClass::calculate(3); ?> Java Static Keyword Usage Java is another programming language which provides the static keyword. Java can use static keyword with variables, methods, blocks, and classes. Java Static Variable Java variables can be made static which will make them available from all different code blocks and structures. They are also persistent during the execution of the program or application. In this example, we will create an integer variable named count which will store its value during the execution of the program. Other functions, libraries, classes access this variable will store count value persistently. static int count=0; Java Static Variable and Function In A Class We can also define a variable or function in a class statically. We can also access these variables and functions without an instance of the class. We will create a static variable named count and function named calculate()in this example. class MyClass{ static int count=0; public static void calculate(int a){ return a*a; } } MyClass.count=1; int result = MyClass.calculate(3);
https://www.poftut.com/what-is-static-keyword-in-programming-languages-like-php-java/
CC-MAIN-2021-31
refinedweb
505
55.54
Import third-party modules the easy way Part 2 in a series of tutorials on modern app infrastructure: CocoaPods is the world’s largest collection of pre-built, open source modules for iOS developers – some 46,000 at the time of writing. Although it’s far from perfect (I have complained about it a great deal in the past), CocoaPods has done more to streamline developer productivity than any other piece of our infrastructure: you can literally pull incredible functionality into your app in just a few seconds, and keep it updated over time. This is part two of a tutorial series about upgrading your apps to use modern infrastructure – tools that help you write better software by automating tasks. In this installment we’re going to look at another problem our test app has: although it uses SwiftyBeaver for logging, it does so by literally copying the files directly into the project. While this certainly works it means any future updates to SwiftyBeaver won’t automatically be merged into our app. CocoaPods is designed to solve this. Rather than copying someone else’s code into your project, you reference their Git repository and a version number and let CocoaPods install it for you. Even better, you can update all your third-party modules to the latest version using a single command, bringing with them any new features and security updates. So, we’re going to install CocoaPods then update our app so that it pulls in SwiftyBeaver using CocoaPods rather than importing the files directly. Before we proceed, please download the test app that we’re using for this tutorial series. If you completed the first part of this tutorial series – how to refactor your app to add unit tests – you should use the code you had at the end. Warning: The example project has been written specifically for this tutorial series, and contains mistakes and problems that we’ll be examining over this tutorial series. If you’re looking for example code to learn from, this is the wrong place. If you don’t already have the CocoaPods tools, the first thing you need to do is install them. CocoaPods is actually written in Ruby, but your Mac already includes the tools needed to install and run it. So, open the Terminal app and run this command now: sudo gem install cocoapods That should only take a few seconds as your Mac downloads and installs CocoaPods and its dependencies. The next step is to change into the directory where your project is. Xcode’s naming is a little unhelpful here because there’s a “Paraphrase” directory that itself contains a “Paraphrase” subdirectory, however you’re looking for the parent directory – the one where you can see Paraphrase.xcodeproj. For me, my project directory is on my desktop, so I ran this command cd ~/Desktop/Paraphrase If you stored it elsewhere, please adjust that command as needed. Now for the important part: we need to ask CocoaPods to configure our project for pod usage. Please run this command: pod init That asks CocoaPods to create a file called Podfile in our project’s directory so that it can store our project’s CocoaPods configuration. It will look something like this: # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'Paraphrase' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for Paraphrase end The # Pods for Paraphrase line is one of two we care about: we request specific frameworks there and have them installed into our project. As I said earlier, right now the Paraphrase project works by copying all of SwiftyBeaver’s Swift source code directly into the project. We’re going to replace that with a CocoaPods-managed version instead, so under # Pods for Paraphrase I’d like you to add this line: pod 'SwiftyBeaver' That asks CocoaPods to add SwiftyBeaver to our project. It doesn’t specify any version of SwiftyBeaver, so CocoaPods will automatically use the latest version – we’ll look at alternatives to that later. Before we move on, we need to make one more change. Near the top of your Podfile you’ll see this comment: # platform :ios, '9.0' We’re going to specify a deployment target of iOS 11.0, which should be fine for most apps. So, replace that line with this: platform :ios, '11.0' Save your Podfile then run this command from the terminal: pod install If you’ve used CocoaPods before, that command will take a few seconds to run as CocoaPods fetches SwiftyBeaver and prepares our project. If you haven’t used CocoaPods before, you’ll run into arguably one of the biggest problems of CocoaPods: it uses a centralized “master spec” repository that contains metadata for all versions of all CocoaPods in their system, and that repository must be downloaded onto your computer in order to continue. Yes, metadata for all 40,000. Yes, with their version histories too. As a result, the CocoaPods master repo will take up about 600MB on your computer at the time of writing. This will will be downloaded the first time you run pod install on any project, then kept up to date over time. There is no way around this, I’m afraid, and if you’re on a slower or capped internet connection I think you’ll appreciate why this has been such a pain point for users in the past. Anyway, even if you have a relatively fast internet connection this process will take a while to complete – not only must the repository be downloaded, but it must also have its information fully resolved by Git. So, go and make some coffee or tea, because it will take a while no matter what setup you have… Welcome back! Running pod init for the first time is always a bit of a shock to the system at first, but once it finishes you’re all set - everything is smooth sailing from here. CocoaPods should have printed an important warning while it was working, but if you missed it I’ll repeat it here: [!] Please close any current Xcode sessions and use Paraphrase.xcworkspace` for this project from now on. This matters. You see, CocoaPods hasn’t changed your original Paraphrase.xcodeproj file – that’s the same Xcode project it always was. Instead, it generated an Xcode workspace that wraps around your project, adding in the pods you requested. This will be called Paraphrase.xcworkspace. Now, the reason this matters is two-fold: So: if you had the Xcode project open, please close it. Now that’s done, go ahead and open Paraphrase.xcworkspace. You should see both a “Paraphrase” project and a “Pods” project, and inside Paraphrase is the same code we had before – you can effectively go ahead and carry on working as you did previously, leaving CocoaPods to do its thing. In this case we need to upgrade our project so that it uses the CocoaPods-supplied version of SwiftyBeaver rather than the one that was added by hand. This takes two steps: deleting all the SwiftyBeaver code, then importing the SwiftyBeaver module everywhere it’s needed. So, go ahead and select the SwiftyBeaver group inside the Paraphrase project, then hit backspace to delete it. You should choose Move To Trash because all that code just isn’t needed any more. Now when you press Cmd+B to build the project you’ll get lots of errors because Swift no longer knows what SwiftyBeaver is. This is because CocoaPods provides it was an external module that must be imported, but that’s easy to do. In fact, all you need to do is add import SwiftyBeaver to the top of the following files: And that’s it – our code will compile again. Awesome! Although upgrading our project to use CocoaPods was straightforward enough, there are three more things you’re likely to need to know going forward. First, if you change your Podfile to add, remove, or update any pods, you should re-run the pod install command. This will download any pods that aren’t already available and update your workspace ready to use them. On the other hand, if you want CocoaPods to update your pods to their latest versions you should run pod update. Warning: Running pod update will also update the CocoaPods master spec repository, so it might take 30 seconds or so. Second, when we added pod 'SwiftyBeaver' to our Podfile it meant we wanted the latest version of SwiftyBeaver. This is fine while you’re actively developing something, but as you come closer to shipping you’ll want to switch to a specific version to avoid breakages happening. CocoaPods lets you request specific versions of pods if you want – “give me 1.0 and nothing else” – but more often you’ll want a range of versions based on semantic versioning. Using semver version numbers are written as 1.0.3, where the “1” is a major number that reflects breaking changes made to code, the “0” is a minor number that reflects non-breaking additions to the code, and the “3” is a patch number that reflects bug fixes but no new features or breaking changes. In CocoaPods you can request a range of pod versions based on your needs. Probably the most common looks like this: pod 'Alamofire', '~> 4.7' That means “install the Alamofire networking library, making sure I have at least v4.7 but I’m happy with anything before v5.0” Remember, when the major version changes it means breaking changes might affect your app, so restricting usage in this way is sensible. Finally, there is some disagreement as to whether the code for your pods should be included in your source control system or not. When we ran pod install CocoaPods created a Pods directory containing the code for SwiftyBeaver. If you delete that folder and run pod install again, you’ll get the Pods directory back, so why include it in your source control? Like many things in programming there are good reasons for and against. Checking pods into source control means your project can be built immediately after check out without needing any extra commands, you’re isolated from problems with GitHub (they do happen!), and you’re guaranteed to have a known-good state in your central repository. On the flip side, not checking pods into source control will mean your repository is smaller and you eliminate the possibility of problems when merging branches that have different Podfiles. I ran a brief Twitter poll and almost 2/3rds of folks thought checking their pods into source control was a bad idea, however I think the pragmatic thing is, as usual, to do whatever works best for your team. Checking your Pods directory into source control is…— Paul Hudson (@twostraws) May 7, 2018 This was the second part of a short series on upgrading apps to take advantage of modern infrastructure. You’ve seen how easy it is to stop importing source code by hand and rely on a dependency manager instead, but in the following articles we’ll look at other ways computer automation can help us write better code – stay tuned!.
https://www.hackingwithswift.com/articles/95/how-to-add-cocoapods-to-your-project
CC-MAIN-2020-05
refinedweb
1,890
66.78
<< Preston Hill5,766 Points Really frustrated with this challenge.. Add input validation to your program by printing “You must enter a whole number.” if the user enters a decimal or something that isn’t a number. Hint: Catch the FormatException. using System; namespace Treehouse.CodeChallenges { class Program { static void Main() { Console.Write("Enter the number of times to print \"Yay!\": "); var response = Console.ReadLine(); int count = Int32.Parse(response); for(int i = 0; i < count; i++) { Console.WriteLine("Yay"); } if () { Console.WriteLine("You must enter a whole number."); } } } } 1 Answer Steven Parker215,939 Points The instructions say "Hint: Catch the FormatException". If you're going to take that hint, you won't need an "if", but you will need a "try" and a "catch". Do you need to review the video about using those?
https://teamtreehouse.com/community/really-frustrated-with-this-challenge
CC-MAIN-2022-27
refinedweb
134
71.92
This is a simple little server program... my first socket program and pretty much my first program so don't bash me too badly on the formatting. You'll see that the program accepts input from the client and displays it in a message box... but what I don't understand is when I send the command quit... why does it not quit? Maybe I am doing something wrong with the while loops.. i don't know. If anyone could point me in the right direction that would be awesome. Thank you. #include <stdio.h> #include <winsock.h> #include <windows.h> #define PORT 5531 int sockfd7, testa, sockfd8, newsock, sin_size, num_bytes; struct sockaddr_in localhost, client; char buf[50]; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { WSADATA wsda; WSAStartup (0x0101, &wsda); MessageBox(NULL, "Cannot Load Picture!", "Error!", 0); if((sockfd7 = socket(AF_INET, SOCK_STREAM, 0))<0) { exit(1); } localhost.sin_family =AF_INET; localhost.sin_port =htons(PORT); localhost.sin_addr.s_addr =htonl(INADDR_ANY); if((testa=bind(sockfd7, (struct sockaddr *) &localhost, sizeof(localhost)))<0) { closesocket(sockfd7); exit(1); } listen (sockfd7, 10); sin_size=sizeof(struct sockaddr_in); if((newsock = accept(sockfd7, (struct sockaddr *)&client, &sin_size))==-1){ perror("accept error ");} while(buf!="quit") { if((num_bytes=recv(newsock, buf, 49, 0))==-1) { return 0; } buf[ num_bytes ] = '\0'; MessageBox(NULL, buf, "Message", 0); } WSACleanup(); closesocket(sockfd7); closesocket(newsock); return 0; } Hi, I can't get your code to compile so I maybe wrong. But this line while(buf!="quit") did catch my eye. 1. While it's syntactically correct, if you want to compare the string contained in variable buf with string "quit", it won't work. It will compare the address of variable buf with the address of string "quit", which is always different. To compare strings, use strcmp function. Try running this piece of code: #include <stdio.h> #include <string.h> int main() { char buf[10] = "quit"; printf("buf = %s\n", buf); if (buf == "quit") printf("%s\n", "Using '==' : match"); if (!strcmp(buf, "quit")) printf("%s\n", "Using 'strcmp' : match"); } So you need to change that particular line to while (strcmp(buf, "quit")) 2. I'm assuming you're using a telnet client to connect to your "server" at port 5531. I'm not so sure about this one. But I think when you type "quit" (w/o quotes) and press Enter, the client will send the string "quit" followed with the characters CR and LF (0x0d and 0x0a) to the "server". So you may need to concatenate "quit" with CRLF (using strcat) before comparing it with buf.
http://www.antionline.com/showthread.php?249874-SIMPLE-C-Server&s=
CC-MAIN-2017-43
refinedweb
423
67.35
I've been busy playing with Python 3K at home. It seems to be nice though I haven't dug deep enough / far enough to notice real changes outside of the 'print' statement changes. In other work, I'm managing to tame wxPython again and am producing a consistent and simple interface for importing data from different sources (databases, spreadsheets, text files). It could form the basis of a data manager, but it's all for the statistics program which is itself coming along. The program has an interactive interpreter which is fun: it's all based on Python's 'code' module and I've organised it so that users can import data with awkward field names (like: 'Variable (1) & Variable (2) mixed'), and they can still be used on the command line, thus: Variable (1) & Variable (2) mixed.mean Not a big change, but it's one less thing to explain to demanding users. The work on the main GUI is still ongoing (choosing a test is the hardest thing) but we're getting there. The thing will be released under the Affero GPL license so it's even relevant to this site. In administration things, I managed to get some more marketing research done (all promising but lots of things to think about), and the company is getting closer to being officially founded. It's all very exciting stuff. I have a questionnaire here if anyone feels like completing it: it should take about 5-10 minutes and concerns people who use computers to perform statistical analysis. I cannot offer any money in return (we have zero investment - any offers will be carefully considered!), but it would be extremely helpful in getting open source to the top. The questionnaire is at Survey Monkey. TIA to anyone who completes it.
http://www.advogato.org/person/salmoni/diary/570.html
CC-MAIN-2014-42
refinedweb
301
68.91
Odoo Help Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps: CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc. Set default invoiced date to current date At Quotation we set --> Create Invoice: On Delivery Order After the delivery a popup window appears to create the invoice, by default the invoiced date field is empty. I want to change it to: After I click create invoice, the invoice date field will display the current date. This is a wizard that is located on stock/wizard/stock_invoice_onshipping. You can inherit it with this: from datetime import date from openerp.osv import fields, osv from openerp.tools.translate import _ class stock_invoice_onshipping(osv.osv_memory): _inherit = "stock.invoice.onshipping" _defaults={ invoice_date': date.today().strftime('%Y-%m-%d'), } Or you can add that line on defaults to the original file, but this is no recommended because if you want to update your OpenERP version you have to check all your changes and modify them on the new version. do this as a new module and it's going to work. I've just tested it on the RunBot. The date is set when the invoice is validated Can you tell me in what file that is entered? Sorry I don't understand your question. what do you mean? OK. Your code looks like the part of a custom module. You dont edit account_invoice.py? Please see, i have edit my question. Answer edited too. About This Community Odoo Training Center Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
https://www.odoo.com/forum/help-1/question/set-default-invoiced-date-to-current-date-30337
CC-MAIN-2018-17
refinedweb
275
68.36
Unformatted text preview: 11 Coding Standards CERTIFICATION OBJECTIVES Use Sun Java Coding Standards 2 Chapter 11: Coding Standards CERTIFICATION OBJECTIVE Use Sun Java Coding Standards The Developer exam is challenging. There are a lot of complex design issues to consider, and a host of advanced Java technologies to understand and implement correctly. The exam assessors work under very strict guidelines. You can create the most brilliant application ever to grace a JVM, but if you don't cross your t's and dot your i's the assessors have no choice but to deduct crucial (and sometimes substantial) points from your project. This chapter will help you cross your t's and dot your i's. Following coding standards is not hard; it just requires diligence. If you are careful it's no-brainer stuff, and it would be a shame to lose points because of a curly brace in the wrong place. The Developer exam stresses things that must be done to avoid automatic failure. The exam uses the word must frequently. When we use the word must, we use it in the spirit of the exam, if you must you must, so just get on with it. Let's dive into the fascinating world of Java Coding Standards. Spacing Standards This section covers the standards for indenting, line-length limits, line breaking, and white space. Indenting We said this was going to be fascinating didn't we? Each level of indentation must be four spaces, exactly four spaces, always four spaces. Tabs must be set to eight spaces. If you are in several levels of indentation you can use a combination of tabs and (sets of four) spaces to accomplish the correct indentation. So if you are in a method and you need to indent 12 spaces, you can either press SPACEBAR 12 times, or press TAB once and then press SPACEBAR four times. (Slow down coach.) We recommend not using the TAB key, and sticking to the SPACEBAR--it's just a bit safer. When to Indent If you indent like this, you'll make your assessor proud: Beginning comments, package declarations, import statements, interface declarations, and class declarations should not be indented. Use Sun Java Coding Standards 3 Static variables, instance variables, constructors, methods, and their respective comments* should be indented one level. Within constructors and methods, local variables, statements, and their comments should be indented another level. Statements (and their comments) within block statements should be indented * another level for each level of nesting involved. (Don't worry, we'll give you an example.) The following listing shows proper indenting: public class Indent { static int staticVar = 7; public Indent() { } public static void main(String args) { int x = 0; for(int z=0; z<7; z++) { x = x + z; if (x < 4) { x++; } } } } Line Lengths and Line Wrapping The general rule is that a line shouldn't be longer than 80 characters. We recommend 65 characters just to make sure that a wide variety of editors will handle your code gracefully. When a line of code is longer than will fit on a line there are some line wrapping guidelines to follow. We can't say for sure that these are a must, but if you follow these guidelines you can be sure that you're on safe ground: Break after a comma. Break before an operator. * Rules about comments are coming soon! 4 Chapter 11: Coding Standards Align the new line a tab (or eight spaces) beyond the beginning of the line being broken. Try not to break inside an inner parenthesized expression. (Hang on, the example is coming.) The following snippet demonstrates acceptable line wrapping: /*); White Space Can you believe we have to go to this level of detail? It turns out that if you don't parcel out your blank spaces as the standards say you should, you can lose points. With that happy thought in mind, let's discuss the proper use of blank lines and blank statements. The Proper Use of Blank Lines Blank lines are used to help readers of your code (which might be you, months after you wrote it) to easily spot the logical blocks within your source file. If you follow these recommendations in your source files, your blank line worries will be over. Use a blank line, Between methods and constructors After your last instance variable Inside a method between the local variables and the first statement Inside a method to separate logical segments of code Before single line or block comments Use two blank lines between the major sections of the source file: the package, the import statement(s), the class, and the interface. Use Sun Java Coding Standards 5 The Proper Use of Blank Spaces Blank spaces are used to make statements more readable, and less squished together. Use a blank space, Between binary operators After commas in an argument list After the expressions in a for statement Between a keyword and a parenthesis After casts The following code sample demonstrates proper form to use when indenting, skipping lines, wrapping lines, and using spaces. We haven't covered all of the rules associated with the proper use of comments; therefore, this sample does not demonstrate standard comments: /* * This listing demonstrates only proper spacing standards * * The Javadoc comments will be discussed in a later chapter */ package com.wickedlysmart.utilities; import java.util.*; /** * CoolClass description * * @version .97 10 Oct 2002 * @author Joe Beets */ public class CoolClass { /** Javadoc static var comment */ public static int coolStaticVar; /** Javadoc public i-var comment */ 6 Chapter 11: Coding Standards public long instanceVar; /* private i-var comment */ private short reallyLongShortName; /** Javadoc constructor comment */ public CoolClass() { // do stuff } /** Javadoc comment about method */ void coolMethod() { int x = 0; long numberOfParsecs = 0; /* comment about for loop */ for(z = 0; z < 7; z++) { x = x + z; /* comment about if test */ if (x < 4) { x++; } /*); } } /** Javadoc comment about method */ int doStuffWithLotsOfArgs(int a, long b, long c, short d, int e, int f) { return e * f; } } How to Care for Your Curly Braces If you format your curly braces correctly, you can distinguish your exam submittal from all the other Larrys and Moes out there. We know that this is a passionate Use Sun Java Coding Standards 7 topic for lots of folks; we're just letting you know what your assessor will be looking for, so please don't attempt to drag from us what our real feelings are about curly braces. Curly Braces for Classes, Interfaces, Constructors, and Methods OK, along with curly braces, we might talk a little about parentheses in this section. The opening brace for classes, interfaces, constructors, and methods should occur at the end of the same line as the declaration. The closing brace starts a new line by itself, and is indented to match the beginning of the corresponding declaration; for example, public interface Curly { public int iMethod(int arg); } class Moe implements Curly { int id; public Moe() { id = 42; } public int iMethod(int argument) { return (argument * 2); } } Curly Braces for Flow Control (ifs and whiles, etc.) Your flow control blocks should always be enclosed with curly braces. There are places where the compiler will let you get away with not using curly braces, such as for loops and if tests with only one statement in the body, but skipping the braces is considered uncivilized (and in fact often leads to bugs when code is enhanced later). For the exam, always use curly braces. Following is an example of how to structure all of the flow control code blocks in Java--pin this baby to your wall! class Flow { static int x = 0; 8 Chapter 11: Coding Standards static int y = 5; public static void main(String args) { for (int z = 0; z < 7; z++) { x = x + 1; y = y - 2; } if (x > 4) { System.out.println("x > 4"); x++; } if (x > 5) { System.out.println("x > 5"); } else { System.out.println("x < 6"); } if (x > 30) { System.out.println("x > 30"); } else if (x > 20) { System.out.println("x > 20"); } else { System.out.println("x < 21"); } // for loop // if test // if, else // if, else-if, else do { // do loop x++; System.out.println("in a do loop"); } while (x < 10); while (x < 13) { // do while loop x++; System.out.println("in a do while loop"); } switch (x) { case 12: x++; /* falls through */ case 13: x++; System.out.print("x was 13"); /* falls through */ // switch block // see comment at end Use Sun Java Coding Standards 9 case 14: System.out.print("x is 14"); /* falls through */ default: break; } try { // try, catch doRiskyMethod(); x++; } catch (Exception e) { System.out.println("doRisky failed"); } try { // try, catch, finally doRiskyMethod(); x++; } catch (Exception e) { System.out.println("doRisky failed"); } finally { x = 100; } } static void doRiskyMethod() { x = y; } } You might want those Exceptions above to be RuntimeExceptions. javac does not mind, but jikes will give you a warning. One interesting thing to notice about the example above is the use of the /* falls through */ comment in the switch statement. This comment should be used at the end of every case block that doesn't contain a break statement. Our Comments About Comments Earlier we talked about being a team player. The orientation of the exam is to see if you can create software that is readable, understandable, and usable by other programmers. Commenting your code correctly is one of the key ways that you can create developer-friendly software. As you might expect, the assessors will be looking to see if your code comments are appropriate, consistent, and in a standard form. 10 Chapter 11: Coding Standards This chapter will focus on implementation comments; Chapter 16 will cover javadoc comments. There are several standard forms that your implementation comments can take. Based on the results of extensive research and worldwide polling we will recommend an approach, which we believe represents the most common of the standard approaches. If you choose not to use our recommendation, the most important thing that you can do is to pick a standard approach and stick with it. There are several types of comments that commonly occur within source code listings. We will discuss each of them with our recommendations and other possible uses. Block Comments Use a block comment in your code when you have to describe aspects of your program that require more than a single line. They can be used most anywhere, as source file or method headers, within methods, or to describe key variables. Typically, they should be preceded by a blank line and they should take the following form: /* *this is a block comment *it occupies several lines */ Single Line Comments Use a single line comment in the same place you would block comments, but for shorter descriptions. They should also be preceded by a blank line for readability, and we recommend the following form: /* this is a single line comment */ It is acceptable to use this alternate form: // this is the alternate single line comment form End of Line Comments When you want to add a comment to the end of a line of code, use the aptly named end of line comment. If you have several of these comments in a row, make sure to align them vertically. We recommend the following form: Use Sun Java Coding Standards 11 doRiskyStuff(); doComplexStuff(); // this method might throw a FileNotFoundException // instantiate the rete network It is acceptable to use this alternate form: doRiskyStuff() doComplexStuff(); /* this method might throw a FileNotFoundException /* instantiate the rete network */ */ Masking Comments Often in the course of developing software, you might want to mask a code segment from the compiler without removing it from the file. This technique is useful during development, but be sure to remove any such code segments from your code before finishing your project. Masking comments should look like this: // // // // // // if (moreRecs == true) { ProcessRecord(); } else { doFileCleanUp(); } General Tips About Comments It is important to use comments where the code itself may not be clear, and it is equally important to avoid comments where the code is obvious. The following is a classic, from the Bad Comments Hall of Fame: x = 5; // set the variable x equal to 5 Comments should be used to provide summaries of complex code and to reveal information about the code that would otherwise be difficult to determine. Avoid comments that will fall out of date, i.e., write your comments as if they might have to last forever. Declarations Are Fun Declarations are a huge part of Java. They are also complex, loaded with rules, and if used sloppily can lead to bugs and poor maintainability. The following set of 12 Chapter 11: Coding Standards guidelines is intended to make your code more readable, more debuggable, and more maintainable. Sequencing Your Declarations The elements in your Java source files should be arranged in a standard sequence. In some cases the compiler demands it, and for the rest of the cases consistency will help you win friends and influence people. Here goes: class comments package declaration import statements class declaration static variables instance variables constructors methods Location and Initialization The following guidelines should be considered when making Java declarations: Within methods: Declare and initialize local variables before other statements (whenever possible). Declare and initialize block variables before other block statements (when possible). Declare only one member per line. Avoid shadowing variables. This occurs when an instance variable has the same name as a local or block variable. While the compiler will allow it, shadowing is considered very unfriendly towards the next co-worker (remember: potentially psychopathic) who has to maintain your code. Use Sun Java Coding Standards 13 Capitalization Three guesses. You better use capitalization correctly when you declare and use your package, class, interface, method, variable, and constant names. The rules are pretty simple: Package names The safest bet is to use lowercase when possible: com.wickedlysmart.utilities Class and Interface names Typically they should be nouns; capitalize the first letter and any other first letters in secondary words within the name: Customer or CustomTable Method names Typically they should be verbs; the first word should be lowercase, and if there are secondary words, the first letter of each should be capitalized: initialize(); or getTelescopicOrientation(); Variable names They should follow the same capitalization rules as methods; you should start them with a letter (even though you can use _ or $, don't), and only temporary variables like looping variables should use single character names: currentIndex; or name; or x; Constant names To be labeled a constant, a variable must be declared static and final. Their names should be all uppercase and underscores must be used to separate words: MAX_HEIGHT; or USED; Key Points Summary This is the easiest part of the exam, if you are careful and thorough you should be able to do very well in this area. Always indent four spaces from the previous level of indentation. Break long lines at around the 65 character mark: Break after a comma 14 Chapter 11: Coding Standards Break before an operator Try not to break inside inner parens. Use single blank lines between constructors, methods, logic segments, before comments, and after your last instance variable. Use blank spaces between binary operators, after commas in argument lists, after for expressions, between a keyword and a paren. Place opening curly brace on the same line as the declaration or statement. Put closing curly brace on a new line. Closing curly brace shares a line with else, else if, do, catch, and finally. Block comments start and end with /* and */, * in the middle. Single line comments use /* */ End of line comments use // Masking comments use // File declaration sequence is this: comments, package, import, class, static, instance, constructors, methods. Initialize variables at the top of blocks; avoid variable name shadowing. Package names are lowercase: com.wickedlysmart.utilities. Classes and interfaces have capitalized nouns for names: Inventory. Methods and variables names start lowercase and capitalize secondary words, as in doRiskyStuff(); or currentIndex;. Constant names are all caps with underscores: MAX_HEADROOM. ... View Full Document - Fall '07 - GPour - Flow control, developer, java coding standards Click to edit the document details
https://www.coursehero.com/file/5582294/ch11/
CC-MAIN-2017-51
refinedweb
2,690
58.11
First and foremost, a shameless plug, check out this blog post on my brand new personal site if you would like here! I've got some awesome syntax highlighting and an RSS feed if you prefer reading that way! Why Redesign? As a web developer, your personal site is a reflection of yourself and your skill set. I was proud of my previous iteration, but I knew it could be better. I found it was lacking in a few key areas: - Was only one page - Very text heavy - Lacked personality - Portfolio aspects were missing In hindsight, I am certain that prospective clients visited my site, saw very little imagery or proof of my skills, and bounced. Requirements and Goals I had a few key goals in mind when I began the new iteration: - Look amazing (obviously) - Showcase my personality - Showcase projects and websites - Markdown-powered blog & content - RSS Feed - Minimal JS/CSS bundles - Syntax highlighting in pages & posts - App-like page routing, without a frontend framework - Contain styles, structure, and functionality in templates as much as possible How I Built This I pulled together a collection of awesome tools to make this site awesome. I call this set of tools the TEA Stack (patent pending 😉). The TEA stack includes TailwindCSS, Eleventy, and AlpineJS. If you have not already, I suggest you give each of these tools a try. When combined, they are insanely powerful and delightful to work with. I built a starter template repository on GitHub, so if you're looking to jump right into the stack, give it a spin and let me know how it goes! TailwindCSS Tailwind is a phenomenal framework and I have far too many good things to say about it. This site is styled almost entirely by utility classes, with the minor exception of syntax highlighting and global defaults. With the help of Tailwind, I was able to build this entire site with only five postcss files. This keeps my project scaffolding much leaner, while also allowing me to both build and style the site within my templates. For example, here is a brief snippet of the hero element on this very page: <section class="gradient-purple text-white py-8 lg:py-16"> <div class="container max-w-screen-md mx-auto text-center"> <p class="uppercase font-bold text-indigo-300 text-sm">{{ date | prettyDate }}</p> <h1 class="mt-2 text-2xl sm:text-3xl xl:text-4xl font-bold leading-none"> {{ title }} </h1> <p class="mt-4 text-sm sm:text-base text-indigo-100">{{ excerpt }}</p> </div> </section> <span class="w-full h-12 block gradient-purple text-gray-100"> {% include 'icons/waves.svg' %} </span> Tailwind Plugins TailwindCSS has some fantastic plugins, from both the community and Tailwind Labs, that make life so much easier. At the time of writing this, I am using these two great packages: - TailwindCSS Custom Forms to style form inputs - TailwindCSS Debug Screens to display the current breakpoint in development Eleventy All pages on this site are truly statically generated at build time with Eleventy. What I mean by truly is that there is no pre-rendering, rehydrating, or any other funny business going on here. Don't get me wrong, I think projects like Next, Gatsby, Nuxt, and Sapper are great. However, I believe the SSG aspects of these projects have major problems. Build times are atrocious, and the client-side JS bundles are massive even for tiny websites. Here's a look at the result from running npm run build on my site: Copied 1 item and Processed 11 files in 0.38 seconds No JavaScript, no frameworks, just raw HTML. But now you don't get those dope page transitions that feel like an app! Wrong! Turbolinks can provide this functionality for us. Adding this to your bundle will grant you buttery smooth page transitions for quite the bargain: # package-size is a fantastic tool to quickly check filesize npx package-size turbolinks package size minified gzipped turbolinks@5.2.0 39.79 KB 37.78 KB 8.74 KB Eleventy allows for a markdown-powered website, exposes a fantastic API for passing data to templates, and makes it crazy simple to add custom filters, plugins, and so much more. Eleventy Plugins - Syntax Highlighting to syntax highlight inline code with Prism at build time, not on the client - RSS Feed to generate the RSS feed automatically on build AlpineJS This project contains one JavaScript file. That file looks like this: // This passes all postcss files through rollup and out into a single css file import './main.pcss' // Import and auto-initialize both Alpine and Turbolinks import 'alpinejs' import 'turbolinks' That's right. All of the functionality on my site, like the mobile navigation and the year in the footer, are written in the template files. Take a look at the code in my footer to update the year client-side: <span x-</span> Or maybe the button code to toggle the mobile nav: <button @ <span x- {% include 'icons/menu.svg' %} </span> <span x- {% include 'icons/close.svg' %} </span> </button> With some vue-esque directives and custom attributes, I've got all the logic I need, and that logic is contained in the template file itself. So sexy. The Best Bundler: Rollup It's worth noting that I am using Rollup to compile and split the CSS/JS files. I will always advocate using Rollup over Webpack, as the syntax is lightyears easier to grok and configure. Here is my entire Rollup configuration file: import commonjs from '@rollup/plugin-commonjs' import postcss from 'rollup-plugin-postcss' import resolve from '@rollup/plugin-node-resolve' import { terser } from 'rollup-plugin-terser' const prod = process.env.NODE_ENV == 'production' export default { input: 'src/_bundle/main.js', output: { sourcemap: false, format: 'iife', name: 'main', file: 'dist/assets/main.bundle.js', }, plugins: [ postcss({ extract: 'dist/assets/main.bundle.css', minimize: prod, }), resolve({ browser: true, }), commonjs(), prod && terser(), ], watch: { clearScreen: false, }, } Inspiration The design, tools, and stack was derived from a bunch of great tools and sites I follow very closely. I would feel like I am plaigerizing if I didn't devote a section on this post to point to things that helped bring this site to life: Peep The Source My website's source code will always be public on GitHub, so feel free to poke around yourself to see how things work! Some of the content in this post may not be 100% up-to-date, so check that out if you're feeling curious! Thanks for reading, and as always, stay sexy. Discussion (10) You forgot the awesomeness of Nunjucks. So its not Tea stack, It should be TEAN Stack 😊 Didn't knew I could include svg as well, It will be written as inline SVG right? Man, Turbolinks is 🔥, Why I didn't knew this before. The main reason I liked Gatsby or other SSG. Thanks for sharing. Update: So I have added one more stack to it and launched NEAT Starter 😊 github.com/surjithctly/neat-starter _includefolder you can include them and they will render as inline SVG, so you can slap tailwind classes on/around them 😀 Thanks for reading! TailwindCSS is unbeatable rn. Site looks gorgeous tho, kudos! Wow, thank you! until now i never heard about the tea stack. thank you for the post. I made up the name myself! Feel free to use it to your hearts content! Cool post, thanks Matt! Thank you Simon! Look great! and thanks for the guidelines~ I Too Never Heared About Tea Stack IT Was Really Helpfull Post Buddy. Thanks For Sharing Us Your Knowledge. I Had Thing Tell You To I had Written as Nice Article Too You Would Not Like To Read It --> 13 Habits of Effective Programmers
https://dev.to/mattwaler/my-new-website-4if3
CC-MAIN-2021-43
refinedweb
1,296
61.67
The Letters of Horace Walpole Volume 3 by Horace Walpole Part 2 out of 17 FullBooks.com homepage Index of The Letters of Horace Walpole Volume 3 Previous part (1) Next part (3) but which will remain there while I have a being. having the wretched people have not subsistence. A pound of bread sells at Dresden for eleven-pence. We are going to send many more troops thither; and it Is so much the fashion to raise regiments, that I wish there were such a neutral kind of beings in England as ab read Fontaine's fable of the lion grown old; don't it put you in mind of any thing? No! not when his shaggy majesty has borne the insults of the tiger and the horse, etc. and the ass comes last, kicks out his only remaining fang, and asks for a blue bridle? Apropos, I will tell you the turn Charles Townshend gave to this fable. "My lord," said he, "has quite mistaken the thing; he soars too high at first: people often miscarry by not proceeding by degrees; he went and at once asked for my Lord Carlisle's garter-if he would have been contented to ask first for my Lady Carlisle's garter, I don't know but he would have obtained it." ' Adieu! (18) Sir Edward Hawke had defeated the French fleet, commanded by Admiral Conflans, in the beginning of this winter. [A graphical description of this victory is given by Walpole in his Memoires. "It was," he says, "the 20th of November: the shortness of the day prevented the total demolition of the enemy; but neither darkness, nor a dreadful tempest that ensued, could call off Sir Edward from pursuing his blow. The roaring of the element was redoubled by the thunder from our ships; and both concurred, in that scene of horror, to put a period to the navy and hopes of France."--E.] Letter 10 To Sir Horace Mann. Strawberry Hill, Jan. 20, 1760. (page 36) I am come hither in the bleakest of all winters, not to air and exercise, but to look after my gold-fish and orange-trees. We import all the delights of hot countries, but as we cannot propagate their climate too, such a season as this is mighty apt to murder rarities. And it is this very winter that has been used for the invention of a campaign in Germany! where all fuel is so destroyed that they have no fire but out of the mouth of a cannon. If I were writing to an Italian as well as into Italy, one might string concetti for an hour, and describe how heroes are frozen on their horses till they become their own statues. But seriously, does not all this rigour of warfare throw back an air of effeminacy on the Duke of Marlborough and the brave of ancient days, who only went to fight as one goes out of town in spring, and who came back to London with the first frost'@ Our generals are not yet arrived, though the Duke de Broglio's last miscarriage seems to determine that there shall at last be such a thing as winter quarters; but Daun and the King of Prussia are still choosing King and Queen in the field. There is a horrid scene of distress in the family of Cavendish; the Duke's sister,(19). I insisted on her keeping her bed, she said, as she went into her room, "Then, Lord have mercy on me! I shall never come out of it again," and died in three days. Lord Besborough grew outrageously impatient at not seeing her, and would have forced into her room, when she had been dead about four days. They were obliged to tell him the truth: never was an answer that expressed so much horror! he said, "And how many children have I left?"not knowing how far this calamity might have reached. Poor Lady Coventry is near completing this black list. You have heard, I suppose, a horrid story of another kind, of Lord Ferrers murdering his steward in the most barbarous and deliberate manner. He sent away all his servants but one, and, like that heroic murderess Queen Christina, carried the poor man through a gallery and several rooms, locking them after him, and then bid the man kneel down, for he was determined to kill him. The poor creature flung himself at his feet, but in vain; was shot, and lived twelve hours. Mad as this action was from the consequences, there was no frenzy in his behaviour; he got drunk, and, at intervals, talked of it coolly; but did not attempt to escape, till the colliers beset his house, and were determined to take him alive or dead. He is now in the gaol at Leicester, and will soon be removed to the Tower, then to Westminster Hall, and I suppose to Tower Hill; unless, as Lord Talbot prophesied in the House of Lords, "Not being thought mad enough to be shut up, till he had killed somebody, he will then be thought too mad to be executed;" but Lord Talbot was no more honoured in his vocation, than other prophets are in their own country. As you seem amused with my entertainments, I will tell you how I passed yesterday. A party was made to go to the Magdalen-house. We met at Northumberland-house at five, and set off in four coaches. Prince Edward, Colonel Brudenel his groom, Lady Northumberland, Lady Mary Coke, Lady Carlisle, Miss Pelham, Lady Hertford, Lord Beauchamp, Lord Huntingdon. old Bowman, and I. This new convent is beyond Goodman's-fields, and I assure you would content any Catholic alive. We were received by--oh! first, a vast mob, for princes are not so common at that end of the town as at this. Lord Hertford, at the head of the governors with their white staves, met us at the door, and led the Prince directly into the chapel, where, before the altar, was an arm-chair for him, with a blue damask cushion, a prie-Dieu, and a footstool of black cloth with gold nails. We set on forms near him. There were Lord and Lady Dartmouth in the odour of devotion, and many city ladies. The chapel is small and low, but neat, hung with Gothic paper, and tablets of benefactions. At the west end were enclosed the sisterhood, above an hundred and thirty, all in grayish brown stuffs, broad handkerchiefs, and flat straw hats, with a blue riband, pulled quite over their faces.,(22) who contributed to the Popish idea one had imbibed, by haranguing entirely in the French style, and very eloquently and touchingly. He apostrophized. We had another hymn, and then were conducted to the parloir, where the governors kissed the Prince's hand, and then the lady abbess, or matron, brought us tea. From thence we went to the refectory, where all the nuns, without their hats, were ranged at long tables, ready for supper. A few were handsome, many who seemed to have no title to their profession, and two or three of twelve years old; but all recovered, and looking healthy. I was struck and pleased with the modesty of two of them, who swooned away with the confusion of being stared at. We were then shown their work, which is making linen, and bead-work; they earn ten pounds a-week. One circumstance diverted me, but amidst all this decorum, I kept it to myself. The wands of the governors are white, but twisted at top with black and white, which put me in mind of Jacob's rods, that he placed before the cattle to make them breed. My Lord Hertford would never have forgiven me, if I had joked on this; so I kept my countenance very demurely, nor even inquired, whether among the pensioners there were any novices from Mrs. Naylor's. The. I (cannot say I am surprised to hear that the controversy on the Queen of Scots is likely to continue. Did not somebody write a defence of Nero, and yet none of his descendants remained to pretend to the empire? If Dr. Robertson could have said more, I am sorry it will be forced from him. He had better have said it voluntarily. You will forgive me for thinking his subject did not demand it. Among the very few objections to his charming work, one was, that he seemed to excuse that Queen more than was allowable, from the very papers he has printed in his Appendix; and some have thought, that though he could not disculpate her, he has diverted indignation from her, by his art in raising up pity for her and resentment against her persecutress, and by much overloading the demerits of Lord Darnley. For my part, Dr. Mackenzie, or any body else, may write what they please against me: I meaned to speak my mind, not to write controversy-trash seldom read but by the two opponents who write it. Yet were I inclined to reply, like Dr. Robertson, I could say a little more. You have mentioned, Sir, Mr. Dyer's Fleece. I own I think it a very insipid poem.(25) His Ruins of Rome had great picturesque spirit, and his Grongar Hill was beautiful. His Fleece I could never get through; and from thence I suppose never heard of Dr. Mackenzie. Your idea of a collection of ballads for the cause of liberty is very public-spirited. I wish, Sir, I could say I thought it would answer your view. Liberty, like other good and bad principles, can never be taught the people but when it is taught them by faction. The mob will never sing lilibullero but in opposition to some other mob. However, if you pursue the thought, there is an entire treasure of that kind in the library of Maudlin College, Cambridge. It was collected by Pepys, secretary of the admiralty, and dates from the battle of Agincourt. Give me leave to say, Sir, that it is very comfortable to me to find gentlemen of your virtue and parts attentive to what is so little the object of public attention now. The extinction of faction, that happiness to which we owe so much of our glory and success, may not be without some inconveniences. A free nation, perhaps, especially when arms are become so essential to our existence as a free people, may want a little opposition: as it is a check that has preserved us so long, one cannot wholly think it dangerous; and though I would not be one to tap new resistance to a government with which I have no fault to find, yet it may not be unlucky hereafter, if those who do not wish so well to it, would a little show themselves. They are not strong enough to hurt; they may be of service by keeping ministers in awe. But all this is speculation, and flowed from the ideas excited in me by your letter, that is full of benevolence both to public and private. Adieu! Sir; believe that nobody has more esteem for you than is raised by each letter. (23) --no wonder he is honest. You will now conceive that a letter I have given Mr. Pitt is not a mere matter of form, but an earnest suit to you to know one you will like so much. I should indeed have given it him, were it only to furnish you with an opportunity of ingratiating yourself with Mr. Pitt's nephew: but I address him to your heart. Well! but I have heard of another honest lawyer! The famous Polly, Duchess of Bolton,(32) is dead, having, after a life of merit, relapsed into her Pollyhood. Two years ago, at Tunbridge, she picked up an Irish surgeon. When she was dying, this fellow sent for a lawyer to make her will, but the man, finding who was to be her heir, instead of her children, refused to draw it. The Court of Chancery did furnish one other, not quite so scrupulous, and her three sons have but a thousand pounds apiece; the surgeon about nine thousand. I think there is some glimmering of peace! God send the world some repose from its woes! The King of Prussia has writ to Belleisle to desire the King of France will make peace for him: no injudicious step, as the distress of France will make them glad to oblige him. We have no other news, but that Lord George Sackville has at last obtained a court-martial. I doubt much whether he will find his account in it. One thing I know I dislike-a German aide-de-camp is to be an evidence! Lord George has paid the highest compliment to Mr. Conway's virtue. Being told, as an unlucky circumstance for him, that Mr. Conway was to be one of his judges, (but It is not so,) he replied, there was no man in England he should so soon desire of that number. And it is no mere compliment, for Lord George has excepted against another of them--but he knew whatever provocation he may have given to Mr. Conway, whatever rivalship there has been between them, nothing could bias the integrity of the latter. There is going to be another court-martial on a mad Lord Charles Hay,(33) who has foolishly demanded it; but it will not occupy the attention of the world like Lord George's. There will soon be another trial of another sort on another madman, an Earl Ferrers, who has murdered his steward. He was separated by Parliament from his wife, a very pretty woman, whom he married with no fortune, for the most groundless barbarity, and now killed his steward for having been evidence for her; but his story and person are too wretched and despicable to give you the detail. He will be dignified by a solemn trial in Westminster-hall. Don't you like the impertinence of the Dutch? They have lately had a mudquake, and giving themselves terrafirma airs, call it an earthquake! Don't you like much more our noble national charity? Above two thousand pounds has been raised in London alone, besides what is collected in the country, for the French prisoners, abandoned by their monarch. Must not it make the Romans blush in their Appian-way, who dragged their prisoners in triumph? What adds to this benevolence is, that we cannot contribute to the subsistence of our own prisoners in France; they conceal where they keep them, and use them cruelly to make them enlist. We abound in great charities: the distress of war seems to heighten rather than diminish them. There is a new one, not quite so certain of its answering, erected for those wretched women, called abroad les filles repenties. I was there the other night, and fancied myself in a convent. The Marquis of Buckingham and Earl Temple are to have the two vacant garters to-morrow. Adieu! Arlington Street, 6th. I am this minute come to town, and find yours of Jan. 12. abed all the morning, calling it morning as long as you please; who sup in company; who have played at pharaoh half my life, and now at loo till two and three in the morning; who have always loved pleasure haunted auctions--in short, who don't know so much astronomy as would carry me to Knightsbridge, nor more physic than a physician, nor in short any thing. I see by your letter that you despair of peace; I almost do: there is but a gruff sort of answer from the woman of' Russia to-day in the papers; but how should there be peace? If We are victorious, what is the King of Prussia? Will the distress of France move the Queen of Hungary? When we do make peace, how few will it content! The war was made for America, but the peace will be made for Germany; and whatever geographers may pretend, Crown-point lies somewhere in Westphalia. Again adieu! I don't like your rheumatism, and much less your plague. (26) Prints of the palace of Caserta. (27) Don Carlos, King of Naples, who succeeded his half-brother Ferdinand in the crown of Spain. An interesting picture of the court of the King of the Two Sicilies at the time of his leaving Naples, will be found in the Chatham Correspondence, in a letter from Mr. Stanier Porten to Mr. Pitt. See vol. ii. p. 31.-E. (28) Thomas, only son of Thomas Pitt of boconnock, eldest brother of the famous William Pitt. [Afterwards Lord Camelford. (Gray, in a letter to Dr. Wharton, of the 23d of January, says, "Mr. Pitt (not the great, but the little one, my acquaintance) is setting out on his travels. He goes with my Lord Kinnoul to Lisbon; then (by sea still) to Cates; then up the Guadalquiver to Seville and Cordova, and so perhaps to Toledo, but certainly to Grenada; and, after breathing the perfumed air of Andalusia, and contemplating the remains of Moorish magnificence, re-embarks at Gibraltar or Malaga, and sails to Genoa. Sure an extraordinary good way of passing a few winter months, and better than dragging through Holland, Germany, and Switzerland, to the same place." A copy of Mr. Thomas Pitt's manuscript Diary of his tour to Spain and Portugal is in the possession of Mr. Bentley, the proprietor of this Correspondence.-E.] (29)?, and that it is King John(36) of Bedford, and not King George of Brunswick, that has lost this town. Why, I own you are a great politician, and see things in a moment-and no wonder, considering how long you have been employed in negotiations; but for once all your sagacity is mistaken. Indeed, considering the total destruction of the maritime force of France, and that the great mechanics and mathematicians of this age have not invented a flying bridge to fling over the sea and land from the coast of France to the north of Ireland, it was not easy to conceive how the French should conquer Carrickfergus--and yet they have. But how I run on! not reflecting that by this time the old Pretender must have hobbled through Florence on his way to Ireland, to take possession of this scrap of his recovered domains; but I may as well tell you at once, for to be sure you and the loyal body of English in Tuscany will slip over all this exordium to come to the account of so extraordinary a revolution. Well, here it is. Last week Monsieur Thurot--oh! now you are au fait!--Monsieur Thurot, as I was saying, landed last week in the isle of Islay, the capital province belonging to a great Scotch King,(37) who is so good as generally to pass the winter with his friends here in London. Monsieur Thurot had three ships, the crews of which burnt two ships belonging to King George, and a house belonging to his friend the King of Argyll--pray don't mistake; by his friend(38) I mein King George's, not Thurot's friend. When they had finished this campaign, they sailed to Carrickfergus, a poorish town, situated in the heart of the Protestant cantons. They immediately made a moderate demand of about twenty articles of provisions, promising to pay for them; for you know it is the way of modern invasions(39) to make them cost as much as possible to oneself, and as little to those one invades. If this was not complied with, they threatened to burn the town, and then march to Belfast, which is much richer. We were sensible of this civil proceedings and not to be behindhand, agreed to it; but somehow or other this capitulation was broken; on which a detachment (the whole invasion consists of one thousand men) attack the place. We shut the gates, but after the battle of Quebec it is impossible that so great a people should attend to such trifles as locks and bolts, accordingly there were none--and as if there were no gates neither, the two armies fired through them--if this is a blunder, remember I am describing an Irish war. I forgot to give you the numbers of the Irish army. It consisted but Of seventy-two, under lieut.-colonel Jennings, a wonderful brave man--too brave, in short, to be very judicious. Unluckily our ammunition was soon spent, for it is not above a year that there have been any apprehensions for Ireland, and as all that part of the country are most protestantly loyal, it was not thought necessary to arm people who would fight till they die for their religion. When the artillery was silenced, the garrison thought the best way of saving the town was by flinging it at the heads of the besiegers; accordingly they poured volleys of brickbats at the French, whose commander, Monsieur Flobert, was mortally knocked down, and his troops began to give way. However, General Jennings thought it most prudent to retreat to the castle, and the French again advanced. Four or five raw recruits still bravely kept the gates, when the garrison, finding no more gunpowder in the castle than they had had in the town, and not near so good a brick-kiln, sent to desire to surrender. General Thurot accordingly made them prisoners of war, and plundered the town. END OF THE SIEGE OF CARRICKFERGUS. You will perhaps ask what preparations have been made to recover this loss. The, viceroy immediately despatched General Fitzwilliam with four regiments of foot and three of horse against the invaders, appointing to overtake them in person at Newry; but -@is I believe he left Bladen's Caesar, and Bland's Military Discipline behind him in England, which he used to study in the camp at Blandford, I fear he will not have his campaign equipage ready soon enough. My Lord Anson too has sent nine ships, though indeed he does not think they will arrive time enough. Your part, my dear Sir, will be very easy: you will only have to say that it is nothing, while it lasts; and the moment it is over, you must say it was an embarkation of ten thousand men. I will punctually let you know how to vary your dialect. Mr. Pitt is in bed very ill with the gout. Lord George Sackville was put under arrest to-day. His trial comes on to-morrow, but I believe will be postponed, as the court-martial will consult the judges, whether a man who is not in the army, may be tried as an officer. The judges will answer yes, for how can a point that is not common sense, not be common law! Lord Ferrers is in the Tower; so you see the good-natured people of England will not want their favourite amusement, executions- -not to mention, that it will be very hard if the Irish war don't furnish some little diversion. My Lord Northampton frequently asks me about you. Oh! I had forgot, there is a dreadful Mr. Dering come over, who to show that he has not been spoiled by his travels, got drunk the first day he appeared, and put me horridly out of countenance about my correspondence with you--for mercy's sake take care how you communicate my letters to such cubs. I will send you no more invasions, if you read them to bears and bear-leaders. Seriously, my dear child, I don't mean to reprove you; I know your partiality to me, and your unbounded benignity to every thing English; but I sweat sometimes, when I find that I have been corresponding for two or three months with young Derings. For clerks and postmasters, I can't help it, and besides, they never tell one they have seen One's letters; but I beg you will at most tell them my news, but without my name, or my words. Adieu! If I bridle you, believe that I know that it is only your heart that runs away with you. (36) John Duke of Bedford, Lord Lieutenant of Ireland. (37) Archibald Earl of Islay and Duke of Argyle. (38) The Duke of argyle had been suspected of temporizing in the last rebellion. (39) Alluding to our expensive invasions on the coast of France. Letter 16 To Sir Horace Mann. Arlington Street, March 4, 1760. (page 48) never was any romance of such short duration as Monsieur Thurot's! Instead of the waiting for the viceroy's army, and staying to see whether it had any ammunition, or was only armed with brickbats `a la Carrickfergienne, he re-embarked on the 28th, taking along with him the mayor and three others--I suppose, as proofs of his conquest. The Duke of Bedford had sent notice of' the invasion to Kinsale, where lay three or four of our best frigates. They instantly sailed, and came up with the flying invaders in the Irish Channel. You will see the short detail of the action in the Gazette; but, as the letter was written by Captain Elliot himself, you will not see there, that he with half the number of Thurot's crew, boarded the latter's vessel. Thurot was killed, and his pigmy navy all taken and carried into the Isle of Man. It is an entertaining episode; but think what would have happened, if the whole of the plan had taken place -it the destined time. The negligence of the Duke of Bedford's administration has appeared so gross, that one may believe his very kingdom would have been lost, if Conflans had not been beat. You will see, by the deposition of Ensign hall, published in all our papers, that the account of the siege of Carrickfergus, which I sent you in my last, was not half so ridiculous as the reality--because, as that deponent said, I was furnished with no papers but my memory. The General Flobert, I am told, you may remember at Florence; he was then very mad, and was to have fought Mallet.--but was banished from Tuscany. Some years since he was in England; and met Mallet at lord Chesterfield's, but without acknowledging one another. The next day Flobert asked the Earl if Mallet had mentioned him?--No-"Il a donc," said Flobert, "beaucoup de retenue, car surement ce qu'il pourroit dire de moi, ne seroit pas `a mon avantage."--it was pretty, and they say he is now grown an agreeable and rational man. The judges have given their opinion that the court-martial on lord George Sackville is legal; so I suppose it will proceed on Thursday. I receive yours of the 16th of last month: I wish you had given me any account of your headaches that I could show to Ward. He will no more comprehend nervous, than the physicians do who use the word. Send me an exact description; if he can do you no good, at least it will be a satisfaction to me to have consulted him. I wish, my dear child, that what you say at the end of your letter, of appointments and honours, was not as chronical as your headaches-that is a thing you may long complain of-indeed there I can consult nobody. I have no dealings with either our state-doctors or statequacks. I only know that the political ones are so like the medicinal ones, that after the doctors had talked nonsense for years, while we daily grew worse, the quacks ventured boldly, and have done us wonderful good. I should not dislike to have you state your case to the latter, though I cannot advise it, for the regular physicians are daintily jealous; nor could I carry it, for when they know I would take none of their medicines myself, they would not much attend to me consulting them for others, nor would it be decent, nor should I care to be seen in their shop. Adieu! P. S. There are some big news from the East Indies. I don't know what, except that the hero Clive has taken Mazulipatam and the Great Mogul's grandmother. I suppose she will be brought over and put in the Tower with the Shahgoest, the strange Indian beast that Mr. Pitt gave to the King this winter. .Letter 17 To Sir Horace Mann. Arlington Street, March 26, 1760. (page 49) I have a good mind to have Mr. Sisson tried by a court-martial, in order to clear my own character for punctuality. It is time immemorial since he promised me the machine and the drawing in six weeks. After above half of time immemorial was elapsed, he came and begged for ten guineas. Your brother and I called one another to a council of war, and at last gave it him nemine contradicente. The moment your hurrying letter arrived, I issued out a warrant and took Sisson up, who, after all his promises, was guilty by his own confession, of not having begun the drawing. However, after scolding him black and blue, I have got it from him, have consigned it to your brother James, and you will receive it, I trust, along With this. I hope too time enough for the purposes it is to serve, and correct; if it is not, I shall be very sorry. You shall have the machine as soon as possible, but that must go by sea. I shall execute your commission about Stoschino(40) much better; he need not fear my receiving him well, if he has virt`u to sell,--I am only afraid, in that case, of receiving him too well. You know what a dupe I am when I like any thing. I shall handle your brother James as roughly as I did Sisson--six months without writing to you! Sure he must turn black in the face, if he has a drop of brotherly ink in his veins. As to your other brother,(41) he is so strange a man, that is, so common a one;, that I am not surprised at any thing he does or does not do. Bless your stars that you are not here, to be worn out with the details of lord George's court-martial! One hears of nothing else. It has already lasted much longer than could be conceived, and now the end of it is still at a tolerable distance. The colour of it is more favourable for him than it looked at first. Prince Ferdinand's narrative has proved to set out with a heap of lies. There is an old gentleman(42) of the same family who has spared no indecency to give weight to them--but, you know, general officers are men of strict honour, and nothing can bias them. Lord Charles Hay's court-martial is dissolved, by the death of one of the members--and as no German interest is concerned to ruin him, it probably will not be re-assumed. Lord Ferrers's trial is fixed for the 16th of next month. Adieu! P. S. Don't mention it from me, but if you have a mind you may make your court to my Lady Orford, by announcing the ancient barony of Clinton, which is fallen to her, by the death of the last incumbentess.(43) (40) Nephew of Baron Stosch, a well-known virtuoso and antiquary, who died at Florence. (41) Edward Louisa Mann, the eldest brother. (42) George the Second. (43) Mrs. Fortescue, sister of Hugh last Lord Clinton. Letter 18 To George Montagu, Esq. Arlington Street, March 27, 1760. (page 50) I should have thought that you might have learnt by this time, that when a tradesman promises any thing on Monday, Or Saturday, or any particular day of the week, he means any Monday or any Saturday of any week, as nurses quiet children and their own consciences by the refined salvo of to-morrow is a new day. When Mr. Smith's Saturday and the frame do arrive, I will pay the one and send you the other. Lord George's trial is not near being finished. By its draggling beyond the term of the old Mutiny-bill, they were forced to make out a new warrant: this lost two days, as all the depositions were forced to be read over again to, and resworn by, the witnesses; then there will be a contest, whether Sloper(44) shall re-establish his own credit by pawning it farther. Lord Ferrers comes on the stage on the sixteenth of next month. I breakfasted the day before yesterday at Elia laelia Chudleigh's. There was a concert for Prince Edward's birthday, and at three, a vast cold collation, and all the town. The house is not fine, nor in good taste, but loaded with finery. Execrable varnished pictures, chests, cabinets, commodes, tables, stands, boxes, riding on One another's backs, and loaded with terrenes, filigree, figures, and every thing upon earth. Every favour, in every corner. But of all curiosities, are the conveniences in every bedchamber: great mahogany projections, with brass handles, cocks, etc. I could not help saying, it was the loosest family I ever saw. Adieu! (44) Lieutenant-colonel Sloper, of Bland's dragoons. Letter 19 To Sir. David Dalrymple.(45) Strawberry Hill, April 4, 1760. (page 51) Sir, As I have very little at present to trouble you with myself, I should have deferred writing, till a better opportunity, if it were not to satisfy the curiosity of a friend; a friend whom you, Sir, will be glad to have made curious, as you originally pointed him out as a likely person to be charmed with the old Irish poetry you sent me. It is Mr. Gray, who is an enthusiast about those poems, and begs me to put the following queries to you; which I will do in his own words, and I may say truly, Poeta loquitur. "I am so charmed with the two specimens of Erse poetry, that I cannot help giving you the trouble to inquire a little farther about them, and should wish to see a few lines of the original, that I may form some slight idea of the language, the measure, and the rhythm. "Is there any thing known of the author or authors, and of what antiquity are they supposed to be? "Is there any more to be had of equal beauty, or at all approaching to it? "I have been often told, that the poem called Hardykanute (which I always admired and still admire) was the work of somebody that lived a few years ago.(46) This I do not at all believe, though it has evidently been retouched in places by some modern hand; but, however, I am authorized by this report to ask, whether the two poems in question are certainly antique and genuine. I make this inquiry." You see, Sir, how easily you may make our greatest southern bard travel northward to visit a brother. young translator had nothing to do but to own a forgery, and Mr. Gray is ready to pack up his lyre, saddle Pegasus, and set out directly. But seriously, he,' Mr. Mason, my Lord Lyttelton, and one or two more, whose taste the world allows, are in love with your Erse elegies - I cannot say in general they are so much admired--but Mr. Gray alone is worth satisfying. The "Siege of Aquileia," of which you ask, pleased less than Mr. Home's other plays.(47) In my own opinion, Douglas far exceeds both the other. Mr. Home seems to have a beautiful talent for painting genuine nature and the manners of his country. There was so little nature in the manners of both Greeks and Romans, that I do not wonder at his success being less brilliant when he tried those subjects; and, to say the truth, one is a little weary of them. cannot conceive a man saying that it would be droll to write a book in that manner, but have no notion of his persevering in executing it. It makes one smile two or three times at the beginnings but in recompense makes one yawn for two hours. The characters are tolerably kept up, but the humour is for ever attempted and missed. The best thing in it is a Sermon, oddly coupled with a good deal of bawdy, and both the composition of a clergyman. The man's head, indeed, was a little turned before, now topsy-turvy with his success and fame.(48) Dodsley has given him six hundred and fifty pounds for the second edition and two more volumes (which I suppose will reach backwards to his great-great-grandfather); Lord Falconberg, a donative of one hundred and sixty pounds a-year; and Bishop Warburton gave him a purse of gold and this compliment (which happened to be a contradiction), "that! (45), so I will not describe it to you. The judge and criminal were far inferior to those you have seen. For the Lord High Steward(49) he neither had any dignity nor affected any; nay, he held it all so cheap, that he said at his own table t'other day, "I will not send for Garrick and learn to act a part." At first I thought Lord Ferrers shocked, but in general he behaved rationally and coolly; though it was a strange contradiction to see a man trying by his own sense, to prove himself out of his senses. It was more shocking to see his two brothers brought to prove the lunacy in their own blood; in order to save their brother's life. Both are almost as ill-looking men as the Earl; one of them is a clergyman, suspended by the Bishop of London for being a Methodist; the other a wild vagabond, whom they call in the country, ragged and dangerous. After Lord Ferrers was condemned, he made an excuse for pleading madness, to which he said he was forced by his family. He is respited till Monday-fortnight, and will then be hanged, I believe in the Tower; and, to the mortification of the peerage, is to be anatomized, conformably to the late act for murder. Many peers were absent; Lord Foley and Lord Jersey attended only the first day; and Lord Huntingdon, and my nephew Orford (in compliment to his mother), as related to the prisoner, withdrew without voting. But never was a criminal more literally tried by his peers, for the three persons, who interested themselves most in the examination, were at least as mad as he; Lord Ravensworth, Lord Talbot, and Lord Fortescue. Indeed, the first was almost frantic. The seats of the peeresses were not near full, and most of the beauties absent; the Duchess of Hamilton and my niece Waldegrave, you know, lie in; but, to the amazement of every body, Lady Coventry was there; and what surprised me much more, looked as well as ever. I sat next but one to her, and should not have asked if she had been ill--yet they are positive she has few weeks to live. She and Lord Bolingbroke seemed to have different thoughts, and were acting over all the old comedy of eyes. I sat in Lord Lincoln's gallery; you and I know the convenience of it; I thought it no great favour to ask, and he very obligingly sent me a ticket immediately, and ordered me to be placed in one of the best boxes. Lady Augusta was in the same gallery; the Duke of York and his young brothers were in the Prince of Wales's box, who was not there, no more than the Princess, Princess Emily, nor the Duke. It was an agreeable humanity in my friend--the Duke of York; he would not take his seat in the House before the trial, that he might not vote in it. There are so many young peers, that the show was fine even in that respect; the Duke of Richmond was the finest figure; the Duke of Marlborough, with the best countenance in the world, looked clumsy in his robes; he had new ones, having given away his father's to the valet de chambre. There were others not at all so indifferent about the antiquity of theirs; Lord Huntingdon's, Lord Abergavenny's, and Lord Castlehaven's scarcely hung on their backs; the former they pretend were used at the trial of the Queen of Scots. But all these honours were a little defaced by seeing Lord Temple, as lord privy seal, walk at the head of the peerage. Who, at the last trials, would have believed a prophecy, that the three first men at the next should be Henley the lawyer, Bishop Secker, and Dick Grenville. The. We have had another trial this week, still more solemn, though less interesting, and with more serious determination: I mean that of Lord Ferrers. I have formerly described this solemnity to you. The behaviour, character, and appearance of the criminal, by no means corresponded to the dignity of the show. His figure is bad and villanous, his crime shocking. He would not plead guilty, and yet had nothing to plead; and at last to humour his family, pleaded madness against his inclination: it was moving to see two of his brothers brought to depose the lunacy in their blood. After he was condemned, he excused himself for having used that plea. He is to be hanged in a fortnight, I believe, in the Tower, and his body to be delivered to the surgeons, according to the tenour of the new act of parliament for murder. His mother was to present a petition for his life to the King to-day. There were near an hundred and forty peers present; my Lord Keeper was lord high steward, but was not at all too dignified a personage to sit on such a criminal: indeed he gave himself no trouble to figure. I will send you both trials as soon as they are published. It is astonishing with what order these shows are conducted. Neither within the hall nor without was there the least disturbance,(53) though the one so full, and the whole way from Charing-cross to the House of Lords was lined with crowds. The foreigners were struck with the awfulness of the proceeding-it is new to their ideas, to see such deliberate justice, and such dignity of nobility, mixed with no respect for birth in the catastrophe, and still more humiliated by anatomizing the criminal. I am glad you received safe my history of Thurot: as the accounts were authentic, they must have been useful and amusing to you. I don't expect more invasions, but I fear our correspondence will still have martial events to trade in, though there are such Christian professions going about the world. I don't believe their Pacific Majesties will waive a campaign, for which they are all prepared, and by the issue of which they will all hope to improve their terms. You know we have got a new Duke of York(54) and were to have had several new peers, but hitherto it has stopped at him and the lord keeper. Adieu! P. S. I must not forget to recommend to you a friend of Mr. Chute, who will ere long be at Florence, in his way to Naples for his health. It is Mr. Morrice, clerk of the green cloth, heir of Sir William Morrice, and of vast wealth. I gave a letter lately for a young gentleman whom I never saw, and consequently not meaning to incumber you with him, I did not mention him particularly in my familiar letters. (51)) The with a criminal merely because I have had the pleasure of his execution. I certainly did not see it, nor should have been struck with more intrepidity--I never adored heroes, whether in a cart or a triumphal car--but there has been Such wonderful coolness and sense in all this man's last behaviour, that it has made me quite inquisitive about him --not at all pity him. I only reflect, what I have often thought, how little connexion there is between any man's sense and his sensibility--so much so, that instead of Lord Ferrers having any ascendant over his passions, I am disposed to think, that his drunkenness, which was supposed to heighten his ferocity, has rather been a lucky circumstance-what might not a creature of such capacity, and who stuck at nothing, have done, if his abilities had not been drowned in brandy? I will go back a little into his history. His misfortunes, as he called them, were dated from his marriage, though he has been guilty of horrid excesses unconnected with Matrimony, and is even believed to have killed a groom -,,,he died a year after receiving a cruel beating from him. His wife, a very pretty woman, was sister of Sir William Meredith,(55) had no fortune, and he says, trepanned him into marriage, having met him drunk at an assembly in the country, and kept him so till the ceremony was over. As he always kept himself so afterwards, one need not impute it to her. In every other respect, and one scarce knows how to blame her for wishing to be a countess, her behaviour was unexceptionable.(56) He had a mistress before and two or three children, and her he took again after the separation from his wife. He was fond of both and used both ill: his wife so ill, always carrying pistols to bed, and threatening to kill her before morning, beating her, and jealous without provocation, that she got separated from him by act of Parliament, which appointed receivers of his estate in order to secure her allowance. This he could not bear. However, he named his steward for one, but afterwards finding out that this Johnson had paid her fifty pounds without his knowledge, and suspecting him of being in the confederacy against him, he determined, when he failed of opportunities of murdering his wife, to kill the steward, which he effected as you have heard. The shocking circumstances attending the murder, I did not tell you-indeed, while he was alive, I scarce liked to speak my opinion even to you; for though I felt nothing for him, I thought it wrong to propagate any notions that might interfere with mercy, if he could be then thought deserving it--and not knowing into what hands my letter might pass before it reached yours, I chose to be silent, though nobody could conceive greater horror than I did for him at his trial. Having shot the steward at three in the afternoon, he persecuted him till one in the morning, threatening again to murder him, attempting to tear off his bandages, and terrifying him till in that misery he was glad to obtain leave to be removed to his own house; and when the earl heard the poor creature was dead, he said he gloried in having killed him. You cannot conceive the shock this evidence gave the court-many of the lords were standing to look at him-at once they turned from him with detestation. I had heard that on the former affair in the House of Lords, he had behaved with great shrewdness--no such thing appeared at his trial. It is now pretended, that his being forced by his family against his inclination to plead madness, prevented his exerting his parts- -but he has not acted in any thing as if his family had influence over him--consequently his reverting to much good sense leaves the whole inexplicable. The very night he received sentence, he played at picquet with the warders and would play for money, and would have continued to play every evening, but they refuse. Lord Cornwallis, governor of the Tower, shortened his allowance of wine after his conviction, agreeably to the late strict acts on murder. This he much disliked, and at last pressed his brother the clergyman to intercede that at least he might have more porter; for, said he, what I have is not a draught. His brother represented against it, but at last consenting (and he did obtain it)--then said the earl, "Now is as good a time as any to take leave of you--adieu!" A minute journal of his whole behaviour has been kept, to see if there was any madness in it. Dr. Munro since the trial has made -,in affidavit of his lunacy. The Washingtons were certainly a very frantic race, and I have no doubt of madness in him, but not of a pardonable sort. Two petitions from his mother and all his family were presented to the King, who said, as the House of Lords had unanimously found him guilty, he would not interfere. Last week my lord keeper very good-naturedly got out of a gouty bed to present another: the King would not hear him. "Sir," said the keeper, "I don't come to petition for mercy or respite; but that the four thousand pounds which Lord Ferrers has in India bonds may be permitted to go according to his disposition of it to his mistress' children, and the family of the murdered man." "With all my heart," said the King, "I have no objection; but I will have no message carried to him from me." However, this grace was notified to him and gave him great satisfaction: but unfortunately it now appears to be law, that it is forfeited to the sheriff of the county where the fact was committed; though when my Lord Hardwicke was told that he had disposed of it, he said, to be sure he may before conviction. Dr. Pearce, Bishop of Rochester,(57) offered his service to him: he thanked the Bishop, but said, as his own brother was a clergyman, he chose to have him. Yet he had another relation who has been much more busy about his repentance. I don't know whether you have ever heard that one of the singular characters here is a Countess of Huntingdon,(58) aunt of Lord Ferrers. She is the Saint Theresa of the Methodists. Judge how violent bigotry must be in such mad blood! The Earl, by no means disposed to be a convert, let her visit him, and often sent for her, as it was more company; but he grew sick of her, and complained that she was enough to provoke any body. She made her suffragan, Whitfield, pray for and preach about him, and that impertinent fellow told his enthusiasts in his sermon, that my Lord's heart was stone. The earl wanted much to see his mistress: my Lord Cornwallis, as simple an old woman as my Lady Huntingdon herself, consulted her whether he should permit it. "Oh! by no means; it would be letting him die in adultery!" In one thing she was more sensible. He resolved not to take leave of his children, four girls, but on the scaffold, and then to read to them a paper he had drawn up, very bitter on the family of Meredith, and on the House of Lords for -the first transaction. This my Lady Huntingdon persuaded him to drop, and he took leave of his children the day before. He wrote two letters in the preceding week to Lord Cornwallis on some of these requests - they were cool and rational, and concluded with desiring him not to mind the absurd requests of his (Lord Ferrers's) family in his behalf. On the last morning he dressed himself in his wedding clothes, and said, he thought this, at least, as good an occasion of putting them on as that for which they were first made. He wore them to Tyburn. This marked the strong impression on his mind. His mother wrote to his wife in a weak angry Style, telling her to intercede for him as her duty, and to swear to his madness. But this was not so easy; in all her cause before the lords, she had persisted that he was not mad. Sir William Meredith, and even Lady Huntingdon had prophesied that his courage would fail him at last, and had so much foundation, that it is certain Lord Ferrers had often been beat:- -but the Methodists were to get no honour by him. His courage rose where it was most likely to fail,-an unlucky circumstance to prophets, especially when they have had the prudence to have all kind of probability on their side. Even an awful procession of above two hours, with that mixture of pageantry, shame, and ignominy, nay, and of delay, could not dismount his resolution. He set out from the Tower at nine, amidst crowds, thousands. First went a string of constables; then one of the sheriffs, in his chariot and six, the horses dressed with ribands; next Lord Ferrers, in his own landau and six, his coachman crying all the way; guards at each side; the other sheriffs chariot followed empty, with a mourning coach-and-six, a hearse, and the Horse Guards. Observe, that the empty chariot was that of the other sheriff, who was in the coach with the prisoner, and who was Vaillant, the French bookseller in the Strand. How will you decipher all these strange circumstances to Florentines? A bookseller in robes and in mourning, sitting as a magistrate by the side of the Earl; and in the evening, every -body going to Vaillant's shop to hear the particulars. I wrote to him '. as he serves me, for the account: but he intends to print it, and I will send it you with some other things, and the trial. Lord Ferrers at first talked on indifferent matters, and observing the prodigious confluence of people, (the blind was drawn up on his side,) he said,--"But they never saw a lord hanged, and perhaps will never see another;" One of the dragoons was thrown by his horse's leg entangling in the hind wheel: Lord Ferrers expressed much concern, and said, "I hope there will be no death to-day but mine," and was pleased when Vaillant told him the man was not hurt. Vaillant made excuses to him on his office. "On the contrary," said the Earl, "I am much obliged to you. I feared the disagreeableness of the duty might make you depute your under-sheriff. As you are so good as to execute it yourself, I am persuaded the dreadful apparatus will be conducted with more expedition." The chaplain of the Tower, who sat backwards, then thought it his turn to speak, and began to talk on religion; but Lord Ferrers received it impatiently. However, the chaplain persevered, and said, he wished to bring his lordship to some confession or acknowledgment of contrition for a crime so repugnant to the laws of God and man, and wished him to endeavour to do whatever could be done in so short a time. The Earl replied, "He had done every thing he proposed to do with regard to God and man; and as to discourses on religion, you and I, Sir," said he to the clergyman, "shall probably not agree on that subject. The passage is very short: you will not have time to convince me, nor I to refute you; it cannot be ended before we arrive." The clergyman still insisted, and urged, that. at least, the world would expect some satisfaction. Lord Ferrers replied, with some impatience, "Sir, what have I to do with the world? I am going to pay a forfeit life, which my country has thought proper to take from me--what do I care now what the world thinks of me? But, Sir, since you do desire some confession, I will confess one thing to you; I do believe there is a God. As to modes of worship, we had better not talk on them. I always thought Lord Bolingbroke in the wrong, to publish his notions on religion: I will not fall into the same error." The chaplain, seeing sensibly that it was in vain to make any more attempts, contented himself with representing to him, that it would be expected from one of his calling, and that even decency required, that some prayer should be used on the scaffold, and asked his leave, at least to repeat the Lord's Prayer there. Lord Ferrers replied, "I always thought it a good prayer; you may use it if you please." While these discourses were passing, the procession was stopped by the crowd. The Earl said he was dry, and wished for some wine and water. The Sheriff said, he was sorry to be obliged to refuse him. By late regulations they were enjoined not to let prisoners drink from the place of imprisonment to that of execution, as great indecencies had been formerly committed by the lower species of criminals getting drunk; "And though," said he, "my Lord, I might think myself excusable in overlooking this order out of regard to a person of your lordship's rank, yet there is another reason which, I am sure, will weigh with you;-your Lordship is sensible of the greatness of the crowd; we must draw up to some tavern; the confluence would be so great, that it would delay the expedition which your Lordship seems so much to desire." He replied, he was satisfied, adding, "Then I must be content with this," and took some pigtail tobacco out of his pocket. As they went on, a letter was thrown into his coach; it was from his mistress, to tell him, it was impossible, from the crowd, for her to get up to the spot where he had appointed her to meet and take leave of him, but that she was in a hackney-coach of such a number. He begged Vaillant to order his officers to try to get the hackney-coach up to his, "My Lord," said Vaillant, you have behaved so well hitherto, that I think it is pity to venture unmanning yourself." He was struck, and was satisfied without seeing her. As they drew nigh, he said, "I perceive we are almost arrived; it is time to do what little more I have to do;" and then taking out his watch, gave it to Vaillant, desiring him to accept it as a mark of his gratitude for his kind behaviour, adding, , and with his most tender regards, saying, "The key of it is to the watch, but I am persuaded you are too much a gentleman to open it." He destined the remainder of the money in his purse to the same person, and with the same tender regards. When they came to Tyburn, his coach was detained some minutes by the conflux of people; but as soon as the door was opened, he stepped out readily and mounted the scaffold: it was hung with black, by the undertaker, and at the expense of his family. Under the gallows was a new invented stage, to be struck from under him. He showed no kind of fear or discomposure, only just looking at the gallows with a slight motion of dissatisfaction. He said little, kneeled for a moment to the prayer, said, "Lord have mercy upon me, and forgive me my errors," and immediately mounted the upper stage. He had come pinioned with a black sash, and was unwilling to have his hands tied, or his face covered, but was persuaded to both. When the rope was put round. He desired not to be stripped and exposed, and Vaillant promised him, though his clothes must be taken off, that his shirt should not. This decency ended with him: the sheriffs fell to eating and drinking on the scaffold, ran and helped up one of their friends to drink with them, as he was still hanging, which he did for above an hour, and then was conveyed back with the same pomp to Surgeons' Hall, to be dissected. The executioners fought for the rope, and the one who lost it cried. The mob tore off the black cloth as relics; but the universal crowd behaved with great decency and admiration, as they well might; for sure no exit was ever made with more sensible resolution and with less ostentation. If I have tired you by this long narrative, you feel differently from me. The man, the manners of the country, the justice of so great and curious a nation, all to me seem striking, and must, I believe, do more so to you, who have been absent long enough to read of your own country as history. I have run into so much paper, that I am ashamed at going on, but having a bit left, I must say a few more words. The other prisoner, from whom the mob had promised themselves more entertainment, is gone into the country, having been forbid the court, with some barbarous additions to the sentence, as you Will see in the papers. It was notified, too, to the second court,(59) who have had the prudence to countenance him no longer. The third prisoner, and second madman, Lord Charles Hay, is luckily dead, and has saved much trouble. Have you seen the works of the philosopher of Sans Souci, or rather of the man who is no philosopher, and who had more Souci than any man now in Europe? How contemptible they are! Miserable poetry; not a new thought, nor an old one newly expressed.(60) I say nothing of the folly of publishing his aversion to the English, at the very time they are ruining themselves for him; nor of the greater folly of his irreligion. The epistle to Keith is puerile and shocking. He is not so sensible as Lord Ferrers, who did not think such sentiments ought to be published. His Majesty could not resist the vanity of showing how disengaged he can be even at this time. I am going to give a letter for you to Strange, the engraver, who is going to visit Italy. He is a very first-rate artist, and by far our best. Pray countenance him, though you will not approve his politics.(61) I believe Albano(62)) is his Loretto. I. We) Well! at last Sisson's machine sets out-but, my dear Sir, how you still talk of him! You seem to think him as grave and learned as a professor of Bologna--why, he is an errant, low, indigent mechanic, and however Dr. Perelli found him out, is a shuffling knave, and I fear, no fitter to execute his orders than to write the letter you expect. Then there was my ignorance and your brother James's ignorance to be thrown into the account. For the drawing, Sisson says Dr. Perelli has the description of it already; however, I have insisted on his making a reference to that description in a scrawl we have with much ado extorted from him. I pray to Sir Isaac Newton that the machine may answer: It costs, the stars know what! The whole charge comes to upwards of threescore pounds! He had received twenty pounds, and yet was so necessitous, that on our hesitating, he wrote me a most impertinent letter for his money. I dreaded at first undertaking a commission for which I was so unqualified, and though I have done all I could, I fear you and your friend will be but ill satisfied. Along with the machine I have sent you some new books; Lord. That wonderful creature Lord Ferrers, of whom I told you so much in my last, and with whom I am not going to plague you much more, made one of his keepers read Hamlet to him the night before his death after he was in bed-paid all his bills in the morning, as if leaving an inn, and half an hour before the sheriffs fetched him, corrected some verses he had written in the Tower in imitation of the Duke of Buckingham's epitaph, dublus sed ron improbus vin.(65) What a noble author have I here to add to my Catalogue! For the other noble author, Lord Lyttelton, you will find his work paltry enough; the style, a mixture of bombast, poetry, and vulcarisms. Nothing new in the composition, except making people talk out of character is so. Then he loves changing sides so much, that he makes Lord Falkland and Hampden cross over and figure in like people in a country dance; not to mention their guardian angels, who deserve to be hanged for murder. He is angry too at Swift, Lucian, and Rabelais, as if they had laughed at him of all men living, and he seems to wish that one would read the last's Dissertation 1 on Hippocrates instead of his History of Pantagruel. But I blame him most, when he was satirizing too free writers, for praising the King of Prussia's poetry, to which any thing of Bayle is harmless. I like best the Dialogue between the Duke of argyll and the Earl of Angus, and the character of his own first wife under that of Penelope. I need not tell you that Pericles is Mr. Pitt. I) My dear lord, When at my time of day one can think a ball worth going to London for on purpose, you will not wonder that I am childish enough to write an account of it. I could give a better reason, your bidding me send you any news; but I scorn a good reason when I am idle enough to do any thing for a bad one. You had heard, before you left London, of Miss Chudleigh's intended loyalty on the Prince's birthday. Poor thing, I fear she has thrown away above a quarter's salary! It was magnificent and well-understood--no crowd--and though a sultry night, one was not a moment incommoded. The court was illuminated on the whole summit of the wall with a battlement of lamps; smaller ones on every step, and a figure of lanterns on the outside of the house. The virgin-mistress began the ball with the Duke of York, who was dressed in a pale blue watered tabby, which, as I told him, if he danced much, would soon be tabby all over, like the man's advertisement,(67) but nobody did dance much. There was a new Miss Bishop from Sir Cecil's endless hoard of beauty daughters, who is still prettier than her sisters. The new Spanish embassy was there--alas! Sir Cecil Bishop has never been in Spain! Monsieur de Fuentes is a halfpenny print of my Lord Huntingdon. His wife homely, but seems good-humoured and civil. The son does not degenerate from such high-born ugliness; the daughter-in-law was sick, and they say is not ugly, and has as good set of teeth as one can have, when one has but two and those black. They seem to have no curiosity, sit where they are placed, and ask no questions about so strange a country. Indeed, the ambassadress could see nothing; for Doddington(68) stood before her the whole time, sweating Spanish at her, of which it was evident, by her civil nods without answers, she did understand a word. She speaks bad French, danced a bad minuet, and went away--though there was a miraculous draught of fishes for their supper, for it was a fast-day--but being the octave of their f`ete-dieu, they dared not even fast plentifully. Miss Chudleigh desired the gamblers would go up into the garrets--"Nay, they are not garrets-it is only the roof of the house hollowed for upper servants-but I have no upper servants." Every body ran up: there is a low gallery with bookcases, and four chambers practised under the pent of the roof, each hung with the finest Indian pictures on different colours, and with Chinese chairs of the same colours. Vases of flowers in each for nosegays, and in one retired nook a most critical couch! The lord of the Festival(69) was there, and seemed neither ashamed nor vain of the expense of his pleasures. At supper she offered him Tokay, and told him she believed he would find it good. The supper was in two rooms and very fine, and on the sideboards, and even on the chairs, were pyramids and troughs of strawberries and cherries you would have thought she was kept by Vertumnus. Last night my Lady Northumberland lighted up her garden for the Spaniards: I was not there, having excused myself for a headache, which I had not, but ought to have caught the night before. Mr. Doddington entertained these Fuentes's at Hammersmith; and to the shame of our nation, while they were drinking tea in the summer-house, some gentlemen, ay, my lord, gentlemen, went into the river and showed the ambassadress and her daughter more than ever they expected to see of England. I) Who the deuce was thinking of Quebec? America was like a book one has read and done with; or at least, if one looked at the book, one just recollected that there was a supplement promised, to contain a chapter on Montreal, the starving and surrender of it- -but here are we on a sudden reading our book backwards. An account came two days ago that the French on their march to besiege Quebec, had been attacked by General Murray, who got into a mistake and a morass, attacked two bodies that were joined, when he hoped to come up with one of them before the junction, was enclosed, embogged,'and defeated. By the list of officers killed and wounded, I believe there has been a rueful slaughter- -the place, too, I suppose will be retaken. The year 1760 is not the year 1759.. The) I am obliged to you, Sir, for the volume of Erse poetry - all of it has merit; but I am sorry not to see in it the six descriptions of night, with which you favoured me before, and which I like as much as any of the pieces. I can, however, by no means agree with the publisher, that they seem to be parts of an heroic poem; nothing to me can be more unlike. I should as soon take all the epitaphs in Westminster Abbey, and say it was an epic poem on the History of England. The greatest part are evidently elegies; and though I should not expect a bard to write by the rules of Aristotle, I would not, on the other hand, give to any work a title that must convey so different an idea to every common reader. I could wish, too, that the authenticity had been more largely stated. A man who knows Dr. Blair's character, will undoubtedly take his word; but the gross of mankind, considering how much it is the fashion to be sceptical in reading, will demand proofs, not assertions. Back to Full Books
http://www.fullbooks.com/The-Letters-of-Horace-Walpole-Volumex79572.html
crawl-002
refinedweb
11,967
73
When managing sessions in web applications the key to the castle is a sessionid. Most often this sessionid is passed to and from the client by means of a cookie. In this article we explore the tools available in Python to deal with cookies. Reading and writing cookies If we are extending the BaseHTTPRequestHandler class from Python's http.server module we have access to the request headers by means of the headers attribute. It provides a convient method get_all() to retrieve headers by name (line 12 in the code sample below): from http.cookies import SimpleCookie as cookie ... class ApplicationRequestHandler(BaseHTTPRequestHandler): sessioncookies = {} def __init__(self,*args,**kwargs): self.sessionidmorsel = None super().__init__(*args,**kwargs) def _session_cookie(self,forcenew=False): cookiestring = "\n".join(self.headers.get_all('Cookie',failobj=[])) c = cookie() c.load(cookiestring) try: if forcenew or self.sessioncookies[c['session_id'].value]-time() > 3600: raise ValueError('new cookie needed') except: c['session_id']=uuid().hex for m in c: if m=='session_id': self.sessioncookies[c[m].value] = time() c[m]["httponly"] = True c[m]["max-age"] = 3600 c[m]["expires"] = self.date_time_string(time()+3600) self.sessionidmorsel = c[m] break The way we call get_all() provides us with an empty list if there are no cookies in the headers. Either way we end up with a (possibly empty) string that contains the cookies the client sent us. This cookie (or cookies) can be converted to a SimpleCookie object from Python's http.cookie module (line 14). Cookies are basically key/value pairs with some extra attributes. The whole ensemble is called a morsel. The SimpleCookie object acts as a dictionary that indexes those morsels by key. The whole excersize is aimed at maintaining a session id so we check if our cookie object holds a session_id morsel and use its value (a GUID) as an index into the sessioncookies class variable. This class variabele maintains a dictionary indexed by the GUIDs of the session id cookies we produced. The corresponding values are their timestamps. Line 17 will therefore raise an exception if - no session_id cookie was provided by the client, - the session_id is unknown to us, - the session_id is expired, i.e. older than one hour, or - when we explicitely indicated we want a new cookie, no matter what. At this point we are guaranteed to have a SimpleCookie httponly attribute to signal to the browset that this cookie should not be manipulated by any client side JavaScript and set both its expires attribute and its max-age before we store this specific morsel in an instance variabele. This way we can add this cookie to the response headers one we have processed the request. An outline is sketched in the snipper below: ... def do_GET(self): ... self._session_cookie() ... if not (self.sessionidmorsel is None): self.send_header('Set-Cookie',self.sessionidmorsel.OutputString()) ... Security considerations At this point we have a tool to manage a session id. Such a session id can be used as a key to access other session information, a topic we cover in a later article. Before we even start thinking of using this we should consider the security issues. Pythonsecurity.org has a handy checklist that will walk through: - Are session IDs exposed in the URL? - No, we use cookies and those are part of the HTTP headers. - Do session IDs timeout and can users log out? - Our session IDs certainly timeout but providing a log out option should be part of the web application. - When a user logs out or times out, is the session invalidated? - At this point we only dealing with session ids. - Are session IDs rotated after successful login? - That is why we provide the forcenewparamter. After a successful login the web application should call _session_cookie()again with forcenew=True - Are session IDs only sent over TLS/SSL? - That should be implemented in the HTTP server, here we only look at the request handling part. - Are session IDs completely randomly generated? - We use a variant 4 uuid from Python's uuidmodule which should be completely random. The documentation makes no claims about the quality of the random generator used but a quick look at the code of the uuidmodule (in Python 3.2) reveals that is uses either system provided functions or the built-in random()function. In other words, we don't know what we get and that is bad! It is probably better use os.urandom()directly which will raise a NotImplentedError if a source of randomness couldn't be found. Generating a a string of 32 hex digits might be done as follows: "%02x"*16%tuple(os.urandom(16)) Been trying to find a way to contact you. In your book Python Web Development-> C# is interpreted. Feel free to delete this message. "Consider how important development time is compared to performance. Compiled languages like C# or C++ might be used if CPU power is scarce or if you do not want to distribute the source code in a readable format" If I am wrong for any reason in the above correction, feel free to chastise me @ edward@critikel.net
http://michelanders.blogspot.com/2011/10/managing-session-id-with-cookies.html
CC-MAIN-2017-22
refinedweb
848
58.08
25 April 2012 03:34 [Source: ICIS news] ?xml:namespace> The line was initially scheduled to be restarted in late April following a three-week turnaround, according to the source. “Demand for BR is very weak and we will extend the shutdown of the 80,000 tonne/year BR line by at least another week and restart [it] sometime in early May,” the source said. LG Chem runs three BR lines at Daesan with a combined capacity of 180,000 tonnes/year. Its other two BR lines, each with 50,000 tonnes/year of capacity, are operating at 100% of capacity. BR spot prices were at $3,650-3,750/tonne (€2,774-2,850/tonne) CFR (cost &
http://www.icis.com/Articles/2012/04/25/9553330/s-koreas-lg-chem-to-extend-br-unit-shutdown-on-weak.html
CC-MAIN-2014-49
refinedweb
118
71.34
Software applications are constantly updated to fix bugs and to add new function. How to deliver updates to your user base is a very important enterprise infrastructure consideration, especially when your user base is large and spread out. In a worldwide organization, it is not pragmatic to send out a technician to install software updates. Fortunately, IBM Lotus Sametime V7.5, built on the Eclipse platform, allows you to leverage update sites, which allow Lotus Sametime Connect V7.5 to retrieve updates from a centralized location. In this article, we take you through the full process of creating an update site for your Sametime plug-ins. You learn how an update site provides a method for delivering new features and feature updates to your Sametime clients. We show you how to create a simple plug-in that places a button on the Lotus Sametime Connect's action bar. We use the Sametime clientâs Update Manager to pull this plug-in from an update site that we also create. We also show you how to retrieve an update for an existing plug-in. Figure 1 is the Update Manager of the Sametime client through which you can define sites that can provide your Sametime client with new features and existing feature updates. Figure 1. Update Manager The role of HTTP server in updating plug-ins One way of making your Sametime plug-in available to the Sametime community is by placing it on an Eclipse update site. An Eclipse update site is a URL location where clients can download enhancements or updates to their Sametime client. An Eclipse update site is defined by a site.xml file, which we describe later in this article. To host the update site, you need an HTTP server. For our HTTP server, we used the freely available IBM HTTP Server to host our update site. You can download a free copy of the IBM HTTP Server V6.1 from the IBM HTTP Server page. Creating your plug-in Before you delve into the world of installing and updating, you need to create a simple plug-in that can be delivered to your Sametime client through a feature. A feature is a collection of plug-ins and can, in turn, house other features inside it. As mentioned earlier, we begin by creating a simple plug-in that places a button on the action bar as shown in figure 2. Figure 2. Action bar with feature plug-in We assume that you are familiar with developing a plug-in for Lotus Sametime using Eclipse 3.2. If this is not the case, refer to the Resources section of this article for a list of Sametime plug-in development articles to get you started developing plug-ins. Follow these steps to change your target platform to Lotus Sametime V7.5 and to create a plug-in project named com.ibm.example.iu in Eclipse 3.2: - Open Eclipse 3.2, and then switch to the Plug-in Development Perspective. - Choose Window - Preferences. - In the Preferences dialog box, choose Plug-in Development - Target Platform. - Change your target platform to the location of the directory representing the Lotus Sametime V7.5 plug-ins directory on your system. For example, if you installed Lotus Sametime V7.5 in the default location, the target platform location is C:\Program Files\IBM\Sametime Connect 7.5. - Create a new plug-in project by choosing File - New Project. - Select Plug-in Project. - In the New Plug-in Project wizard, specify com.ibm.example.iu as the project name, and then click Next. - For the plug-in name, specify com.ibm.example.iu. For the plug-in provider, specify IBM DeveloperWorks. The plug-in.xml file After you create the com.ibm.example.iu plug-in project, create a plug-in.xml file that extends the org.eclipse.ui.viewaction extension point. The contents of the plug-in.xml file are shown in listing 1. Listing 1. Plug-in.xml file <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin> <extension point="org.eclipse.ui.viewActions"> <viewContribution id="com.ibm.collaboration.realtime.sample.snippets.viewAction" targetID="com.ibm.collaboration.realtime.imhub"> ."/> </viewContribution> </extension> </plugin> Notice that the extension point starts with org.eclipse. This means that the extension point is part of the base Eclipse API, not the Lotus Sametime API. Lotus Sametime often leverages the Eclipse API, enabling an experienced Eclipse developer to develop Sametime plug-ins right away. More information about the org.eclipse.ui.viewActions extension point can be found on the Eclipse Web site. Also, choosing Help - Help Contents in the Eclipse SDK brings up the Help Window from which you can search for org.eclipse.ui.viewAction to find information on the viewActions extension point. Letâs take a further look at the org.eclipse.ui.viewActions extension point. The targetID is the ID of the view to which you add your button. The view ID for the action bar is com.ibm.collaboration.realtime.imhub. Highlighted in figure 3 is the Sametime client action bar with its corresponding view ID. Figure 3. Action bar with view ID By defining the action barâs view ID as your targetID, you can extend the action bar. We also define com.ibm.example.iu.ClickHandler as the class that handles our view action. We define icon/kulvir.gif as the icon that represents our view action. The kulvir.gif file is a headshot of Kulvir Bhogal, one of the authors of this article. Also, note the tooltip is "Kulvir hates gyros." Later, when we demonstrate updating existing features, we change the tooltip to "Kulvir loves gyros." (As an aside, Kulvir is a gyro fanatic.) The BuddyListDelegate interface The button you add to the action bar presents the user with a Hello! message box when it is clicked as shown in figure 4. Figure 4. Plug-in message box Accordingly, in addition to defining the button in the plug-in.xml, you must also create the implementation class that handles clicks to the button. Create a class inside of the com.ibm.example.iu plug-in named com.ibm.example.iu.ClickHandler. The BuddyListDelegate interface handles clicks to the viewAction button, which you defined previously. The BuddyListDelegate interface is contained in the com.ibm.collaboration.realtime.imhub plug-in. To resolve the BuddyListDelegate interface, you must add the com.ibm.collaboration.realtime.imhub plug-in to the META-INF/MANIFEST.MF fileâs list of required bundles as shown in listing 2. Listing 2. META-INF/MANIFEST.MF Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Iu Plug-in Bundle-SymbolicName: com.ibm.example.iu;singleton:=true Bundle-Version: 1.0.0 Bundle-Activator: com.ibm.example.iu.Activator Bundle-Vendor: IBM Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, com.ibm.collaboration.realtime.imhub Eclipse-LazyStart: true To open a MessageBox that presents the user with a message of Hello! when your button is clicked, you need to implement the run method as shown in listing 3. Listing 3. Run method for MessageBox public class ClickHandler implements BuddyListDelegate { public void run(ISelection selection) { MessageBox mBox = new MessageBox(new Shell()); mBox.setMessage("Hello!"); mBox.open(); } } Creating and building the icon Now, you create the folder that includes your image for the button that you add to the action bar. Right-click com.ibm.example.iu and choose New - Folder. Name the folder icon and click Finish. To import the icon, drag it from the folder that contains the image file to the icon folder of your plug-in project. Next, change the build.properties file so that the icon folder and its contents are included in the build file. Open the build.properties file with the Build Properties editor. To do this, right-click build.properties, which is in the com.ibm.example.iu plug-in project, and then choose Open With - Build Properties Editor from the context menu. From the Build Properties Editor, select the option next to the icon folder as well as plugin.xml as shown in figure 5, and then save your modifications to the build.properties file. Figure 5. Build Properties Editor Eclipse features Eclipse features represent an abstract unit of function that appears to the user. A feature can be a calendar, a mail tool, or in our case, an action button. Eclipse features can be comprised of multiple plug-ins or may reference multiple features. These relationships are determined in the feature.xml file. We now show you how to create a feature. To keep things simple, you have only one required plug-in housed in the feature, the com.ibm.example.iu plug-in that you created earlier. To create a new feature, choose File - New - Other. In the New Feature wizard, choose Plug-in Development - Feature Project, then click Next. For the feature project name use com.ibm.example.feature.iu. Accept the default feature ID, and name the feature "Action Bar Button Feature." Click Next. For the Reference Plug-ins and Fragments, select the com.ibm.example.iu plug-in as shown in figure 6, and then click Finish. Figure 6. New Feature wizard Next, open the feature.xml file and select the Overview tab. Enter the update site URL with the following URL format: where YOUR_HTTPSERVER_URL is the URL for the HTTP server you use. Entering an HTTP server here enables the Sametime client to automatically check for and download updates for features when they are available from the HTTP server. Feature.xml: Behind the scenes of the Eclipse PDE The Eclipse plug-in development environment (PDE) provides a convenient means of viewing and editing the feature.xml file. For those of you who prefer to know what your PDE is doing, we highlight parts of the feature.xml file in listing 4. First, notice that the basic details of the feature are described, such as the unique ID, the label (the name of the feature as it appears to the user), the version number, and the provider name. Also notice the description, copyright, and license fields. Finally, the required plug-ins and features are described along with their unique IDs and version numbers. The version number is important because it describes to the Update Manager the lowest acceptable version number that should exist on the client. Version number 0.0.0 states that any version is acceptable. Listing 4. Feature.xml file <?xml version="1.0" encoding="UTF-8"?> <feature id="com.ibm.example.feature.iu" label="Iu Feature" version="1.0.0" provider- <description url=""> [Enter Feature Description here.] </description> <copyright url=""> [Enter Copyright Description here.] </copyright> <license url=""> [Enter License Description here.] </license> <url> <update url=""/> </url> <plugin id="com.ibm.example.iu" download- </feature> Update site Next, we demonstrate how to use the Eclipse toolset to create an update site. The update site was described previously as a location where clients receive either updates to existing Sametime components or entirely new Sametime components. Now that we have reviewed the concept of features, we can modify our definition of an update site: An update site is a location from which clients can install new features or receive updates to existing features. We now dive further into the process of creating an update site. Eclipse provides a wizard that automates the process of creating an update site. To start that wizard, choose File - New Project. In the New Project wizard, choose Plug-in Development - Update Site Project. The New Update Site wizard appears (see figure 7). Figure 7. New Update Site wizard As you can see from figure 7, we specify the location of our update site to be the location of our HTTP server. For your HTTP server location, use the format HTTP_DOC_ROOT\myupdatesite, where HTTP_DOC_ROOT is the document root for your HTTP server. In addition, we chose to not use the default location by deselecting the option Use default location. We also specified that we want to generate a Web page listing used to display information about the feature we provide. Site.xml The site.xml file provides a listing of the features that are available on an update site. Open the site.xml file. Click the New Category button to add a category. After adding the new category, the Update Site Map page looks similar to figure 8. Notice how the Category Properties for the newly created Category appear in the right-hand pane of the Update Site Map page. Figure 8. New category added to site map Define the name and the label for the category as DeveloperWorks Sample. The name is a unique name for the category. The label is how the category appears to the user. For the description, we entered the following statement: "This feature is a sample feature to demonstrate the functionality of an update site." Next, add the feature you created earlier to the DeveloperWorks Sample Category. To do this, select the DeveloperWorks Sample category, and then click the Add Feature button. In the Feature Selection dialog box (see figure 9), select the com.ibm.example.feature.iu feature created earlier in the article, and then click OK. Figure 9. Feature Selection dialog box Now that your site map has been properly configured, you can build your plug-in and your feature. To do this, click the Build All button. This builds both the com.ibm.example.feature.iu feature and the feature's required plug-in(s). Updating Lotus Sametime Connect V7.5 Now that your update site is built, a user can download the feature from his Sametime client. Open Lotus Sametime V7.5 Connect. From the Sametime client, choose File - Manage Updates - Download plugins. The Install/Update wizard opens (see figure 10). Figure 10. Install/Update wizard Select the "Search for new features to install" option, and then click Next. In the following wizard panel, click the New Remote Site button. In the Edit Remote Site dialog box (see figure 11), enter the appropriate URL of the update site that you created. Figure 11. Edit Remote Site dialog box Next, click OK to add your newly created update site to the list of update sites your Sametime client checks for updates. Click Finish. The Updates window now appears. Select the Developer Works Example Site option to install all the features available on the Developer Works Example Site, and then click Next. (Alternately, you can choose to select only a subset of the features available.) Accept the License for the feature and click Next. In the following window, click Finish to install the feature. You are asked to verify if you want to install the feature. Click the Install button. A dialog box appears asking if you want to restart the workbench (see figure 12). Click Yes to restart the workbench. Figure 12. Restart prompt box After restarting, the new action bar button appears as shown in figure 13. Figure 13. Updated action bar with new feature Making updates to an existing feature Many times the providers of an existing feature have bug fixes or enhancements that they want to deliver to their user base. Recall in our feature.xml file that we specified the location of our update site: <url> <update url=""/> </url> The URL stated here is where the Sametime client looks for updates for an existing feature. You can set up your client to automatically check for updates to an existing feature. To do this, choose File - Preferences. In the Preferences dialog box, select Install/Update - Automatic Updates in the left-hand pane. Configure the Automatic Updates preferences to check for updates each time the platform is started as shown in figure 14. Figure 14. Preferences dialog box - Automatic Updates Now that your Sametime client is configured to check for updates, when an update to an existing feature is available, you receive a dialog box like the one in figure 15. Figure 15. New update available Updating your plug-in To demonstrate the process of updating a feature, letâs update the tooltip for our plug-in to change from "Kulvir hates gyros." to "Kulvir loves gyros." First, update the tooltip in your plugin.xml of your com.ibm.example.iu as shown in listing 5. Listing 5. Tooltip change ."/> Next, increment the version of your MANIFEST.MF file from 1.0.0 to 1.1.0 by modifying the value of the Bundle version: Bundle-Version: 1.1.0 The increment to the version is important because clients look for this change in version numbers to let them know that updates are available. Next, save and close all the com.ibm.example.iu plug-in files. Open the feature.xml file and select the Overview tab. Click the Versions button. In the Feature Versions dialog box, choose the option to "Copy versions from plug-in and fragment manifests." See figure 16. Figure 16. Feature Versions dialog box The plug-in version of com.ibm.examle.iu referenced by the feature is 1.1.0. Next, edit the feature.xml file. Update the feature.xml fileâs version number to be version 1.1.0 as shown in listing 6. Listing 6. Version change <feature id="com.ibm.example.feature.iu" label="Iu Feature" version="1.1.0" provider- Save and close all of your feature files. Next, open the site.xml file in the Update Site Map page. Click the Build All button to build your updated plug-in and the corresponding updated feature and to place it on the update site. NOTE: In our case the development environment and the update site are on the same machine. However, in a production environment, the server and the development machines are separate. In such a case, you have to transfer the newly built update site from your development machine to your production server. Given that you modified your Sametime client to automatically check for updates to existing features, upon restarting your Sametime client, the new feature is detected and installed. You can verify this by checking if the tooltip has changed from "Kulvir hates gyros." to "Kulvir loves gyros." See figure 17. Figure 17. Updated feature Conclusion In an enterprise environment with users of varying technical abilities, you cannot always assume that a user will know how to manually install and manage his own updates. This can even be a cumbersome task for Sametime developers. The Update Manager of Lotus Sametime Connect makes the process of getting new features and feature updates much more user friendly. In this article, you learned how to distribute new Sametime plug-ins with an update site. For the purposes of this article, the update site, plug-in development environment (PDE), and the Sametime client all existed on the same machine. In reality, these entities would likely reside on separate machines. The update site that you create can be copied to another machine that runs an HTTP server. Multiple clients can access that HTTP server for their updates. As an alternative to the update site, you can deploy Sametime features with an optional provisioning add-on. The advantage to the provisioning add-on is that installing updates does not require any action on behalf of the user. In our example, the user is still required to enter the location of the update site and to schedule the automatic updates. The provisioning add-on allows for push updates (versus pull updates as in our example) and scheduled updates. Push updates allow updates to be pushed down by an administrator without any interaction on the user's part. Scheduled updates allow updates to be published during off hours, when updates are least likely to interfere with business. In a follow-up article, we discuss using the provisioning add-on as an enhanced means of distributing software updates to IBM Lotus Sametime. Resources, "Extending the Lotus Sametime client with an LDAP directory lookup plug-in" - developerWorks Lotus article, "Designing a Google Maps plug-in for Lotus Sametime Connect V7.5" - developerWorks Lotus article, "Extending IBM Lotus Sametime Connect V7.5 with an SMS messaging plug-in" - developerWorks Lotus article, "Creating an audio playback plug-in for IBM Lotus Sametime Connect V7.5" - Eclipse.org article, "How To Keep Up To Date" Get products and technologies - Download the Lotus Sametime V7.5 SDK from the developerWorks Lotus Toolkits page. - Download Eclipse 3.2 SDK from Eclipse.org..
http://www.ibm.com/developerworks/lotus/library/sametime-updates/index.html
CC-MAIN-2015-06
refinedweb
3,405
58.89
How to process SIGTERM signal gracefully? Let's assume we have such a trivial daemon written in python: def mainloop(): while True: # 1. do # 2. some # 3. important # 4. job # 5. sleep mainloop() and we daemonize it using start-stop-daemon which by default sends SIGTERM ( TERM) signal on --stop. Let's suppose the current step performed is #2. And at this very moment we're sending TERM signal. What happens is that the execution terminates immediately. I've found that I can handle the signal event using signal.signal(signal.SIGTERM, handler) but the thing is that it still interrupts the current execution and passes the control to handler. So, my question is - is it possible to not interrupt the current execution but handle the TERM signal in a separated thread (?) so that I was able to set shutdown_flag = True so that mainloop() had a chance to stop gracefully? A class based clean to use solution: import signal import time class GracefulKiller: kill_now = False def __init__(self): signal.signal(signal.SIGINT, self.exit_gracefully) signal.signal(signal.SIGTERM, self.exit_gracefully) def exit_gracefully(self,signum, frame): self.kill_now = True if __name__ == '__main__': killer = GracefulKiller() while True: time.sleep(1) print("doing something in a loop ...") if killer.kill_now: break print "End of the program. I was killed gracefully :)" ★ Back to homepage or read more recommendations:★ Back to homepage or read more recommendations: From: stackoverflow.com/q/18499497
https://python-decompiler.com/article/2013-08/how-to-process-sigterm-signal-gracefully
CC-MAIN-2019-26
refinedweb
236
58.28
Stack example in Java - push(), pop(), empty(), search() By: Henry Printer Friendly Format Stack is a subclass of Vector that implements a standard last-in, first-out stack. Stack only defines the default constructor, which creates an empty stack. Stack includes all the methods defined by Vector, and adds several of its own. To put an object on the top of the stack, call push(). To remove and return the top element, call pop(). An EmptyStackException is thrown if you call pop( ) when the invoking stack is empty. You can use peek( ) to return, but not remove, the top object. The empty() method returns true if: // Demonstrate the Stack class. import java.util.*; class StackDemo {, 42); showpush(st, 66); showpush(st, 99); showpop(st); showpop(st); showpop(st); try { showpop(st); } catch (EmptyStackException e) { System.out.println("empty stack"); } } } The following is the output produced by the program; notice how the exception handler for EmptyStackException is caught so that you can gracefully handle a stack underflow: stack: [ ] push(42) stack: [42] push(66) stack: [42, 66] push(99) stack: [42, 66, 99] pop -> 99 stack: [42, 66] pop -> 66 stack: [42] pop -> 42 stack: [ ] pop -> empty for this example (glad t View Tutorial By: Thor at 2007-10-06 15:12:28 2. if i wanna push the data from my keyboard input, h View Tutorial By: andys at 2008-11-09 03:09:32 3. help me for learning to programing with java View Tutorial By: hemn at 2008-11-25 03:12:19 4. Hi! Thanks for the examples posted here...it reall View Tutorial By: creece at 2009-01-23 17:28:33 5. pls give us aprogram of postfix and infix using st View Tutorial By: lost_hope1111 at 2009-02-13 01:48:37 6. thanks for this example but i want the whether th View Tutorial By: Rupesh Chavan at 2010-03-14 07:36:31 7. lots of thanks for this given example........hope View Tutorial By: virgi crisostomo at 2010-08-18 17:18:08 8. hi !! my problem is how to make a program f View Tutorial By: khenn reyes at 2010-12-25 05:47:08 9. please help me to do find a push and pop operation View Tutorial By: sweet mae at 2011-01-14 00:01:33 10. for user input use this method.... 1. impor View Tutorial By: susmit at 2011-03-02 09:09:46 11. import java.io.*; import java.util.Stack; View Tutorial By: jack&jill at 2011-07-26 06:40:32 12. very good.I think if you put the other structures View Tutorial By: mohammad at 2011-08-08 11:01:05 13. pls give me example of stack class with postfix me View Tutorial By: uchiha at 2011-09-16 04:02:57 14. This helped me to make my mature cheddar cheese ap View Tutorial By: Randy Peterson at 2011-10-06 12:22:35 15. can u give me a codes for prefix to infix converti View Tutorial By: bangskie at 2011-10-10 08:11:46 16. pls send to me example about stacks becaus View Tutorial By: suliman at 2011-12-10 08:02:01 17. Thanks View Tutorial By: PARIKSHIT SHARMA at 2011-12-23 22:33:39 18. THANKS you for having this site. it help me a lot View Tutorial By: fermilita at 2012-01-04 11:45:53 19. Hi Thanks for this example but i need more help fo View Tutorial By: hetal at 2012-02-03 08:47:39 20. Thank you lot [email protected] This example help me. View Tutorial By: Tushar at 2012-02-12 02:48:10 21. thank you lot of... this example help me... View Tutorial By: Lam Hoang Thy at 2012-05-04 01:11:20 22. Thnx A Lot...very healpful........... View Tutorial By: vinay at 2012-07-19 09:21:20 23. Thanks a lot man ! PEace View Tutorial By: Karan Vohra at 2012-08-30 02:15:05 24. please give some examples of postfix and infix. View Tutorial By: john mark at 2012-10-07 13:55:04 25. please help me on "why subclass of stack is View Tutorial By: mahendra at 2012-12-15 03:39:22 26. sex View Tutorial By: sex at 2013-09-07 09:22:48 27. Thanks for the example taken directly from the Jav View Tutorial By: Lewis Chase at 2013-09-24 23:39:21 28. aare aaighalya.....tuza chik stack madhe push kar View Tutorial By: chutiya at 2013-10-08 09:22:11 29. There is another implementation of stack I saw at: View Tutorial By: John Smith at 2014-02-11 09:50:05 30. Please tell me how to display the contents of stac View Tutorial By: Senthil at 2014-05-21 21:44:05 31. import java.io.*; import java.util.*; View Tutorial By: srikanth at 2014-05-30 06:44:58 32. walay boot ang program View Tutorial By: jampong at 2014-08-27 07:52:32 33. public class zcxzcStack { //push fun View Tutorial By: eissen at 2014-09-22 13:32:20 34. How can I use stack in entering a letter and will View Tutorial By: mards at 2014-10-17 12:18:34 35. thanks bro n SEe myblog <a href=" View Tutorial By: Arif at 2014-12-03 05:12:02 36. pls help on me to program in c++, write a program View Tutorial By: Hamid at 2014-12-18 20:41:40 37. why push is error in st.push(new Integer(a)); ? an View Tutorial By: ann at 2015-02-02 09:23:41 38. that is fifo rigth? how about lifo? View Tutorial By: galz at 2015-02-18 03:03:31 39. can i using stack in microsoft access 2007 View Tutorial By: pxin at 2015-03-24 05:45:56 40. how to implement stack with using vector class View Tutorial By: anamika at 2015-08-25 18:58:29 41. Guestchoob View Tutorial By: Guestchoob at 2017-02-23 12:23:58 42. Guestchoob View Tutorial By: Guestchoob at 2017-03-26 18:52:26 43. Hey I am so grateful I foujnd your weeb site, I re View Tutorial By: Vashikaran Totke In Hindi at 2017-04-26 19:10:06 44. how to create a simulation of java stack without u View Tutorial By: cakka at 2017-07-05 00:21:12 45. I see you don't monetize your site, don't waste yo View Tutorial By: 86Cathern at 2017-07-20 18:05:08 46. Have fun with your Mii on the Nintendo social app. View Tutorial By: Adela at 2017-08-06 01:54:31
https://www.java-samples.com/showtutorial.php?tutorialid=374
CC-MAIN-2020-05
refinedweb
1,137
74.79
Debuggit - A fairly simplistic debug statement handler use Debuggit DEBUG => 1; # say you have a global hashref for your site configuration # (not to imply that global vars are good) our $Config = get_global_config(); # now we can set some config things based on whether we're in debug mode or not $Config->{'DB'} = DEBUG ? 'dev' : 'prod'; # maybe we need to pull our local Perl modules from our VC working copy push @INC, $Config->{'vcdir/lib'} if DEBUG; # basic debugging output debuggit("only print this if debugging is on"); debuggit(3 => "only print this if debugging is level 3 or higher"); # show off our formatting my $var1 = 6; my $var2; my $var3 = " leading and trailing spaces "; # assuming debugging is enabled ... debuggit("var1 is", $var1); # var1 is 6 debuggit("var2 is", $var2); # var2 is <<undef>> debuggit("var3 is", $var3); # var3 is << leading and trailing spaces >> # note that spaces between args, as well as final newlines, are provided automatically # use "functions" in the debugging args list my $var4 = { complex => 'hash', with => 'lots', of => 'stuff' }; # this will call Data::Dumper::Dumper() for you # (even if you've never loaded Data::Dumper) debuggit("var4 is", DUMP => $var4); # or maybe you prefer Data::Printer instead? use Debuggit DEBUG => 1, DataPrinter => 1; debuggit("var4 is", DUMP => $var4); # make your own function Debuggit::add_func(CONFIG => 1, sub { my ($self, $var) = $_; return (lc($self), 'var', $var, 'is', $Config->{$var}) }); # and use it like so debuggit(CONFIG => 'DB'); # config var DB is dev You want debugging? No, you want sophisticated, full-featured, on-demand debugging, and you don't want to take it out when you release the code because you might need it again later, but you also don't want it to take up any space or cause any slowdown of your production application. Sound impossible? Nah. Just use Debuggit. To start: use strict; use warnings; use Debuggit; my $var = 6; debuggit(2 => "var is", $var); # this does not print debuggit(4 => "var is", $var); # neither does this Later ... use strict; use warnings; use Debuggit DEBUG => 2; my $var = 6; debuggit(2 => "var is", $var); # now this prints debuggit(4 => "var is", $var); # but this still doesn't That's it. Really. Everything else is just gravy. This POD explains just the basics of using Debuggit. For full details, see Debuggit::Manual. DEBUG is a constant integer set to whatever value you choose: use Debuggit DEBUG => 2; or to 0 if you don't choose: use Debuggit; Actually, failure to specify a value only defaults to 0 the first time in a program this is seen. Subsequent times (e.g. in modules included by the main script), DEBUG will be set to the first value passed in. In this way, you can set DEBUG in the main script and have it "fall through" to all included modules. See "The DEBUG Constant" in Debuggit::Manual for full details. Only "debuggit" is exported. Use this function to conditionally print debugging output. If the first argument is a positive integer, the output is printed only if DEBUG is set to that number or higher. The remaining arguments are concatenated with spaces, a newline is appended, and the results are printed to STDERR. Some minor formatting is done to help distinguish undef values and values with leading or trailing spaces. To get further details, or to learn how to override any of those things, see "The debuggit function" in Debuggit::Manual. This is what debuggit is set to initially. You can call it directly if you want to "wrap" debuggit. For examples of this, see "Wrapping the debugging output" in Debuggit::Cookbook. Add or remove debugging functions. Please see "Debugging Functions" in Debuggit::Manual. It means you did something like this: use Debuggit DEBUG => 2; use Debuggit DEBUG => 3; only probably not nearly so obvious. Debuggit tries to be very tolerant of multiple imports into the same package, but the DEBUG symbol is a constant function and can't be redefined without engendering severe wonkiness, so Debuggit won't do it. As long as you pass the same value for DEBUG, that's okay. But if the second (or more) value is different from the first, then you will get the original value regardless. At least this way you'll be forewarned. Debuggit is designed to be left in your code, even when running in production environments. Because of this, it needs to disappear entirely when debugging is turned off. It can achieve this unlikely goal via the use of a compile-time constant. Please see "Performance Considerations" in Debuggit::Manual for full details. DEBUG, you can't change it. Even if you try, you get the original value. See "DIAGNOSTICS". debuggit(0 => "in production mode"); never prints anything, even when DEBUG is 0. That's because debuggit is guaranteed to be an empty function when debugging is turned off. debuggit($var, "is the value"); is inherently dangerous. If $var is a positive integer, debuggit would interpret it as a debug level, and not print it. So, either do this: debuggit(1 => $var, "is the value"); or this: debuggit("the value is", $var); Or, to look at it another way, you can pass a value as the first arg to print, or you can leave off a debugging level altogether, but don't try to do both at once. my $var1 = "DUMP"; my $var2 = "stuff"; debuggit(1 => "vars are", $var1, $var2); is equivalent to: debuggit(1 => "vars are", DUMP => $var2); which is probably not going to do what you want, assuming the default functions are still in place. See "IMPORTANT CAVEAT!" in Debuggit::Manual for full details. debuggit(2 => "first thousand elements:", @array[0..999]); is likely going to have a performance impact even when debugging is off. Instead, do: debuggit("first thousand elements:", @array[0..999]) if DEBUG >= 2; See "Style Considerations" in Debuggit::Manual for another example and details on the problem. That's all I know of. However, lacking omniscience, I welcome bug reports. Debuggit is on GitHub at barefootcoder/debuggit. request a feature, that's okay too. You can create an issue on GitHub, or a bug in CPAN's RT (at). Or just send an email to bug-Debuggit@rt.cpan.org. Buddy Burden CPAN ID: BAREFOOT Barefoot Software barefootcoder@gmail.com This program is free software licensed under The Artistic License The full text of the license can be found in the LICENSE file included with this module. This module is copyright (c) 2008-2015, Barefoot Software. It has many venerable ancestors (some more direct than others), including but not limited to: Barefoot::debug, (c) 2000-2006 Barefoot Software, 2004-2006 ThinkGeek Barefoot::base, (c) 2001-2006 Barefoot Software Geek::Dev::Debug, (c) 2004 ThinkGeek VCtools::Base, (c) 2004-2008 Barefoot Software, 2004 ThinkGeek Barefoot, (c) 2006-2009 Barefoot Software Company::Debug, (c) 2008 Rent.com Log::Log4perl, debug, Debug, Debug::Message, Debug::EchoMessage. Comparison with most of these (and others) can be found in "Comparison Matrix" in Debuggit::Manual.
http://search.cpan.org/~barefoot/Debuggit-2.06/lib/Debuggit.pm
CC-MAIN-2017-17
refinedweb
1,163
53.92
Show: Delphi C++ Display Preferences Adding the Clipboard Object From RAD Studio Go Up to Working with Text in Controls Most text-handling applications provide users with a way to move selected text between documents, including documents in different applications. TClipboard object encapsulates a clipboard (such as the Windows Clipboard) and includes methods for cutting, copying, and pasting text (and other formats, including graphics). The Clipboard object is declared in the Clipbrd unit. To add the Clipboard object to an application (Delphi) - Select the unit that will use the clipboard. - Add Clipbrd to the uses clause below implementation. - If there is already a uses clause in the implementation part, add Clipbrd to the end of it. - If there is not already a uses clause, add one that says uses Clipbrd; For example, in an application with a child window, the uses clause in the unit's implementation part might look like this: uses MDIFrame, Clipbrd; To add the Clipboard object to an application (C++) - Select the unit that will use the clipboard. - In the form's header file ( .h), add #include <vcl\Clipbrd.hpp>
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Adding_the_Clipboard_Object
CC-MAIN-2018-05
refinedweb
184
51.28
Anyone know the context of the "drag_select" command run in the mousemap files? I'm working on a click-drag plugin, and the first thing I need to be able to do is allow for a normal click event to happen if there's no selection. I can't fire the 'drag_select' command, though.Tried the following: import sublime, sublime_plugin class DragSelectionCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.run_command('drag_select') self.view.window().run_command('drag_select') Not working and console has no output. Anyone else with experience? Perhaps the great jps or sublimator? drag_select is a view command, and requires an event argument to be passed, containing the cursor position and the pressed mouse button. If you implement run_ rather than run you will get access to the event (take a look through sublime_plugin.py in the same directory as the executable to see an example). It's also worth turning on command logging (via sublime.log_commands(True) ) to see the commands that normally get run. That being said, I don't think you'll have much luck getting text dragging working via a plugin.
https://forum.sublimetext.com/t/run-command-drag-select-from-a-text-windowcommand/2471
CC-MAIN-2016-30
refinedweb
186
59.5
Options for listing the files in a directory with Python I do a lot of sysadmin-type work with Python so I often need to list the contents of directory on a filesystem. Here are 4 methods I've used so far to do that. Let me know if you have any good alternatives. The examples were run on my Ubuntu Karmic machine. OPTION 1 - os.listdir()¶ This is probably the simplest way to list the contents of a directory in Python. import os dirlist = os.listdir("/usr") from pprint import pprint pprint(dirlist) Results: ['lib', 'shareFeisty', 'src', 'bin', 'local', 'X11R6', 'lib64', 'sbin', 'share', 'include', 'lib32', 'man', 'games'] OPTION 2 - glob.glob()¶ This method allows you to use shell-style wildcards. import glob dirlist = glob.glob('/usr/*') from pprint import pprint pprint(dirlist) Results: ['/usr/lib', '/usr/shareFeisty', '/usr/src', '/usr/bin', '/usr/local', '/usr/X11R6', '/usr/lib64', '/usr/sbin', '/usr/share', '/usr/include', '/usr/lib32', '/usr/man', '/usr/games'] OPTION 3 - Unix "ls" command using subprocess¶ This method uses your operating system's "ls" command. It allows you to sort the output based on modification time, file size, etc. by passing these command-line options to the "ls" command. The following example lists the 10 most recently modified files in /var/log: from subprocess import Popen, PIPE def listdir_shell(path, *lsargs): p = Popen(('ls', path) + lsargs, shell=False, stdout=PIPE, close_fds=True) return [path.rstrip('\n') for path in p.stdout.readlines()] dirlist = listdir_shell('/var/log', '-t')[:10] from pprint import pprint pprint(dirlist) Results: ['auth.log', 'syslog', 'dpkg.log', 'messages', 'user.log', 'daemon.log', 'debug', 'kern.log', 'munin', 'mysql.log'] OPTION 4 - Unix "find" style using os.walk¶ This method allows you to list directory contents recursively in a manner similar to the Unix "find" command. It uses Python's os.walk. import os def unix_find(pathin): """Return results similar to the Unix find command run without options i.e. traverse a directory tree and return all the file paths """ return [os.path.join(path, file) for (path, dirs, files) in os.walk(pathin) for file in files] pathlist = unix_find('/etc')[-10:] from pprint import pprint pprint(pathlist) Results: ['/etc/fonts/conf.avail/20-lohit-gujarati.conf', '/etc/fonts/conf.avail/69-language-selector-zh-mo.conf', '/etc/fonts/conf.avail/11-lcd-filter-lcddefault.conf', '/etc/cron.weekly/0anacron', '/etc/cron.weekly/cvs', '/etc/cron.weekly/popularity-contest', '/etc/cron.weekly/man-db', '/etc/cron.weekly/apt-xapian-index', '/etc/cron.weekly/sysklogd', '/etc/cron.weekly/.placeholder'] Related posts - How to get the filename and it's parent directory in Python — posted 2011-12-28 - How to remove ^M characters from a file with Python — posted 2011-10-03 - Monitoring a filesystem with Python and Pyinotify — posted 2010-04-09 - os.path.relpath() source code for Python 2.5 — posted 2010-03-31 - A hack to copy files between two remote hosts using Python — posted 2010-02-08 Adding a regexp to your option #1 is a quick way to get python's re module into play when sh regexps won't cut it: import os, pprint, re pat = re.compile(r".+\d.+") dirlist = filter(pat.match, os.listdir("/usr/local")) pprint.pprint(dirlist) gives me (on my FreeBSD box) ['diablo-jdk1.6.0', 'netbeans68', 'openoffice.org-3.2.0', 'i386-portbld-freebsd7.3'] Keith: That's a good tip. I will give it a try the next time I get a chance. Thanks! ...and how about an easy way for listing contents of a WEB directory? Could any of the above techniques be used? I'm just learning python for my job and this has been a really useful reference page for me!! I realise it's only really useful for one thing - but the methods you've shown are perfect for particular types of directory listings in my code ;). I recently started learning python and i love your blog i'm constantly looking for best practices and "solved" problems I'm also just learning python for my job and this has been a really useful reference page for me. I hope you can post more about system administration booth Unix and Windows. Keep up the good work man ;) how to getting files from three different dirctory in reverse manner....please give idea..
https://www.saltycrane.com/blog/2010/04/options-listing-files-directory-python/
CC-MAIN-2018-13
refinedweb
717
57.77
Created on 2014-05-10.10:16:29 by t-8ch, last changed 2014-05-10.15:08:04 by zyasoft. When putting a wheel (zipfile on the PYTHONPATH) the import mechanism does not pick it up (this breaks for example virtualenv). # This works with CPython (tested 2.5 - 3.4) and PyPy (1.9 and 2.0) given I use PYTHONPATH=/tmp/requests-2.2.1-py2.py3-none-any.whl requests = __import__('requests') print(requests.__file__) print(requests.__loader__) # This also works on Jython (and all the others), so zipimport can't be to broken) import zipimport ARCHIVE = 'requests-2.2.1-py2.py3-none-any.whl' requests = zipimport.zipimporter(ARCHIVE).load_module('requests') print(requests.__file__) print(requests.__loader__) Tested with 2.5.3 and 01460e803ef3 Sorry for the noise. The problem is that jython does not honor PYTHONPATH (instead it uses JYTHONPATH). This still breaks virtualenv. No worries, I have also noticed that virtualenv wants to use PYTHONPATH, not JYTHONPATH. However, virtualenv also wants to use the standard pip iirc, so it's one more thing that would have to be temporarily forked. For the moment, you can install my fork of pip at I have verified that you can then use it to install the wheel packaging of requests. Lastly, we are not going to be supporting wheel on 2.5. Closing this bug accordingly.
http://bugs.jython.org/issue2139
CC-MAIN-2018-05
refinedweb
229
62.44
Reverse each word in a sentence in Python This tutorial will teach you how to reverse each word in a sentence in Python. For example, if a sentence is “CodeSpeedy is great”, our output should be– “ydeepSedoC si taerg”. Let’s see how this can be done. We are going to use these Python methods in our program to reverse each word in a given sentence. - split(): To split the sentence into words. - join(): To join the reversed words to form a new sentence. If you are not familiar with these methods, first go through this: String split and join in Python First, we use the split() method and break the sentence into words. These are stored in a list. We can reverse individual words in the list by using a for loop and store the new words in a new list. After all the words have been reversed, we join all the items of the new list and form a new sentence which is the required output. Have a good look at the example code given below for reversing individual words in a sentence. def reverse(sentence): #split the sentence and store the words in a list words = sentence.split(" ") #reverse each words reversed_words = [w[::-1] for w in words] #join the reversed words and form new sentence new_sentence = " ".join(reversed_words) print(new_sentence) reverse("CodeSpeedy is great") The above Python program gives the output: ydeepSedoC si taerg We can also write the whole reverse function in a single line. That way our code looks great and simple. Try to do it yourself. Thank you.
https://www.codespeedy.com/reverse-each-word-in-a-sentence-in-python/
CC-MAIN-2020-50
refinedweb
265
80.51
When I wrote something like cout << "Every age has a language of its own"; It's supposed that the sentence between the two quotation marks will not be targeted directly to the screen, but will be stored somewhere first before directed to the screen. What is that place in which the sentence will be stored? The same thing is done in a reverse way with the cin so the question is, Is it the same storing place is used to store what is enetered by the user on the screen before assiging it to a variable of whatever was in the right hand side of the cin? What does it mean that the header file iostream contains the declarations that are needed by the cout identifier and the << operator?. What does it mean by the declarations? If with an illustrative example of this would be the best. What is the content of the namespace? what it means that certain names are recognized in namespace std including cout is declared within it! is not cout declaration exists in the iostream header file?
https://www.daniweb.com/programming/software-development/threads/450766/header-file-namespace
CC-MAIN-2017-47
refinedweb
181
76.56
The GroupsController class inherits from System.Wep.Http.ApiController. Because you've chosen the Empty API controller template, there aren't methods defined for the class. A complete REST service would require you to implement the following methods in a simple entity with a numeric ID and a string value: Because the goal is to retrieve all the groups with their items from the Windows Store app, I focus just on the IEnumerable<Group> Get() method. The following code creates an array of Group with six groups. Only one group has two items, just to keep the example simple. You can add more items to other groups in order to check how the Grid app works in detail. namespace DrDobbsWebAPI.Controllers { using System.Collections.Generic; using System.Linq; using System.Web.Http; using DrDobbsApp.Entities; public class GroupsController : ApiController { private readonly Group[] _groups = new[] { new Group { Id = "1", Title = "Cloud", Subtitle = "Cloud Developer", Description = "Cloud feature articles", MainPage = "cloud", Items = new[] { new Item { Id = "240012549"," }, new Item { Id = "120020304050",/240009175" }, } }, new Group { Id = "2", Title = "Mobile", Subtitle = "Mobile Developer", Description = "Mobile feature articles", MainPage = "mobile" }, new Group { Id = "3", Title = "Parallel", Subtitle = "Parallel Programming", Description = "Parallel feature articles", MainPage = "parallel" }, new Group { Id = "4", Title = ".NET", Subtitle = "M-Dev", Description = "The world of Microsoft Developers", MainPage = "windows" }, new Group { Id = "5", Title = "JVM Languages", Subtitle = "Powered by Java Virtual Machine", Description = "The world of JVM languages", MainPage = "jvm" }, new Group { Id = "6", Title = "C/C++", Subtitle = "Powered by C/C++", Description = "The world of C/++ developers", MainPage = "cpp" } }; /// <summary> /// Retrieves all the groups with their items /// GET api/values /// </summary> /// <returns>All the groups with their items</returns> public IEnumerable<Group> Get() { return _groups.ToArray(); } } } Notice that Group is DrDobbsApp.Entities.Group, thus, I'm using the class shared in the previously created PCL. It is really very easy to create a REST service with ASP.NET Web API, and I have a service ready to provide data to my Windows Store app. Now, I just have to make sure it works correctly. First, it is necessary to check the base URL in the project Web configuration. To do this, right click on DrDobbsWebAPI in Solution Explorer, select Properties | Web and check the value for Project URL in case you're using your local IIS Web Server (see Figure 8). Figure 8: Web properties for the ASP.NET Web API project with the Project URL details. In my case, the Project Url is, so I can retrieve the groups if I execute the solution and I enter the following URL in any Web browser:. I just need to add api/groups to the base URL, as explained in the table. Figure 9 shows the partial results of that executes the GroupsController.Get method that returns an IEnumerable<Group>. Figure 9: Using a Web browser to test that the GET api/groups REST call is working OK. Making Calls to a REST Service with System.Net.Http.HttpClient Now that I've created the REST service, I'll consume it in the sample Grid app by using the new asynchronous methods provided by the new System.Net.Http.HttpClient. Thus, it is necessary to go back to the DrDobbsApp project and follow these steps:
http://www.drdobbs.com/mobile/access-data-with-rest-in-windows-8-apps/240144594?pgno=3
CC-MAIN-2014-52
refinedweb
543
53.92
Can we get rid of duplicate <at> Path? We currently have the following code, which is prototypical for a POST / GET combination. POST is implemented by the root resource, and must return a location header pointing to the created sub resource. Then, a client can use that URI to GET a sub resource, implemented by a second class: <at> Path("myroot") public class RootResource { <at> POST public post() { …create in database and request id from it… URI location = UriBuilder.fromResource(SubResource.class).build(…id from database…); return Response.created(location).build(); } <at> Path("{id}") public SubResource getSubResource() { return new SubResource(); } } <at> Path("{id}") public class SubResource { <at> GET public String get() { return … ; } } That works pretty well, but it is not smart that <at> Path is needed at both, the getSubResource() method AND the SubResource class. I wonder if we can get rid of one of those, as the information provided by both actually is the same. Thanks! Markus
http://blog.gmane.org/gmane.comp.java.jersey.user/month=20110201
CC-MAIN-2015-18
refinedweb
158
50.16
FPATHCONF(3) Linux Programmer's Manual FPATHCONF(3) fpathconf, pathconf - get configuration values for files #include <unistd.h> long fpathconf(int fd, int name); long pathconf(const. The limit is returned, if one exists. If the system does not have a limit for the requested resource, -1 is returned, and errno is unchanged. If there is an error, -1 is returned, and errno is set to reflect the nature of the error.fpathconf(), pathconf() │ Thread safety │ MT-Safe │ └────────────────────────┴───────────────┴─────────┘.07 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at. GNU 2015-08-08 FPATHCONF(3)
http://man7.org/linux/man-pages/man3/pathconf.3.html
CC-MAIN-2016-40
refinedweb
111
60.31
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode. Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript). Hello, I'm seeking advice for a drag & drop reorder effect similar to the one in this UIKit. Sorry for the delay here the full example. """ Author: Maxime Adam Description: - Creates and attaches a GeUserArea to a Dialog. - Creates a series of aligned squares, that can be dragged and swapped together. Note: - This example uses weakref, I encourage you to read. Class/method highlighted: - c4d.gui.GeUserArea - GeUserArea.DrawMsg - GeUserArea.InputEvent - GeUserArea.MouseDragStart - GeUserArea.MouseDrag - GeUserArea.MouseDragEnd - c4d.gui.GeDialog - GeDialog.CreateLayout - GeDialog.AddUserArea - GeDialog.AttachUserArea Compatible: - Win / Mac - R13, R14, R15, R16, R17, R18, R19, R20 """ import c4d import weakref # Global variable to determine the Size of our Square. SIZE = 100 class Square(object): """ Abstract class to represent a Square in a GeUserArea. """ def __init__(self, geUserArea, index): self.index = index # The initial square index (only used to differentiate square between each others) self.w = SIZE # The width of the square self.h = SIZE # The height of the square self.col = c4d.Vector(0.5) # The default color of the square self.parentGeUserArea = weakref.ref(geUserArea) # A weak reference to the host GeUserArea def GetParentedIndex(self): """ Returns the current index in the parent list. :return: The index or c4d.NOTOK if there is no parent. :rtype: int """ parent = self.GetParent() if parent is None: return c4d.NOTOK return parent._squareList.index(self) def GetParent(self): """ Retrieves the parent instance, stored in the weakreaf self.parentGeUserArea. :return: The parent instance of the Square. :rtype: c4d.gui.GeUserArea """ if self.parentGeUserArea: geUserArea = self.parentGeUserArea() if geUserArea is None: raise RuntimeError("GeUserArea parent is not valid.") return geUserArea return None def DrawNormal(self, x, y): """ Called by the parent GeUserArea to draw the Square normally. :param x: X position to draw. :param y: Y position to draw. """ geUserArea = self.GetParent() geUserArea.DrawSetPen(self.col) geUserArea.DrawRectangle(x, y, x + self.w, y + self.h) geUserArea.DrawText(str(self.index), x, y) def DrawDraggedInitial(self, x, y): """ Called by the parent GeUserArea when the Square is dragged with the initial position (same coordinate than DrawNormal). :param x: X position to draw. :param y: Y position to draw. """ geUserArea = self.GetParent() geUserArea.DrawBorder(c4d.BORDER_ACTIVE_1, x, y, x + self.w, y + self.h) def DrawDragged(self, x, y): """ Called by the parent GeUserArea when the Square is dragged with the current mouse position. :param x: X position to draw. :param y: Y position to draw. """ geUserArea = self.GetParent() geUserArea.DrawSetPen(c4d.Vector(1)) geUserArea.DrawRectangle(int(x), int(y), int(x + self.w), int(y + self.h)) geUserArea.DrawText(str(self.index), int(x + (SIZE / 2.0)), int(y + (SIZE / 2.0))) class DraggingArea(c4d.gui.GeUserArea): """ Custom implementation of a GeUserArea that creates 4 squares and lets you drag them. """ def __init__(self): self._squareList = [] # Stores a list of Square that will be draw in the GeUserArea. self.draggedObj = None # None if not dragging, Square if dragged self.clickedPos = None # None if not dragging, tuple(X, Y) if dragged # Creates 4 squares self.CreateSquare() self.CreateSquare() self.CreateSquare() self.CreateSquare() # =============================== # Square management # =============================== def CreateSquare(self): """ Creates a square that will be draw later. :return: The created square :rtype: Square """ square = Square(self, len(self._squareList)) self._squareList.append(square) return square def GetXYFromId(self, index): """ Retrieves the X, Y op, left position according to an index in order. This produces an array of Square correctly aligned. :param index: The index to retrieve X, Y from. :type index: int :return: tuple(x left position, y top position). :return: tuple(int, int) """ x = SIZE * index xPadding = 5 * index x += xPadding y = 5 return x, y def GetIdFromXY(self, xIn, yIn): """ Retrieves the square id stored in self._squareList according to its normal (not dragged) position. :param xIn: The position in x. :type xIn: int :param yIn: The position in y. :type yIn: int :return: The id or c4d.NOTOK (-1) if not found. :rtype: int """ # We could optimize the method by reversing the algorithm from GetXYFromID, # But for now we just iterate all squares and see which one is correct. for squareId, square in enumerate(self._squareList): x, y = self.GetXYFromId(squareId) if x < xIn < x + SIZE and y < yIn < y + SIZE: return squareId return c4d.NOTOK # =============================== # Drawing management # =============================== def DrawSquares(self): """ Called in DrawMsg. Draws all squares contained in self._squareList """ for squareId, square in enumerate(self._squareList): x, y = self.GetXYFromId(squareId) if square is not self.draggedObj: square.DrawNormal(x, y) else: square.DrawDraggedInitial(x, y) def DrawDraggedSquare(self): """ Called in DrawMsg. Draws the dragged squares """ if self.draggedObj is None or self.clickedPos is None: return x, y = self.clickedPos self.draggedObj.DrawDragged(x, y) def DrawMsg(self, x1, y1, x2, y2, msg): """ This method is called automatically when Cinema 4D Draw the Gadget. :param x1: The upper left x coordinate. :type x1: int :param y1: The upper left y coordinate. :type y1: int :param x2: The lower right x coordinate. :type x2: int :param y2: The lower right y coordinate. :type y2: int :param msg_ref: The original mesage container. :type msg_ref: c4d.BaseContainer """ # Initializes draw region self.OffScreenOn() self.SetClippingRegion(x1, y1, x2, y2) # Get default Background color defaultColorRgbDict = self.GetColorRGB(c4d.COLOR_BG) defaultColorRgb = c4d.Vector(defaultColorRgbDict["r"], defaultColorRgbDict["g"], defaultColorRgbDict["b"]) defaultColor = defaultColorRgb / 255.0 self.DrawSetPen(defaultColor) self.DrawRectangle(x1, y1, x2, y2) # First draw pass, we draw all not dragged object self.DrawSquares() # Last draw pass, we draw the dragged object, this way dragged square is drawn on top of everything. self.DrawDraggedSquare() # =============================== # Dragging management # =============================== @property def isCurrentlyDragged(self): """ Checks if a dragging operation currently occurs. :return: True if a dragging operation currently occurs otherwise False. :rtype: bool """ return self.clickedPos is not None and self.draggedObj is not None def GetDraggedSquareWithPosition(self): """ Retrieves the clicked square during a drag event from the click position. :return: The square or None if there is nothing dragged. :rtype: Union[Square, None] """ if self.clickedPos is None: return None x, y = self.clickedPos squareId = self.GetIdFromXY(x, y) if squareId == c4d.NOTOK: return None return self._squareList[squareId] def InputEvent(self, msg): """ Called by Cinema 4D, when there is a user interaction (click) on the GeUserArea. This is the place to catch and handle drag interaction. :param msg: The event container. :type msg: c4d.BaseContainer :return: True if the event was handled, otherwise False. :rtype: bool """ # Do nothing if its not a left mouse click event if msg[c4d.BFM_INPUT_DEVICE] != c4d.BFM_INPUT_MOUSE and msg[c4d.BFM_INPUT_CHANNEL] != c4d.BFM_INPUT_MOUSELEFT: return True # time to update information about the current drag process. # This allow to catch when the mouse is released and leave the infinite loop. while True: # Updates the current mouse information result, deltaX, deltaY, channels = self.MouseDrag() if result != c4d.MOUSEDRAGRESULT_CONTINUE: break # The first tick is ignored as deltaX/Y include if deltaX == 0.0 and deltaY == 0.0: continue # Updates mouse position with the updated delta mouseX -= deltaX mouseY -= deltaY self.clickedPos = mouseX, mouseY # Retrieves the clicked square square = self.GetDraggedSquareWithPosition() # Defines the draggedObj only if the user clicked on a square and is not yet already defined if square is not None and self.draggedObj is None: self.draggedObj = square # Redraw the GeUserArea (it will call DrawMsg) self.Redraw() # Asks why we leave the while loop endState = self.MouseDragEnd() # If the drag process was ended because the user releases the mouse. # Note that while we are not anymore really in the Drag Pooling, from our implementation we consider we are still # and don't clear directly the data, so self.clickedPos and self.draggedObj still refer to the last tick of the # MouseDrag pool and we will clear it once we don't need anymore those data (after this if statement). if endState == c4d.MOUSEDRAGRESULT_FINISHED: # Checks a dragged object is set # in case of a simple click without mouse movement nothing has to be done. if self.isCurrentlyDragged: # Retrieves the initial index of the dragged object. currentIndex = self.draggedObj.GetParentedIndex() # Retrieves the index where the drag operation ended. If we find an ID, swap both items. releasedSquare = self.GetDraggedSquareWithPosition() if releasedSquare is not None: targetIndex = releasedSquare.GetParentedIndex() # Swap items only if source index and target index are different if targetIndex != currentIndex: self._squareList[currentIndex], self._squareList[targetIndex] = self._squareList[targetIndex], \ self._squareList[currentIndex] # In case the user release the mouse not on another square. # Swaps the current square to either the first position or last position. else: # if current Index is already the first one, make no sense to inserts it if currentIndex != 0: # If the X position is before the X position of the first square # Removes and inserts it back to the first position. if self.clickedPos[0] < self.GetXYFromId(0)[0]: self._squareList.remove(self.draggedObj) self._squareList.insert(0, self.draggedObj) # Retrieves the last index lastIndex = len(self._squareList) - 1 # if current Index is already the last one, make no sense to insert it if currentIndex != lastIndex: if self.clickedPos[0] > self.GetXYFromId(lastIndex)[0] + SIZE: # If the X position is after the X position of the last square (and its size) # Removes and inserts it back to the last position. self._squareList.remove(self.draggedObj) self._squareList.insert(lastIndex, self.draggedObj) # Cleanup and refresh information if we dragged something if self.clickedPos is not None or self.draggedObj is not None: self.clickedPos = None self.draggedObj = None self.Redraw() the GeDialog. self.area = DraggingArea()() It will be included soon on Github. Cheers, Maxime Hello, we don't have any helpful functions to do that kind of drag and drop and no example to reproduce that within a GeUserArea. It's still possible but really a lot of work. Cheers, Manuel @m_magalhaes Thank you for the reply and confirmation that it's possible. I'm happy to do the work with a little help from the Maxon SDK specialists. In the example below, the drag behavior seems right, but the print to the console on line 67 doesn't show until I save the file on my machine or hit enter in the console (and sometimes not at all) for some reason. I want to make sure it's not a memory leak. Could you please let me know if this is a recommended way to set up a drag in a GeUserArea? (I got the basis from this post). If so, how would I print the input events to the console? import c4d from c4d import gui from c4d.gui import GeUserArea, GeDialog class Area(c4d.gui.GeUserArea): def __init__(self): super(Area, self).__init__() self.rectangle=[-1,-1,-1,-1] def DrawMsg(self, x1, y1, x2, y2, msg): self.OffScreenOn() self.DrawSetPen(c4d.Vector(.2)) self.DrawRectangle(x1, y1, x2, y2) xdr,ydr,x2dr,y2dr = self.toolDragSortEx() self.DrawSetPen(c4d.Vector(1)) self.DrawBorder(c4d.BORDER_ACTIVE_4, xdr,ydr,x2dr,y2dr) def toolDragSortEx(self): if self.rectangle[0]<self.rectangle[2]: x1,x2 = self.rectangle[0],self.rectangle[2] else: x1,x2 = self.rectangle[2],self.rectangle[0] if self.rectangle[1]<self.rectangle[3]: y1,y2 = self.rectangle[1],self.rectangle[3] else: y1,y2 = self.rectangle[3],self.rectangle[1] return x1,y1,x2,y2 def InputEvent(self, msg): dev = msg.GetLong(c4d.BFM_INPUT_DEVICE) if dev == c4d.BFM_INPUT_MOUSE: mousex = msg.GetLong(c4d.BFM_INPUT_X) mousey = msg.GetLong(c4d.BFM_INPUT_Y) start_x = mx = mousex - self.Local2Global()['x'] start_y = my = mousey - self.Local2Global()['y'] channel = msg.GetLong(c4d.BFM_INPUT_CHANNEL) if channel == c4d.BFM_INPUT_MOUSELEFT: print("mouse down") #drag interaction state = c4d.BaseContainer() self.MouseDragStart(c4d.KEY_MLEFT,start_x, start_y, c4d.MOUSEDRAGFLAGS_DONTHIDEMOUSE| c4d.MOUSEDRAGFLAGS_NOMOVE ) while True: result, dx, dy, channels = self.MouseDrag() #end of Drag if result == c4d.MOUSEDRAGRESULT_ESCAPE: break if not self.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSELEFT, state): print "other clicks" break if state[c4d.BFM_INPUT_VALUE] == 0: #mouse release self.rectangle = [-1,-1,-1,-1] self.Redraw() break #not moving, continue if dx == 0 and dy == 0: continue #dragging mx -= dx my -= dy print(mx,my) self.rectangle = [start_x,start_y,mx,my] self.Redraw() return True def Message(self, msg, result): return c4d.gui.GeUserArea.Message(self, msg, result) class MyDialog(c4d.gui.GeDialog): def __init__(self): pass def CreateLayout(self): self.SetTitle("Drag Test") self.area = Area() self.AddUserArea(1000, c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT) self.AttachUserArea(self.area, 1000) self.GroupEnd() return True def main(): dialog = None dialog = MyDialog() dialog.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, xpos=-2, ypos=-2, defaultw=960, defaulth=540) if __name__=='__main__': main() Hello. Just checking in again: can anyone please help me with some advice on dragging in the GeUserArea? Have I set it up properly and why is there no realtime feedback in the While loop? Thank you! Hi @blastframe, In general, it's not necessary to bump a topic however since the topic is already 5 days ago without an answer from us, in this case, no issue at all, and sorry for the time needed, understand that we also have other duties to do but don't worry you are not forgotten. We are working on a more general example that draws a bunch of cubes and let you drag them. It's under review process, once the review will be done it will be on GitHub (and we will add it to this thread), here a preview of it. Anyway since it's already 5days longs, dragging is a bit particular and our documentation/example will be adapted since explanations provided for the moment are not very clear. So here are the usual steps to do drag operation in a GeUserArea (Very Similar to what you will in a ToolData::MouseInput) def InputEvent(self, msg): """ Called by Cinema 4D, when there is an user interaction (click) on the GeUserArea. This is the place to catch and handle drag interaction. :param msg: The event container. :type msg: c4d.BaseContainer :return: True if the event was handled, otherwise False. :rtype: bool """ # times to update information about the current drag process. # This allows catching when the mouse is released and leaves the infinite loop. while True: # Updates the current mouse information result, deltaX, deltaY, channels = self.MouseDrag() if result != c4d.MOUSEDRAGRESULT_CONTINUE: break # The first tick is ignored as deltaX/YY includes, since we passed c4d.MOUSEDRAGFLAGS_NOMOVE it's unlikely to happen if deltaX == 0.0 and deltaY == 0.0: continue # Updates mouse position with the updated delta mouseX -= deltaX mouseY -= deltaY self.clickedPos = mouseX, mouseY # Do some operation # Redraw the GeUserArea during the drag process (it will call DrawMsg) self.Redraw() # Asks why we leave the while loop endState = self.MouseDragEnd() # If the drag process was ended because the user releases the mouse. if endState == c4d.MOUSEDRAGRESULT_FINISHED: print "Drag finished normally" # Probably change some internal data and then redraw # If the drag process was canceled by the user elif endState == c4d.MOUSEDRAGRESULT_ESCAPE: print "Drag was escaped, do Nothing, reset initial state" # Probably change some internal data and then redraw to restore the initial content return True Cheers, Maxime. @m_adam Hi Maxime, Thank you for the response and guidance on dragging in the C4D GeUserArea. I had certainly imagined that your team has many other duties (including the fantastic support you provide on this forum). It seemed from the previous response that it was the last word as I didn't have any indication your team was still working on the issue. I am very happy to see that you will be shining light on the GeUserArea dragging process! The example you shared looks very promising as well. I very much look forward to seeing the code: thank you! Interesting example, @m_adam! If I copy/paste the code into the script manager the gui is empty. Which is funny, because yesterday or so I tried it and it worked... Has the code been updated? Anyone else experiencing this..? (checked in multiple versions...) Cheers, Lasse @lasselauch said in Drag & Drop to Reorder in GUI: Interesting example, @m_adam! If I copy/paste the code into the script manager the gui is empty. Which is funny, because yesterday or so I tried it and it worked... Has the code been updated? Anyone else experiencing this..? (checked in multiple versions...) Cheers, Lasse Maybe because the code I provided is only for Mouse Input, so nothing is drawn and its purpose its only to demonstrate how to handle drag in a GeUserArea. So if you simply copy/paste my script yes it will not work, at least we didn't change anything. @m_adam Ah... I thought that was a working example as shown in your gif and I've already had it running at one point... Sorry! My bad. @m_adam This is nice work, Maxime, thank you! I have to check out weakref I'm getting a couple of errors when clicking in a part of the GeUserArea without a square or hitting a key on the keyboard. How can I handle these? No square: line 331, in InputEvent currentIndex = self.draggedObj.GetParentedIndex() AttributeError: 'NoneType' object has no attribute 'GetParentedIndex'` Keyboard input: line 278, in InputEvent self.MouseDragStart(c4d.KEY_MLEFT, mouseX, mouseY, c4d.MOUSEDRAGFLAGS_DONTHIDEMOUSE | c4d.MOUSEDRAGFLAGS_NOMOVE) TypeError: a float is required Thanks, I just updated the previous code with a fix to both issues. The first one was related because in isCurrentlyDragged I used or while it should be and. The second one is because InputEvent is called for any kind of event, and I didn't filter when I want to do the drag operation so I added the next code at the start of the Message method: isCurrentlyDragged or and # Only do something if its a left mouse click if msg[c4d.BFM_INPUT_DEVICE] != c4d.BFM_INPUT_MOUSE and msg[c4d.BFM_INPUT_CHANNEL] != c4d.BFM_INPUT_MOUSELEFT: return True @m_adam Terrific work, Maxime! This is very helpful to me and I'm sure the many others who want to learn about dragging in Cinema 4D's UI. Excellent job!
https://plugincafe.maxon.net/topic/12129/drag-drop-to-reorder-in-gui
CC-MAIN-2021-39
refinedweb
2,999
61.02
Driving perception change. There are two important things, what developers must know: 1) Webparts for WSS v2 in most cases fully compatible with WSS 3.0 without recompilation (and .cab repacking) in RTM version of WSS 3.0/MOSS2007 2) New webpart framework model for WSS 3.0 based on ASP.NET 2.0 webparts and is not compatible with WSS v2 SharePoint version 3 has made a significant bet on ASP.NET web parts as the preferred mechanism for delivering web parts. In version 3, a developer has three choices for how they wish to develop web part: Note that in version 3 WSS.WebPart derives from ASP.WebPart, so technically, WSS.WebParts are ASP.WebParts. However, for the purposes of discussion when the term ASP.WebPart is used we will refer to “pure” web parts. The long term vision for SharePoint is to solidly bet on ASP.NET 2.0 as the owner of the web part framework. Therefore, a goal of this vision is to ensure that SharePoint does not deviate from the core web part framework; that developers can place a solid bet on ASP.NET 2.0. However, in SharePoint version 3 there will remain some core differences between WSS.WebPart and ASP.WebPart that developers should be aware of: In SharePoint version 2, if these properties were set to true than customization or personalization of a web part was blocked at both the user interface and the object model level. Whidbey only enforces these settings at the user interface level. SharePoint version 3 now follows this model. Differences in How "Pure" ASP.NET web parts work vs. Other ASP.NET implementations For ASP.NET Web Parts hosted in WSS, there are some behavior differences vs. how other ASP.NET servers might deal with the parts. Developers need to explicitly call SetPersonalizationDirty to cause their web parts to have changes persisted, when hosted in WSSv3. On other ASP.NET 2.0 implementations, changes to certain properties will automatically get persisted. When the web part is hosted within WSS, developers will need to call if (null != WebPartManager) SetPersonalizationDirty() to ensure their properties are persisted. There are two fundamental web part frameworks supported in WSS: the WSS v2 Web Part Framework (Microsoft.SharePoint.WebPartPages.WebPart) and the ASP.NET 2.0 Web Part Framework (System.Web.UI.WebControls.WebParts.WebPart) For most new web parts going forward, developers should use the ASP.NET 2.0 framework. To develop an ASP.NET web part for WSS, you need to do the following things: Developing a web part assembly typically means creating a class library with a class that derives from the System.Web.UI.WebControls.WebParts.WebPart base class. A simple way to do this is: 1. Start up Visual Studio 2005 2. Start a new class library project 3. Add a reference to System.Web 4. In your .cs file, paste in the following: using System;using System.Text; using System.Web.UI.WebControls.WebParts; namespace MS.Samples{ public class ASP.NETHelloWorldPart : WebPart { protected override void Render(System.Web.UI.HtmlTextWriter writer) { writer.Write("Hello, ASP.NET!"); } }} 5. Compile this -- you should have an assembly which contains your Hello World web part. For more information on developing ASP.NET assemblies, the ASP.NET 2.0 documentation is a great place to start. NOTE: One caution on this. ASP.NET has a capability for hosting 'plain' controls as web parts, and optionally exposing an interface (IWebPart) so that those controls can take advantage of web part features. As a result, you will see controls and .ascxs acting as Web Parts. WSSv3 does not support this capability; your web part must derive from the WebPart class directly. There are two fundamental locations to deploy an assembly to, within SharePoint: 1. The Bin Directory 2. The Global Assembly Cache Each has its own pros and cons. As a positive, the Bin Directory is a partial trust location. By default, code that runs from this directory has a very low level of code access security (CAS) permissions. It is the job of an administrator to specifically and explicitly raise the permissions granted to a web part so it can function properly. Because of this level of control and defense-in-depth, administrators tend to prefer that assemblies they get can run in the bin directory, with a known set of required CAS permissions. The Bin directory is also per-web application. Depending on your scenario, this is either an advantage or disadvantage. This makes it possible to isolate code to a particular web application. As a negative, if you want your web part to run everywhere, you would need to deploy your bin assembly. The bin directory is a folder stored off your web application root. The global assembly cache is a global place where signed assemblies can be deployed. These assemblies run with full trust by default. They are globally installed, so they will work in any web application. As mentioned in the bin directory, there are generally no CAS restictions on code installed to the GAC; therefore, you lose the defense in depth security benefit. One negative is that deploying your PDBs to GAC'ed assemblies can be a little tricky to setup. ASP.NET parts in the bin directory have some special constraints for security. The bin directory is a partial trust location -- when your part is executed, you do not have full trust code permissions. Because the code that calls into your part will be partial trust, your ASP.NET part needs to have the "AllowPartialTrustedCallers" attribute set on it. This can be done at the assembly level. WARNING: Marking an assembly as safe to AllowPartiallyTrustedCallers puts a lot of responsibility for safe implementation on the developers. Another issue is that the code access security permissions for the bin directory are very low by default -- only pure execution is allowed. You almost certainly will need to elevate these permissions to have your assembly run correctly. There are two ways to do this: 1. Inside of web.config in the web application root you will see a tag called trust with an attribute as level="WSS_Minimal". You can change this to WSS_Medium. This will raise the net trust level of the bin directory. 2. Create a new trust policy file, and point your web.config at that. #1 is simpler, but because it generically raises the trust level by granting arbitrary new permissions you might not need, it is less secure. #2 is more complicated, but lets you have a more precise attribution of permissions for your parts. A fundamental assumption of SharePoint is that 'untrusted users' can upload and create ASPX pages within the system. Not only should those users be prevented from adding server-side code within those pages, but there should be a list of approved controls those untrusted users can use. Put another way, just because you have the "FormatYourHardDrive" control on your machine doesn't mean that untrusted users should be able to use it. Along with other defense in depth strategies, one tool to prevent this is the SafeControl list. The Safe Controls list is a SharePoint-specific list of controls and web parts that are safe for invokation on a page. The list is stored in web.config in your web application root. To add a safe control entry, open up web.config and add a safe control entry for your custom assembly. You should copy one of the existing references and use that as a template. Every web part should have a .webpart file -- a blurb of XML which describes the web part and shows up in the gallery. The easiest way to create a .webpart file is to have WSS do it. After you have deployed your web part and registered in the safe control list, visit. From there, select your web part class and select "Populate webpart gallery". This will create your new .webpart file. Note that in beta there are some bugs with this process. Via provisioning, you can add a web part to the page by adding <View> tags (for list views) or <AllUsersWebPart> tags (for all other web parts) as a child of the <File> tag. You can only use these tags for pages you "own". If you want to add a web part to a page that is a part of someone elses' feature or site definition, you should use the object model to add it. You can programmatically add a web part by calling SPFile.GetLimitedWebPartManager(), and from there, calling AddWebPart. It way simple to develop for WSS 3.0 using webpart template for VS 2005. This extension contains the following tools to aid developers in building SharePoint applications: Visual Studio 2005 Project Templates Visual Studio 2005 Item Templates (items that can be added into an existing project) SharePoint Solution Generator HINT: Web Part template delivers some extremely useful features like automatic deployment and solution generation (former manifest). You can download beta of this extension from Regrettably, there are some cases where how WSS works with "pure" ASP.NET web parts will differ a little bit from how a "vanilla" ASP.NET server would work with an ASP.NET web part. This topic documents a few of those cases. IPersonalizable and "Dirty Behavior" ASP.NET has infrastructure to automatically detect when changes have been made to properties. For example, if you change part.Title to some other value, it can recognize under the covers that the part's data stream has changes and make appropriate updates. Because of differences in the way WSS stores data, however, we don't have the necessary plumbing to automatically detect changed properties in all cases. Therefore, in cases where you update the value of a property you should call .SetPersonalizationDirty() to inform the underlying infrastructure that the state of a property has changed. IPersonalizable.Load() IPersonalizable.Load is called before the web part is added to the web part manager. For this reason, the WebPartManager property will be null during load. IPersonalizable.Save() In some cases in ASP.NET, IPersonalizable.Save() is called. For example, during Import, IPersonalizable.Save() is called even if the web part returns false for .Dirty. In other cases, however, ASP.NET is a bit more efficient and does not call IPersonalizable.Save() if the web part returns false for .Dirty. However, WSS needs to regenerate the property data on saving a web part. For this reason, when any particular web part property has changed (e.g., the Title), we will call into the Web Part's Save method to extract IPersonalizable data. The implication of this is that web parts who implement IPersonalizable.Save() should be prepared to do work even if they return IsDirty = false. This is true in both the ASP.NET and WSS cases. In the WSS cases, though, it will be more often be true that .Save() gets called even if .IsDirty returns false. Differences in Behavior When WebParts are Accessed from the WSS Object Model The Windows SharePoint Services object model provides facilities for letting aribitrary code enumerate and interoperate with web parts. This object model could be called from command line executables, for example, where facilities such as ASP.NET's HttpContext and HttpRequest objects are not available. For this reason, when your web part is accessed "from the WSS object model", certain expecations you may have about objects being present may not hold up. This is a list of limitations and things you should be aware of: Based on the implications of this, you should ensure that for some operations (like IPersonalizable.Save()) you have a means of saving and persisting data even if the web part manager is not defined. Failure to persist data even if WebPartManager is null could result in data loss. General Philosophy Hybrid web parts let you use “modern” ASP.NET web part development techniques and capabilities combined with base Windows SharePoint Services capabilities. The general design is to, wherever possible, make implementing a hybrid web part operate like a “vanilla” ASP.NET web part. Creating a Hybrid Part To create a hybrid web part, one derives from Microsoft.SharePoint.WebPartPages.WebPart. Usage of certain features will automatically make your web part a Hybrid Web Part: Also, if your web part does not contain any XML serialization attribute hints, we will consider it a Hyrbid Web Part. Restrictions on a Hybrid Part Hybrid parts can not: Hybrid parts can have: Windows SharePoint Services Facilities you can use in a Hybrid Part ToolParts with Hybrid Toolparts are not automatically injected for Hybrid webparts (this is only done for ASP.NET WebParts to simulate the pure ASP.NET developer experience where there might be toolparts inside the ZoneTemplate on an EditorZone on an ASP.NET page.) So, for Hybrid Parts: We will always call GetToolParts and CreateEditorParts for Hybrid Parts.We will call CreateEditorParts and inject toolparts for ASP.NET parts. Ensure your web part is on the safe control list Every web part needs to be on the safe control list. To add a web part, get the assembly strong name. From there, add this into the Safe Control list. The safe control list is stored in web.config in the root of your web application. The <configuration>/<SharePoint>/<SafeControls> XML section contains a list of assemblies which have controls that have been marked as safe. Copy an existing tag, and modify it as appropriate for your assembly. Note: Even if you have added your assembly, it doesn't hurt to double check to ensure that the assembly name within web.config matches the current strong name of your compiled assembly. Consider turning on callstacks SharePoint by default swallows callstacks generated by web parts. You may want to expose these. To do this, open the web.config in the root of your web application. Set the Callstack attribute of the <configuration>/<SharePoint>/<SafeMode> tag to true. You may also want to turn off customer errors, under <configuration>/<system.web>/<customErrors> For ASP.NET Web Parts, either support APTCA or place them in the GAC ASP.NET web parts stored in the bin directory of a web application require that the AllowPartiallyTrustedCallers attribute flag (APTCA) be set for the assembly. WARNING: this flag has a number of securtiy implications so be sure to understand what APTCA implies. You may want to consider -- at least for debugging purposes -- placing your assembly in the GAC, In general, placing assemblies in the GAC for debugging purposes can help to narrow down problems. Use the toolpane to catch error messages In beta builds, the web part adder popup does not properly show error messages when a web part fails to add successfully. For this reason, you should use the toolpane to add your web parts. To use the toolpane, open the web part adder and select the "Show the toolpane" link at the bottom of the page. From the toolpane, drag and drop web parts onto the page. Debug your web parts You can use Visual Studio 2005 to debug your web parts. First, ensure that wherever your web part assembly is deployed to (either the GAC or the bin directory) has its PDB located next to it. If your part is GACed, you will need to go to %WINDIR%\Assembly and do a search for where your web part DLL is. Copy the PDB to that folder. Likely, you will want to set up a batch file to automate this process. Every time you want to debug, go to the Debug Menu | Attach to Process. You should attach to the w3wp.exe process (you may need hit your website to ensure w3wp is running, and select "Show Process from All Users" to ensure it shows up in the list). HINT: If you don’t want manually attach to w3wp every time, provide executable url for webpage which your webpart resides via Solution Properties/Debug/Start Browser with URL, and start debugging using F5 key. Ensure your .webpart or .dwp file is correct. Incorrect XML may be causing your web part to fail to import or export. The best thing to do is to let SharePoint create your .webpart/.dwp file for you, so you have a wellformed .dwp/.webpart file to compare and contrast with. To do this, (assuming you have site collection adminsitrative rights to your SharePoint site) Now, compare and contrast that .webpart/.dwp file to your own to ensure that you are not missing anything. Consider upping the trust level of the application. Office12 beta builds do not have finalized code access security settings. Therefore, depending on where you place your web part (bin vs. global assembly cache) you may experience issues where your code does not have enough rights to run properly. This may be the case even if your assembly is in the GAC (i.e., has full trust). You may want to try bumping up the trust level to full to see if this makes your issues go away. To do this, change your trust level to FullTrust. The current trust level is stored in web.config in the root of your web application. Find the <configuration>/<system.web>/<trust> tag, and change the "level" attribute to "Full". The web part user interface can be customized in a number of ways: Customizing the "Add Web Part" popup The "Add Web Part" popup is not highly customizable. However, it is possible to "suggest" which web parts the Add Web Part dialog should recommend on a zone by zone basis. To do this, you can declare a string on your zone called "QuickAdd-GroupNames". Any web part which has a corresponding match in its QuickAddGroup property will show up as a recommend part in this dialog. You can also determine whether lists and libraries should show by adding the QuickAdd-ShowListsAndLibraries="true|false" to your web part. Note that the web part gallery is a standard document library, and supports per-item permissions. You could use these per-item permissions to only allow a certain group of users to "read" a particular .webpart or .dwp file, and thereby "target" it to just those users. Keep in mind that this isn't a "web part security" feature, as anyone who can add web parts can upload arbitrary .webpart/.dwp files via the Import UI. Customizing ToolPanes"). Customizing Web Part Availabilty With the addition of per-item security to SharePoint document libraries, it is now possible to assign individual permissions to web part definitions in the site collection web part gallery. This lets you control which people see which kinds of web parts. Note that this is not a security feature -- any user who can add web parts can import arbitrary web part definitions, even if you don't expose that web part in a web part gallery. Customizing the Location of the Web Part Pane On most SharePoint pages, we will append a toolpane as a child of the form tag, and add it in. However, if you wish to have a custom placement of the web part toolpane, you can accomplish this by adding a control into the page with an ID of "MSO_ContentDiv". Using the "Quick Add Groups" feature of add web parts you can provide "strong suggestions" in the primary user interface (the add web part popup) for users. Ultimately the "Advanced Web Part Gallery" will show all available web parts. Beyond this, there is no really good way to customize web part exposure in the gallery on a page by page basis. One option is to remove the web part toolpane altogether by deriving your page from something other than Microsoft.SharePoint.WebPartPages.WebPartPage. WebPartPage-based pages have the WSS web part toolpane always autoinserted, so by deriving from some other page class you can define an alternate "add web part" experience. There isn't a good example of this at this point, and likely the work to do this would likely be pretty complex. Web part definitions inside of the web part gallery inside of sharepoint are inherently monolingual. The root site of a site collection is in a particular language (e.g., Spanish) and so the web part definitions (.webpart files, etc.) in the web part gallery are created in that language (Spanish). Now, if you are defining a SharePoint Feature or site definition, you can use resource tokens such that when the .webpart file is provisioned into that web part gallery, Therefore, the .webpart file you ship is resource pluggable, even if it ultimately gets provisioned into the web part gallery in a specific language. MOSS ships their web part files this way: if you take a look at the MOSS install, and look at the SearchWebParts feature (12\TEMPLATE\Features\SearchWebPart), you’ll see something like the SearchBestBets webpart file: Note the $Resources tag: it specifies that resources from 12\Resources\spscore.culture.resx (where culture is en-us, say) and the name of the resource to be used. <?xml version="1.0" encoding="utf-8"?><webParts> <webPart xmlns=""> <metaData> <type name="Microsoft.Office.Server.Search.WebControls.HighConfidenceWebPart,Microsoft.Office.Server.Search,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> <property name="Title" type="string">$Resources:spscore,SearchBestBetsWP_Title;</property> <property name="Description" type="string">$Resources:spscore,SearchBestBetsWP_Desc;</property> <property name="ChromeType">None</property> <property name="AllowMinimize" type="bool">true</property> <property name="AllowClose" type="bool">true</property> <property name="Hidden" type="bool">false</property> <property name="PartOrder" type="int">1</property> <property name="DisplayHCImage" type="bool">false</property> <property name="DisplayHCTitle" type="bool">false</property> <property name="DisplayHCProps" type="bool">false</property> <property name="DisplayHCDescription" type="bool">false</property> </properties> </data> </webPart></webParts> The web part implementation itself can be any language it wants to, as it’s ‘just code.’ However, since all SharePoint sites are cast into a particular language, the web part implementation should generally follow the language of the particular site. A frequent question is, where should I deploy my web parts? To the bin directory of a web application, or the global assembly cache? bin web parts have the benefit that you can use code access security to lock down the set of things the web part can do, providing a defense in depth benefit for web parts. e.g.., if you expect a web part to only render a weather forecast, you can deny it the ability to write to the file system, and the web part will fail if it attempts to do that. Note that by default code access security is very restrictive for web parts, so if your web part actually does anything you WILL need to configure CAS for your web part. It's not optional. Depending on your deployment mechanism, dealing with deploying CAS policies can be quite difficult. Also, bin web parts are deployed per web application, which means that every web application needs to have the assembly deployed in its local BIN directory. This can make deployment difficult - especially if you are using a technology like Windows Installer to do deployment. This can also be a benefit, as it allows you to isolate the availability of code to a subset of servers. GAC web parts don’t really benefit from CAS – generally, GAC web parts are always full trust – but they are “easier to deploy” because you only need to drop them in one location, and don’t need to configure CAS policies for them. All web parts and controls shipped by WSS and MOSS are deployed to the GAC. So, the difference between the two is a difference between ease-of-deployment (GAC) vs. having more security tools (code isolation, code access security) at your disposal.
http://blogs.msdn.com/dmandreev/archive/2006/12/07/wss-3-0-webparts-development.aspx
crawl-002
refinedweb
3,966
57.47
I am working on a NodeJS app with Angular2. In my app, I have a home page and search page. For home page I have an HTML page that will render for the localhost:3000/ and from home page user navigate to search i.e localhost:3000/search page that I handled by angular2 routes. I don’t have the page for the search page its view render by the angular2. But when I directly hit localhost:3000/search as I don’t have this routing in my node app it gives the error. I don’t know How to handle this in node app? If you enter localhost:3000/search directly in the browser navigation bar, your browser issues an request to ‘/search’ to your server, which can be seen in the console (make sure you check the ‘Preserve Log’ button). Navigated to If you run a fully static server, this generates an error, as the search page does not exist on the server. Using express, for example, you can catch these requests and returns the index.html file. The angular2 bootstrap kicks-in, and the /search route described in your @RouteConfig is activated. // example of express() let app = express(); app.use(express.static(static_dir)); // Additional web services goes here ... // 404 catch app.all('*', (req: any, res: any) => { console.log(`[TRACE] Server 404 request: ${req.originalUrl}`); res.status(200).sendFile(index_file); }); You need to use HashLocationStrategy import { LocationStrategy, HashLocationStrategy } from "angular2/router"; bootstrap(AppComponent, [ ROUTER_PROVIDERS, provide(LocationStrategy, { useClass: HashLocationStrategy }) ]); In your bootstrap file. If you want to go with PathLocationStrategy ( without # ) you must setup rewrite strategy for your server. I’ve been digging this topic for quite a time , and try a lot of method that don’ work . If you are using angular-cli and with express , I found a solution if the chosen answer doesn’t works for you . Try this node module : express-history-api-fallback[ Angular ] Change your app.module.ts file , under @NgModule > imports as following : RouterModule.forRoot(routes), ... This is so called : ” Location Strategy “ You probably were using ” Hash Location Strategy ” like this : [ Express & Node ] Basically you have to handle the URL properly , so if you want call “api/datas” etc. that doesn’t conflict with the HTML5 Location Strategy .[ Express & Node ] Basically you have to handle the URL properly , so if you want call “api/datas” etc. that doesn’t conflict with the HTML5 Location Strategy . RouterModule.forRoot(routes, { useHash: true }) , ... In your server.js file ( if you used express generator , I’ve rename it as middleware.js for clarity ) Step 1. – Require the express-history-api-fallback module . const fallback = require('express-history-api-fallback'); Step 2 . You may have a lot of routes module , sth. like : app.use('/api/users, userRoutes); app.use('/api/books, bookRoutes); ...... app.use('/', index); // Where you render your Angular 4 (dist/index.html) Becareful with the order you are writing , in my case I call the module right under app.use(‘/’,index); app.use(fallback(__dirname + '/dist/index.html')); * Make sure it is before where you handle 404 or sth. like that . This approach works for me : ) I am using EAN stack (Angular4 with cli , Express , Node )
https://exceptionshub.com/how-to-handle-angular2-route-path-in-nodejs.html
CC-MAIN-2021-21
refinedweb
531
59.19
Hi this is my first post and I need help on my first program on making some shapes in c++ using for statement and using *. Its an simple for statement program but I got nothing. Im trying to making an acute triangle using *. I got the triangle down but its coming out as an right triangle and I dont really know how to make it as as acute. This is what i have now _______________________________________________________________ #include <iostream> #include <iomanip> using namespace std; int main() { for (int i=0; i < 10; i++) { for (int j=0; j < i; j++) { cout << "*"; } cout << endl; } } _______________________________________________________________ thanks inadvance
https://www.daniweb.com/programming/software-development/threads/19706/need-help-with-first-c-program
CC-MAIN-2018-34
refinedweb
104
76.15
Introduction to MERN In this article, we'll be building and deploying an application built with the MERN stack to Heroku. MERN, which stands for MongoDB, Express, React, and Node.js, is a popular tech stack used in building web applications. It involves frontend work (with React), backend work (with Express and NodeJS) and a database (with MongoDB). Heroku, on the other hand, is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. For the database, we'll be using MongoDB Atlas, which is a global cloud database service for modern applications. This is more secure than the MongoDB installed locally on our server and it also gives us room for more resources on our servers. For the frontend we'll build a simple React app which makes POST requests to an API to add a user, and can also make GET requests to get all users. You can skip to any step with the table of contents listed below. Table of contents - Introduction to MERN - Let's Start Building - Building the React App - Creating the Backend - Connect the MongoDB Atlas Database - Calling APIs on the Frontend - Deploying to Heroku - Create a Heroku app - Configure package.json - Wrap up Let's Start Building Building the React App Note: Before we begin with our project, node must be installed on your computer. node also provides us with npm, which is used for installing packages. Install create-react-app create-react-app is used to create a starter React app. If you do not have create-react-app installed, type the following in the command line: npm i create-react-app -g The -g flag installs the package globally. Create the project directory create-react-app my-project cd my-project The above creates a directory 'my-project', and installs dependencies which will be used in the React starter app. After it's finished installing, the second command changes to the project directory. Start the app and make necessary edits npm start The command above starts the React application, which gives you a URL where you preview the project. You can then make necessary edits like changing images or text. Install axios npm i axios --save axios is a JavaScript library used to make HTTP requests easier. It'll be used to send requests from the frontend (React) to the APIs provided by the backend. Creating the Backend The backend manages the APIs, handles requests, and also connects to the database. Install the backend packages npm i express cors mongoose body-parser --save express: "Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web applications" - Express Documentation cors: "CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options" - cors Documentation mongoose: "Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports both promises and callbacks" - Mongoose Documentation body-parser: "Node.js body parsing middleware." - body-parser Documentation Create the backend folder mkdir backend cd backend Configure the backend Create an entry point server.js First, create a server.js file, which will be the entry point to the backend. touch server.js In server.js, type the following: const express = require('express'); const bodyParser = require('body-parser'); const cors = require('cors'); const path = require('path') const app = express(); require('./database'); ----- app.use(bodyParser.json()); app.use(cors()); ----- // API const users = require('/api/users'); app.use('/api/users', users); ----- app.use(express.static(path.join(__dirname, '../build'))) app.get('*', (req, res) => { res.sendFile(path.join(__dirname, '../build')) }) ----- const port = process.env.PORT || 5000; app.listen(port, () => { console.log(`Server started on port ${port}`); }); express.static delivers static files which are the ones built when npm run build is run on a React project. Remember, the built file is in the build folder. From our configuration, any request sent to /api/users will be sent to users API which we're about to configure. Configure the users API mkdir api touch api/users.js In api/users.js, add the following: const express = require('express'); const router = express.Router() ----- const User = require('../models/User'); ----- router.get('/', (req, res) => { User.find() .then(users => res.json(users)) .catch(err => console.log(err)) }) ----- router.post('/', (req, res) => { const { name, email } = req.body; const newUser = new User({ name: name, email: email }) newUser.save() .then(() => res.json({ message: "Created account successfully" })) .catch(err => res.status(400).json({ "error": err, "message": "Error creating account" })) }) module.exports = router In the code above, we create a GET and POST request handler which fetches all users and posts users. Fetching and adding a user to the database is aided by the User model we'll create. Create User model mkdir models touch models/user.js In models/user.js, add the following: const mongoose = require('mongoose'); const Schema = mongoose.Schema; ----- const userSchema = new Schema({ name: { type: String, required: true }, email: { type: String, required: true } }) module.exports = mongoose.model("User", userSchema, "users") In the code above, a schema is created for the user which contains the fields of the user. At the end of the file, the model ("User") is exported with the schema and the collection ("users"). Connect the MongoDB Atlas Database According to the docs, "MongoDB Atlas is the global cloud database service for modern applications." First we need to register on Mongo cloud. Go through this documentation to create an Atlas account and create your cluster. One thing worth noting is whitelisting your connection IP address. If you ignore this step, you won't have access to the cluster, so pay attention to that step. The cluster is a small server which will manage our collections (similar to tables in SQL databases). To connect your backend to the cluster, create a file database.js, which as you can see is required in server.js. Then enter the following: const mongoose = require('mongoose'); const connection = "mongodb+srv://username:<password>@<cluster>/<database>?retryWrites=true&w=majority"; mongoose.connect(connection,{ useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false}) .then(() => console.log("Database Connected Successfully")) .catch(err => console.log(err)); In the connection variable, enter your username (for MongoDB cloud), your password (cluster password), your cluster (address for your cluster) and the database (name of your database). All these can be easily discovered if you followed the documentation. Calling APIs on the Frontend All APIs will be available on localhost:5000 locally, just as we set up in server.js. When deployed to Heroku, the server will use the port provided by the server ( process.env.PORT). To make things easier, React allows us to specify a proxy which requests will be sent to. Open package.json and just before the last curly brace, add the following: "proxy": "" This way we can directly send requests to api/users. And when our site is deployed and built, the default port of our application will be used with the same API. Open App.js for React and add the following: import React, {useState, useEffect} from 'react' import axios from 'axios'; ----- const App = function () { const [users, setUsers] = useState(null); const [username, setUsername] = useState(""); const [email, setEmail] = useState(""); useEffect(() => { axios .get("/api/users") .then((users) => setUsers(users)) .catch((err) => console.log(err)); }, []); function submitForm() { if (username === "") { alert("Please fill the username field"); return; } if (email === "") { alert("Please fill the email field"); return; } axios .post("/api/users", { username: username, email: email, }) .then(function () { alert("Account created successfully"); window.location.reload(); }) .catch(function () { alert("Could not creat account. Please try again"); }); } return ( <> <h1>My Project</h1> {users === null ? ( <p>Loading...</p> ) : users.length === 0 ? ( <p>No user available</p> ) : ( <> <h2>Available Users</h2> <ol> {users.map((user, index) => ( <li key={index}> Name: {user.name} - Email: {user.email} </li> ))} </ol> </> )} <form onSubmit={submitForm}> <input onChange={(e) => setUsername(e.target.value)} <input onChange={(e) => setEmail(e.target.value)} <input type="submit" /> </form> </> ); }; export default App The useState and useEffect hooks are used to handle state and sideEffects. What is basically happening is that the first state of users is null and 'Loading...' is showed in the browser. In useEffect, [] is used to specify that at the componentDidMount stage (when the component is mounted), make an Axios request to the API which is running on localhost:5000. If it gets the result and there is no user, 'No user available' is displayed. Otherwise a numbered list of the users is displayed. If you want to learn more about useState and useEffect, check out this article - What the heck is React Hooks? With the form available, a POST request can be made to post a new user. The state of the inputs are controlled and sent to the API at localhost:5000 on submission. Afterwards, the page is refreshed and the new user is displayed. Deploying to Heroku To deploy your application to Heroku, you must have a Heroku account. Go to their page to create an account. Then go through their documention on how to create a Heroku app. Also check out the documentation on Heroku CLI. Create a Heroku App First, login to Heroku: heroku login This will redirect you to a URL in the browser where you can log in. Once you're finished you can continue in the terminal. In the same React project directory, run the following: heroku create This will create a Heroku application and also give you the URL to access the application. Configure package.json Heroku uses your package.json file to know which scripts to run and which dependencies to install for your project to run successfully. In your package.json file, add the following: { ... "scripts": { ... "start": "node backend/server.js", "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install npm && run build" }, ... "engines": { "node": "10.16.0" } } Heroku runs a post build, which as you can see installs your dependencies and runs a build of your React project. Then it starts your project with the start script which basically starts your server. After that, your project should work fine. engines specifies the versions of engines like node and npm to install. Push to Heroku git push heroku master This pushes your code to Heroku. Remember to include unnecessary files in .gitignore. After few seconds your site will be ready. If there are any errors, you can check your terminal or go to your dashboard in the browser to view the build logs. Now you can preview your site at the URL Heroku sent when you ran heroku create. That's all there is to it. Glad you read this far. Wrap Up Of course there is more to MERN stack applications. This article did not go as deep as authentications, login, sessions, and all that. It just covered how to deploy MERN stack applications to Heroku and work with MongoDB Atlas. You can find other articles like this on my blog - dillionmegida.com Thanks for reading.
https://www.freecodecamp.org/news/deploying-a-mern-application-using-mongodb-atlas-to-heroku/
CC-MAIN-2020-29
refinedweb
1,824
58.28
/* * config.h -- configure various defines for tcsh * * All source files should #include this FIRST. * * Configuration file for Harris Tahoe running CX/UX 5.1, CX/UX 7.1 * Compile in ucb universe; tested with gcc 1.42 and cc. */ #ifndef _h_config #define _h_config /****************** System dependant compilation flags ****************/ /* * POSIX This system supports IEEE Std 1003.1-1988 (POSIX). */ #undef. */ #ifdef _CX_UX # undef TERMIO #else # define TERMIO #endif /* * */ #define SYSVREL 0 /* * YPBUGS Work around Sun YP bugs that cause expansion of ~username * to send command output to /dev/null */ #undef YPBUGS #ifdef _CX_UX /* * /* Both BSD and SYSV options */ #endif /****************** local defines *********************/ /* * It appears like 5.x defines hcx and does not define _CX_UX and * 7.x defines _CX_UX and does not define hcx. In tcsh we currently * use _CX_UX, maybe in the future we should try something neutral */ #if defined(hcx) && !defined(_CX_UX) # define _CX_UX #endif #endif /* _h_config */
http://opensource.apple.com/source/tcsh/tcsh-63.2/tcsh/config/hcx
CC-MAIN-2014-15
refinedweb
146
67.65
?. ----- I'd say Brett is giving bad advice here in some cases. This seems to make sense if you are running a commercial site selling multiple products. However, if I happen to have a website where I am only selling green widgets, then what is so bad about the domain green-widgets.com? Not only does it get a boost because the keywords are in the domain name, but when people *see* the URL it immediately stands out as a site that may have exactly what they want to buy. Also, this doesn't seem to apply to a lot of information sites. If someone has a site about breeding dinosaurs, dinosaur-breeding.org sounds like a good domain name to me. And if there are any doubts about the power of inbound links, check out the cache of result number 3, the Smoky Mountain one. This guy's a titan! And, things like the fact if I run keyword1keyword2.com, I sure as heck would have optimizized the on page text with lots of instances of keyword1 and keyword2. I suspect other webmasters would to. I also totally disbelieve that Google is actually trying to parse out keyword1keyword2.com as if it were the same as keyword1-keyword2.com. Take a look at this very domain, webmasterworld.com. Parsing that URL without hyphens, is this a site for webmasters of the world, or is it a site for for those seeking to achieve world domination via the Internet? ;) If Google parsed that as the same as web-master-world, this site would then rank a lot lower than if webmaster-world. Because of this danger, not trying to parse URLs makes sense in a SE algo. Can't say anything more than Macguru, martinibuster and rfgdxm1. keywords in the URL may well be a factor, but they're only a small one. The problem is that this is too easy. All it takes is buying a domain name, and getting links back. No great content needed, just at least the term in the body or tags somewhere. Google will find a way to make sure that the Title of the site is well related to content soon I am sure. This DOES create a potential for spamming just becuase it is so easy. It IS possible to get great rankings with a very poor site. My feeling is that the google ranking algorithms are always changing, and as optimization technqiues catch up with them, they will change. This may include taking the content of the whole site into account as well as the page only, and maybe theming in incoming sites. Im not too worried. The only options are 1) to wait a while for Google to improve, or join the crowd using their knowledge which works at present. (we have done both for different sites) Long term, the only option is content content content and target target target and using as many of Googles stated 100 criteria (that you can guess) to make your sites more attractive to them. Spread your optimization efforts over several technqiues. Thats long term. I disagree in that they seem to be relatively large. However, things like the keyword in the anchor text of links, keyword in page title, on page text, and PageRank are also very important. A LOT of this will have to do with how competitive the search keywords are. For very non-competitive keywords, just having them in the URL, with a little on page optimization, may be enough to get close to the top. If there are a LOT of pages that match they keywords you are aiming it, not so. For example, I could probably come up #1 for a search on "capybara pollination" pretty easy with just the domain name capybara-pollination.org and a link from one page with a low PageRank. Dunno that many will ever search much for that though. ;) Absolutely. The only problem seems to be with those who do not use domain names to reflect the content of their own sites. If is on topic for blue widgets with stripes, where's the problem? It's simply telling the punter what the site is about. Furthermore, I bet 99.9% of sites that use descriptive domain names are actually descriptive of the actual content. Why would us off topic domain names? If Google uses this fact I just don't see a problem. It seems perfectly sensible to me. And again (I've been here before), names like this are fantastic for real world... billboards, sides of vans, etc. I just can't get my head around why anyone objects (other than perhaps that they don't use them). Age and wisdom are supposed to tell us that when, time and time again, friends and peers disagree with you continually and consistently, then perhaps you are, just this once, obviously, wrong, and that it's time for a rethink. So, colour me very young or very stupid and stubborn, because I still think that the no-brainer-toss-in-my-keywords domain 'trick' IS overly weighted in the algorithm. One bad apple and all that aside, in my area (travel, not affiliate stuff, where it's even worse), I too see high-up pages with titles such as new_document.html or default.html, and the sites with hyphenated-keyword domains are, pretty much without exception, Johnny-come-latelys, with little content, little optimisation, little pretty much anything you care to name, except the great big (yet hidden) signpost that screams 'I'm a mirror/doorway/gateway/harvester'. OK, disclaimer first - our site is numer one, or, at very worse, on page one, for pretty much any keyword-combo or phrase you could dream of. The last few Google updates have loved us, we're getting daily trawls and pretty much daily Fresh tags. Couldn't be better. So, this is not sour grapes, just a well tempered and informed-by-long-observation take on things. And that take is? - IT'S JUST TOO EASY TO DO. Sorry for shouting. No finesse, no time-served in terms of content and link-building, no reason whatsoever for that site to be where it is. You'll just have to trust me on this - I do know our market, and I do know the players - I'ts not that big a pond, and the bulk of these sites really are cookie-cutter types - 'use once and throw away' - that weave a breadcrumb trail home to Daddy. Not in a way that Google will follow, but once an enquiry is made through such a site, then the punter is led, smiling innocently, towards the real portfolio beef. With hindsight, I too would have gone for a slightly more on-the-money name for our site. But that was four years ago, and now it doesn't matter. I have no problem at all with the principle - aside from the fact that most of these domain names look pretty ugly - but the (supported in this thread) assumption that 'it's called we're-really-great-at-this.com so then, like, hey, they must be' seems to me to be surprisingly naiive. Why are you all so willing to implicitly trust a domain name, but 99.9% of you wouldn't trust a keyword metatag if you'd given birth to it yourself? That's what I find most odd. The fact that someone has gone to the not overly taxing extreme of spending a very few Dollars/Euros and come up with a sledgehammer-to-brain-and-wallet domain name is enough to convince a lot of people that the site will be, by extension, right on the money, no doubt about it deserving of a high ranking. It says so on the label, doesn't it? Maybe your neighbourhoods are different, but in mine, it looks like a get-ranked-quick scheme, and it does seem to work. EDITED TO ADD - Napoleon, we've head-butted on this before, I know. It's not the usage that bugs me - sure, it makes sense - no, it's the rewards. That, after all, is how this thread started out, and that is what I have a beef with. Regards, Mat In the light of this, isn't that a perfectly good fact to consider when ranking sites? It's a lot safer than many of the criteria they use. As for people clicking on it... well... perhaps they too have learned through experience that the domain name usually reflects the content. Also, maybe I am right about the real world - people actually remember the domain name far more readily if it is a proper construct. The neighborhood may be the problem. This goes back to my criticism of Brett: "Domain name: Easily brandable. You want "google.com" and not "mykeyword.com"." D'ya think everything on the WWW is somebody shilling something? I personally only use e-commerce sites rarely. I suspect there are many on the Internet like me. What if some gourmand who liked Italian foods wanted to share a lot of recipes he had collected and registered pasta-sauce-recipes.org. (And, before the mods jump on this, I checked and there is no domain like this registered.) Informational sites and the like will tend NOT to try and develop a "brand" for their domain, and choose a domain with keywords. As Napoleon said: "It's simply telling the punter what the site is about." No algo is perfect. NONE will work well for all searches. However, have you considered that the Google algo may work well in a lot of other instances? Also stop and consider that in a highly competitive and lucrative search area such as travel, there will be a LOT of SEO types doing all that they can to fight to the top, and succeed better at beating the Google algo. However, for the info sites like the hypothetical Italian food one I mentioned, the webmaster is a more likely to pick a name that gives tells the punters exactly what they will get. One question to mat: Have you checked exactly what the PageRank of these "Johnny-come-latelys, with little content" have? If they are doing this for money, I wouldn't be surpised that they have managed to use some other Google SEO tricks besides just a keyword1-keyword2 domain name. similar thread in parallel here at the moment: [webmasterworld.com...] The basic question is: All other things being equal, should The answer is of course NO! The added effect should be nullified. The sad reality for the moment and in the past is YES! (amongst others within Google, because of the anchortext effect). It has been mentioned earlier within a Google suggestion/discussion thread here [webmasterworld.com] and and there [webmasterworld.com] and with a bit of luck it has also been plugged in as a todo! :) I would think it to be best to just disregard the seperated words in anchortexts should they be part of, or equal the to-be-linked-to separated words of the core-url and instead to use other factors such as the nearest surrounding text etc. The link, and its Pagerank gift, and all the other secret benefits should be credited but not this see-through effect, in my mind. [edited by: vitaplease at 7:45 am (utc) on Sep. 6, 2002] Has anyone actually seen any statistics about what percentage of domains in actual use are commercial sites, rather than non-profit info sites? Absolutely no logic for a non-commercial site to use keyword stuffed domains that don't reflect the content. And, even in the case of commercial sites, I tend to think in most cases of a green-widgets.com the site actually does sell green widgets. >The answer is of course NO! The added effect should be nullified. But would the person running pasta-sauce-recipes.org I mentioned choose something like brandname.org? NO. What doesn't work well as an algo for johnson.com does rather well for pasta-sauce-recipes.org. And, if you throw the keyword in domain benefit out, then if johnson.com is selling blue widgets then I maybe I can succeed with stuffing lots of instances of "blue widgets" on my page and stuff the page text with keywords rather than the domain name. One tip here. I have seen multi-keyword url sites get high rankings in fairly uncompetitive terms with no back-links showing in Google for the keyword urls in anchortext. If you however check with alltheweb's backlink function you can see plenty links (all below PR4, but in quantaties together they do add effect) all using the keywords in url in anchortext. This occurs more often in non-English languages pages which naturally have much lower PR's. Don't get me wrong. Anyone should use pasta-sauce-recipes.org if that suits them and their clients/visitors. But poor old Johnson.com being in the pasta sauce recipe business long ago, before Google's algo kicked in, should have just as much chance in high rankings as pasta-sauce-recipes.org. The point here is that Google has done an excellent job in cleaning out keyword stuffing and other on-page SEO over-emphasis in their algo ranking. But my tendency is to think that for the most part sites with keywords in domains *do* tend to reflect the content. Stop thinking commercial for a second (which seems to be the area of interest of a lot of people posting here) and think of websites run by the little non-commercial sites and such. The Google algo tends to do well in most of those cases. By lowering the importance of the keyword in the domain, Google might well produce better SERPs on searches for terms that happen to be the sort people SEO for, but lower the quality in cases of searches where the search terms have few if nobody gunning after in the SEO world. Searches on travel will improve, while searches in other areas will get worse. I agree as it's only one part of the whole "ranking" process. If you had big-yellow-widgets.com and actually sold cars on the site - it wouldn't rank at all well due to the lack of Widget content and no links from Widget-related sites. But if you sold Big Yellow Widgets and had Widget pages and had good quality Widget links - it would! Man, I need to start selling Widgets.... rfgdxm1, as much as I sympathise, its an ugly commercial world out there. How to have two standards, how to choose between big-bad-commercial and mom-pop-non-profit? And who says the latter should be given a ranking boost? Also the little non-commercial sites will rank for what they should rank, because there are still enough other ranking factors. digitalghost, possible, but very difficult, the more competitive, and not very likely to be sought after by profesional SEO spammers, as they would add "purple bunnies' on-page to rank even better. >That's where I see the flaw in the algo.. Actually, thats where I see one of the strengths of the algo. If blue widgets suddenly are the cure for an awful desease, the site on blue-widgets containing only blue-widgets information can still help searchers looking for a remedy against that awful desease thanks to the inbound links. ROFLMAO. Good point, as you are right. One of the inherent problems with *any* search engine algo is that so long as there are some people out there who have a basic idea of how that algo works, these some people WILL find a way to score high by using that knowledge. The trick with any search engine is to come up with the best SERPs for a wide variety of search terms will come up *on average* with good results. When it comes to searches on very competive phrases in a commercial area, there will be a natural tendency for the quality of any search engine to suffer because the SEO types have played games to make sites that don't deserve it come up high. Personally, I have seen exceedingly few instances where keyword1-keywords.TLD domain name sites have lowered the quality much. This likely has to do with the fact I almost never do searches on terms the the SEO types care about. Google works very well for *me* because I don't use the Internet much to look for things to buy. Non-commercial sites don't tend to have domain names that don't fit what they are about. >Also the little non-commercial sites will rank for what they should rank, because there are still enough other ranking factors. Sure that is true? I ended up going out into Western Samoan namespace for my main site (anyone can check profile if they care) because domain name speculators have (foolishly) grabbed up one of the 3 main single keywords I had to optimize for. None in use because nobody will ever buy. Of the 4 other sites run by others on a similar theme, 2 of them aren't doing nearly as well. I got one of the 2 out of Google nowheresville by doing some SEO for him. The other ain't in the top 100 in Google on this all important search word, *even though* this site's home page has a PageRank of 5, equal to mine. As for it being an ugly commercial world out there, it has been my experience most people typically use the Internet looking for non-commercial sites, and only rather rarely commercial ones. Google needs to please the searchers out there to get eyeballs. Now where does Google rank in search engine popularity at the moment? #1. If Google has to choose between big-bad-commercial and mom-pop-non-profit, the obvious priority should be the latter. Also, have you considered for a moment that Google *makes money* from those "Sponsored Links" that comes up in searches? Google actually *benefits* if searches on commercial terms come up with lousy SERPs; those "Sponsored Links" then seem much more appealing to click on. ;) Selling something on the Internet? Sign up and pay for Google AdWords Select. THEN Google will care about your big-bad-commercial site and put it on page 1. Did you forget that Google was a big-bad-commercial website itself? They ain't in business to give businesses good SERPs for they search terms they want. That's why Google AdWords Select exists. At the moment Google is what it is because it is striving to serve the best most relevant information for free. The best information could be highly commercial or completely non-profit, I would wonder if you could judge for others where that would be wanted to be found and which (comm. or non-prof) sites generally deliver that quality. Google's algo using Weighted (PR), Motivated (anchortext), Citation (links) seems to be the best available to differentiate between results and not the single fact of being commercial or non-profit. Example: I would say the publication "Nature" to be highly informative and generally of high quality, furthermore it has peer-review and is edited for mistakes and sources. Is it commercial? Yes. The point of this thread's discussion is that, in some occasions, there seems to be an over-weighting of keyword-rich-seperated urls disturbing the above mentioned rankings of best information . The discussions hope to lead to improvement, with perfecting and not necessarily averaging out results. >The discussions hope to lead to improvement, with perfecting and not necessarily averaging out results. I'll accept that this happens on some occasions. I've never actually seen it be a material concern, and I normally use Google. Thus I would disagree that keyword-rich-separated URLs are overweighted. At the moment that this is averaging out seems very acceptible. Can you come up with a specific protocol that could be added to the Google algo that would be able to distiguish the difference between a keyword1-keyword2 URL that will properly weight these sites such that this causes good rankings of best information, and those that lead to poor rankings of information? Unless you can, to me the algo seem just right in this regard as it is now. No I'm not a programmer. 50 Google PhD's might though :) But conceptually some ideas? 1. In general, leave the weighting of the anchortext in the algo as it is. 2. If anchortext equals (or is a main part of) the to-be-linked to url, average out the keywords (in anchortext) weighting in the algo with the surrounding text. 3. For high-Pagerank pages such as DMOZ/ODP, use the description instead of the title for the anchortext algo value (again if title equals keywords of url). DMOZ/ODP tend to often use the url or company/site name for the title. 4. If there is no surrounding text, just use the link for Pagerank and all the other unknown factors. (would that be fair to Johnson.com ?) 5. There is probably an average of how many links in the whole Google index are motivated (descriptive word(s) in anchortext), how many are unmotivated and are equal to URL, and how many are completely non-related (e.g. click here). Google could use these averages to neutralise any over-emphasis created by multi-keyword url effects. any others - someone ? Wrong. At least part of it. Google is trying to serve the most relevant results to ensure they gain even more market share which will in turn increase revenue. They aren't in this game to make sure Billy can find pertinent research papers. Profit is the motive. Relevant results are the means to that end. Google has also created their share of problems. Pagerank is for sale and since that is definitely part of their algo it means that their SERPS are for sale. To the highest bidder with the most talented SEOs. Just because a site is listed in their free index and didn't purchase an ad directly from Google doesn't mean that the position wasn't paid for. Companies with large ad marketing budgets can afford to buy all the Pagerank they require and hire SEOs that know what to do with that Pagerank. Even though Google doesn't outright sell positioning doesn't mean they can escape from the commercial aspect of the medium. Since Google uses offsite factors in determining position, and they weight anchor text in inbound links, they've opened themselves up to manipulation from these off-the-page factors and it can be embarrasing for them. Fortunately, for Google, commercial sites strive to provide relevant content because that's how they make sales. The best information could indeed be commercial or non-profit, but Google is starting to lose it's ability to find "the best" information on its own because it's dollars driving the web and if Deep-Pockets wants to rank well for alley-oop widgets, Mr. Deep-Pockets will crush Ma And Pa Alley-Oop even if Ma and Pa Alley-Oop were lucky enough to purchase Alley-oop-widgets.com. I don't really care if Google tones down the URL component of their algo or not. All I want to know is how to manipulate the algo so that my client's sites rank well. Yes, I still get a thrill out of beating out the competition on a small budget, but for those deep-pocket clients that want results no matter what, it's quite easy to deliver. I don't care if Google becomes a "perfect" search engine, nor do my clients. They want to sell widgets. I want to help them sell widgets. Google just wants relevant widgets. As I see it, it's win/win. >>keyword rich urls are beating good pr and well optimized pages! Google doesn't care about that either. They want happy, mouse-clicking surfers that only have to click once or twice and leave. The thrust of the discussion seems to be that keyword rich domains are favored by Google with the theory (a good one at that) :) that it's because anchor text in inbounds reinforce the keywords in the domain, title, url, headers and body text. That makes the end-game pretty easy. Buy a keyword rich domain, or find a way to level the playing field. Competition has widgets.com eh? Well, get a good number or PR7 inbounds and a couple of PR8's and see how the competition holds up. Better yet, supply your own anchor text for those PR7 and PR8 inbounds. Then the competition, which is now below you in the serps, will be here in the forums debating the merits of Google toning down the PageRank component of their algo. ;) Exactly, you are pushing for the same :) Is the algo perfect? No. But there are so many ways to counter possible short-comings in the future: (at least if Google remembers where it came from) - Against buying pagerank [webmasterworld.com] - Against keyword rich urls [webmasterworld.com] - Against heavy interlinking of seperate sites [webmasterworld.com] and thats just some quick & dirty from one mind ;) Will cash-rich still have an extra? Yes. Always. Its an imperfect world. Not only on the web. But publish a brilliant idea, concept or overview and eventually you can surpass them all and more so and with near to no budget than in the real non-web world. (there are still mom&pop Pagerank 8 sites around for example). Only partially right. Google is definitely interested in gaining even more market share. However, if Google does a good job of getting Billy pertinent information for his research paper, Google may become Billy's search engine he uses for everything. The Google algo likely will do Billy well, because the sort of people with websites that have pertinent information for research papers likely aren't competing against commercial sites trying to set top SERPs for the sort of things people writing research papers use as search terms. Now, if Google can get Billy to be a regular user, do they care that much if their SERPs are great when he searches for "widget sales"? Or, is perhaps is would Google prefer lousy SERPs, and hope Billy will click on the Google Adword to the right that says "Discount Widget Emporium"? I noticed on a search for "peloponnesian war" there were no Adwords, so there Google has no benefit from lousy SERPs. ;) - Against heavy interlinking of seperate sites" both of which would hurt our perfectly legitimate site...we have our key phrase in the URL on our "directory" site, we have the main keyword in the URL of our multilingual site, and both sites are linked from every page of our information site the multilingual site has to be heavily cross linked...you can't tell where a visitor will arrive, and you can't guarantee to get them to the correct language by content negotiation alone...so penalising interlinking is penalising well organised multilingual sites All you whiners should wake up and realize that Google doesn't give a damn about what you think they should do. They are a "for-profit" business and they will (and should) do whatever they think is in THEIR best interests. Welcome to free enterprise. IMO most people here would be better off focusing on studying what they can control to improve THEIR rankings rather than complain about things they have no control over. Feel free to disagree. Exactly! If google makes it too easy for me to set up getabluewidget.com (without even bothering with a proper page title) and rank 5th - then their search relevance will suffer and someone else will come along with more relevant serps.
http://www.webmasterworld.com/forum3/5271-2-30.htm
CC-MAIN-2015-18
refinedweb
4,692
71.55
Where are my error codes? - Currently Being ModeratedApr 3, 2013 4:30 PM (in response to Gil Dawson) open /System/Library/Frameworks//CoreServices.framework/Versions/A/Frameworks/Carbon Core.framework/Versions/A/Headers/ or with Xcode, try open /Developer/Headers/FlatCarbon/ Do note that the former is newer than the latter.27" i7 iMac SL, Lion, OS X Mountain Lion (10.8.3), G4 450 MP w/Leopard, 9.2.2 - Currently Being ModeratedApr 3, 2013 5:48 PM (in response to baltwo) Thanks for your suggestion. I tried Finder -> Go -> Go to Folder... -> and pasted "/System/Library/Frameworks//CoreServices.framework/Versions/A/Frameworks/Carbon Core.framework/Versions/A/Headers/" in the dropdown dialog text box. It returned "The folder can't be found." Then I tried Finder -> Go -> Go to Folder... -> and pasted "/Developer/Headers/FlatCarbon/". It opened the folder in a Finder window. In that folder I found a file named "Errors.h". That file contains one line, #include <CoreServices/CoreServices.h> I found another file in that folder named "CoreServices.h". That file also contains just one line, #include <CoreServices/CoreServices.h> I'm not sure where to go from here, baltwo. I'm looking for a list of all error message numbers that MacOS can generate. Mark found such a file on his machine. --Gil - Currently Being ModeratedApr 3, 2013 6:09 PM (in response to Gil Dawson) My error copying the first one from the originating post. There's a double slash between the first Frameworks and CoreServices, mucking things up. Try: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Carbon Core.framework/Versions/A/Headers/ The second folder should have this:27" i7 iMac SL, Lion, OS X Mountain Lion (10.8.3), G4 450 MP w/Leopard, 9.2.2 - Currently Being ModeratedApr 3, 2013 6:11 PM (in response to Gil Dawson) I think I found it... I used the Find Any File app to search for 'MacErrors.h'. It found 21 matches. 4 were aliases. The remaining 17 were for various SDKs. One that looks like it might pertain to my current system is located at: /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/ Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/'MacErrors.h This file contains 3204 lines, starting with... /* File: CarbonCore/MacErrors.h Contains: OSErr codes. Version: CarbonCore-861.13~4 Bugs?: For bug reports, consult the following page on the World Wide Web: */ I think this is the file I'm looking for. I wonder why it's not in the same place as on your machine? No matter. This will be a big help. Thanks for your encouragement. --Gil - Currently Being ModeratedApr 3, 2013 6:17 PM (in response to baltwo) Ah, I see the mistake. Thanks, baltwo. I apologize for misclicking the star for you instead of the check. You definitely earned the check. --Gil - Currently Being ModeratedApr 4, 2013 12:30 PM (in response to Gil Dawson)
https://discussions.apple.com/message/21700426?tstart=0
CC-MAIN-2014-15
refinedweb
494
52.87
Solar Powered Soil Moisture Sensor I have build an Solar panel-powered Soil moisture sensor. I bought the lamps on Jula. Lamp1 Battery 2/3 AAA 100 mAh, 10 SEK, 1 euro Lamp2 Battery 2/3 AA 200 mAh, 5 SEK, 0,5 euro Lamp3 Battery LR44 40 mAh, 10 SEK, 1 euro, NOT TESTED YET I removed all the electronic on the PCB and used the PCB as a connection board. The solar panel gives around 1,4 V during a very sunny day. I had to add a step-up(0,8->3,3V) to be able to run a ATMEGA. My first idea was to connect 2 batteries in series, but that was too much work. Now everything fits in the parts that is included. Lamp1 is using a Pro Mini(fake), glued soil sensor on "arrow" Lamp2 is using my designed PCB with ATMEGA328p, soil sensor just put in soil, not glued at all. Both MCU are using Optiboot,. Pro Mini:Power-on LED removed and also step-down. Activity-LED is still in use. My designed PCB:, also with LED for startup and send OK I am using @mfalkvidd sketch, thank you. I have only add a few rows(LED and resend function) It sends data(Humidity/Volt/VoltPercent every 10 second, just for testing the hardware later on I will send maybe twice an hour or once an hour. I am measuring the battery voltage on a analog input. #include <SPI.h> #include <MySensor.h> #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0])) #define CHILD_ID_MOISTURE 0 #define CHILD_ID_BATTERY 1 #define SLEEP_TIME 10000 // Sleep time between reads (in milliseconds) (); gw.sendSketchInfo("Plant moisture w solar", "1.0"); gw.present(CHILD_ID_MOISTURE, S_HUM); delay(250); gw.present(CHILD_ID_BATTERY, S_MULTIMETER); for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) { pinMode(SENSOR_ANALOG_PINS[i], OUTPUT); digitalWrite(SENSOR_ANALOG_PINS[i],(); } gw.send; gw.sendBatteryLevel(batteryPcnt); resend((voltage_msg.set(batteryVolt, 3)), 10); digitalWrite(LED, HIGH); delay(200); digitalWrite(LED, LOW); gw.sleep(SLEEP_TIME); } gw; } New schematic. I forgot the step-up @mfalkvidd I hope this can help you to use them. It takes maybe 1 hour to one lamp. update I've let it be outdoor in the sun during 2-3 days now and it works well. yesterday I took one of them and placed it in the garage, totally black whole day not even a lamp. red line is when I moved it to the garage. it is sending every 10 second. After ~20 hours the battery was to low to be able to run Pro Mini this is genious Do not let it run out of battery. I had to disconnect the power from solar panel to step-up and charge it(sun)for a few hours to get it to work again, or you could use some kind of connectors to disconnect. I was "smart" and solder it directly to step-up. - martinhjelmare Plugin Developer I like this design. Do you think it will survive the Swedish winter days with their limited sun hours? @martinhjelmare said: I like this design. Do you think it will survive the Swedish winter days with their limited sun hours? Yes, I think so. Today I send data every 10 seconds so if I send it once an hour it should not be a problem during winter. It will test to simulate rain and see if it is sealed enough. What kind of soil moisture sensor is it? It is just a simple pitchfork, like this I love this concept. This kind of setup could be used for outdoor temp, light, humidity, and other things and not having to worry about power with it being solar. It also keeps the arduino shielded from weather and such also which is nice. I may use this design for some of my new sensors. @dbemowsk If you have the solar in the sun and the sensors in the shadow and protected from rain that will work. My idea is to use a solar for all my outdoor sensors but have a bigger solar panel and a bigger(more mah) that feeds my nodes, rain, temp, hum, pressure, light, UV and in future lightning. @mfalkvidd Thanks for posting that link! Even though I don't believe in these types of sensors, I used your link to buy some anyway just because they're so darn cheap! @NeverDie If you just want to know when it is time to water regular home plants (0.5-2 times per week normally) , they are more than good enough. If you want to maximize growth in a farming situation, you'll probably need to go for more advanced measurement methods. Good to know! I'll give it a try--I guess two months from now after they arrive. My wife has two dozen house plants, and so it would be nice if I could automate the monitoring. I have noisy measurement on analog input for battery voltage. Anyone that know how I can solve that? All pictures during night so there shouldn't be any sun that create power. See schematic above how it is connected. First Node No cap. Measures every 10 seconds, picture is 5 minute average. Second Node. 10uF electrolyte cap between GND and A0. Measure every 30 minute. Picture is 5 min average. Third Node No cap. Measure every 30 minute. Picture is 5 min average. I see a slightly better measurement on Seconds Node but can it be better? This is power directly from the battery and I think the battery should be more stable than this. I have other nodes were I measure the VCC on Arduino and that measurement is extremely stable. Maybe the analog input isn't better than what I get in the pictures? Could you show better scetch how you connect electicaly everything? how you sending data from arduino pro mini to Domoticz? In your scetch I see only power->battery->step-up->MCU - AWI Hero Member @flopp I had exactly the same problem with a solar powered node. I solved it by moving the battery measurement around in the sketch. The analog measurement is sensitive.. Could you show better scetch how you connect electicaly everything? how you sending data from arduino pro mini to Domoticz? In your scetch I see only power->battery->step-up->MCU Electric connection as the attached schematic and NRF you connect according to MySensors instruction. Data is sent through the NRF with attached sketch
https://forum.mysensors.org/topic/4045/solar-powered-soil-moisture-sensor
CC-MAIN-2017-17
refinedweb
1,090
75.3
Title: Yet Another Python Templating Utility (YAPTU) Submitter: Alex Martelli (other recipes) Last Updated: 2001/08/31 Version no: 1.5 Category: Text 6 vote(s) Description: "Templating" (copying an input file to output, on the fly inserting Python expressions and statements) is a frequent need, and YAPTU is a small but complete Python module for that; expressions and statements are identified by arbitrary user-chosen regular-rexpressions. Source: Text Source "Yet Another Python Templating Utility, Version 1.2" import sys # utility stuff to avoid tests in the mainline code class _nevermatch: "Polymorphic with a regex that never matches" def match(self, line): return None _never = _nevermatch() # one reusable instance of it suffices def identity(string, why): "A do-nothing-special-to-the-input, just-return-it function" return string def nohandle(string): "A do-nothing handler that just re-raises the exception")) block = self.locals['_bl'] if last is None: last = len(block) while i<last: line = block[i] match = self.restat.match(line) if match: # a statement starts "here" (at line block[i]) # i is the last line to to _not_ process elif self.restat.match(line): # found a nested statement nest = nest + 1 # update (increase) nesting elif nest==1: # look for continuation only at this nesting match = self.recont.match(line) if match: # found a contin.-statement nestat = match.string[match.end(0):].strip() stat = '%s _cb(%s,%s)\n%s' % (stat,i+1,j,nestat) i=j # again, i is the last line to _not_ process j=j+1 stat = self.preproc(stat, 'exec') stat = '%s _cb(%s,%s)' % (stat,i+1,j) # for debugging, uncomment...: print "-> Executing: {"+stat+"}" exec stat in self.globals,self.locals i=j+1 else: # normal line, just copy with substitution self.ouf.write(self.regex.sub(repl,line)) i=i+1 def __init__(self, regex=_never, dict={}, restat=_never, restend=_never, recont=_never, preproc=identity, handle=nohandle, ouf=sys.stdout): "Initialize self's attributes" self.regex = regex self.globals = dict self.locals = { '_cb':self.copyblock } self.restat = restat self.restend = restend self.recont = recont self.preproc = preproc self.handle = handle self.ouf = ouf def copy(self, block=None, inf=sys.stdin): "Entry point: copy-with-processing a file, or a block of lines" if block is None: block = inf.readlines() self.locals['_bl'] = block self.copyblock() if __name__=='__main__': "Test: copy a block of lines, with full processing" import re rex=re.compile('@([^@]+)@') rbe=re.compile('\+') ren=re.compile('-') rco=re.compile('= ') x=23 # just a variable to try substitution cop = copier(rex, globals(), rbe, ren, rco) lines_block = [line+'\n' for line in """ A first, plain line -- it just gets copied. A second line, with @x@ substitutions. + x+=1 # non-block statements MUST end with comments - Now the substitutions are @x@. + if x>23: After all, @x@ is rather large! = else: After all, @x@ is rather small! - + for i in range(3): Also, @i@ times @x@ is @i*x@. - One last, plain line at the end.""".split('\n')] print "*** input:" print ''.join(lines_block) print "*** output:" cop.copy(lines_block)). Add comment Number of comments: 1 # at the end of a line, Not specified Not specified, 2001/12/18 > If a statement must be embedded that does NOT end with a colon (e.g. , an assignment statement), then a Python comment MUST terminate its line; Of course you can use a ';' as well. Looks better.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52305
crawl-001
refinedweb
563
51.14
If I comment out a = ADC() and remove the comments from the two lines below it works. To me the logic appears to be the same. Code: Select all import pigpio as pg pi = pg.pi() class ADC(): def __init__(self): self.handle = pi.spi_open(0,50000,0) def __del__(self): pi.spi_close(self.handle) a = ADC() #handle = pi.spi_open(0,50000,0) #pi.spi_close(handle) pi.stop() /code] The error I get is [code] Exception AttributeError: "'NoneType' object has no attribute 'send'" in <bound method ADC.__del__ of <__main__.ADC object at 0xb6965110>> ignored I think an exception is being thrown when the close call tries to send a message - but why? Roger Woollett
https://www.raspberrypi.org/forums/viewtopic.php?p=756988
CC-MAIN-2020-16
refinedweb
115
77.64
If :-) This enables support for font mapping and Unicode translation on virtual consoles.. (Try "man bootparam" or see the documentation of your boot loader (lilo or loadlin) about how to pass options to the kernel at boot time.) If unsure, say Y.>.. The GNU C library glibc 2.1 and later, however, supports the Unix98 naming. All modern Linux systems use the Unix98 ptys. Say Y unless you're on an embedded system and want to conserve memory. Enable support for multiple instances of devpts filesystem. If you want to have isolated PTY namespaces (eg: in containers), say Y here. Otherwise, say N. If enabled, each mount of devpts filesystem with the '-o newinstance' option will create an independent PTY namespace., including security. This option enables these legacy devices; on most systems, it is safe to say N.. Add support for emulating a TTY device over the Blackfin JTAG. To compile this driver as a module, choose M here: the module will be called bfin_jtag_comm.. This driver supports Comtrol RocketPort and RocketModem PCI boards. These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or modems. For information about the RocketPort/RocketModem boards and this driver read <file:Documentation/serial/rocket.txt>. To compile this driver as a module, choose M here: the module will be called rocket. If you want to compile this driver into the kernel, say Y here. If you don't have a Comtrol RocketPort/RocketModem card installed, say N./README.cycladesZ>. To compile this driver as a module, choose M here: the module will be called cyclades. If you haven't heard about it, it's safe to say N.. Say Y here if you have a Moxa Intellio multiport serial card. To compile this driver as a module, choose M here: the module will be called moxa.. Support for SyncLink GT and SyncLink AC families of synchronous and asynchronous serial adapters manufactured by Microgate Systems, Ltd. () If you have a HSDPA driver Broadband Wireless Data Card - Globe Trotter PCMCIA card, say Y here. To compile this driver as a module, choose M here, the module will be called nozomi. This is a driver for the Multi-Tech cards which provide several serial ports. The driver is experimental and can currently only be built as a module. The module will be called isicom. If you want to do that, choose M here.. This line discipline provides support for the GSM MUX protocol and presents the mux as a set of 61 individual tty devices.".
http://www.kernel.org/doc/menuconfig/drivers-tty-Kconfig.html#VT
crawl-003
refinedweb
422
67.04
The last two articles were about how to pass and deal with primitive datatypes, Java objects, and JavaFX objects. This article focuses on JavaFX sequences. There are quite a number of Java classes implemented to represent JavaFX sequences. Which implementation is used depends on the input parameters during creation. All of the implementations share the interface Sequence, which we must therefore use when dealing with sequences in Java code. Using a specific sequence The interface Sequence is generic. When using it as a parameter in a method, we can define the exact type in the method signature or we leave the type open by defining a generic method. The first code sample shows a method which expects a sequence of Integer-objects. Note that the type is not exactly defined, but used as an upper bound. This needs to be done always. 1 import com.sun.javafx.runtime.sequence.Sequence; 2 import java.util.Iterator; 3 4 public class MyIntegerLibrary { 5 6 public static void printIntegerSum (Sequence<? extends Integer> seq) { 7 int sum = 0; 8 for (Iterator<? extends Integer> it = seq.iterator(); it.hasNext();) { 9 sum += it.next(); 10 } 11 System.out.println(sum); 12 } 13 } Code Sample 1: Calculating sum of an Integer sequence The method printIntegerSum in Code Sample 1 iterates through the sequence of Integers and calculates the sum. The JavaFX statement in Code Sample 2 creates a sequence of 5 integers and calls the method printIntegerSum. 1 MyIntegerLibrary.printIntegerSum( [2, 3, 5, 7, 11] ); Code Sample 2: Calling printIntegerSum Note that the type of this example is pretty strict. It is for example not possible to pass a sequence of Byte-objects. If you want to allow a more general sequence, you have to use a more general type. The sequence cannot be cast automatically. In the example above, the class Number can be used to allow any kind numbers in the given sequence. Using a generic sequence Using the interface Sequence in generic methods works as one would expect (with one exception, which will be covered later). Code Sample 3 defines a method which takes an arbitrary sequence and prints its elements using the method toString(). 1 import com.sun.javafx.runtime.sequence.Sequence; 2 import java.util.Iterator; 3 4 public class MySequencePrinter { 5 6 public static <T> void printSequence(Sequence<T> seq) { 7 for (Iterator<T> it = seq.iterator(); it.hasNext();) { 8 System.out.println(it.next().toString()); 9 } 10 } 11 } Code Sample 3: Printing the elements of an arbitrary sequence The following statement calls the method with an Integer-Sequence. 1 MySequencePrinter.printSequence( [2, 3, 5, 7, 11] ); Code Sample 4: Calling the Sequence-Printer When defining a method which expects a sequence and a single element of the same type, you have to define the type of the sequence bounded as in the first example. Code Sample 5 defines a generic method, which takes an arbitrary sequence and an element. As you can see, the type of the sequence-elements extend the type of the single element. 1 import com.sun.javafx.runtime.sequence.Sequence; 2 import java.util.Iterator; 3 4 public class MyElementCounter { 5 6 public static <T> void countElement(Sequence<? extends T> seq, T key) { 7 int sum = 0; 8 for (Iterator<? extends T>it = seq.iterator(); it.hasNext();) { 9 if (key.equals(it.next())) 10 ++sum; 11 } 12 System.out.println(sum); 13 } 14 } Code Sample 5: Counting element in a sequence The method countElement in Code Sample 5 counts how often the element appears in the sequence. The following statement calls the method. 1 MyElementCounter.countElement( [2, 3, 2, 2, 5, 7, 11, 2], 2 ); Code Sample 6: Calling counting element If you want to know more about generic types and generric methods, this chapter of the Java Tutorial is a good start. This article finishes the small series about how to deal with parameters passed from JavaFX to Java after primitive datatypes and Java objects were covered in the first article and JavaFX objects in the second article. The next article will be a short intermezzo on how to create JavaFX objects in Java code. After that will follow another small series which focuses some more on sequences.
http://blogs.sun.com/michaelheinrichs/entry/using_javafx_sequences_in_a
crawl-002
refinedweb
703
57.47
Last edited: January 25th 2018Last edited: January 25th 2018 In this notebook we will discuss orbits in general relativity. More specifically, we will look at orbits in the Schwarzschild geometry, named after Karl Schwarzschild (1873-1916) who solved the Einstein equation in 1916 [1]. This geometry describes the curvature of space-time around a spherically symmetric mass distribution. This is to an excellent approximation the curved space-time outside the Sun. The relativistic corrections to the Newtonian gravity is however minute. We will therefore consider a spacecraft, planet or star orbiting a massive black hole. It can be shown (see appendix at the end of this notebook) that the force on a particle of mass $m\ll M$ outside a spherically symmetric mass distribution of mass $M$ is given by \begin{equation} \mathbf F =-\frac{GMm}{r^3}\mathbf r\left(1 + \frac{3l^2}{c^2r^2}\right), \label{eq:force} \end{equation} where $G$ is the Newtonian gravitational constant, $r$ is the distance to the center of the mass distribution, $l$ is the angular momentum per unit mass and $c$ is the speed of light. # Import libraries import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle import time %matplotlib inline # Set common figure parameters fig_size = 10 newparams = {'axes.grid': True, 'lines.linewidth': 1.5, 'lines.markersize': 10, 'font.size': 14} plt.rcParams.update(newparams) We will be using natural units, i.e. we let $G=c=1(=\hbar=k_B)$. In these units any velocity is given in terms of the speed of light. That is, if a spacecraft has the velocity $v=0.1$ in natural units, it has the velocity $v=0.1c\approx 3\times 10^7\,\mathrm{m/s}$ in SI-units. We will measure distances in terms of the Schwarzschild radius, often called the event horizon, or the point of no return, in the case of Black Holes; see appendix. It is given by \begin{equation} R_\mathrm{S} = \frac{2MG}{c^2} = 2M. \end{equation} Nothing can escape once inside the Schwarzschild radius, even light. We will not be discussing this any further, but we will leave a couple of exercises on the subject later. We introduce the dimensionless variables \begin{equation} \rho\equiv \frac{r}{R_S} = \frac{r}{2M_\odot\mu} \quad \mathrm{and}\quad T\equiv \frac{\tau}{t_0}, \end{equation} where $t_0$ is some characteristic time of the system and $\tau$ is the proper time. Note that $t_0$ have mass dimension $1$. We can thus choose $t_0=R_\mathrm{S}$. Exercise: What is $R_\mathrm{S}$ for the Sun in SI-units? What is $t_0$ in SI-units? Answer: $\sim 3\,\mathrm{km}$, $\sim 10\,\mathrm{\mu s}$ In the appendix we show that the system can be described by a the equation \begin{equation} \mathcal E = \frac{1}{2}\left(\frac{\mathrm d r}{\mathrm d\tau}\right)^2 + V_\mathrm{eff}(r), \label{eq:energy_ein} \end{equation} where $\mathcal E$ is a constant and \begin{equation} V_\mathrm{eff}(r)\equiv -\frac{M}{r}+\frac{l^2}{2r^2}- \frac{Ml^2}{r^3} \label{eq:effpot} \end{equation} is an effective potential. The constant $\mathcal E$ reduces in the classical limit to the energy density of the particle. Note that the effective potential has extremum points at \begin{equation} r_\mathrm{min/max} = \frac{l^2}{2m}\mp \frac{l}{2}\sqrt{\frac{l^2}{m^2}-12}. \end{equation} In classical mechanics, the effective potential is given by \begin{equation} V_\mathrm{classical}(r)= -\frac{M}{r}+\frac{l^2}{2r^2}. \end{equation} This potential has a minimum at $r = l^2/M$ The last term in equation \eqref{eq:effpot} is a general relativistic correction. This term gives arise to several different types of orbits that we do not encounter in classical mechanics. To see this, we first visualize the potentials. In the code below we have used the newly defined units. def Veff(rho, l): """ Evaluates the effective potential in the Schwarzschild geometry. """ return -1/(2*rho) + l**2/(2*rho**2) - l**2/(2*rho**3) def Vclassical(rho, l): """ Evaluates the classical effective potential. """ return -1/(2*rho) + l**2/(2*rho**2) def K(Z): """ Evaluates the kinetic part of the energy density. Z = (x, y, u, v). """ rho2 = Z[0, :]**2 + Z[1, :]**2 return .5 * (Z[3, :]*Z[1, :] + Z[2, :]*Z[0, :])**2/rho2 N = 1000 rho = np.linspace(1, 30, N) l = 2 # Evaluate potentials VGR = Veff(rho, l) VCM = Vclassical(rho, l) # Max/min # Classical mechanics rhoCM_min = 2*l**2 VCM_min = -0.125/l**2 # General relativity rho_min = l**2 + l*(l**2 - 3)**.5 VGR_min = Veff(rho_min, l) rho_max = l**2 - l*(l**2 - 3)**.5 VGR_max = Veff(rho_max, l) plt.figure(figsize=(fig_size, fig_size/2)) # Potentials plt.plot(rho, VGR, label="GR") plt.plot(rho, VCM, label="CM") # Three different types of orbits edge = VGR_max - VGR_min plt.plot([0, rho[-1]], 2*[VGR_max + edge/6], "--m", label="Orbit 1") plt.plot([0, rho[-1]], 2*[(VGR_max + VGR[-1])/2], "-.m", label="Orbit 2") plt.plot([0, rho[-1]], 2*[(VCM_min + VGR[-1])/2], ":m", label="Orbit 3") # Extremum plt.plot(rhoCM_min, VCM_min, 'ko', label="Extremum") plt.plot(rho_min, VGR_min, 'ko') plt.plot(rho_max, VGR_max, 'ko') # Axes settings plt.ylabel(r"$V$") plt.xlabel(r"$\rho=r/R_S$") plt.ylim([VGR_min - edge/3, VGR_max + edge/3]) plt.xlim([0, rho[-1]]) plt.legend(loc=1) plt.show() In classical mechanics, there exists only two different types of orbits: There is only one circular orbit in classical mechanics, and it is stable. In general relativity there are three types of orbits: Note that there are two circular orbits in general relativity: one unstable (the maximum) and one stable (the minimum). The bound orbits are either circles or precessing ellipses. In the case of the scattering orbits, especially near the maximum, the orbit can hurl around the black hole several times before going off to infinity. We will encounter the three different orbits as examples later in this notebook. For a more complete analytical analysis, we refer you to ref. [1]. By using Newton's second law and the newly introduced variables, we can rewrite equation \eqref{eq:force} as \begin{equation} \frac{\mathrm{d}^2 \rho}{\mathrm{d}T^2} =-\frac{1}{2\rho^2}\left(1 + \frac{3l^2}{\rho^2}\right), \label{eq:eqmotion} \end{equation} where we have redefined $l$ as $l/R_s$. Classical orbits are located in a plane due to conservation of angular momentum. The same is true for orbits in the Schwarzschild geometry (see appendix). We can thus choose that the particle is moving in the $xy$-plane. Let $\mathrm \rho \equiv (x, y)$, $u\equiv \partial x/\partial \tau$ and $v\equiv \partial y/\partial \tau$. We can write (in natural units) equation \eqref{eq:force} as the four coupled first order differential equations \begin{equation} \frac{\mathrm{d}x}{\mathrm{d}T}=u,\quad \frac{\mathrm{d}u}{\mathrm{d}T}=-\frac{x}{2\rho^3}\left(1 + \frac{3l^2}{\rho^2}\right), \end{equation} \begin{equation} \frac{\mathrm{d}y}{\mathrm{d}T}=v,\quad \frac{\mathrm{d}v}{\mathrm{d}T}=-\frac{y}{2\rho^3}\left(1 + \frac{3l^2}{\rho^2}\right). \end{equation} Note that $u$ and $v$ are given as a fraction of the speed of light, which implies that $|u|\leq 1$, $|v|\leq 1$. We implement the fourth order Runge-Kutta method. If you are unfamiliar with this method, we refer you to one of our notebooks on the subject. In the code below, we define $A\equiv 1/2$ and $B\equiv 3l^2$ def getB(x, y, u, v): """ Computes the constant B. """ l2 = (x*v - y*u)**2 # Note that l2 has the "dimension" R_s return 3*l2 def getA(): """ Computes the constant A. """ return .5 def RHS(Z, A, B): """ Returns the time derivatives of Z = X, Y, U and V. """ rho = np.sqrt(Z[0]**2 + Z[1]**2) correction = 1 + B/rho**2 dUdtau = -A*Z[0]/rho**3*correction dVdtau = -A*Z[1]/rho**3*correction return np.array([Z[2], Z[3], dUdtau, dVdtau]) def rk4step(f, y, h, A, B): """Calculate next step of an IVP of an ODE with a RHS described by the RHS function with RK4. Parameters: f: function. Right hand side of the ODE. y: float. Current step (position). h: float. Step-length. Returns: Next step. """ s1 = f(y, A, B) s2 = f(y + h*s1/2.0, A, B) s3 = f(y + h*s2/2.0, A, B) s4 = f(y + h*s3, A, B) return y + h/6.0*(s1 + 2.0*s2 + 2.0*s3 + s4) def getOrbit(n, T_max, Z0): """ Computes the orbit of the particle using the fourth order Runge-Kutta method. Parameters: n : int. Number of iterations T_max : float. Stop time T=tau/t0 Z0 : numpy-array, len(4), float. Position and velocities Z0 = [x, y, u, v] Returns: numpy-array, size(4, n). Z = [x[], y[], u[], v[]] Position and velocities for the orbit. """ B = getB(*Z0) print("GR correction constant: %.2e"%(B)) A = getA() h = T_max/float(n) Z = np.zeros((4, n + 1)) Z[:, 0] = Z0 tic = time.time() for i in range(0, n): Z[:, i + 1] = rk4step(RHS, Z[:, i], h, A, B) print("%.5f s, run time with %i steps."% (time.time() - tic, n)) return Z One method for checking the numerical accuracy of our numerical method is to check if the conserved quantities of the system in fact are conserved. In the appendix we show that the angular momentum per unit mass $l = |\mathbf v\times \mathbf r|$ and the energy per unit mass $\mathcal E$ defined in equation \eqref{eq:energy_ein} are constants. We are now ready to look at some examples. Before we start we create a plotting function so that we don't repeate ourselves. We will plot the orbit in the $xy$-plane, the effective potential and $\mathcal E$. Moreover, we will check that $\mathcal E$ and $l$ are conserved. We will denote the event horizon as a gray circle. def plotOrbit(Z, lim_fact): """ Plots the orbit, energy and effective potential. Parameters: Z: numpy-array, size(4, n). Z = [x[], y[], u[], v[]] Position and velocities for the orbit. lim_fact: float. Axis limits are given lim_fact multiplied by the start position. """ plt.figure(figsize=(2*fig_size, fig_size)) rho = (Z[0, :]**2 + Z[1, :]**2)**.5 l = Z[0, :]*Z[3, :] - Z[1, :]*Z[2, :] # Trajectory ax = plt.subplot(2, 2, (1, 3)) plt.title("Orbit") ax.plot(Z[0, :], Z[1, :], label="Orbit") ax.plot(Z[0, 0], Z[1, 0], "o", label="Start") plt.xlabel(r"$x$") plt.ylabel(r"$y$") ax.plot(0, 0, ".", label="Origin") circle = plt.Circle((0, 0), radius=1, color="gray") ax.add_artist(circle) ax_lim = max(Z[0, 0], Z[1, 0]) plt.xlim([-lim_fact*ax_lim, lim_fact*ax_lim]) plt.ylim([-lim_fact*ax_lim, lim_fact*ax_lim]) plt.legend() # Effective potential plt.subplot(2, 2, 2) plt.title("Effective potential") r = np.linspace(1.5, 20, 500) plt.plot(r, Veff(r, l[0]), label="Effective pot.") e = Veff(rho[0], l) + K(Z[:, 0:2])[0] plt.plot([r[0], r[-1]], [e, e], label="Energy density") plt.xlabel(r"$\rho$") plt.ylabel(r"$V$") # Energy per unit rest mass plt.subplot(2, 2, 4) plt.title("Kinetic and potential energy") V = Veff(rho, l) Ek = K(Z) E = V + Ek plt.plot(V) plt.plot(Ek, label=r"$\frac{1}{2}\left(\frac{dr}{d\tau}\right)^2$") plt.plot(E, label=r"$E$") plt.xlabel("Step") plt.ylabel("Energy density") plt.legend() print("Relative change in\n E: %.2e\n l: %.2e"%((E[0] - E[-1])/E[0], (l[0] - l[-1])/l[-1])) plt.show() Z0 = [0, 10, .1845, 0] #Z0 = [0, 10, .1849, 0] n = 5000 tau_max = 102.7 Z = getOrbit(n, tau_max, Z0) plotOrbit(Z, 1.1) GR correction constant: 1.02e+01 0.24435 s, run time with 5000 steps. Relative change in E: 1.21e-03 l: 3.95e-08 #Z0 = [0, 20, .1, 0] #Z0 = [0, 10, 0.2, -0.2] #Z0 = [0, 10, .25, 0] #Z0 = [0, 10, 0.2, -.1] Z0 = [0, 10, .2, 0] n = 5000 tau_max = 5000 Z = getOrbit(n, tau_max, Z0) plotOrbit(Z, 1.1) GR correction constant: 1.20e+01 0.24000 s, run time with 5000 steps. Relative change in E: -1.01e-04 l: 1.52e-05 #Z0 = [0, 100, 0.05, -0.5] Z0 = [0, 10, 0.2, -.25] n = 5000 tau_max = 1000 Z = getOrbit(n, tau_max, Z0) plotOrbit(Z, 1.1) GR correction constant: 1.20e+01 0.25200 s, run time with 5000 steps. Relative change in E: -3.27e-04 l: 3.04e-07 It is now your time to play around with the codes and concepts introduced in this notebook. We leave you with a couple of exercises you can consider: In this appendix we will derive the expressions used to describe the motion of Mercury around the Sun. The same expressions holds for any (point) mass around a spherically symmetric mass distribution. It is assumed that the reader has some knowledge about Special Theory of Relativity and Einstein's summation convention. We will be using the metric convention $(-+++)$ and natural units $c=G=1 (=\hbar=k_B)$. Let us start by recalling a few concepts from special relativity. Consider the standard textbook setup in which a inertial system $S'$ is moving along the $x$-axis with constant velocity $v$ with respect to an inertial system $S$. The Lorentz' transformations are in this case given by $$\Delta t' = \gamma (\Delta t - v\Delta x),\quad \Delta x' = \gamma (\Delta x - v\Delta t),\quad \Delta y' = \Delta y,\quad \Delta z' = \Delta z,$$ where $\gamma = 1/\sqrt{1-v^2}$ as usual. The inverse transformations are $$\Delta t = \gamma (\Delta t' + v\Delta x'),\quad \Delta x = \gamma (\Delta x' + v\Delta t'),\quad \Delta y = \Delta y',\quad \Delta z = \Delta z'.$$ From this we can derive expressions for consepts like time dilation, length contraction and simultaneity. The position four-vector $x^\alpha$ is defined as the four-tuple with elements $x^0 = t$, $x^1 = x$, $x^2 = y$ and $x^3 = z$. More generally, we define a four-vector $a^\alpha$ as a four-tuple which Lorentz transforms in the same way as $x^\alpha$. Note in particular that the quantity $x_\alpha x^\alpha \equiv \eta_{\alpha\beta}x^{\alpha}x^{\beta}$ is Lorentz invariant. $\eta_{\alpha\beta} = \mathrm{diag}(-1, 1, 1, 1)$ is the Minkowsky metric tensor, that is, the metric tensor of flat space-time. This is the case for all four-vectors. Is is easy to show that for the Minkowsky (flat space) metric, we have $$\mathrm{d} s^2 = \eta_{\alpha\beta}\mathrm{d}x^\alpha\mathrm{d}x^\beta=-\mathrm{d}t^2 + \mathrm{d}x^2+ \mathrm{d}y^2+ \mathrm{d}z^2= -1.$$ This is even the case in General Theory of Relativity for a general metric $g_{\alpha\beta}$. Consider a particle moving along the $x$-axis with a velocity $v$. Let $t'\equiv \tau$ be the proper time of the particle. The four-velocity is given by $$u^\alpha\equiv\frac{\mathrm{d}x^\alpha}{\mathrm{d}\tau} = \left(\frac{\mathrm{d} t}{\mathrm{d} \tau}, \frac{\mathrm{d} \vec x}{\mathrm{d} \tau}\right) = \gamma\left(1, \frac{\mathrm{d} \vec x}{\mathrm{d} t}\right).$$ In our natural units, we see that $-\mathrm{d}\tau^2 = \mathrm{d}s^2$. This implies that $$u^\alpha u_\alpha = \frac{\mathrm{d} x^\alpha}{\mathrm{d}\tau}\frac{\mathrm{d} x_\alpha}{\mathrm{d}\tau} = \frac{\mathrm{d}s^2}{\mathrm{d}\tau^2} = -1.$$ Again, this holds even for curved space-time. Our starting point for the derivation of the equations is the Schwarzschild metric \begin{equation} \mathrm{d} s^2 = -\left(1-\frac{2GM}{c^2r}\right)(c\mathrm{d} t)^2 + \left(1-\frac{2GM}{c^2 r}\right)^{-1} \mathrm{d}r^2 + r^2\left(\mathrm{d}\theta + \sin^2\theta\mathrm{d}\phi^2\right). \end{equation} This metric describes the curvature of space-time around a spherically symmetric mass distribution. More more information or deeper insight, we refer you to e.g. [1]. We will for simplicity use natural units, in which $c=G=1 (=\hbar=k_B)$. The metric can in this case be written as \begin{equation} g_{\alpha\beta} = \mathrm{diag}\left(-(1-2M/r), (1-2M/r)^{-1}, r^2, r^2\sin^2\theta\right). \end{equation} We make the following observations (see [1] for more): From observation 1 and 2, it follows that the quantities $\xi^\alpha u_\alpha$ and $\eta^\alpha u_\alpha$ (remember that we use the Einstein summation convention) are conserved, where $u^\alpha$ is the four-velocity of the particle. More specifically, they are constants along the geodesic. Define $$e \equiv -\xi^\alpha u_\alpha = g_{\alpha\beta}\xi^\alpha u^\beta = \left(1-\frac{2M}{r}\right)\frac{\mathrm{d}t}{\mathrm{d}{\tau}}$$ and $$l\equiv \eta^\alpha u_\alpha = g_{\alpha\beta}\eta^\alpha u^\beta = r^2\sin^2\theta\frac{\mathrm{d}\phi}{\mathrm{d}{\tau}}.$$ $e$ is often called the energy per unit rest mass, since this is what the energy reduces to in flat space ($E=mu^t = m(\mathrm d t/\mathrm d \tau)$). In the same manner, $l$ is called angular momentum per unit rest mass because this is what it reduces to at low velocities. As in classical mechanics, the angular momentum and energy (per unit rest mass) is conserved. The conservation of angular momentum implies that the orbit lies in a given plane. We thus choose $\theta=\pi/2$ and $\mathrm{d}\theta = 0$ without loss of generality. In this case $$ -1=g_{\alpha\beta}u^\alpha u^\beta=-\left(1-\frac{2M}{r}\right) \left(u^t\right)^2 + \left(1-\frac{2M}{r}\right)^{-1} \left(u^r\right)^2 + r^2 \left(u^\phi\right)^2.$$ By writing $u^\alpha = \mathrm d x^\alpha/\mathrm d \tau$ and using the expressions for the constants $e$ and $l$, we can rewrite this as \begin{equation} \mathcal{E} = \frac{1}{2}\left(\frac{\mathrm{d} r}{\mathrm{d} \tau}\right)^2 + V_{\mathrm{eff}}(r), \label{eq:energy_ein} \end{equation} where we have defined the constant $$\mathcal E \equiv \frac{e^2 - 1}{2},$$ and the effective potential $$V_\mathrm{eff}(r)\equiv -\frac{M}{r}+\frac{l^2}{2r^2}- \frac{Ml^2}{r^3}.$$ Equation \eqref{eq:energy_ein} can be viewed as a statement that the total energy of the system is equal to the sum of the kinetic and potential energy. If we reinstate $c$ and $G$ and multiply by the mass of the object, $m$, on both sides of equation \eqref{eq:energy_ein}, we obtain \begin{equation} E = \frac{1}{2}mu^2 + \frac{L^2}{2mr^2} - \frac{GMm}{r} - \frac{GML^2}{c^2mr^3}, \label{eq:orben} \end{equation} where $u = (\mathrm d r/\mathrm d\tau)^2$ is the relativistic velocity, $E=\mathcal E m$ is the total energy and $L^2 = l^2m^2$ is the orbital angular momentum. In the classical limit ($c\to \infty$, $\mathrm d \tau\to\mathrm d t$) to the well known classical expression for the orbital energy \begin{equation} E_\mathrm{classical} = \frac{1}{2}mv^2 + \frac{L^2}{2mr^2} - \frac{GMm}{r}. \end{equation} In other words, the last term in equation \eqref{eq:orben} is a general relativistic correction to the classical expression. Note also that we are working with the proper time in equation \eqref{eq:orben}. We obtain the radial force by differentiating the last two terms in equation \eqref{eq:orben}. The result is \begin{equation} F = -\frac{\partial }{\partial r}\left(-\frac{GMm}{r} - \frac{GML^2}{c^2mr^3}\right)=-\frac{GMm}{r^2}\left(1 + \frac{3l^2}{c^2r^2}\right). \end{equation}
https://nbviewer.jupyter.org/urls/www.numfys.net/media/notebooks/GR.ipynb
CC-MAIN-2018-39
refinedweb
3,383
50.94
Act without doing, work without effort. Think of the small as large and the few as many. Confront the difficult while it is still easy; accomplish the great task by a series of small steps. - Lao-Tze Sometimes, the code you don't write is more important than the one you write. Whenever I start on a new task, my first question is "how can I do this without coding?". Here's a small (true) exmaple: We had a problem that serving files on an NFS mounted volume was slow for the first request and them it was good. Probably the mount went "stale" after a while. First option of learning the inner working of NFS mounts was dropped immediately - you can never know how much time this tinkering will take and if it'll work eventually. So I decided to keep the NFS mount "warm" by periodically accessing it. First Version: from time import sleep from os import listdir while 1: listdir("/path/to/nfs") sleep(10 * 60 * 60) and in crontab @reboot /usr/bin/python /path/to/script.py Then I thought - "cron", and second version came: from os import listdir listdir("/path/to/nfs")</code></pre> and in crontab: */10 * * * * /usr/bin/python /path/to/script.py And then last version (just crontab): */10 * * * * /bin/ls /path/to/nfs So down from 6 LOC to 3 LOC to 1 LOC - that's what I call produtivity :)
http://pythonwise.blogspot.com/2008_11_01_archive.html
CC-MAIN-2017-34
refinedweb
239
70.43
When creating events, use the following conventions for field names and abbreviations. Use the following naming conventions for field names: - All fields must be lower case. - Use snake case (underscores) for combining words. - Group related fields into subdocuments by using dot (.) notation. Groups typically have common prefixes. For example, if you have fields called CPULoadand CPUSystemin a service, you would convert them into cpu.loadand cpu.systemin the event. - Avoid repeating the namespace in field names. If a word or abbreviation appears in the namespace, it’s not needed in the field name. For example, instead of cpu.cpu_load, use cpu.load. - Use standardised names and avoid using abbreviations that aren’t commonly known. - Organise the documents from general to specific to allow for namespacing. The type, such as .pct, should always be last. For example, system.core.user.pct. - If two fields are the same, but with different units, remove the less granular one. For example, include timeout.sec, but don’t include timeout.min. If a less granular value is required, you can calculate it later. If a field name matches the namespace used for nested fields, add .valueto the field name. For example, instead of: workers workers.busy workers.idle Use: workers.value workers.busy workers.idle - Do not use dots (.) in individual field names. Dots are reserved for grouping related fields into subdocuments. - Use singular and plural names properly to reflect the field content. For example, use requests_per_secrather than request_per_sec.
https://www.elastic.co/guide/en/beats/libbeat/current/event-conventions.html
CC-MAIN-2017-17
refinedweb
244
55.1
Aug 13 2009 Calculate Prime Numbers: Sieve of EratosthenesColdFusion, Mathmatics, Performance Ahh... the quintessential math problem-- finding prime numbers. Last week while tinkering with a math challenge I needed to find all of the primes up to a given number. There was a version on cflib.org, but I thought I could do it in less code, so I dug in myself.I turned to Google for an algorithm and found a simple one called the Sieve of Eratosthenes. It works by making a list of all the numbers up to your max and systematically eliminating all the numbers which have have divisors other than 1 and themselves (primes). This is copied from Wikipedia: To find all the prime numbers less than or equal to a given integer n by Eratosthenes' method: My first version populated an array with all the integers up to your max number and deleted out the array elements as it eliminated them. The array shrinks in size until only primes are left. Please check out this post where I made some more performance modifications to my function at a later date: Generating Primes Revisited: My Modifications To The Sieve of Eratosthenes -. [code]function getPrimes(num) { var i = 1; var p = 1; var m = 0; var t = 0; var l = 0; var arr = []; var arr2 = []; while (++i <= num) arr[i-1] = i; while(p<arrayLen(arr)) { i = 0; arr2 = arr; while (++i <= arrayLen(arr2)) { m = arr[p]*arr2[i]; t = arr.indexOf(m); if(t>-1) arrayDeleteAt(arr,t+1); if(m>=num) break;} p++;} return arr;} [/code]This method was pretty effective, but performance absolutely sucked once you got past an upper bound of about 10,000. The function took roughly 30 seconds to find all the primes below 100,000. Firing up SeeFusion and watching stack traces showed 99% of the processing time was spent on this: [code]java.util.Vector.indexOf(Vector.java:335)[/code]Apparently searching an array many, many times is a very time consuming thing. Unfortunately I had to search the array if I expected to delete items out of it. My second version of the function left all the array indexes in and simply marked the non-primes as "0". This allowed me to always access specific array elements without searching. The downside is, the array doesn't shrink as you go, and the same non-primes will get marked over and over. At the end of the function it deletes out all 0's from the array and returns what's left (the primes). [code]function getPrimes2(num) { var i = 0; var p = 1; var m = 0; var l = 0; var arr = []; while (++i <= num) arr[i] = i; while(++p<arrayLen(arr)) { i = 1; if(!arr[p]) continue; while (++i <= num) { m = p*i; if(m<=num) arr[m] = 0; else break; }} i = arrayLen(arr)+1; while (--i > 0) { if(!arr[i]) arrayDeleteAt(arr,i);} return arr;} [/code]My second version was quite a bit faster. It could generate all the primes up to 1 million in about 30 seconds. The stack traces now showed a large amount of processing time doing this: [code]coldfusion.runtime.CFPage.ArrayDeleteAt(CFPage.java:491) [/code]Apparently it is also very costly to delete hundreds of thousands of array indexes. My final version only differed from the second in that I simply looped over the array at the end and built a new array out of the prime numbers in the first array. [code]function getPrimes3(num) { var i = 0; var p = 1; var m = 0; var l = 0; var arr = []; var arr2 = []; while (++i <= num) arr[i] = i; while(++p<arrayLen(arr)) { i = 1; if(!arr[p]) continue; while (++i <= num) { m = p*i; if(m<=num) arr[m] = 0; else break; }} i = 0; while (++i <= arrayLen(arr)) { if(arr[i] > 1 && arr[i] < num) arr2[arrayLen(arr2)+1] = arr[i];} return arr2;} [/code]Ahh, much better. Now I can generate all primes under 1 million in about 3 seconds. Performance is exponential though-- all the primes up to 10 million takes about 30 seconds still. I was surprised at the cost of searching and deleting from an array when performed millions of times. Who would have guessed it ended up being faster leaving the array in tact and copying out the parts you needed? Of course, these performance differences are completely negligible with small numbers under a few thousand. Regardless, I feel confident I've squeezed out about as much performance as I'm going to get with this algorithm in ColdFusion. It is a little tempting to compile a C++ or Java version just to compare raw performance. Also, in case you were wondering my prime calculator used roughly half the code as the example on cflib.org and was twice as fast at cranking out primes up to 10,000,000. (There's 664,579 of them) Update: I made it even faster! Please check out this post where I made some more performance modifications to my function at a later date: Generating Primes Revisited: My Modifications To The Sieve of Eratosthenes Sean Guthrie said at 12/02/2009 09:51:49 PM Wed Dec 2 20:43:20 MST 2009 (start time) ------------------------------------------------- Cacluations Complete Wed Dec 2 20:43:21 MST 2009 (end time) ------------------------------------------------- Answers Written to File //code section------ // Name : bitvector.cpp // Author : Sean Guthrie // Version : 3 // Description : Prime Calcuator using a bolean vector array #include <iostream> #include <fstream> #include <vector> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { int x=5000000; vector<bool>v1(x); int i=0; int c=0; unsigned long long xz=3; system("date"); cout << "-------------------------------------------------" << endl; for (int b=3;b+b<=x;) {i=c; for (int u=0;u!=x;u++) {i=i+b; v1[i]=1; if (i+b>x) {u=x-1;} } b=b+2; c++; } cout << "Cacluations Complete" << endl; system("date"); cout << "-------------------------------------------------" << endl; ofstream outFile; outFile.open("dat1.dat", ios::app); if (!outFile.fail()) //Verify File Open {outFile << "1" << endl; outFile << "2" << endl; for (int u=0;u!=x;u++) {if (v1.at(u)==1) {xz=xz+2;} else {outFile << xz << endl; xz=xz+2;} } } else //Open File Failed cout << "There was and error opening dat1.dat." << endl; cout << "Answers Written to File" << endl; return 0; } Sean Guthrie said at 12/02/2009 10:06:11 PM Brad Wood said at 12/03/2009 01:47:54 PM Skipping the evens isn't nearly that big of a deal then-- since when I go through and mark all the multiples of two as not primes, my short circuit will prevent all those from being evaluated again anyway. Basically, the number of usable indexes in the array shrinks the more multiples you eliminate. I'm afraid ColdFusion will never be quite as fast for this sort of stuff as C++ or Java. Looking at the stack traces, most of the processing going on is casting srings to doubles over and over again for all the numeric operations and searching the page for scopes. neither of those things would be an issue in a strongly typed language that didn't do scope hunting. Sean Guthrie said at 12/04/2009 12:53:09 AM
http://wwvv.codersrevolution.com/index.cfm/2009/8/13/Calculate-Prime-Numbers-Sieve-of-Eratosthenes
CC-MAIN-2019-22
refinedweb
1,209
68.4
I think the \r is a non-issue, but as stated earlier, it hurts nothing to try to strip them. I went ahead and posted the last currently planned features.-color and black and white default color schemes.-quick panel access to configurations stored in settings file.-multi-select available-option to turn off gutter styling (mainly for when you want to print)-code cleanup At this point I just need to do some good testing and write up the documentation. @agibsonswI will keep an eye on what you are working on. Good luck! working on unicode issues in html. Unicode fix is now in. I'm interested to hear a little more detail? Because we are using an HTML5 DOCTYPE, we could add <meta charset="UTF-8"> *immediately *after the opening tag, but it isn't strictly required link here. But I assume you've come across more specific issues? Unicode could not be written to the file for one. That just required some encoding to pass it to the file write command. But then the unicode characters didn't show up right. So really what needed to happen was the text needed to be converted to ASCII, but also escaped for HTML to something like &#XXXX;. So now I just pass the text to a function: @facelessuser: I came across encode() the other day and was considering 'xmlcharrefreplace', although I wasn't sure how it fitted in to the project. The Python docs don't indicate that encode() takes varargs - must be out of date. BTW, and out of interest, I conquered adding comments last night (in my head ). Here's my outline, but I'm not sure if it's worth doing. Nevertheless, it's interesting : Allowing a selection is too messy, as it would cover a number of spans. Similarly, extending the comment across the current span could be messy, particularly if within a comment line. (Why would someone put a comment in a comment, Doh!) I recall/believe that tooltips can be created with just CSS, particularly CSS3. They could even just be links, but a little JS might be better. Anyway, I haven't decided how far I might pursue this. Although, it's still kinda cool I shall have a look at your current work in a while. Regards, Andy. Anyway, I haven't decided how far I might pursue this. Although, it's still kinda cool I shall have a look at your current work in a while. Regards, Andy. @facelessuser He, he, I was looking at this yesterday, and wondered why ST didn't offer the second, default, argument. But it does - must have been in my blind-spot when I glanced at the docs. Curious as to why you created theme files, rather than just creating a dictionary? Perhaps you feel users would be more comfortable modifying the plist. My **idiom **(notice the Python reference there?) would be to delete all the ' self.bground = '' ' as they are now *always *assigned a value, but we had a similar discussion before Are 'activeGuide', etc., standard pList items in ST? Or have you made them up for the plug-in? (I've struggled to find a list of the possible items.) Andy. I just took the Monokai Bright Color Scheme file and modified it. I figured it needed to be in accordance with other scheme files. People can modify them if they want. I left everything in the settings section so it would be functional if some used it (I can't imagine people using the grayscale one though). In the gray scale one, I gutted everything scope wise because everything is black accept comments which is gray. If something was italic or something, I left it in. 'activeGuide' controls the color of the stippled tab guides. People can use my other plugin and convert the plist to a JSON file if they like that better for modifications. But I wanted to be universal with how I handle all input colors schemes. @facelessuser: I like this class PrintHtmlCommand(sublime_plugin.WindowCommand): def run(self, **kwargs): view = self.window.active_view() if view != None: PrintHtml(view).run(**kwargs) class PrintHtml(object): def __init__(self, view): self.view = view I still prefer my idea of skipping past tabs and spaces, to reduce the number of spans: while self.end <= self.line_end: scope_name = self.view.scope_name(self.pt) while (self.end <= self.line_end and (self.view.scope_name(self.end) == scope_name or (self.view.substr(self.end) in '\t', ' ', '']))): self.end += 1 but, then again, you need to keep an eye out for highlights and multi-selects. The penny hasn't quite dropped: are you using a table of two-columns, one for the gutter, and then spans in the second column? And using nbsp to keep your alignment? Pretty much. Just two table columns. Text content is always in a styled span. For code content I wrap it in a float:left div with width set to 100% and word break enabled. When I need to wrap, I just diff the column sizes and and then set the code column size to finite width. CSS <style type="text/css"> pre { border: 0; margin: 0; padding: 0; } table { border: 0; margin: 0; padding: 0; } div { float:left; width:100%; word-wrap: break-word; } .code_text { font: 12pt "Consolas", Consolas, Monospace; } .code_page { background-color: #FFFFFF; } .code_gutter { background-color: #E5E5E5;} span { border: 0; margin: 0; padding: 0; } body { color: #000000; } </style> html line output <tr> <td valign="top" id="L_0_1" class="code_text code_gutter"><span style="color: #000000;"> 1 </span></td> <td class="code_text"><div id="C_0_1"> <span style="color:#000000">{</span> </div></td> </tr> Sorry, being a bit dim.. You mention 'text content' and 'code content', but I can't see the distinction in your code (yet). Do you mean that the 2nd column (containing the code) always contains a div? And, as per your html output sample, are you using nbsp to align the line-numbers? I hope the width behaves for you in other browsers @facelessuser: I suspect it should be: encode('utf-8', 'xmlcharrefreplace') If you select some text to print, with the end point in the middle of a word, does it sometimes include an extra (following) character? Might just be mine and it's not a biggie. Added: scrub this question - sorted. Andy. No. 'ascii' is correct. I have already tested it. Select in sublime? It used to, then I fixed it . Oh, on a side note. I think I am going to add a shift click to hide/show the line numbers. Do you mean in the HTML output, using JS? Or just a shortcut in ST to hide the gutter (I kinda assumed there would already be one somewhere to do this?). I wrote a JS bookmarklet previously, so that I could hide elements on a page by clicking javascript:(function(){var d=document,useMine=true,prevEl;function AddHandler(orig,mine) {return function(e){if(useMine)mine(e);else if(orig)orig(e);};}function Myonmouseover(e) {var evt=e||window.event;var elem=evt.target||evt.srcElement;elem.style.outline='2px solid gray'; prevEl=elem;}function Myonmouseout(e){var evt=e||window.event;var elem=evt.target||evt.srcElement;elem.style.outline='';} function Myonclick(e){var evt=e||window.event;var elem=evt.target||evt.srcElement;elem.style.display='none';} function Myonkeydown(e){var evt=e||window.event;if(evt.keyCode==27){prevEl.style.outline='';useMine=false;}} d.onmouseover=AddHandler(d.onmouseover,Myonmouseover);d.onmouseout=AddHandler(d.onmouseout,Myonmouseout); d.onclick=AddHandler(d.onclick,Myonclick);d.onkeydown=AddHandler(d.onkeydown,Myonkeydown);})() But if I click a line number the whole page disappears because I'm actually clicking the 'ol' ! In the HTML with JS. That way, you just style the Gutter has hidden or shown. If the person changes there mind and wants to see the gutter, you just toggle it. Something like this probably. TOGGLE_GUTTER = \ """ <script type="text/javascript"> function show_hide_column(e, tables) { var i; var j; var evt = e ? e:window.event; if (evt.shiftKey) { var tbls = document.getElementsByTagName('table'); var t = tables; for (i = 0; i < t; i++) { var rows = tbls*.getElementsByTagName('tr'); var r = rows.length; var state; for (j = 0; j < r; j++) { cels = rows[j].getElementsByTagName('td'); if (state == null) { if (cels[0].style.display == 'none') { state = 'table-cell'; } else { state = 'none'; } } cels[0].style.display = state; } } } } document.getElementsByTagName('body')[0].ondblclick = function (e) { show_hide_column(e, %(tables)d); } </script> """ * Maybe not though, then I would have to re-wrap the HTML. We will see. @facelessuser: You are re-kindling my interest in JS and I had to dig out my neat JS that highlights a table row (and displays the row number). The neat bit is that it remembers, and re-instates, the previous background colour: but I know it's not relevant to what you're looking at var HighlightRows = function (tbl,colour,withIndex) { // Supply the table name (or object) and the colour you want for the highlight // E.g. HighlightRows('table1','yellow') // Any row background colour will be re-instated on mouseout; if a cell already // has a background colour this will remain. // If withIndex (optional) is true, pointing at a row will show a tooltip e.g. 'Row 24'. tbl = $(tbl); AddEvent(tbl,'mouseover',function (e) { var evt = e || window.event; var elem = evt.target || evt.srcElement; if ( elem.nodeName.toLowerCase() == 'td' ) { elem.prevColour = elem.parentNode.style.backgroundColor; elem.parentNode.style.backgroundColor = colour; if (typeof withIndex != 'undefined' && withIndex == true) elem.setAttribute('title','Row ' + elem.parentNode.rowIndex); } }); AddEvent(tbl,'mouseout',function (e) { var evt = e || window.event; var elem = evt.target || evt.srcElement; if ( elem.nodeName.toLowerCase() == 'td' ) { elem.parentNode.style.backgroundColor = elem.prevColour; } }); }; It is possible to hide a column just by changing the class-name of the table itself. It's also possible with a Perhaps using 'visible' instead of 'display' would prevent having to re-wrap the HTML, and the page wouldn't jump (but it's been a while.. ) If you set the display to 'table-cell' by default in the css then you wouldn't have to be concerned about null. That is, you can safely reference 'style.display' without any weird browser response. Andy. Nah, I mainly need to rewrap because the width of the table changes and the wrapping is no longer valid. Remove gutter, and now I need to wrap less, etc. It is no big deal, I was feeling lazy, but I think I will address it anyways . I like the idea of being able to toggle the gutter too much. It just occurred to me that I could handle my tooltips just by modifying the current 'scope_name' and adding to the colour dictionary. That is, when I reach the pt (or region) for the tooltip I can add ' tooltip' at the end of the scope-name and create a corresponding colour-dictionary entry. Then, when I build the , I can look for 'tooltip' in the scope-name (or just use a flag) and amend it to . (The title will just pop up when I point at the element.) I suppose a similar approach could have been taken with your highlighted text. However, it's probably not as simple as it sounds. Andy. I suppose a similar approach could have been taken with your highlighted text. However, it's probably not as simple as it sounds.
https://forum.sublimetext.com/t/copy-text-with-highlighted-colors/3910/127
CC-MAIN-2016-30
refinedweb
1,898
67.55
I am extremely new to programming and I have an issue trying to use a random. I am not looking for the direct answers, but maybe some guidance. I am working on an exercise that is supposed to help me learn the language, but I am struggling with trying to create a random that i need to call upon later in the program to create an average. I am supposed to create a program that allows a user to enter two dice sides. Then the system randomly rolls each dice multiple times and at the end averages the number rolled for each die. My program has a lot of comments so i can review it and know what function each line performs. Any assistance is greatly appreciated. :confused: Thanks, Anthony import java.util.Random; import java.util.Scanner; public class Dice { public static void main(String[] args) { //int is the Primitive Data type and Diceone and Dicetwo are the Variables I created int Diceone, Dicetwo; /**int is the Primitive Data type and the DiceonefirstRoll is the variable for holding the number entered by the user*/ int DicetwofirstRoll, Dicetwosecondroll, DicetwothirdRoll; //Calls the scanner class Scanner scan = new Scanner (System.in); //Sets Diceone to be the next integer entered via the keyboard System.out.print ("How many sides does die 1 have?"); Diceone = scan.nextInt(); //Sets Diceotwo to be the next integer entered via the keyboard System.out.print ("How many sides does die 2 have?"); Dicetwo = scan.nextInt(); //Closes the scanner for input scan.close (); //Do I need to call the random class like I do with the scanner in line 16? //Creates random dice roll System.out.print ("Die 1 first roll="); Random DiceonefirstRoll= new Random(Diceone) + 1; /**Trying make this so i can call it later. I am trying to have the # entered from Diceone and +1 due to not being able to receive a 0 on a die*/
http://www.javaprogrammingforums.com/%20object-oriented-programming/32471-question-about-randoms-trying-use-printingthethread.html
CC-MAIN-2015-40
refinedweb
320
72.16
Access Object Manager Fold and Unfold? Hi, I'm trying to create a shortcut for folding and unfolding the object manager. Is this possible in the API? You can check the post here for reference. The first post will do. Thank you Hi depending what you really want to do there is multiple ways for doing it. import c4d def Unfold(obj): obj.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET) obj.ChangeNBit(c4d.NBIT_OM2_FOLD, c4d.NBITCONTROL_SET) obj.ChangeNBit(c4d.NBIT_OM3_FOLD, c4d.NBITCONTROL_SET) obj.ChangeNBit(c4d.NBIT_OM4_FOLD, c4d.NBITCONTROL_SET) def Fold(obj): obj.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_CLEAR) obj.ChangeNBit(c4d.NBIT_OM2_FOLD, c4d.NBITCONTROL_CLEAR) obj.ChangeNBit(c4d.NBIT_OM3_FOLD, c4d.NBITCONTROL_CLEAR) obj.ChangeNBit(c4d.NBIT_OM4_FOLD, c4d.NBITCONTROL_CLEAR) def FoldSelected(): c4d.CallCommand(100004803) # Fold Selected def UnfoldSelected(): c4d.CallCommand(100004802) # Unfold Selected def FoldAll(): c4d.CallCommand(100004749) # Fold All def UnfoldAll(): c4d.CallCommand(100004748) # Unfold All # Main function def main(): FoldAll() c4d.EventAdd() # Execute main() if __name__=='__main__': main() Note: That Un/Fold Selected/All are commands already available. If you have any question, let me know. Cheers, Maxime. @m_adam said in Access Object Manager Fold and Unfold?: c4d.CallCommand(100004803) Thanks for the response. Sorry for the confusion, but I'm not after the folding/unfolding of an object but the whole manager. Here is a video posted in the link above for illustration: As stated in the link above, "The software is in Maya. It allows me to hide and unhide the outliner (object manager in C4D). It’s helpful since I can hide panel/manager that occupies space."The software is in Maya. It allows me to hide and unhide the outliner (object manager in C4D). It’s helpful since I can hide panel/manager that occupies space. The alternative is layouts. The problem is when I have to update the buttons (add or remove), I have to adjust it to other layouts. It’s a bit cumbersome by then. I’d prefer the toggle/collapse panels instead. Is this possible?" Thank you You don't need a script for that. When in the Object Manager, look at the menu (File/Edit/View...). There is this point pattern to the left of it that contains the window menu. Ctrl-leftclick on it, and it folds into a neat bar. Click the point pattern of this bar to unfold the OM again. I am not aware of a keyboard shortcut for that functionality - and I doubt it would make sense since you need to specify the window to fold anyway, which is done by clicking in this case (thereby pointing the mouse at the desired window). (You also don't have any window functions in the API, so you couldn't write a script even if you would be content with having as many keyboard shortcuts as possible Object Managers, which IMHO is awkward.) Hi Bentraje, thanks for reaching out us. With regard to your request, I confirm that it's not possible to programmatically fold/unfold a generic manager being the API involved in controlling the managers' behavior not exposed. In addition, being possible to open multiple managers (of the same or of a different type) at the same time it's currently impossible to identify on which windows to execute the fold/unfold task. Best, Riccardo Thanks for confirmation @Cairyn and @r_gigante Sorry for being picky. Just had some muscle memory from other softwares that wanted to port to C4D. Anyhow, will settle for the Ctrl+LMB as specified by @Cairyn Thanks again have a great day ahead!
https://plugincafe.maxon.net/topic/11594/access-object-manager-fold-and-unfold
CC-MAIN-2020-10
refinedweb
587
58.99
An IOSlave Tutorial Note This document is a work in progress. Please feel free to add constructive comments, make additions and edit accordingly. Introduction The ADFS IOSlave presents the contents of ADFS floppy disk images to the user by inspecting the ADFS filesystem stored within each image and using the KIOSlave API to return this information to client applications. Although the underlying Python module was written with a command line interface in mind, it provides an interface which can be used by an IOSlave without too much of an overhead. This document outlines the source code and structure of the ADFS IOSlave and aims to be a useful guide to those wishing to write IOSlaves, either in Python or C++. Annotated code It is convenient to examine the source code as it is written in the kio_adfs.py file. However, we can at least group some of the methods in order to provide an overview of the IOSlave and separate out the details of the initialisation. Initialisation Various classes and namespaces are required in order to communicate with the KIOSlave framework. These are drawn from the qt, kio and kdecore modules: from qt import QByteArray from kio import KIO from kdecore import KURL The os and time modules provide functions which are relevant to the operation of the IOSlave; the sys and traceback modules are useful for debugging the IOSlave: import os, sys, traceback, time The ADFSlib module is imported. This provides the functionality required to read disk images: import ADFSlib We omit the debugging code to keep this tutorial fairly brief. This can be examined in the distributed source code. The slave class We define a class which will be used to create instances of this IOSlave. The class must be derived from the KIO.SlaveBase class so that it can communicate with clients via the DCOP mechanism. Various operations are supported if the appropriate method (represented as virtual functions in C++) are reimplemented in our subclass. Note that the name of the class is also declared in the details.py file so that the library which launches the Python interpreter knows which class to instantiate. class SlaveClass(KIO.SlaveBase): """SlaveClass(KIO.SlaveBase) See kdelibs/kio/kio/slavebase.h for virtual functions to override. """ An initialisation method, or constructor, is written which calls the base class and initialises some useful attributes, or instance variables. Note that the name of the IOSlave is passed to the base class's __init__ method: def __init__(self, pool, app): # We must call the initialisation method of the base class. KIO.SlaveBase.__init__(self, "adfs", pool, app) # Initialise various instance variables. self.host = "" self.disc_image = None self.adfsdisc = None We create a method to parse any URLs passed to the IOSlave and return a path into a disk image. This initially extracts the path from the KURL object passed as an argument and converts it to a unicode string: def parse_url(self, url): file_path = unicode(url.path()) The presence of a colon character is determined. If one is present then it will simply be discarded along with any preceding text; the remaining text is assumed to be a path to a local file. at = file_path.find(u":") if at != -1: file_path = file_path[at+1:] Since we are implementing a read-only IOSlave, we can implement a simple caching system for operations within a single disk image. If we have cached a URL for a disk image then we check whether the URL passed refers to an item beneath it. This implies that the cached URL is a substring of the one given. If the disk image has been cached then return the path within the image: if self.disc_image and file_path.find(self.disc_image) == 0: # Return the path within the image. return file_path[len(self.disc_image):] An uncached URL must be examined element by element, as far as possible, comparing the path with the local filesystem. Since a valid path will contain at least one slash character then we can immediately discard any paths which do not contain one, returning None to the caller: elements = file_path.split(u"/") if len(elements) < 2: return None Starting from the root directory, we apply each new path element to the constructed path, testing for the presence of the objects it refers to. If no object can be found at the path given then None is returned to the caller to indicate that the URL was invalid. If a file is found then it is assumed that an ADFS disk image has been located; a check could be performed to verify this. Finally, if all the path elements are added to the root directory, and the object referred to is itself a directory, then the URL is treated as invalid; it should have referred to a file. path_elements, elements = elements[:1], elements[1:] while elements != []: path_elements.append(elements.pop(0)) path = u"/".join(path_elements) if os.path.isfile(path): break elif elements == [] and os.path.isdir(path): return None elif not os.path.exists(path): return None At this point, it is assumed that a suitable image has been found at the constructed path. The characters following this path correspond to the path within the image file. We record the path to the image and construct the path within the image: self.disc_image = path image_path = u"/".join(elements) If not already open, it is necessary to open the image file, returning None if the file cannot be found. (Its presence was detected earlier but it is better to catch any exceptions.) try: adf = open(self.disc_image, "rb") except IOError: return None We attempt to open the disk image using a class from the support module. This will read and catalogue the files within the image, storing them in an internal structure. However, if a problem is found with the image, then an exception will be raised. We tidy up and return None to signal failure in such a case, but otherwise return the path within the image: try: self.adfsdisc = ADFSlib.ADFSdisc(adf) except ADFSlib.ADFS_exception: adf.close() return None return image_path The get file operation Various fundamental operations are required if the IOSlave is going to perform a useful function. The first of these is provided by the get method which reads files in the disk image and sends their contents to the client. The first thing this method does is check the URL supplied using the previously defined parse_url method, reporting an error if the URL is unusable: def get(self, url): path = self.parse_url(url) if path is None: self.error(KIO.ERR_DOES_NOT_EXIST, url.path()) return Having established that the disk image referred to is valid, we now have a path which is supposed to refer to a file within the image. It is now necessary to attempt to find this file. This is achieved by the use of the as yet undeclared find_file_within_image method which will return None if a suitable file cannot be found: adfs_object = self.find_file_within_image(path) if not adfs_object: self.error(KIO.ERR_DOES_NOT_EXIST, path) return Since, at this point, an object of some sort was located within the image, we need to check whether it is a directory and return an error if so. The details of the object returned by the above method is in the form of a tuple which contains the name, the file data and some other metadata. If the second element in the tuple is a list then the object found is a directory: if type(adfs_object[1]) == type([]): self.error(KIO.ERR_IS_DIRECTORY, path) return For files, the second element of the tuple contains a string. In this method, we are only interested in the file data. Using the base class's data method, which we can access through the current instance, we send a QByteArray to the client: self.data(QByteArray(adfs_object[1])) The end of the data string is indicated by an empty QByteArray before we indicate completion of the operation by calling the base class's finished method: self.data(QByteArray()) self.finished() The stat operation The stat method returns information about files and directories within the disk image. It is very important that this method works properly as, otherwise, the IOSlave will not work as expected and may appear to be behaving in an unpredictable manner. For example, clients such as Konqueror often use the stat method to find out information about objects before calling get, so failure to read a file may actually be the result of a misbehaving stat operation. As for the get method, the stat method initially verifies that the URL supplied is referring to a valid disk image, and that there is a path within the image to use. Unlike the get method, it will redirect the client to the path contained within the URL if the parse_url fails to handle it. This allows the user to use URL autocompletion on ordinary filesystems while searching for images to read. def stat(self, url): path = self.parse_url(url) if path is None: # Try redirecting to the protocol contained in the path. redir_url = KURL(url.path()) self.redirection(redir_url) self.finished() #self.error(KIO.ERR_DOES_NOT_EXIST, url.path()) return As before, nonexistent objects within the image cause errors to be reported: adfs_object = self.find_file_within_image(path) if not adfs_object: self.error(KIO.ERR_DOES_NOT_EXIST, path) return In the tuple containing the object's details the second item may be in the form of a list. This would indicate that a directory has been found which we must deal with appropriately. However, for ordinary files we simply generate a suitable description of the file to return to the client: if type(adfs_object[1]) != type([]): entry = self.build_entry(adfs_object) If the object was not a file then we must ensure that the path given contains a reference to a directory. If, on the other hand, the path is either empty or does not end in a manner expected for a directory then it is useful to redirect the client to an appropriate URL: elif path != u"" and path[-1] != u"/": # Directory referenced, but URL does not end in a slash. url.setPath(unicode(url.path()) + u"/") self.redirection(url) self.finished() return If the URL referred to a directory then a description can be returned to the client in a suitable form: else: entry = self.build_entry(adfs_object) After a description of the object found has been constructed, it only remains for us to return the description (or entry in the filesystem) to the client by submitting it to the KIOSlave framework. This is performed by the following operation to the statEntry method, and is followed by a finished call to indicate that there are no more entries to process: if entry != []: self.statEntry(entry) self.finished() else: self.error(KIO.ERR_DOES_NOT_EXIST, path) The mimetype operation In many virtual filesystems, the mimetype operation would require a certain amount of work to determine MIME types of files, or sufficient planning to ensure that data is returned in a format in line with a predetermined MIME type. Since its use is optional, we do not define a method to determine the MIME types of any files within our virtual filesystem. The client will have to inspect the contents of such files in order to determine their MIME types. The listDir operation The contents of a directory on our virtual filesystem are returned by the listDir method. This works like the stat method, but returns information on multiple objects within a directory. As for the previous methods the validity of the URL is checked. If no suitable directory found within the disk image, the path component of the original URL is extracted and the client redirected to this location. Note that the url argument is a kdecore.KURL object. def listDir(self, url): path = self.parse_url(url) if path is None: redir_url = KURL(url.path()) self.redirection(redir_url) self.finished() return Having established that the path refers to a valid disk image, we try to find the specified object within the image, returning an error if nothing suitable is found: adfs_object = self.find_file_within_image(path) if not adfs_object: self.error(KIO.ERR_DOES_NOT_EXIST, path) return If the path does not end in a slash then redirect the client to a URL which does. This ensures that either a directory will be retrieved or an error will be returned to the client: elif path != u"" and path[-1] != u"/": url.setPath(unicode(url.path()) + u"/") self.redirection(url) self.finished() return If a file is referenced then an error is returned to the client because we can only list the contents of a directory: elif type(adfs_object[1]) != type([]): self.error(KIO.ERR_IS_FILE, path) return A list of files is kept in the second item of the object returned from the support module. For each of these files, we must construct an entry which is understandable to the KIOSlave infrastructure in a manner similar to that used in the method for the stat operation. # Obtain a list of files. files = adfs_object[1] # Return the objects in the list to the application. for this_file in files: entry = self.build_entry(this_file) if entry != []: self.listEntry(entry, 0) # For old style disk images, return a .inf file, too. if self.adfsdisc.disc_type.find("adE") == -1: this_inf = self.find_file_within_image( path + "/" + this_file[0] + ".inf" ) if this_inf is not None: entry = self.build_entry(this_inf) if entry != []: self.listEntry(entry, 0) # We have finished listing the contents of a directory. self.listEntry([], 1) self.finished() The dispatch loop Although not entirely necessary, we implement a dispatchLoop method which simply calls the corresponding method of the base class: def dispatchLoop(self): KIO.SlaveBase.dispatchLoop(self) Utility methods We define some methods which, although necessary for this IOSlave to work, are not standard virtual methods to be reimplemented. However, they do contain code which might be usefully reused in other IOSlaves. Building file system entries We create a method to assist in building filesystem entries to return to the client via the KIOSlave infrastructure. For this example, some basic details of each file or directory in the disk image is derived from information contained within and stored within standard KIO.UDSAtom instances. def build_entry(self, obj): entry = [] We check the type of object passed to the method in order to determine the nature of the information returned. For files we do not provide a predetermined MIME type, leaving the client to determine this from data retrieved from the disk image. if type(obj[1]) != type([]): # [name, data, load, exec, length] name = self.encode_name_from_object(obj) length = obj[4] Files stored in old disk images require accompanying .inf files to describe their original attributes. The following code provides details of these files which are not actually present in the disk image, but are generated automatically by this IOSlave: "Continued..." if self.adfsdisc.disc_type.find("adE") == -1 and \ obj[0][-4:] == ".inf": # For .inf files, use a MIME type of text/plain. mimetype = "text/plain" else: # Let the client discover the MIME type by reading # the file. mimetype = None else: name = self.encode_name_from_object(obj) length = 0 mimetype = "inode/directory" Having determined the MIME type we now declare all the relevant attributes of the object and return these to the caller: atom = KIO.UDSAtom() atom.m_uds = KIO.UDS_NAME atom.m_str = name entry.append(atom) atom = KIO.UDSAtom() atom.m_uds = KIO.UDS_SIZE atom.m_long = length entry.append(atom) atom = KIO.UDSAtom() atom.m_uds = KIO.UDS_MODIFICATION_TIME # Number of seconds since the epoch. atom.m_long = int(time.time()) entry.append(atom) atom = KIO.UDSAtom() atom.m_uds = KIO.UDS_ACCESS # The usual octal permission information (rw-r--r-- in this case). atom.m_long = 0644 entry.append(atom) # If the stat method is implemented then entries _must_ include # the UDE_FILE_TYPE atom or the whole system may not work at all. atom = KIO.UDSAtom() atom.m_uds = KIO.UDS_FILE_TYPE if mimetype != "inode/directory": atom.m_long = os.path.stat.S_IFREG else: atom.m_long = os.path.stat.S_IFDIR entry.append(atom) if mimetype: atom = KIO.UDSAtom() atom.m_uds = KIO.UDS_MIME_TYPE atom.m_str = mimetype entry.append(atom) return entry Encoding filenames The following two internal methods deal with the translation of paths and filenames within the disk image to and from canonical URL style paths. These are only of interest to those familiar with ADFS style paths. def encode_name_from_object(self, obj): name = obj[0] # If the name contains a slash then replace it with a dot. new_name = u".".join(name.split(u"/")) if self.adfsdisc.disc_type.find("adE") == 0: if type(obj[1]) != type([]) and u"." not in new_name: # Construct a suffix from the object's load address/filetype. suffix = u"%03x" % ((obj[2] >> 8) & 0xfff) new_name = new_name + "." + suffix return unicode(KURL.encode_string_no_slash(new_name)) def decode_name(self, name): return unicode(KURL.decode_string(name)) Locating objects within a disk image A key element in the construction of an IOSlave is the method used to map between the URLs given by client applications and the conventions of the virtual filesystems represented by the IOSlave. In this instance, the disk image contains a working snapshot of an ADFS filesystem which must be navigated in order to extract objects referenced by the client. Since the ADFSlib support module provides objects to contain the directory structure contained within the disk image, only a minimal amount of work is required to locate objects, and this mainly involves a recursive examination of a tree structure. However, there are a few special cases which are worth mentioning. In this method, the path argument contains the path component of the URL supplied by the client in the standard form used in URLs. def find_file_within_image(self, path, objs = None): A convention we have adopted is the use of a default value of None for the final argument of this method. Omission of this argument indicates that we are starting a search from the root directory of the disk image. As we descend into the directory structure, recursive calls to this method will supply suitable values for this argument but, for now, a reasonable value needs to be substituted for None; this is a structure containing the entire filesystem: if objs is None: objs = self.adfsdisc.files If an empty path was supplied then it is assumed that an object corresponding to the root directory was being referred to. In such a case a slash character is given as the name of the object, and the list of objects supplied is given as the contents of the root directory: if path == u"": # Special case for root directory. return [u"/", objs, 0, 0, 0] For non-trivial paths, we split the path string into elements corresponding to the names of files and directories expected as we descend into the filesystem's hierarchy of objects, then we remove any empty elements: elements = path.split(u"/") elements = filter(lambda x: x != u"", elements) For each object found in the current directory, we examine each object and compare its name to the next path element expected. for this_obj in objs: if type(this_obj[1]) != type([]): # A file is found. If a file is found in the filesystem, we translate its name so that we can compare it with the next path element expected: obj_name = self.encode_name_from_object(this_obj) if obj_name == elements[0]: # A match between names. For files, we perform the simple test that the current path element is the final one in the list, and return the corresponding object if this is the case. If this is not the case then the URL is likely to be invalid: if len(elements) == 1: # This is the last path element; we have found the # required file. return this_obj else: # There are more elements to satisfy but we can # descend no further. return None If a direct match between names is not possible then, for old-style disk images, it is possible that the path is referring to a .inf file; we check for this possibility, applying the same check on the remaining path elements as before: elif self.adfsdisc.disc_type.find("adE") == -1 and \ elements[0] == obj_name + u".inf": If successfully matched, a .inf file is created and returned, otherwise a None value is returned to indicate failure: "Continued..." if len(elements) == 1: file_data = "%s\t%X\t%X\t%X\n" % \ tuple(this_obj[:1] + this_obj[2:]) new_obj = \ ( this_obj[0] + ".inf", file_data, 0, 0, len(file_data) ) return new_obj else: # There are more elements to satisfy but we can # descend no further. return None else: # A directory is found. As for files, the names of directories found in the filesystem are translated for comparison with the next path element expected: obj_name = self.encode_name_from_object(this_obj) if obj_name == elements[0]: # A match between names. Unlike files, directories can occur at any point in the descent into the filesystem. Therefore, we either return the object corresponding to the last path element or descend into the directory found: if len(elements) == 1: # This is the last path element; we have found the # required file. return this_obj else: # More path elements need to be satisfied; descend # further. return self.find_file_within_image( u"/".join(elements[1:]), this_obj[1] ) At this point, no matching objects were found, therefore we return None to indicate failure: return None
https://wiki.python.org/moin/IoSlavesTutorial?highlight=(CategoryDocumentation)
CC-MAIN-2017-04
refinedweb
3,525
55.03
libs/gil/example/packed_pixel.cpp /* Copyright 2005-2007 Adobe Systems Incorporated Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at). See for most recent version including documentation. */ /*************************************************************************************************/ /// \file /// \brief Example file to show how to deal with packed pixels /// \author Lubomir Bourdev and Hailin Jin /// \date February 27, 2007 /// /// This test file demonstrates how to use packed pixel formats in GIL. /// A "packed" pixel is a pixel whose channels are bit ranges. /// Here we create an RGB image whose pixel has 16-bits, such as: /// bits [0..6] are the blue channel /// bits [7..13] are the green channel /// bits [14..15] are the red channel /// We read a regular 8-bit RGB image, convert it to packed BGR772, convert it back to 8-bit RGB and save it to a file. /// Since the red channel is only two bits the color loss should be observable in the result /// /// This test file also demonstrates how to use bit-aligned images - these are images whose pixels themselves are not byte aligned. /// For example, an rgb222 image has a pixel whose size is 6 bits. Bit-aligned images are more complicated than packed images. They /// require a special proxy class to represent pixel reference and pixel iterator (packed images use C++ reference and C pointer respectively). /// The alignment parameter in the constructor of bit-aligned images is in bit units. For example, if you want your bit-aligned image to have 4-byte /// alignment of its rows use alignment of 32, not 4. /// /// To demonstrate that image view transformations work on packed images, we save the result transposed. #include <algorithm> #include <boost/gil/extension/io/jpeg_io.hpp> using namespace boost; using namespace boost::gil; int main() { bgr8_image_t img; jpeg_read_image("test.jpg",img); //////////////////////////////// // define a bgr772 image. It is a "packed" image - its channels are not byte-aligned, but its pixels are. //////////////////////////////// typedef packed_image3_type<uint16_t, 7,7,2, bgr_layout_t>::type bgr772_image_t; bgr772_image_t bgr772_img(img.dimensions()); copy_and_convert_pixels(const_view(img),view(bgr772_img)); // Save the result. JPEG I/O does not support the packed pixel format, so convert it back to 8-bit RGB jpeg_write_view("out-packed_pixel_bgr772.jpg",color_converted_view<bgr8_pixel_t>(transposed_view(const_view(bgr772_img)))); //////////////////////////////// // define a gray1 image (one-bit per pixel). It is a "bit-aligned" image - its pixels are not byte aligned. //////////////////////////////// typedef bit_aligned_image1_type<1, gray_layout_t>::type gray1_image_t; gray1_image_t gray1_img(img.dimensions()); copy_and_convert_pixels(const_view(img),view(gray1_img)); // Save the result. JPEG I/O does not support the packed pixel format, so convert it back to 8-bit RGB jpeg_write_view("out-packed_pixel_gray1.jpg",color_converted_view<gray8_pixel_t>(transposed_view(const_view(gray1_img)))); return 0; }
http://www.boost.org/doc/libs/1_43_0/libs/gil/example/packed_pixel.cpp
CC-MAIN-2014-52
refinedweb
437
58.99
13 November 2007 11:14 [Source: ICIS news] LONDON (ICIS news)--World oil supply increased 1.4m bbl/day in October as non-OPEC outages receded and OPEC volumes increased, but demand was revised down 500,000 bbl/day, the International Energy Agency (IEA) said on Tuesday.?xml:namespace> In its monthly oil market report, the IEA said recovering production in ?xml:namespace> October OPEC supply increased 410,000 bbl/day to 31.2m bbl/day. Half the rise came from “Signs of higher November supply from Global demand was revised down 500,000 bbl/day due to higher prices, weaker-then-expected data from the The IEA said that coupled with lower GDP growth, these revisions extended to the 2008 forecast, which has been adjusted down by 300,000 bbl/day. World demand now averages 85.7m bbl/day in 2007 and 87.7m bbl/day for 2008. WTI crude hit a new record above $98/bbl in early November driven by lower crude stocks, constrained supplies and new political tensions. “There are, however, strong indications that high prices are depressing demand, which together with signs of higher output from Saudi Arabia, Iraq and Nigeria, have capped further price gains,” said the report. OECD industry stocks fell 29.5m bbl/day in September, with Japanese crude stocks falling to their lowest level in at least 20 years. Global refinery crude runs were seen at 73.5m bbl/day in the fourth quarter, revised lower by 700,000 bbl/day on weaker demand, increased offline capacity and higher planned maintenance in
http://www.icis.com/Articles/2007/11/13/9078137/world-oil-supply-up-1.4m-bblday-in-october-iea.html
CC-MAIN-2014-49
refinedweb
261
54.83
I do have a homework problem that I am having trouble with. I am new to programing, so I will explain this the best I can. ClassB is derrived from ClassA and has the same method names as ClassA. One is overriden and one is new. Class A has one virtual function that can be overriden. I want to set string example5 to the string in InstanceB.TestB. "TestB from ClassB" I have tried casting IntanceB to class B, but am not getting any where with that. I also have tried using the is and as operators and am getting errors. I keep getting the string equal to "TextB from ClassA". The classes are initiated the way they are supposed to be an I believe it has something to do with that. ClassA InstanceB = new ClassB(); Any pointers in the right direction or help understanding why you would initiate InstanceB in such a way would be appreciated. Code:namespace TestIt { class Program { class ClassA { public virtual string TestA() { return "TestA from ClassA"; } public string TestB() { return "TestB from ClassA"; } public virtual string TestC() { return "TestC from ClassA"; } } class ClassB : ClassA { public override string TestA() { return "TestA from ClassB"; } new public string TestB() { return "TestB from ClassB"; } } static void Main(string[] args) { ClassA InstanceA = new ClassA(); ClassA InstanceB = new ClassB(); ClassB InstanceC = new ClassB(); object p = InstanceC; InstanceB = p as ClassB; string example5 = InstanceB.TestB(); } } }
http://cboard.cprogramming.com/csharp-programming/136348-upcasting.html
CC-MAIN-2014-35
refinedweb
234
68.91
NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab. Support Forum » Dont edit the makefile with Notepad I edited the makefile with notepad and it messes it up, probably removes the new lines chars sine the carry return is missing were these files created in Unix/Linux/Mac? so it it gives you an error like C:UsersLUISGA~1AppDataLocalTemp/ccquwCKt.o: In function main': C:\NerdsKitSourceCode\initialload/initialload.c:29: undefined reference tolcd_init' main': C:\NerdsKitSourceCode\initialload/initialload.c:29: undefined reference to it can't find the references to the libs because the makefile is messed up heads up Hey, perhaps your Notepad has removed tab characters from the Makefile. It needs tabs after the target specification: target: dep1 dep2 dep3 ... <tab>command... Make sure that the tabs are still there, eight spaces won't do the trick. Also, your error seems to be with the C code itself, not with the Makefile; make sure that you have #include "../libnerdkits/lcd.h" in initialload.c, and that initialload.c resides in a directory on the same level as libnerdkits/. it was not the tabs, or maybe the encoding of the file changed for 8 bit to 16 bit chars. because of C:/Users/LUISGA~1/AppData/LocalTemp/ccquwCKt.o: In function main..... it's a linker error. the way I solved this yesterday was to copy the Makefile again and edit it with the code editor. luisgarciaalanis, you're right, I wasn't reading carefully: C:\\Users\\LUISGA~1\\AppData\\Local\\Temp/ccquwCKt.o: In function main: C:\\NerdsKitSourceCode\\initialload/initialload.c:29: undefined reference to 'lcd_init' indeed, a linker error. Probably lcd.o wasn't getting linked in with the rest. Glad you solved it! Please log in to post a reply.
http://www.nerdkits.com/forum/thread/106/
CC-MAIN-2020-40
refinedweb
301
52.36
fuchsia / third_party / android / platform / frameworks / native / 6867a125cfe50c12a4b67a0a3e785d10e417802c / . / opengl / specs / EGL_ANDROID_blob_cache.txt blob: e9846943d147e90e1b9447b25203f5af53b41f18 [ file ] [ log ] [ blame ] Name ANDROID_blob_cache Name Strings EGL_ANDROID_blob_cache Contributors Jamie Gennis Jamie Gennis, Google Inc. (jgennis 'at' google.com) Status Complete Version Version 3, December 13, 2012 Number EGL Extension #48 Dependencies Requires EGL 1.0 This extension is written against the wording of the EGL 1.4 Specification Overview Shader compilation and optimization has been a troublesome aspect of OpenGL programming for a long time. It can consume seconds of CPU cycles during application start-up. Additionally, state-based re-compiles done internally by the drivers add an unpredictable element to application performance tuning, often leading to occasional pauses in otherwise smooth animations. This extension provides a mechanism through which client API implementations may cache shader binaries after they are compiled. It may then retrieve those cached shaders during subsequent executions of the same program. The management of the cache is handled by the application (or middleware), allowing it to be tuned to a particular platform or environment. While the focus of this extension is on providing a persistent cache for shader binaries, it may also be useful for caching other data. This is perfectly acceptable, but the guarantees provided (or lack thereof) were designed around the shader use case. Note that although this extension is written as if the application implements the caching functionality, on the Android OS it is implemented as part of the Android EGL module. This extension is not exposed to applications on Android, but will be used automatically in every application that uses EGL if it is supported by the underlying device-specific EGL implementation. New Types /* * EGLsizeiANDROID is a signed integer type for representing the size of a * memory buffer. */ #include <khrplatform.h> typedef khronos_ssize_t EGLsizeiANDROID; /* * EGLSetBlobFunc is a pointer to an application-provided function that a * client API implementation may use to insert a key/value pair into the * cache. */ typedef void (*EGLSetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize) /* * EGLGetBlobFunc is a pointer to an application-provided function that a * client API implementation may use to retrieve a cached value from the * cache. */ typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize) New Procedures and Functions void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); New Tokens None. Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) Add a new subsection after Section 3.8, page 50 (Synchronization Primitives) "3.9 Persistent Caching In order to facilitate persistent caching of internal client API state that is slow to compute or collect, the application may specify callback function pointers through which the client APIs can request data be cached and retrieved. The command void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); sets the callback function pointers that client APIs associated with display <dpy> can use to interact with caching functionality provided by the application. <set> points to a function that inserts a new value into the cache and associates it with the given key. <get> points to a function that retrieves from the cache the value associated with a given key. The semantics of these callback functions are described in Section 3.9.1 (Cache Operations). Cache functions may only be specified once during the lifetime of an EGLDisplay. The <set> and <get> functions may be called at any time and from any thread from the time at which eglSetBlobCacheFuncsANDROID is called until the time that the last resource associated with <dpy> is deleted and <dpy> itself is terminated. Concurrent calls to these functions from different threads is also allowed. If eglSetBlobCacheFuncsANDROID generates an error then all client APIs must behave as though eglSetBlobCacheFuncsANDROID was not called for the display <dpy>. If <set> or <get> is NULL then an EGL_BAD_PARAMETER error is generated. If a successful eglSetBlobCacheFuncsANDROID call was already made for <dpy> and the display has not since been terminated then an EGL_BAD_PARAMETER error is generated. 3.9.1 Cache Operations To insert a new binary value into the cache and associate it with a given key, a client API implementation can call the application-provided callback function void (*set) (const void* key, EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize) <key> and <value> are pointers to the beginning of the key and value, respectively, that are to be inserted. <keySize> and <valueSize> specify the size in bytes of the data pointed to by <key> and <value>, respectively. No guarantees are made as to whether a given key/value pair is present in the cache after the set call. If a different value has been associated with the given key in the past then it is undefined which value, if any, is associated with the key after the set call. Note that while there are no guarantees, the cache implementation should attempt to cache the most recently set value for a given key. To retrieve the binary value associated with a given key from the cache, a client API implementation can call the application-provided callback function EGLsizeiANDROID (*get) (const void* key, EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize) <key> is a pointer to the beginning of the key. <keySize> specifies the size in bytes of the binary key pointed to by <key>. If the cache contains a value associated with the given key then the size of that binary value in bytes is returned. Otherwise 0 is returned. If the cache contains a value for the given key and its size in bytes is less than or equal to <valueSize> then the value is written to the memory pointed to by <value>. Otherwise nothing is written to the memory pointed to by <value>. Issues 1. How should errors be handled in the callback functions? RESOLVED: No guarantees are made about the presence of values in the cache, so there should not be a need to return error information to the client API implementation. The cache implementation can simply drop a value if it encounters an error during the 'set' callback. Similarly, it can simply return 0 if it encouters an error in a 'get' callback. 2. When a client API driver gets updated, that may need to invalidate previously cached entries. How can the driver handle this situation? RESPONSE: There are a number of ways the driver can handle this situation. The recommended way is to include the driver version in all cache keys. That way each driver version will use a set of cache keys that are unique to that version, and conflicts should never occur. Updating the driver could then leave a number of values in the cache that will never be requested again. If needed, the cache implementation can handle those values in some way, but the driver does not need to take any special action. 3. How much data can be stored in the cache? RESPONSE: This is entirely dependent upon the cache implementation. Presumably it will be tuned to store enough data to be useful, but not enough to become problematic. :) Revision History #3 (Jon Leech, December 13, 2012) - Fix typo in New Functions section & assign extension #. #2 (Jamie Gennis, April 25, 2011) - Swapped the order of the size and pointer arguments to the get and set functions. #1 (Jamie Gennis, April 22, 2011) - Initial draft.
https://fuchsia.googlesource.com/third_party/android/platform/frameworks/native/+/6867a125cfe50c12a4b67a0a3e785d10e417802c/opengl/specs/EGL_ANDROID_blob_cache.txt
CC-MAIN-2022-05
refinedweb
1,212
52.29
POX DHCP Server February 9, 2013 in News, POX This week, POX’s betta branch gained a simple DHCP server. I’m actually aware of at least three other POX DHCP servers(!), but this is the first one in the mainline. It’s pretty bare-bones, but it might Do The Job for you (and if it doesn’t maybe it’s at least a start). It also demonstrates a rarely seen POX feature: multiple launch functions. There’s an entry on the POX Wiki describing usage of the DHCP server, but it’s basically pretty simple. To get it to serve addresses in the range 192.168.0.100 through 192.168.0.199, you can simply start it with: ./pox.py misc.dhcpd:default (For the curious, that “ :default” is the aforementioned multiple launch function bit.) There are also a number of options. For example, to serve 10.0.0.x from 10.0.0.1 without specifying a default gateway (router) to clients and specifying 4.2.2.1 as the DNS server: ./pox.py misc.dhcpd --network=10.0.0.0/24 --ip=10.0.0.1 --router=None --dns=4.2.2.1 When the server issues an address, it raises an event. Your components can handle this event to monitor or cancel it: def _I_hate_00_00_00_00_00_03 (event): if event.host_mac == EthAddr("00:00:00:00:00:03"): event.nak() # Deny it! core.DHCPD.addListenerByName('DHCPLease', _I_hate_00_00_00_00_00_03) For further information, check the manual. Hopefully this will satisfy some users’ needs for a DHCP server. If not, please feel free to file issues, chat about it on pox-dev, or submit pull requests! You must be logged in to post a comment.Sign in using...
http://www.noxrepo.org/2013/02/dhcp/
CC-MAIN-2015-32
refinedweb
288
70.5
CSS Wishlist: 21 Designer/Developers Sound Off * 10/10/2008 — 80 Comments * Wolfgang Bartelme Designer at Bartelme Design I’d love to see cross-browser support for gradients, shadows, opacity masks and rounded corners. I guess that would not just dramatically reduce bandwidth, but also speed up production and customization. Jon Hicks Designer at hicksdesign I would love a different box model! I find it bizarre that padding and border add the width of an object, and would love to be able to give something like a textarea 100% width and 3px padding without worrying what it’s going to do the layout. Perhaps something like padding-inside as a new selector? In that vain I also wish I could specify a 100% width for an element, minus a set fixed width. Again, very useful when creating fluid designs with form elements! Andy Budd Author and Web Standards Pioneer: AndyBudd.com Most of the stuff I want is in CSS3, so what I actually want is the core modules finished and implemented fully by at least two browser vendors. David Walsh Web Development Blogger: David Walsh Blog I think that the lack of font abilities that we’ve been living with is a sin. Our other options for using non-standard web fonts, sIFR and utilizing images, are painful and have really held the creativity of the web back. I also believe that standard corner-rounding properties must be added — we’re all tired of creating rounded-corner images and browser-specific hacks to achieve our goals. Lastly, I wish CSS would be implemented in browsers faster. We’ve had little advancement in the past few years. Collis Ta’eed Entrepreneur, Blogger, Designer at Envato, Home The biggest problem I have with my CSS is that with large sites it gets very unwieldy. On a site like FlashDen the CSS goes on for miles, and then I have a second set of sheets to apply to change all the styles for people visiting alternate versions of the site (ThemeForest or AudioJungle). Even with the best intentions, it’s pretty messy. I wish that I could have an inheritance concept in CSS like you have in object oriented programming. So you could go:.button { /* some styles */ } .button >> .sidebar_button { /* inherits all of .button and adds new styles */ } I know that currently I could just define it like this:.button, .sidebar_button { /* some styles */ } .sidebar_button { /* inherits all of .button and adds new styles */ } But somehow that doesn’t seem like an elegant way to do things. And if the first and second definitions happen to be separated by a large block of other CSS code, when you come back to read your CSS later, there is no way for you to know that .sidebar_button has some more styles attached to it. Whereas the inheritance version above, you can read that it’s a derivative of .button. Keith Robinson Creative Director at Blue Flavor, Home I wish CSS could handle embedded fonts in the manner we use sIFR now. Shaun Inman Designer/Developer of Mint, Home Here’s the thing, one more half-baked, tacked-on stopgap isn’t going to improve CSS in any meaningful way–it would only compound a fundamental flaw in its design. CSS feels like a style sheet implementation you’d find in a late 90’s desktop publishing app. It’s still very text-centric. Style sheets just weren’t designed for creating complex layouts. CSS’s layout features are tacked on–and 10 years later it definitely shows. I’d love to see the CSS Text Module rewritten by experienced typographers and typesetters and the CSS Layout Module rewritten by experienced publication designers, both traditional and newfangled. And sometime before 2022 if at all possible. Jeffrey Jordan Way Editor at NETTUTS and ThemeForest Blog, Home I wish we could assign variables in our stylesheets. For example, it would be nice if, rather than having to scroll to the top of my document every time I needed to grab the hex value for my chosen “blue”, I could simply assign that value to a variable called “myBlue”.var myBlue = #191955; #someElement{ color: myBlue; } This is a topic that has been debated to death, and truthfully, it might prove to be a bad idea. I’m still not sure. I could swing either way in such a discussion. Once you open that door, you sort of lose the whole concept of CSS. But, I think if done responsibly, variable assigning could potentially save us a great deal of time when designing. Steven Vandelay Designer at Vandelay Design One of the great things about working with CSS is that there’s usually different ways to approach something that you’re trying to accomplish, but in some ways I would like to see more standardization when it comes to layouts. Andy Clarke Author, Designer, and Developer: Stuff and Nonsense Well, aside from the obvious (making sure that Obama gets elected, making me very rich and making me a cup of nice tea) what I would like most from CSS are better layout tools to allow me to create rich, intricate designs without the need to add presentational elements into my markup. The CSS Working Group (of which I am a former member) have been working hard on these layout tools. I hope that before too long we will see the browser makers implementing these proposals (using -browser- extensions) so that designers and developers can experiment with them. Chris Spooner Designer at SpoonGraphics, Home Multiple Backgrounds, Rounded Corners, Border Images and Opacity are my first thoughts when asked what I wish CSS could do, then I remember – these are all in the pipeline for CSS3! In this case, my dreams are coming true in terms of CSS, which makes the question; Is there anything you wish Browsers could do?! One CSS technique I wish there was a shorter technique for would be to easily make a two or three column layout with equal height sidebars without the use of the faux column method. Elliot Jay Stocks Designer, Writer and Speaker, Home I’d like to see conditionals natively supported in CSS without the need for workarounds such as (the excellent) Conditional-CSS. Many people argue that browser detection is essentially something that should be handled outside of a stylesheet, but all of the HTML-based conditional comments I use to handle IE-specific code is entirely to call in ‘hack’ CSS files. The implementation of code along the lines of what we use to target Gecko- or WebKit-based browsers would be a hugely welcome addition for me. Nick La Designer – Web Designer Wall, N.Design Studio I wish CSS could do layer styles like Photoshop where you can add: inner shadow, outer glow, bevel effects, etc. It would be even better if we could have layer blending mode. Jesse Bennett-Chamberlain Designer at 31Three The only thing that comes to mind would be variables. I don’t get my hands too dirty with code very much any more, but variables would be quite handy for when I do. Ask me what I would like Photoshop to do and I could give you a much longer answer :) Volkan Görgülü Designer / Developer – Web Deneyimleri I wish instead of writing #sample h1, #sample h2, #sample h3 —> (long and ugly) something like this #sample [h1, h2, h3] —> (short and clean) would do the job :) Another example can be #sample a:link, #sample a:visited #sample a [link, visited] Veerle Pieters Designer at Duoh!, Blog I wish CSS had support for gradient borders and easier usage for transparency, like in InDesign or Quark for example. Applicable on every possible object, text etc. Easier and more logical way of floating elements. Lastly that we don’t have to wait on CSS 3 for another 5 years. I also wish that CSS would get mad and punish if some browsers don’t behave :) Jonathan Snook Designer/Developer at Sidebar Creative, Home I’d love to see consistent implementations across all major browsers for CSS3 features like multiple backgrounds, border-radius, and border-image. CSS Transforms would be handy, too. They might seem gimmicky but there are plenty of practical reasons for it like long headers names for narrow columns in a data table. Being able to rotate elements would improve the design while maintaining accessibility (and avoiding have to resort to images). The landscape in 5 years will, I believe, offer us plenty of functionality we don’t enjoy now. Eric Meyer Web Standards Writer and Speaker, Home Strong grid-based layout. We still don’t have it, and it’s needed. At this point I honestly don’t care if it’s accomplished through CSS or some other new language. Cameron Moll Designer, Speaker, Author, Home First and foremost, I’d like CSS to answer my email. Second, I’d like CSS to convince browser developers to cooperatively and incrementally include “future” CSS features and proposals today, rather than waiting for a full spec to be “officially” released. Wishful thinking? Perhaps, though I anticipate the first may happen before the second. Dan Rubin User Experience Director at Sidebar Creative, Home I’d love to see the W3C bring in a proper typographer and book designer to help craft the type and layout parts of the specification. Someone like Robert Bringhurst would be ideal, as both an expert typographer and book designer, so the specification would be created with designers’ needs in mind, rather than by programmers. In a feature-specific way, I would hope this results in much better typographic control, and a web equivalent to “master pages”, which are an old standard in print design software. Stephanie Sullivan Coder, Trainer, Writer at W3Conversions Outside the holy grail of creating equal height columns without using a faux method (while still supporting browsers like IE6 and IE7), I’d love to see a way to set background positioning from the bottom or right side of an element. No, I don’t mean setting them all the way to the bottom or right, of course we can do that now. I mean setting a background image that’s not quite at the bottom or right and remains a specific value away from it. It’s not possible to accurately determine the height of elements containing text, so setting the background image 350px from the top will give wildly variable results in relation to the bottom of the element. Having a reliable way to set a background image 20px from the bottom without adding a non-semantic wrapper, could in some circumstances be very helpful. Some great ideas from the comments: - Andy Ford: I’d like to see a “height-increment” property. Essentially making a block level element only grow in height in specified “chunks” rather than pixel by pixel. - Tony Freixas: GUI applications have access to rich layout tools that could easily have been adapted to Web layout, but were completely ignored. Layout is definitely something that could be entirely re-written. - Andy Pemberton: CSS needs a more advanced “fallback” support model. Right now, we can specify multiple fonts to ‘fallback’ to, but what if that fallback font really could use some negative letter-spacing too? Re: John Hicks’ request for a different box model: You can switch the box model using the box-sizing property from CSS3. It’s supported directly by some browsers, via prefixed/namespaced properties in others, and you can even add support in IE6 via Dean Edwards’ IE7.js: box-sizing: border-box | content-box; The browser-specific variations are -moz-box-sizing, -ms-box-sizing, and -webkit-box-sizing. More info here: jason Many want rounded corner stuff. But when a new style of corners will become trendy, will we ask to change CSS specs again? :) Nice roundup of comments! Hopefully see a lot of them in the near future. Well said funkyboy but they should be ready for future trends ! :P I’d love inheritance, conditionals, variables, etc. One problem – that would make CSS no longer style sheets. So, we’d need an actual language to write styling in. We can do that with Javascript, but I’d really like to see an alternative. What we can have, but don’t (yet?) is support for explicit children classes (which is different from inheritance): .button { parent button style .child_button { extended child styling } .submit_button { } et cetera } How about the ability to rotate and flip (vertial/horizontal) images on the page and on backgrounds. I can think of a few situations where the same image could be used in different ways. This way you wouldnt have to make many variations of the same image. Example code: img.splash { rotate: 30; } img.splash2 { rotate: -270; } .myDiv { background: url(/images/image1.jpg) no-repeat 0 0 flip-x 90; } .myDiv2 { background: url(/images/image2.jpg) no-repeat 0 0 flip-y; } Love your idea Volkan! All these ideas are great. Variables especially. Really neat to see everyone’s opinion. But Chris, you didn’t put your answer! :) I’d like to see a ‘height-increment’ property. I don’t suspect it would be used a lot, but would be handy when you really needed it. I’m mostly thinking it would help when you have a repeated background. For example: .sidebar { background: url(pic.png) repeat-y; /* imagine a 20px tall bg image */ height-increment: 20px; } If the height of .sidebar was 216px due to the size of the contents, then ‘height-increment’ would cause .sidebar to grow to 220px. A positive value would round up, and a negative value would round down. Again, probably not something you’d use every day, but would be so hand in those rare instances that you did need it. @Anton, I was just IM’ing with a fellow CSS dev this week and telling him how I wished css could do exactly what you’ve posted. Awesome ideas from all of these designers. I agree with the column heights. It is a pain in the arse to make work arounds when you want a side column the same height as the wrapper and all the other content. Very upsetting. Hopefully CSS can become more of a web interface designers tool rather than what it currently is. Rounded corners, equal heights for all columns, drop shadows, added stylings, fonts, one statement opacity for all browsers, inheritance (very good one), different box model (also a very good one. Padding really doesn’t need to add width.), CROSS BROWSER SUPPORT AND UPDATED AND STANDARDS COMPLIANT BROWSERS (curse you IE!!!), and anyone who doesn’t update their browsers…curse them too (e-hemm IE6 users. Really???!!! Its over 7 years old. 2 more updated versions have come out in the past 4 years) !!!! Dump IE and get a real browser. Sorry this is a sore subject for me. That is all. I’ve read the discussions about css variables but the one thing i think that really needs variables is the url() function. Changing urls if the site directory changes is my biggest turn off working with css. I’m with Elliot Jay Stocks conditional html should be extended to target more browsers. And Volkan Görgülü’s suggestion would be nice too. The ability to use either color or colour would be great, but not backwards compatible now. While I agree totally with Wolfgang Bartelme and Davind Walsh, and Jesse Bennett-Chamberlain’s variable idea would be incredible. Being able to declare all hex values for each color and then using the variables later would be amazing. But I’d like to see one other thing. Being able to apply IMAGES to borders, just like we add images to all other elements via the background property. Oh, and allowing margin, padding, and border to TR elements. That would be so cool. Mixing units e.g., 100%-30px; Loads of developers I know want this. It’s absurd we don’t have it. Breaking out of the cascade – I should be able to target other objects and inherit properties from those objects e.g., div#two { color : div#one; } Breaking out of the cascade – position relative to other objects so I don’t have to twist my document semantics to achieve a visual objective. e.g., div#two { origin : div#one; top : 10px; left : 10px; } Variables. Real variables, not just constants. Constants. We need these fundamental tools so we can make out own higher level solutions. We don’t need more high level solutions that don’t fix our basic problems (Advanced Layout Module; I’m looking at you). I’d happily forgo fancy pants graphics effects like drop-shadows to get something that’s more fundamentally USEFUL. Oh, and I couldn’t agree with Elliot J Stocks more. We really need Conditional CSS, only today have I had to leave Opera in a sub-optimal state because it doesn’t support RGBA and I can’t target it to deliver a readable alternative. Being that variables has already been offered as an option many times, my top answer would probably be something simpler, like semi-transparent background color overlays without having to use PNGs. YES! inner-padding: x; – I wish we could do this, that drives me crazy that I have to subtract the padding from the total width of my container. Support for more fonts would also be great. I also liked Volkan Görgülü’s suggestion. Very interesting article and responses! Better font usage abilities is high on my list. Hopefully CSS3 stuff will get implemented soon. It’s been a long time coming. How about better vertical alignment and height options. Some have already been suggested, like heights of multiple columns and such. But how about being able to center vertically, meaning real center, not center the upper left corner of the object. Then no fuss like adding negative margins to bump it into place, or to do tricky math to figure the center. @Anton: Totally, I’ve thought about rotation too. Then Chris could get his “Friends” and “Meta” links at the bottom of this page to line up with those tags. :) @funkboy: Besides corners and rounded corners, what other corners would anyone need to account for? Dog-ear corners? :-P @anton and @aaron you can rotate using -moz-transform (FF3.1) and -webkit-transform (Safari, Chrome). Been using them lavishly and loving it on a recent project. I think the only thing that I want is that all web browsers support only 1 css standard. no extension, no hacks any more. That will save me from many scary dreams at night. This list is so depressing and fantastic at the same time. It’s nice to hear my own frustrations being put into words. @matt wilcox Very true. I think there is also a filter to rotate in IE. However this only applies to elements and not background images. There is no reason to be using hacks all the time, they should make it a standard. @Matt – I agree, subtracting padding from the width is silly, and often impossible, particularly when using percentages. However, there’s no need for an inner-padding property. Padding is, by definition, inside the border. See my previous comment re: the box-sizing property. It allows you to switch the box model to work the way you want, and is now pretty well supported across the major browser engines. – jason I’m 100% in support of good opacity control, but thats going to require one thing that I have yet to see in a browser, even those that support opacity; the ability to increase opacity back up to 100%. Currently if you nest two elements, and set the opacity to .5 for the outer one, the inner one is stuck at a max of .5 opacity. We really need a mechanic to go back up to 100% opacity so that we can create effects like see through edges around solid content blocks. most of the requests for variables in CSS I disagree with. Use a pre-processor like SASS or similar. Also, having to put “var LABEL” is stupid. CSS isn’t Javascript and shouldn’t require wordy-ness were not necessary. It should be kept succinct (like SASS). Nice to see the thinkers sounding off. Thanks for this! Aside from Andy Clarke, no one else seems much worried about improved layout tools. I find this surprising. GUI applications have access to rich layout tools that could easily have been adapted to Web layout, but were completely ignored. For instance, way back in the late ’80s, a GUI toolset called Motif (for X Windows) provided a form manager “widget”. With this tool I could take one block of content and attach its left edge to the right edge of another block, its top edge to the bottom edge of a different block, and its bottom edge to the bottom of the form itself. These attachments could have offsets. Each block could be made fixed-size or resizable. Some of the layouts that people struggle to create with CSS are easily created in GUI applications. The upcoming CSS layout tools (the ones I’ve heard about, anyway) seem to continue in the tradition of ignoring existing layout solutions. I’m not as confident as Andy that these will be optimal solutions other than to provide job security for CSS coders. Which leads to the wish that we could add cross-browser CSS plugins much as we have plugins for Quicktime and Flash. Then I would get the CSS features I wanted without having to wait for the CSS committees or browser developers. Some CSS features would eventually become standard due to their success in the real-world, as opposed to the current approach of creating the standard first and then implementing it and hoping it works well. These are all future of CSS tricks. Inheritance, Variables, Grouping seem cool as features. Wish to see them in near future. I’ll add one that I’ve been considering formalizing and proposing to the w3 css working group: CSS needs a more advanced ‘fallback’ support model. For example, CSS2.1 (and 3 to my knowledge) has a basic model for supporting falback font families: font-family:FirstChoice,SecondChoice,LastChoiceShouldBeGeneric; Real world example: font-family: “Lucida Grande”, Garamond, “Times New Roman”, serif; This will fall back support to Garamond if Lucida Grande isn’t supported/available on the client machine, and so on. The problem with this approach is, it sometimes takes more than a simple single rule switch to ‘Garamond’ to make the 2nd choice as good as possible to the 1st. For example, maybe adding an additional ‘letter-spacing:1px’ will make the 2nd choice similar to the first. It’d be nice to apply a pattern for this in a generic manner for property/value support. Example: if(supported){ font-family:”Some Crazy Rare Font”; }else{ font-family:”2nd Choice Font”; letter-spacing:1px; } The syntax here could probably be improved (thinking something similar to the media querying syntax would be nice), but it is about 9pm eastern time after a long week. Does this make sense? Or do you think this feature would be beneficial? From all options above, I really would have somthing like arrays (a [link visited] { } ), variables and something like objects: var linkColor : #f60; #maincontent { p { margin: 20px 0; } code { } a [link visited] { color: linkColor; } } In this code p, code and a are only affected in #maincontent I love to see the rotation being done easily in all major browsers. CSS Tables, don’t fear them. @Lauren Having to use PNGs for semi transparency is not a fault of the browsers or CSS for that matter, but the actual formats themselves. Only PNG supports alpha transparency which is what gives you semi transparent effects. I think I will add rotation to my wish list as well along with better font support and inheritance. And a set opacity attribute as well, instead of having proprietary attributes for each browser. Oh, and lastly should a non compliant browser come across CSS, it is automagically updated to a browser that does or a newer version. I also want CSS to be the second coming of Jesus and bring us porkchops. I’d really to see variables implemented in css On css tables; sitepoint has a book coming out soon or is out. From what I read somewhere, the book is dedicated completely to css tables. Should be an interested read, but we still have the issue of ie6 usage still being pretty high. That being said, I’m definitely going to start experimenting with them. I like Volkan Görgülü idea. As for the others, most of those ideas (i.e. rounded corners, variables, embedded fonts) are already supported by some browsers. All we need is better cross compatibility (and performance for CSS expressions). “Photoshop layer-styles” is an interesting idea, but that would make the browser like Photoshop. Then what’s next? Photoshop Filters? Why not? (The inheritance idea was all wrong). Correction (where’s the damn edit button), actually IE does have Photoshop-like filters. One thing I would like to see in CSS is centering or middle offset. I would LOVE to see most of these integrated, they would make the web a better place. Cross-browser support for text-overflow:ellipsis so that overflowed text will be cut off with … At the moment IE is the only browser supporting this I love the suggestion by Jeffrey Jordan Way! I have never thought about using variables in CSS. That would be freaking awesome and make updating colors sitewide a breeze — Especially in live development! Another admittedly obscure one that I’d like to see is a way to do inset borders. Perhaps a ‘border-inner’ or ‘inner-border’ property. Would be similar to ‘border’ but might look something like this: border-inner: 1px solid #ccc inset(4px); all of these would be very useful perhaps an easier method of ’sandbagging’ text around images too maybe something like #element { display: block; width: 300px; text-shape: url(images/mytextshape.png) 1.1em; } the 1.1em could mean, internal padding to the outside of the shape where the png could be a shape of one solid colour, that the browser formats the text accordingly.. though this may take a bit of processing! will safari’s masking features be able to do anything like this? this could have problems when the user increases the font size (and the text is tied into some sort of design) Volkan has a great point! 15 Designers comment on what they wish CSS could do! @Lauren and @Matt Z You don’t need PNGs for semi-transparent background overlays. If you mean just a colour then you can use RGBA in both Firefox and Webkit (Opera’s support is coming in the next major release). selector { background-color: rgba(255,255,255,0.5); } I’m surprised no one mentioned any kind of rotation. HTML is currently all right angles. Content flows up and down and we can float things right and left. But I’d like to be able to rotate my divs on an angle. So, I’d love to see: #angled-div {rotation: 45;} which might rotate my div 45 degrees clockwise. This would mean we’d have to use images much less for custom designs. It would also mean text didn’t HAVE to align exactly up/down. For example, in the footer of this page, the html links under the “friends” or “meta” graphics could be aligned with the edge layout of the image by using a rotation element. It’s something I’ve thought about for a while and I’m surprised I’ve never heard it mentioned anywhere else. damn……all (well, almost all) of this stuff would be nice. there would definitely be a lot less cursing in my office. Maybe nested CSS would be a good thing in certain situations. e.g: ul#menu { margin: 0; li { list-style: none; a { background: white; } a:hover { background: black; } } } that would make it easier to do things like: ul#menu ul#menu li ul#menu li a ul#menu li a:hover but yes, i agree with the fact that this could possibly also be much more confusing than the usual way. oh no, wordpress ate my indentation, now it looks totally horrible :-/ don’t anyone want kerning available on CSS? Supporting a standard is by far the most important thing, but my wish list includes the CSS3 items like rounded corners, gradients, multiple backgrounds, etc; non-cascading opacity (or breaking the cascade); variables (or nesting a parameter from another element/selector); display: image-replace or a cleaner way of doing image replacement; and even an explicit way of wrapping floats. Simplifying the learning curve for new designers, developers… When it’s all said and done, one standarized set of rules for all browsers is the first step. I can live without new features for a long time if I know old ones will be adopted. Repeating background of a section of image – sprites.. Make one image of all the backgrounds need and you would end up with less bandwidth usage. background:url(images/bigImageSprite.png) -12px 0 0 -12; It’s nice to have such nice ideas among the designers. Just thought of one. How about grouping CSS properties like: body{ margin,padding:0; } h1{ font-style,font-weight:normal;} Not sure how useful it would be in the grand scheme of things, but stuff that can share the same value ought to be able to. I’d mostly just like CSS to actually be implemented by the browser manufacturers and future developments to be at least 50% user lead. Too many ’standards’ are compromises resulting from companies protecting their interests and hampering up and comers. If i had a wishlist though: simple variables, gradients, rounded corners, sensible box model, mixed values (% – px) proposals to be added to the css variables described at: proposal; }} What I’m taking away from this article is “wouldn’t life be wonderful without IE?” I would absolutely love cross-browser support for specifing styles to only be applied when there are two styles on the same object. For example a div with class .button could also have .hover… I think this is possible in FF but not IE :( I’d love multiple backgrounds (oh, the markup this could save me…) and I think a great feature I haven’t seen brought up would be incremental heights on elements. The two together brings up some cool possibilities, too.
http://css-tricks.com/css-wishlist/
crawl-002
refinedweb
5,123
63.39
> The Thanks André, you answered my question about what teachers would pass around, assuming Crunchy Frog installed / working. Tried in Python 2.5 but even after changing to xlm.etree, could find HTMLTreeBuilder, so ended up with separate ElementTree installation. It'd be nice if a VLAM evaluation would then give an ensuing Python interpreter access to the namespace created thereby, something like i.e. if I define a class and user Evaluates, then user might create objects of that class in the following line-by-line dialog. Or is that capability already somehow present and I've missed seeing it? Kirby
http://mail.python.org/pipermail/edu-sig/2006-August/006914.html
CC-MAIN-2013-20
refinedweb
102
57.67
Darren and all, Thanks for the comments. Please keep them coming. I tend to think of SOAPAction this way, recently; A malicious user cooperating with an external server can easily work to get arbitrary messages through a firewall or proxy that allows HTTP to pass through. This possibility is independent of SOAP; while they might use SOAP toolkits for convenience, they could just as easily modify them, or cook them up separately. So, SOAPAction is useless in terms of stopping or detecting malicious users. However, it *may* provide value in that it can be used to enforce policy. For example, a company may decide that it doesn't want purchase orders to be sent by SOAP, but doesn't mind other services, like stock quotes. If option #2 were implemented, it could block any messages with a SOAPAction containing the namespace URI of known purchase order messages. The questions that this brings up, then, are: - does this offer significant value over traditional URI filtering? - does it cause more harm than good because people will think of it as a security mechanism? Re: DTD - I think you mean valid, not well-formed. I'm not sure what value this would add, except to get errors back more quickly ;) AFAIK, I don't think there can be a DTD for SOAP documents, because they're not strictly valid; they contain tags from a number of namespaces, and are dynamically constructed from modules (what we're calling 'blocks' now). Cheers, On Tue, May 08, 2001 at 12:48:01AM +1000, Darren Reed wrote: > Hi > -- Mark Nottingham, Research Scientist Akamai Technologies (San Mateo, CA USA) _______________________________________________ firewall-wizards mailing list firewall-wizards_at_nfr.com
http://seclists.org/firewall-wizards/2001/May/0003.html
crawl-002
refinedweb
279
59.13
- Training Library - Amazon Web Services - Courses - Deploying a Simple Business Application for Pizza Time Monitoring with CloudWatch Hi and welcome to this lecture. In this lecture, we will have an overview about monitoring with CloudWatch. I will talk briefly about CloudWatch itself, we are going to define a few concepts, and then we are going to have a hands on demo on EC2 monitoring, RDS monitoring, S3 monitoring. We are going to talk about CloudWatch alarms, logs and events. So, CloudWatch is a monitoring tool. I guess that there is nothing new in here for you. So let's go further. To really understand CloudWatch we need to define three important concepts in here. We need to define Metrics, Namespaces, and dimensions. So, the first and the most basic concept that we need to define here is the Metric. The Metric is basic and information about something, in this case it is the Number Of Objects, but there is not much sense in here because this metric only will tell us a numeric value in this case in a given time. But objects of what? We need to have a namespace in order to put some sense into a metric. So right now we can see that there is more sensing here. We have the S3 namespace and inside the S3 namespace, we have a metric called number of objects. That will make more sense for us. The same thing happens with other surfaces. We have for example another metric, it is a CPU utilization metric which will hold the information about the CPU utilization but the CPU utilization of what because we can have more than one compute services on AWS and for services like RDS, which are not really compute services we also have the information about the CPU utilization. So again we need of a namespace to put some sense into this metric. So in this case, it is the EC2 namespace. So we define it the most basic concepts in here. We have the metric which we will hold a point time metric. It will hold a timestamp and it will also hold a value. We have a namespace. In this case, we are using the AWS namespaces. These namespaces are created by default on your AWS account. If you are using EC2, it will create the EC2 namespace and it will create the S3 namespace if you are using S3, but that's really not enough because if you think about EC2 you can have a lot of instances and how would you organize those metrics because you have the CPU utilization metric for every single instance that you have and that will be a little bit complicated to really separate those metrics from each other. And that's when dimension comes in place. The dimension will hold more characteristics about the metric itself. For example in this case, it will hold the instance ID related to the CPU utilization metric so by using dimensions you have the ability to separate the CPU utilization metric from each of your instances. And we will see when we talk a little bit more about custom metrics that we can put even more information on a dimension. We could aggregate metrics for all our production service because maybe we are putting things behind in autoscaling group and we don't really care about a single instance but we care about that entire group of instances. So we can aggregate that data inside a bigger dimension, telling it, “these are the instance working on production and these are the instances working on the development”. The same thing happens for S3, since that doesn't make much sense to have the number of objects for S3, that would be like a global metric. We also need a dimension to say, “hey this is the metric for the buckets and this is the number of objects”. From now, things can start to get a bit nasty because imagine that every time you create a new dimension you are actually creating a new metric. When you go to the CloudWatch console, you will see that we will have a metric called CPU utilization for a given instance and we will have a CPU utilization for other instance. If we change the information on our dimensions, that will appear as a new metric, so every time we create a new dimension, we are actually creating a new metric. Just to illustrate a little bit more, what a metric would look like this is the information that we need to provide when we are sending a new metric to CloudWatch using the AWS CLI. We need to provide a metric name and we need to provide a time-stamp of value and we need to say what type of unit is there. In this case, Unit Count. We are going to cover that in the next lecture, so don't worry about the unit right now. As I said, we can have default metrics. The EC2 service will have its own metrics. The RDS service will have its own metrics and so on. And we also have the ability to send custom metrics to CloudWatch. We will cover that in the next lecture but right now what you need to know is that we can send metrics from whatever we want to send to CloudWatch. Also metrics live for 14 days. So a single metric will live for only 14 days. If this metric, for example, is 14 days old, it gets deleted but can still see the CPU utilization for this particular instance in the EC2 console but you won't be able to see these metrics so that we will change your graphs and so on and the same thing will happen to these other metrics after this particular metric gets 14 days old it gets deleted and so on and so on. Metrics exist only in the region in which they are created. So if you are using EC2 instances in the Oregon region you will only be able to see these metrics in the CloudWatch console in the Oregon region. There is only one exception for this rule which is billing. CloudWatch also monitors your billing information but all these metrics are sent to the Northern Virginia region. Even if you are deploying resources to other regions, if you are deploying resources on the Oregon region and so on, you still need to go to the Norther Virginia region in order to see the billing metrics. You can't delete any metrics. Since metrics automatically expires after 14 days, the only thing that you need to do is not send more data to it. After 14 days the metric will disappear. You can export the data from CloudWatch using the AWS CLI or some SDK but there is an out-of-the-box solution for that. So you need to implement your own logic and you need to deploy things by yourself. Enough talking, let's go now to the AWS console and have an overview about monitoring with CloudWatch. So here at the AWS console, let's go first to the CloudWatch console. And in here, we can see that we have something familiar. We can see the namespaces. These are the services that I've been using on this account and if we are clicking here for example on EC2, we can see the metrics that we have for all of the instance that I launched in the last two weeks in this account. And as you can see, this is the instance that we launched the Pizza Time application. If we select the CPU utilization we are not actually selecting the metric for this particular instance at this moment. We are actually selecting a dimension which holds the CPU utilization from all these instances that I launched in the last two weeks. If we are clicking here, then we are selecting only the instance that we want, only the instance that is running the Pizza Time application. We have a very useful graph doing here. We can specify how much we want to go with this graph too. For example if you want to see the average utilization of the last day of our instance we can simply select the period of timing here and we can see. We can change for hours and also we can set a Q-stone time-stamping here. If you want things from five hours and a half, we can simply select the time and the graph will be generated for us. If we want to share this same graph, maybe you identified an outage in the application and you want to share this graph with someone in your team, you can simply click in here and copy the URL for this graph and you can share with people that has access to the account and everytime people access this URL that you share it will show the same graph that is seen in the other screen. So that's a very useful tool. I also want to show you that you don't really need to go to the CloudWatch console to see metrics about your resources. For example, let's go to the EC2 console and in here I want to see the metrics for the instance there is running the pizza time application. So we go to the instance stage and we select the instance that you want and we can see the monitoring tab that we will have some useful information here and this information is related to the single instance so we can have the CPU utilization, we can have information about the disks. Just one thing to consider in here is that all these metrics relates to the disks of the physical machine. In this case, since we are using an EBS volume to launch this instance we won't have any metric in here because we are not actually using a physical disk to run this instance. I will show you where to check out the EBS metrics in a field. We also have network metrics and these three last particular metrics are very important. The last one is status check failed system. We changed the value to one if there is a system fail. Meaning if there is an RH on the AWS side, this status check will monitor your instance. So for example if your operating system can't boot up if you change the value to one or if your instance gets stuck for some reason it will change the state of this metric to one. The last one is status check failed any. We will change the status check to one every time each of this two order's status check fails. So if there is a failure of any kind no matter if it is in our instance or if it is the AWA system that will change this metric to one. So these are very important metrics and these are great for trouble shooting because every time you see a problem especially if you are seeing a problem in the AWS system you need to stop your instance and then you start it again because that will force AWS to relaunch your instance in a different host. And by the way, that also solves a lot of different problems. I've seen people solving problems, DNS problems, only by stopping their instance and starting it again. That will be my first suggestion. Every time you see a problem that doesn't really make much sense, try to stop your instance if you can and start it again. Another thing that I want to show you in here in the EC2 console is that right now the EC2 instance is on basic monitoring. That means that AWS will collect metrics every five minutes. Every five minutes AWS will collect information about the CPU utilization, the disk reads and so on. If we want to increase that maybe we have a very critical application that we want you to look close to it. We can enable detailed monitoring. And what detailed monitoring will do is instead of checking your instance every five minutes that will check your instance every minute. Every minute your instance will be sending data to CloudWatch and you can have a faster response to a failure of any kind by using detailed monitoring. I wont enable that for these instances so I will just close in here. And, talking a little bit about EBS volumes, if you want to see the metrics for the EBS volumes, we can see that on CloudWatch. We can simply click here, select the EBS ID and for EBS we also have the monitoring tab. We will be able to see some metrics related to the EBS volume itself. We can also see that on the CloudWatch console but I find that it is easier to see the metrics for a particular volume or a particular instance in the EC2 console. It is much quicker. I have the information that I need right there. Continuing talking about monitoring with CloudWatch, let's now take a look at the RDS console. If we go on the RDS console and we select the RDS database, we will have kind of the same information that we have for EC2. Lets take a look. We can select the instance and in here we already have some basic monitoring information. This monitoring information comes from CloudWatch and if we want to have more detail you can click on show monitoring and we will have kind of the same interface that we have for EC2. We can see the CPU utilization. We can see the connections. We can see the free star space and so on. So again this is very useful because we can simply click select our database instance and we can instantly see what is going on with for instance. But for other surfaces we don't have that very useful monitoring tab in the console. We always need to go to the CloudWatch console. It is the case for the S3 surface. We don't have a monitoring tab or a monitoring view inside the S3 console. Every time we want to know an information about a particular S3 bug we need to go in here. And we need to select the metric that we want and we will visualize the data. An alarm is a way to evaluate the metric against a threshold in a given period. And the alarm you have in a state depending on the value of that metric over time, the state of the alarm will change. We have three possible states for alarm. The “ok” alarm will be when you have a threshold defined. For example, this is the CPU utilization metric. Let's say that we create an alarm for this metric. So we say that we want our CPU utilization below 50% and we can see here that in the last 50 minutes our CPU utilization is always below 50% so in this case the state of our alarm would be okay. If, somehow, our CPU utilization goes beyond that and reaches 50%, then our alarm state would change to “alarm” meaning that we would probably have a problem. We could specify in low CPU alarm saying that every time the CPU utilization is below let's say 20% we would have an “alarm state” and we could set that alarm to remove an instance from the autoscaling group to save some money. Insufficient data is self explanatory. It is when we don't have enough data to either have an OK state or an alarm state. By the way you can change the state of an alarm using the AWS CLI and also some SDKs and the partial tools for AWS and you can have multiple actions per alarm. You can set a notification that will use the SNS service to notify a topic and send a message to the subscribers of that topic. You can have an autoscaling action. This autoscaling action only works if you are monitoring an autoscaling related metric. So if you are monitoring the CPU utilization for all the instance in the given autoscaling group you can set an autoscaling action to say for example to increase or decrease the number of instances in that group. And this is kind of new. You can also set EC2 actions. An EC2 action will take action in the EC2 instance related to the alarm itself. You can have four types of EC2 actions. You can have the recover action but note that the recover action can only be used if you are monitoring the status check failed system. Remember that this metric relates to problems in the AWS side of things so we can use the recover action to launch that instance in another host and that will most likely solve the problem. We can set an stop action that will stop the instance. We don't need to associate this action to this status check fail system. We can use other metrics to that. We can terminate the instance and we can reboot the instance. When you go to the CloudWatch console and click on create alarm, you see this screen and in this screen you can see that you need to specify a name to the alarm, a description and in here you specify the threshold. So you can see if the CPU utilization in this case is higher or equal than zero or we could specify 50 for one consecutive period. We will specify the period in here so we say we will evaluate these alarms against the threshold every five minutes and if the CPU utilization is beyond 50% for one or more consecutive times we can specify that the state of the alarm will change. Here we can see the instance ID related to this alarm. We can see the metric name and in here we can specify the actions for this alarm. We can select more than one action. We can notify more than one topic. We can do more than one autoscaling action and so on. Once we set everything, we can click on create alarm. Another important thing is that when you change the period of the alarm that won't change the EC2 monitoring type because people sometimes get confused about that. We say that we will evaluate the alarm every five minutes. We can also change that to evaluate the alarm every one minute but that won't change the type of monitoring. If your instance is using basic monitoring, it will remain as basic monitoring. We have many ways of creating an alarm. The easiest way is by going to the CloudWatch console and we select alarms. We click “create alarm” and we will see a page where we need to select the metric for our alarm. So I will create an easy to related alarm. So I'll go on per instance metrics and I will select the instance that is running our Pizza Time application. I will select the CPU utilization metric and I will say that it is a high CPU alarm. I would define the threshold of when it is more than 50% for, I would say, three consecutive periods. I will leave the period as five minutes but we can change that and at this point the only thing that I want to do is receive a notification. So I will keep this notification action and I will create a new list for me. I will say that the topic name is admin and I will insert an email in here. So every time that the state is “alarm” I will receive a notification. And we can also say that every time the state is ok we will also receive a notification but that's really not needed. I would delete and create the alarm. We need to confirm this email but I will do it later. I really don't need to do this right now. CloudWatch can also start logs for us. This is very useful when we have autoscaling groups or when we don't want to for example get inside an instance to analyze logs. We can send the logs to CloudWatch logs and we can have a central place to restart logs and the logs will remain even if we terminate the instance which is very good because sometimes when we are using autoscaling we can have a lot of instances being terminated and we don't know the reason so we can use CloudWatch logs to restart the logs of our instances and even if the instance gets terminated we can still check the logs of the instances in that autoscaling group. Events are a little bit like alarms but they don't monitor metrics. They monitor changes in the AWS resources, so we can select an event source. We can select an instance change or we can select autoscaling change. Maybe we want to do any specific action every time we have an EC2 launch in our autoscaling groups, we can create any schedule which will basically behave as a crown job and we can also monitor AWS API calls but for that we need also to enable Cloudin our account. And those events can trigger some targets. We can trigger a new lambda function. We can send a message to an SNS topic. We can put some message in an SNS queue and so on. That's it for this lecture. We already covered too much. We will continue covering CloudWatch in the next lecture..
https://cloudacademy.com/course/deploying-an-application/monitoring-with-cloudwatch-1/
CC-MAIN-2019-22
refinedweb
3,648
69.31
import java.*: Threads 101 Chuck Allison Using multiple threads can make your programs more responsive and your code cleaner, but getting them to work correctly can be tricky. Java makes the task (pun intended) as easy as possible and is the first language to offer portable threading support. Concurrent programming techniques have been around for many years, but have not seen widespread use until recently for a number of reasons. Traditional concurrent programs used multiple processes that required expensive IPC (interprocess communication) mechanisms and were severely platform dependent. If you could fork with the best of them on Unix, that wouldnt get you anywhere on VAX/VMS. Furthermore, creating processes on Unix was enough of a performance hit, but on many other operating systems it was abysmally slow and to be avoided whenever possible. Operating system designers got the message and invented lightweight processes, which evolved into what we know as threads today. A thread is an execution path through a program, and there can be many threads active in a single process, all sharing the same process space. Using threads solved the performance hit of creating and managing separate processes every time concurrency was called for, but there remained the portability issue. The solution was of course to make threads part of the programming language, instead of leaving the job to the operating system or competing library vendors. This is what Java has achieved with a large degree of success. Threaded programming is a complex affair. In this article, Ill scratch enough of the surface to make you comfortable managing independent tasks and shared resources concurrently in Java. The Benefits of Concurrency The motivation for the concurrent programmer is simple: better throughput. For example, separating the tasks of computation and presentation into distinct threads makes for a more responsive interactive program, because users can still press buttons and fill in text fields while awaiting the result of a pending request. On systems with multiple processors, separate threads can be scheduled to run simultaneously. Even on single processor systems, good thread scheduling algorithms make separate tasks appear to run concurrently to the human eye. A web server, for example, spawns separate threads to process incoming HTTP requests so one request doesnt have to wait for an unrelated one to finish before it gets a response. A web browser can use separate threads to display different parts of a web page. Programmers like threads because they simplify code. That may sound a bit contradictory in light of the first sentence two paragraphs above. A language that supports concurrency shifts the bulk of the details of managing locks and inter-thread communication from your code to your platform, so all you need to do is to define your tasks, along with a minimal amount infrastructure. Getting the glue between threads to work is the tricky part, but the code comes out clean. The program in Listing 1 shows one way to create and launch separate threads, which is to extend the Thread class and override the run method. The MyThread constructor expects a message and a count representing how many times to display it. The Thread class has a constructor that accepts an optional thread name. This feature isnt used much in practice, but I use it here to hold the message each thread is supposed to repeatedly print to the console screen. My run method just displays that message count times. To launch a thread, I call Thread.start, which in turn invokes MyThread.run automatically. As you can see, all but one of the repetitions of DessertTopping appear before the FloorWax thread gets a chance to execute. Your output may vary and is a function of the thread-scheduling algorithm used on your Java platform. Sometimes you may want a thread to explicitly give other threads a chance to run, instead of hogging all the processor time it possibly can. You can do such cooperative multitasking with the Thread.yield static method, as illustrated in Listing 2. The net effect here is that each thread just takes its turn displaying a single instance of its message. Another way to let threads share processor time is to pause them for a period of time. The static method Thread.sleep suspends the thread for at least the number of milliseconds specified by its argument so other threads can run (see Listing 3). Thread.sleep can throw an InterruptedException (explained below), but it wont happen in this example, so I just ignore it. This time the interleaving of the output appears more random than in the previous examples. How many threads do you suppose are active at any one time in the examples above? The answer is one, two, or three (not zero, one, or two). When you start the virtual machine with the command java Independent the main method executes in an initial thread, called the main thread. Listing 4 illustrates this by displaying information about each thread. After t1 starts, there are two threads active, and finally three after t2 begins. To determine all the threads in a program requires access to their thread groups. All threads belong to a thread group [1]. Since I didnt explicitly create any thread groups, all threads belong to the default thread group (named main). The method ThreadGroup.activeCount returns the total number of threads in the group that havent yet terminated, and ThreadGroup.enumerate fills an array with the all the threads currently running and returns the count of the same. Thread.join waits until its thread completes, if necessary, before returning. The ThreadGroup.toString method displays a threads name, priority [2], and thread group. Another way to define a thread is to first define a task to implement the Runnable interface, which defines a single run method, and then to pass that task to an alternate Thread constructor, as shown in Listing 5. This approach is attractive for a couple of reasons. From a conceptual point of view, it makes sense to separate a task from the thread that runs it. From a more pragmatic perspective, you need this technique if your task class extends another class, since Java only supports single inheritance. Thread States You might be wondering how the output in the previous examples came out the way it did. Why didnt the characters of the individual lines get interleaved? The reason is that many methods in java.lang.io cause a thread to block, which means the thread is put on hold until the call is complete. If you were to rewrite Listing 3 to print the characters individually using print instead of println, then such interleaving does occur (see Listing 6). Being blocked is just one of the several states a thread can be in. As Figure 1 illustrates, when a thread is started, it enters the Runnable (or Ready) state, which means it is eligible to be chosen to execute by the JVMs thread scheduler. If the thread calls a blocking method, it enters the Blocked state until the blocking operation is complete, after which it is eligible to be rescheduled. Similarly, when a threads code encounters a call to Thread.sleep, it enters the Sleeping state for the specified amount of time, and then becomes Runnable. When the scheduler suspends a thread so another can run, the first thread moves from the Running to the Runnable state. Only Runnable threads can be scheduled for execution. A thread is considered dead when its run method returns. Once dead, a thread cannot be restarted, although its associated Thread object is still available until it is garbage-collected. The acceptable way to stop a thread is to politely ask it to stop itself. A typical situation where you need to stop a thread prematurely is in interactive applications. For example, if a database query is taking too long and you want to abort, you need to be able to press a Cancel button and have the query stop. The program in Listing 7 contains a first attempt to stop a thread. The main thread spawns a worker thread that displays a count every second and then waits for the user to press Enter. The Counter class has a cancel method that sets the boolean field cancelled. The loop in Counter.run checks cancelled before printing on each iteration so it knows when to exit. Ill explain shortly why this is not a generally safe technique for stopping a thread. Did you notice that the main thread terminated before the worker thread did in Listing 7? The application keeps running as long as any threads are still active. Well, almost any thread. There are two types of threads in Java: user threads and daemon (pronounced DAY-mun) threads. The threads Ive shown you so far are user threads. The difference between the two thread types is that if there are only daemon threads active, the application can terminate. You make a daemon thread by simply calling setDaemon(true) on an existing thread. By making the Counter thread in the previous example a daemon thread, I can halt the application without the canceling mechanism (see Listing 8). A very common technique for stopping a thread is to use Thread.interrupt, which is an official way of getting a threads attention. When you interrupt a thread, it doesnt really stop it just causes a call to Thread.interrupted to return true when invoked in that thread [3]. The program in Listing 9 uses this feature to kill the Counter loop. This program clarifies why Thread.sleep may throw an InterruptedException, and what to do about it. If a thread is sleeping, it cant be directly interrupted, since it isnt running. Instead, it moves to the Runnable state and waits its turn to execute. When it runs, execution resumes in the InterruptedException handler associated with the pending call to Thread.sleep. The usual thing to do is to call interrupt again, since the initial call gave way to the exception. The loop will then complete on its next iteration and run will return [4]. Thread Safety One of the most difficult concepts to grasp in concurrent programming is how to share resources among separate tasks. Whenever two or more threads access the same object, you need to ensure that those threads take turns; otherwise your data can end up in an inconsistent state. Code that guards against this phenomenon is said to be thread safe. To illustrate, consider a Book object in a program that supports a public library. Suppose each book has title, author, and borrower fields. If two threads try to check out the same book at the same time, theres no telling what could happen. Perhaps the thread that executed last would win the privilege of being recorded as the borrower, but both threads would think they completed the transaction successfully. Bad news. The Java threading model uses monitors to prevent threads from accessing shared data simultaneously. A monitor is a mechanism that establishes what are known as critical sections in code. Only one thread is allowed in a critical section at a time. A monitor is always associated with an object. The monitor for an object protects all the critical sections in the code associated with that object as a unit (so one thread cant be in one critical section while another thread is in another section). You declare critical sections with the synchronized keyword. Synchronization is expensive (four to six times more than non-synchronized methods, they say), so you should use it sparingly. The only thread-sensitive data in Listing 10 is the borrower field. The other two fields are read-only and are therefore inherently thread-safe. To protect access to borrower, I do two important things: 1. declare it to be private (otherwise there is no protection whatever!), and 2. declare all methods that use it to be synchronized including the accessor method getBorrower (otherwise it would be possible for one thread to get the borrower right before another thread changes it, making the data invalid). To execute one of these methods, a thread must obtain a lock on the associated object. (All Java objects have a hidden lock field). If another thread has the lock, the requesting thread waits until it becomes available. Once a thread has the lock (which is called being in the monitor), no other thread can execute any synchronized code. The thread in the monitor has exclusive access to the synchronized block until it leaves it and releases the lock. This is why checkout and checkIn can call isAvailable without any problems. Since it is always a good idea to keep critical sections as small as possible, you should declare an entire method synchronized only when absolutely necessary. The program in Listing 11 shows how to declare a synchronized block, while at the same time fixing the problem with stopping a thread via the cancel method in Listing 7. Since multiple threads executing Counter objects could conceivably be running at the same time, then the data fields need to be protected. Since cancel is a one-line method, there is no problem declaring it synchronized, but run must not be synchronized. Since it has an infinite loop, it would never be interrupted if it ran in the monitor. For this reason, I place only the two statements that require protection in a synchronized block on the current object. (Remember, a monitor always requires an object to lock.) It is possible to declare code in static methods as a critical section. The associated monitor simply obtains a lock on the class object. Listing 12 illustrates this by fixing the interleaved output problem shown in Listing 7. There is no shared data in this case, so no non-static synchronized methods are necessary. Instead, I just make the static method display synchronized. When MyThread.run calls MyThread.display, the thread obtains a lock on the object MyThread.class(), so the output proceeds uninterrupted. If I were to make display non-static, it would not prevent the interleaving, because the locks would be on two unrelated objects (t1 and t2). Communication between Threads Synchronization keeps threads from getting in each others way, but it doesnt allow threads to talk to each other. Sometimes a thread needs to wait on a condition brought about by another thread. Such is the case in typical producer-consumer scenarios, like real-time queuing systems. The program in Listing 13 uses a Queue to store messages created by Producer threads. Consumer threads wait until something is available in the queue to process. In this case, for simplicity, I just traffic in Integer objects, but the Queue class, which uses the Java 2 LinkedList collection class, doesnt need to change [5]. In order to protect the queue, each thread synchronizes its own access to it. A consumer thread first checks to see if there is something to consume. If there isnt, it waits until there is. The wait method (defined in the Object class), which for thread safety must itself execute in a monitor, atomically releases its lock and blocks until it is notified by another thread [6]. After a producer inserts an entry in the queue, it calls notify, which causes it to block, and the thread scheduler wakes up another arbitrarily chosen thread that is in a wait state for the same monitor. If the newly awakened thread is a consumer, then its while loop completes so it can consume an Integer. If not, another producer will insert another entry into the queue and do another notify. Eventually a consumer thread will get notified. It is not possible to wake up a specific thread. If you want to notify multiple threads, then call notifyAll instead of notify. That would be counterproductive in this example because only one consumer can process a queue entry. The program in Listing 13 of course doesnt halt. (I pressed Control-C to abort it.) You could use the interrupt/interrupted technique mentioned earlier to halt from the main program, but Listing 14 proposes a better solution [7]. I use a counter to track how many producer threads are active, so when they all finish the consumers can end gracefully. When the queue is empty, each consumer checks to see if there are any producers left running. If not, their run method simply returns and the application ends. Since there are now two conditions that the consumer threads are waiting for (either a new queue entry or zero producers remaining), I need to notify on both conditions. A call to notifyAll after a producer decrements its counter ensures that both threads are alerted when all the producers have terminated. Some things to remember: 1) wait and notify must always be called in a monitor. 2) You must execute wait and notify on the same object you synchronize on. 3) Both methods cause their threads to block (to allow other threads to run) and to enter the monitors wait list. If no threads are waiting, notify simply returns. The original threads reacquire their locks when they resume. 4) In general you should test for a wait condition in a loop. (The condition may have changed between the time the thread was awakened and the time you re-test.) Summary Threads allow you to improve perceived throughput of your programs, as well as divide your code into cleanly defined tasks, but crafting thread-safe code can be tricky. There isnt room here to talk about other issues such as communication through callbacks, deadlock, and thread-local storage. I hope, however, that this article has helped you understand how threads work, and why you should care. Notes [1] ThreadGroups can contain other ThreadGroups, forming a tree with the default group as root. [2] Priorities are integers in the range [Thread.MIN_PRIORITY, Thread.MAX_PRIORITY]. What these priorities actually mean depends on your platform. Using native threads, where the JVM uses the underlying operating systems threading facilities for concurrency, the number of priorities may differ, so two priority numbers can be mapped to the same native priority. The only assumption you can really make is that threads with higher priority may be executed in preference to threads with lower priority. [3] Thread.interrupted is static and works on the current thread. There is a non-static isInterrupted method also. [4] Notice in this example that I reverted to extending Counter from Thread. If you use the Runnable approach, just call Thread.getCurrentThread().interrupt(). [5] For more on Java 2 Collections, see the September 2000 installment of import java.*. I wanted to use a synchronized wrapper for the queue, but it only supports the List interface, so the LinkedList functions arent available. [6] There are overloads for wait that allow you to specify a timeout value. [7] Id like to thank Michael Seaver of Novell for help with this solution.s.
http://www.drdobbs.com/threads-101/184403917
CC-MAIN-2017-51
refinedweb
3,151
63.39
It was 3AM on a Monday. The team had experienced a sleepless weekend, trying to dig into a production failure. In just a few hours, the work week would begin, and we all knew that the world needed this application to work. It would be a disaster if this issue were not fixed before then. But why did it fail? It worked last week. Why did it stop working today? A recent code change? But that was absolutely unrelated. We tested it - with all the rigor. We had setup the best test automation, topped with some manual tests as well. Even further, our microservices are scanned and reviewed by effective tools. Why then did it fail? We started cursing our fate and the tools we used. Management started yelling at us. You said K8s is meant for resilience and it enables applications that can never fail. But we have seen more trouble than solution. Never use Open Source! And all that blah.. But after hours of struggle, fate smiled - just in time - and we discovered the problem with the YML configuration. Some progressive minded developer had not specified the version of the embedded opensource DB used in there - he had used a "latest" - hoping to get the best features as they are released. A new version was available, and that broke some existing functionality. Hush! Our job was saved. We managed to resolve the issue and then crashed into the bed - as the world started using our application that was functioning as before. Does this sound familiar? I am sure it does. We have all seen disasters caused by misconfiguration in Kubernetes. The problem is in the power of the tool. With great power comes great responsibility. There is so much that we configure in there, and there are very few developers who really understand these configurations well enough. Most of them make these configurations using other existing configurations - a copy/paste, with modifying some parts that make sense to them. Or the adventurous ones pick the YML files straight from some online tutorials - which were good to prove a point, but not mature enough for the production. When we use infrastructure as code we tend to forget that it is also a piece of code, that should go through all the validation like a normal application code. It is often tempting to use shortcuts that work today. They work and get deployed into production. And we assume that they will work forever. But unfortunately, that is not the case with Kubernetes configurations. The world is still new to the Kubernetes Patterns. Developers are still struggling their way though it - so are the admins. And too much of configuration goes into the system, making it easy for such errors to creep in. Worse still, most of these errors show their impact after a few days, or even months. The system works perfectly until it just collapses without any warning. This makes the task even more difficult There is no end to our creativity, and our ability - to introduce newer and newer defects in the system. But there are some common issues that show up very often. Let us look at them one by one. This is a common mistake new developers make - when they pick the configurations from tutorials and blogs. Most of them are meant to explain the concept and syntax. To keep that simple, most of them skip the other complexities like namespace. But any Kubernetes deployment should have a meaningful namespace in the architecture. If we miss it out by error, it can cause name clashes in future. Kubernetes is going through an active development. Lot of developers across the globe are working hard on improving it and making it more and more resilient. An unfortunate consequence is that we have some API's getting deprecated in newer releases. We need to identify and remove them before they begin failing in production. Kubernetes provides for "Deployments" - as a way to encapsulate pods and all that they need. But some lazy developers may want to skip this and deploy just the pod into Kubernetes. Well, this may work today. But it is a bad practice, and will definitely lead to a disaster some day. When entities at different levels share the namespace, the lower entity can access neighbors of the higher entity - to probe the network. For example, when a container is allowed to share its host's network namespace, it can access local network listeners and leverage it to probe the host's local network. This is a security risk. Even if it is our own code, the minimal access principle recommends that this should not be allowed. When it comes to system security, we should never believe in anyone - not even ourselves. All communications between the containers should go through the layers of abstraction provided by Kubernetes. Communication between services has to go through the abstractions of ingress and service defined in the deployments. Never run containers with root privilege. Never expose node ports from services, or access host files directly in code (using UID). Ingress should forward traffic to the service, not directly to individual pods. Hardcoding IP addresses, or directly accessing the docker sockets, etc.. can lead to problems. Again, these won't break the system on the very first day. But it will show up sometime someday - when we just can't afford it. This is a common disaster. Developers are often tempted to use "latest" - with the hope of improving continuously, getting the latest and best version available. Such a configuration can live in our system for many months. But, it can lead to a nasty surprise. When an image tag is not descriptive (e.g. lacking the version tag like 1.19.8), every time that image is pulled, the version will be a different version and might break our code. Also, a non-descriptive image tag does not allow us to easily roll back (or forward) to different image versions. It is better to use concrete and meaningful tags such as version strings or an image SHA. This is another problem that shows up very often - when we are not very confident of a configuration, we tend to believe in the defaults. The memory/CPU allocation, min/max replica counts for auto scaling... these are some of the properties that are missed too often. As we noted, there are too many configurations that go into the Kubernetes cluster. Helm tries to reduce this complexity, but makes things worse, when we try to configure Helm itself. It is impossible for a human to ensure the quality that we need in our production deployments. We need some good tools that can automate this process, and help us with this end. After some discussion on tech platforms, and a lot of Google / StackOverflow / YouTube, we found a few interesting tools. After comparing them, we chose Datree. It is simple to set up and use. It can be easily integrated with most CI/CD tools. It helps us identify such issues much before they can cause a problem. It has a lavish free tier and does not lock in - all that we need in an ideal tool. Let's check it out. Installing the tool is quite easy and fast. Run the below command. We need the sudo permissions. curl | /bin/bash A few seconds, and we are ready to go! Most of us are uncomfortable running such a command - we should be. We can just check out the actual code that is executed by script. Just open the link in the browser. "" | grep -o "browser_download_url.*\_${osName}_x86_64.zip") DOWNLOAD_URL=${DOWNLOAD_URL//\"} DOWNLOAD_URL=${DOWNLOAD_URL/browser_download_url: /} OUTPUT_BASENAME=datree-latest OUTPUT_BASENAME_WITH_POSTFIX=$OUTPUT_BASENAME.zip echo "Installing Datree..." echo curl -sL $DOWNLOAD_URL -o $OUTPUT_BASENAME_WITH_POSTFIX echo -e "\033[32m[V] Downloaded Datree" unzip -qq $OUTPUT_BASENAME_WITH_POSTFIX -d $OUTPUT_BASENAME mkdir -p ~/.datree rm -f /usr/local/bin/datree || sudo rm -f /usr/local/bin/datree cp $OUTPUT_BASENAME/datree /usr/local/bin || sudo cp $OUTPUT_BASENAME/datree /usr/local/bin rm $OUTPUT_BASENAME_WITH_POSTFIX rm -rf $OUTPUT_BASENAME curl -s > ~/.datree/k8s-demo.yaml echo -e "[V] Finished Installation" echo echo -e "\033[35m Usage: $ datree test ~/.datree/k8s-demo.yaml" echo -e " Using Helm? =>" tput init echoosName=$(uname -s) DOWNLOAD_URL=$(curl --silent Essentially, it just downloads a zip file and expands it into the specified locations. It places the binary into the /usr/local/bin folder - for which it needs a sudo. It does not mess with any system configuration and so it is very simple to remove. The datree installation provides a sample yaml file - for a POC. datree test ~/.datree/k8s-demo.yaml >> File: ../../.datree/k8s-demo.yaml ❌ Ensure each container has a configured memory limit [1 occurrences] 💡 Missing property object `limits.memory` - value should be within the accepted boundaries recommended by the organization ❌ Ensure each container has a configured liveness probe [1 occurrences] 💡 Missing property object `livenessProbe` - add a properly configured livenessProbe to catch possible d eadlocks ❌ Ensure workload has valid label values [1 occurrences] 💡 Incorrect value for key(s) under `labels` - the vales syntax is not valid so it will not be accepted by the Kuberenetes engine ❌ Ensure each container image has a pinned (tag) version [1 occurrences] 💡 Incorrect value for key `image` - specify an image version to avoid unpleasant “version surprises” in the future +-----------------------------------+-------------------------------------------------+ | Enabled rules in policy “default” | 21 | | Configs tested against policy | 1 | | Total rules evaluated | 21 | | Total rules failed | 4 | | Total rules passed | 17 | | See all rules in policy | | +-----------------------------------+-------------------------------------------------+ Interesting? Well that was just a glimpse. Note the URL it generates at the end of the table - This is a unique ID assigned to your system. It is stored in a config file in home folder. # cat .datree/config.yaml token: t4e73q9ZxkXhKhcg4vYHDF Open the link in a browser. It prompts us to log in with Google / Github. As we login, this Unique ID is connected with the new account on Datree. We can now tailor the tool from the web UI. Also, will see the reports from all the tests There we can see detailed setup for the tests. We can alter that and the same is used when the yaml files are evaluated. We can choose what we feel is important and skip what we feel can be ignored. If we want, we can be a rebel and allow a class of errors to go through. Datree gives us that flexibility as well. Apart from the default policy available to us, we can define more custom policies that can be triggered as per our need. Datree provides "Filters" for all the above mentioned potential issues, and many more. On the left panel, we can see a link for "History". Click on it, and we will see the history of all the validations that it has performed so far. So we can just view the status of policy checks right here - without having to open the "black screen" Every time we invoke the datree command, it connects to the cloud with this ID and pulls the required configuration, and then uploads the report for the run. As we saw above, we can trigger the datree in a single command. Much more than that, it also provides wonderful compatibility with most of the configuration management tools and managed Kubernetes deployments like AKS, EKS and GKS. And ofcourse, we cannot forget Helm when working with Kubernetes. Datree provides a simple plugin on helm. Datree has an elaborate documentation and set of "How to" tutorials on their website. You can refer to them for quickly setting up any feature that you want. Most of the applications across the globe have a lot of such misconfigurations - that will surely bring a nasty disaster some day. We knew our application had this problem. But we underestimated the extent of damage that it could cause. We were just procrastinating, sitting on a timebomb! Now I tell everyone, don't do what we did. Don't wait for the disaster. Automate the configuration checks and enjoy your weekends.
https://blog.thewiz.net/prevent-configuration-errors-in-kubernetes
CC-MAIN-2022-05
refinedweb
2,004
66.33
Created attachment 422054 [details] output of emerge --info I stepped into this one while debugging firefox. output of emerge -pv mesa Calculating dependencies... done! [ebuild R ] media-libs/mesa-11.0.6::gentoo USE="classic debug* dri3 egl gallium gbm llvm nptl pax_kernel pic udev -bindist -d3d9 -gles1 -gles2 -opencl (-openmax) -osmesa (-selinux) -vaapi (-vdpau) -wayland -xa -xvmc" VIDEO_CARDS="nouveau (-freedreno) -i915 -i965 -ilo -intel -r100 -r200 -r300 -r600 -radeon -radeonsi (-vmware)" 0 KiB Created attachment 422056 [details] compressed build.log /var/tmp/portage/media-libs/mesa-11.0.6/work/mesa-11.0.6/src/mapi/glapi/glapi_gentable.c:44:22: fatal error: execinfo.h: No such file or directory #include <execinfo.h> this doesn't happen without debug useflag due to #ifdef USE_BACKTRACE #include <execinfo.h> #endif in glapi_gentable.c A similar issue came up with uclibc. Take a look at bug #425042. I approached the problem incorrectly there and fell into the trap of checking for __GLIBC__ and __UCLIBC__ which is what most code does. But this is wrong minded and musl doesn't define a __MUSL__ on purpose. The proper way to fix this is to check for execinfo.h in configure.ac, set some #define and then check for it in the code. So, in the configure file do AC_CHECK_HEADERS([execinfo.h]) and then in the C code do #ifdef HAVE_EXECINFO_H ... #endif Make sure that config.h is included at the top of the C. Of course, make sure to rip out any of the __GLIBC__ and __UCLIBC__ that are trying to protect the backtrace code. If you like and you find it fun, try making a patch and we'll submit it upstream. Created attachment 422744 [details, diff] patch to ad header-check This is a patch to implement a check for the presence of execinfo.h during configure. I'm not yet really sure about the rest though. Created attachment 422746 [details, diff] patch to eventually bypass the bug This is what Felix suggested to do. It seems to fix the compile issue for me, but I have no idea what it would do on a glibc system or if it would suit upstream. (In reply to tt_1 from comment #4) > Created attachment 422746 [details, diff] [details, diff] > patch to eventually bypass the bug > > This is what Felix suggested to do. It seems to fix the compile issue for > me, but I have no idea what it would do on a glibc system or if it would > suit upstream. That patch should be fine on all systems. Build systems should move away from __CYGWIN__ style check and to direct checks of the components they need. The best example here is __UCLIBC__ where checking if that macro is defined is deceiving since uclibc is configurable. So some uclibc systems might HAVE_EXECINFO_H while others might not. Testing for __UCLIBC__ when you want to know if you HAVE_EXECINFO_H is wrong minded. I've been guilty of this myself. (In reply to tt_1 from comment #3) > Created attachment 422744 [details, diff] [details, diff] > patch to ad header-check > > This is a patch to implement a check for the presence of execinfo.h during > configure. I'm not yet really sure about the rest though. It is sufficient to do just +AC_CHECK_HEADERS([execinfo.h]) since if this macro passes, then it defines HAVE_EXECINFO_H for you. Check that it works though since there might be some subtlety. Created attachment 425000 [details] patch ready for upstrem like this? Created attachment 425006 [details, diff] diff for the ebuild the ebuild needs a little adjustment Created attachment 427852 [details, diff] mesa-11.1.2 and mesa-11.0.6 execinfo patch Here's a modified version of @tt_1's patch that removes the old __GLIBC__ && !__UCLIBC__ checks.. wrt Comment 6: AC_CHECK_HEADERS will define HAVE_EXECINFO_H make configure.status substitute HAVE_EXECINFO_H everywhere, but that's it, since there is no configure header. (In reply to Felix Janda from comment #10) >. Alright. I'll remove those pieces and submit it upstream. What happened with the patch? Has it been sent to upstream? I submitted it, and it was ignored -- I'm not sure how to get the maintainers to notice it. Aric, thanks for submitting the patch upstream! (It can be seen here:) has some advice on submitting patches. (Check out scripts/get_reviewer.pl.) (In reply to Aric Belsito from comment #13) > I submitted it, and it was ignored -- I'm not sure how to get the > maintainers to notice it. mattst88 might be able to help you. i think he's upstream with mesa.
https://bugs.gentoo.org/show_bug.cgi?format=multiple&id=571036
CC-MAIN-2021-43
refinedweb
760
67.55
Advertisement Please send me some tips Greetings... I would like to ask your help regarding how to compute time between the recursive and iterative solution using factorial in c language. thank you TimeToStr? What is the object TimeToStr? how to convert time in milliseconds in to hours - Java Beginners how to convert time in milliseconds in to hours hello, can anyone tell me how i can convert the time in milliseconds into hours or to display it in seconds in java Java Get Time in MilliSeconds Java Get Time in MilliSeconds  ... the time in milliseconds. Please do not forget to import the java.util.calender...; Java Syntax to get time in milliseconds import  Convert Date to Milliseconds Convert Date to Milliseconds In this section, you will learn to convert a date into milliseconds. A millisecond is one thousand part of a second i.e. an unit Convert Time to Milliseconds Convert Time to Milliseconds In this section, you will learn to convert Time...; Description of program: This example helps you in converting a Time to milliseconds Help please, some strange errors Help please, some strange errors Sorry about this messy formatting. As a beginner in java i got no idea which part of the code is creating... is causing that run-time errors? Any kind of help will be helpful to me. and let Convert Milliseconds to Date Convert Milliseconds to Date In this section, you will learn to convert...: This program helps you in converting milliseconds into a date. It uses some
http://roseindia.net/tutorialhelp/allcomments/4927
CC-MAIN-2015-48
refinedweb
253
65.12
The? For each of the situations below, indicate for what choice of system the angular momentum will be conserved (if any). Then indicate whether linear momentum will be conserved. The two disks interaction with each other with both normal forces and friction forces. By choosing both disks as the system, those forces are considered internal forces and therefore don't count in calculating Γnet. The gravitational force from the earth is external. However, it does not produce a torque because it acts on the center of mass (it doesn't affect the way the disks spin). Linear momentum, by the way, is not conserved (assuming that the bottom disk is sitting on some sort of table, which I didn't include in the above analysis). The answer to this depends on how we drop it. Choosing both the block and the disk as the system does allow us to not count the internal forces between them. However, the gravitational force on the block would cause the left edge of the disk to rotate downward and the right side to rotate upward, which would change the angular momentum of the system (specifically, it would add rotation in a new direction while leaving the old rotation unaffected). If we drop the block on the center of the disk, then that wouldn't happen and angular momentum would be conserved. And just like the previous example, linear momentum is not conserved. Angular momentum is conserved for the combination of the putty and the pendulum. The fulcrum here is the pivot point of the pendulum, and while that does exert a force on the pendulum (it supports it vertically and also keeps it from flying to the right), it doesn't exert a torque on the pendulum (i.e. it doesn't cause a rotation). The gravitational force is also an external force, but that also doesn't produce a torque at the moment of collision for the same reason that you can't open a door by pulling in the direction of the door. It should be noted, however, that after the collision angular momentum will not be conserved because then gravity will start slowing down the rotation. For that reason, we could say that this system is momentarily isolated from external torques. Linear momentum, by the way, is not conserved at all here. This is due to the fact that the pendulum is hinged at the top, which will prevent any net rightward motion of the system. It may seem strange to you that angular momentum is conserved even though the putty wasn't necessarily moving in a circle before the collision. The truth is that even objects moving in a straight line can have angular momentum. Imagine, for example, that there was a tether between the putty and the fulcrum; as the putty gets closer to the pendulum, the tether gets shorter and shorter. In that sense, the putty is "rotating" around the fulcrum, just not with a constant radius. Since gravity is the only force acting on the baseball, and since gravity acts on the center of mass, there is no external torque acting on the baseball. Therefore the angular momentum of the ball alone is conserved. Linear momentum, however, is not conserved (though it would be if we included earth as part of the system as well). The figure skater interacts with the ice and with earth, neither of which exerts a torque (unless you consider the small amount of friction between the skates and the ice). Therefore the angular momentum of the figure skater alone will be conserved. When she brings her arms in, by the way, her angular speed will increase because her moment of inertia decreases. Linear momentum is conserved in this case. This situation is similar to the putty hitting the pendulum, but in reverse. The angular momentum of the disk by itself it not conserved since the external torque created by the rocket causes the angular momentum of the disk to increase. If the rocket (and the expelled bits of fuel) are treated as part of the system, though, then the only external interactions are with the spindle (i.e. the rotation axis) and the earth. Neither of these creates a torque on the disk. It could be argued that the gravitational force on the rocket does create a torque (just think about what would happen if the rocket thrusters were not on). In practice, though, that torque is likely very small in comparison to the thrust of the rocket. The linear momentum of the system is not conserved because the forces on the diagram do not cancel out. The? Intuitively it may seem like the block should win because some of the pulling force of the spool goes into rotating the spool instead of moving its center of mass. To answer the question definitely, let's look at force diagrams for each (as viewed from above). The spool will spin because the force from the string applies a torque about the center of mass of the spool. The block will not spin. Linear motion however is only determined by the net force, which is the same for the spool and the block. Given that the net force acting on each is the same, and given that they have the same mass, the center of mass of each will move in exactly the same way. They will tie. If you guessed that the block would win because some of the force would go into rotating the spool, you are partially correct. It's not the force that gets divided between the linear motion and the rotational motion (after all, how do you divide an interaction?) but rather the energy. Where does the extra energy come from? As the string is pulled, the spool will unravel. So even though the block and the spool end up traveling the same distance, the string pulling the spool has to be pulled farther (which is where the extra energy comes from). A ball of putty is thrown horizontally at a hanging rod that hangs from its end as a pendulum. The putty sticks to the end of rod and the two rotate together. Determine an expression for the angular speed immediately after the collision. (The moment of inertia of a rod about its end point is I=31mL2, where L is its length.) The putty+pendulum system is isolated from external torques, so the angular momentum of the system stays the same. r×p=Iω Since we are treating the putty as a point particle, we use ℓ=r×p to describe the angular momentum before the collision. From the right-hand rule for cross products, we also find that the angular momentum points out of the page (the +z direction). The right-hand rule for rotation says that if you curl your fingers in the diretion of rotation, your thumb points in the direction of the angular velocity. In this case, that is the +z direction. Recall that ∣∣∣∣a×b∣∣∣∣=absinϕ for a cross product, where ϕ is the angle between a and b. This form of the cross product is convenient to use in a lot of situations (like this one). rmpvsinθ=(31mrL2+mpL2)ω Notice that rsinθ=L no matter the value of θ. Here I have also used the fact that the moment of inertia of a point particle is I=mr2, where r is the distance of the point particle from the rotation point. mpvL=(31mrL2+mpL2)ω ω=31mrL2+mpL2mpvL=31mrL+mpLmpv The SI units of the final answer are [kg][m][kg][m/s]=[s]1, which is what we expect for an angular speed. Let's check the limits where mr→∞ and mp→∞. In the former case, we would expect that ω=0 because the rod wouldn't move. In the latter case the rod shouldn't slow down the putty at all. The latter result is a little harder to interpret, but it is what the angular speed of the putty was just before the collision (tangential speed is vt=ωr). Unsurprisingly, the angular speed increases with v and decreases with L and mr. According to Kepler's Second Law, an orbiting object will sweep out equal areas in equal times as shown below. Prove this. (Hint, show that it is true for an infinitesimal displacement along the orbit.) As the hint suggests, let's look at infinitesimal displacements (and therefore infinitesimal time intervals) along the arc. If the displacement is infinitesimal, then the shaded areas will basically be isosceles triangles where the height of the triangle is r and the base of the triangle is vdt. We are looking to prove that 21r1(v1dt)=?21r2(v2dt), where subscripts indicate different triangles. After canceling out terms, we get r1v1=r2v2. Where do we proceed from here? The system consisting of the orbiting object and the sun is isolated, so the angular momentum stays the same. If we assume that the orbiting object is much smaller than the sun, then the sun will not move. Therefore ℓ1=ℓ2 r1×p1=r2×p2 r1×mv1=r2×mv2 r1×v1=r2×v2. For a triangle with an infinitesimally small base, r⊥v, so if we take the magnitude of both sides we get ∣r1×v1∣=∣r2×v2∣ r1v1sin90∘=r2v2sin90∘ r1v1=r2v2, which is equivalent to the statement that the areas are the same. Even though we proved this for infinitesimal displacements, its still true for larger displacements because the larger displacements are made from many infinitesimal displacements. A cylinder rolls down a ramp without slipping. Determine a mathematical model for the motion (both linear and rotational). (Hint: Icylinder=21mR2) The friction is static rather than kinetic because the cylinder is not slipping. According to the force diagram, Fecgsinθ−Frcs=mx¨ and . These simplify to mgsinθ−Frcs=mx¨ and Frcn=Fecgcosθ=mgcosθ. In many cases we would use the normal force to determine the friction, but we cannot do that here. Recall that Fs≤μsFn for static friction, and we have no way of knowing in what part of that range the cylinder is. In order to determine Frcs, we can try to look at the rotational version of Newton's Second Law, Γ=dtdL. Of the three forces acting on the cylinder, only the friction force exerts a torque. R×Frcs=dtdL Take the magnitude of both sides. RFrcssin90∘=dtd(Iω) RFrcs=Idtdω Frcs=RIdtdω Substitute this into Newton's Second Law in the x-direction. mgsinθ−RIdtdω=mx¨ How does this help? Recall from introductory mechanics that dtdω=α and α=Racm (the latter only applies to an object that rolls without slipping). mgsinθ−R2Ix¨=mx¨ mgsinθ=mx¨+R2Ix¨=x¨(m+R2I) x¨=m+R2Imgsinθ For a cylinder, I=21mR2. x¨=m+21R2mR2mgsinθ=32gsinθ We integrate to find v(t) and x(t). v(t)−v0=32gsinθt v(t)=32gsinθt+v0 x(t)−x0=31gsinθt2+v0t x(t)=31gsinθt2+v0t+x0 We can use these to find the corresponding rotational motion. α=Rx¨=R32gsinθ ω(t)−ω0=R32gsinθt ω(t)=R32gsinθt+ω0 ϕ(t)−ϕ0=3Rgsinθt2+ω0t ϕ(t)=3Rgsinθt2+ω0t+ϕ0 The SI units of x(t), v(t), and a(t) work out to be [m], [m/s], and [m/s2] (respectively) as we expect. The SI units of α(t) are [m][m/s2]=[s2]1, which is what we expect for an angular acceleration. The SI units of ω(t) work out to be [m][m/s2][s]=[s]1, which is what we expect for an angular speed. the SI units of ϕ(t) work out to be [m][m/s2][s]2= no units, which is what we expect for an angle in radians. In the limit that θ→0, we would expect that there is no acceleration at all. Both of these results are what we expected. The limit θ→90∘ is a little trickier. You might think that the result should be free fall, but that isn't quite the case because of the friction. It's actually similar to a yo-yo, which falls differently that a freely falling object. We could also go back and see what happens when we set I=0, which would correspond to a non-rotating point particle. If we do that, we get a=gsinθ, which is the same result you get for a point particle sliding down a ramp without friction. The linear acceleration of a rolling object is smaller than that of an object that is sliding without friction, which makes sense. Realistically our result would likely break down at a high enough angle because the cylinder would begin to slide instead of roll. from __future__ import division, print_function from vpython import * #initial conditions L=5 #length of ramp theta=10*pi/180 #angle of ramp in radians R=0.1 #radius of cylinder h=L*sin(theta) #height of ramp m=1 #mass of cylinder I=0.5*m*R**2 #moment of inertia of cylinder x=0 #tilted x-coordinate of cylinder y=0 #tilted y-coordinate of cylinder v=0 #initial velocity of cylinder t=0 phi=0 #initial angle of cylinder (rotation) omega=v/R #initial angular speed of cylinder g=9.8 #gravitational field strength dt=0.01 #time step #set the scene scene=canvas(center=vec(0.5*L*cos(theta),0.5*h,0)) #draw the ramp tri=[[0,0],[0,L*sin(theta)],[L*cos(theta),0],[0,0]] tripath=[vec(0,0,1),vec(0,0,-1)] ramp=extrusion(path=tripath, shape=tri) #draw the cylinder cyl=cylinder(pos=vec(0,h+R,0),axis=vec(0,0,1),radius=R, texture=textures.wood) while x<=L: #continue until cylinder reaches the end of the ramp rate(1/dt) #make sure looping rate does not exceed real time a=g*sin(theta)/(m+I/R**2) #calculate acceleration v=v+a*dt #update speed x=x+v*dt #update tilted x-coordinate #perform the coordinate transformation to turn tilted coordinate system into vpython coordinate system cyl.pos.x=x*cos(theta) cyl.pos.y=h+R-x*sin(theta) #angular motion alpha=a/R #angular acceleration omega=omega+alpha*dt #update angular speed cyl.rotate(angle=-omega*dt) #rotate the cylinder (I put in the negative because the cylinder rotated the wrong way otherwise) t=t+dt #increment the time
https://share.cocalc.com/share/302dc0735ab9f92be33607d0ef7a40cc4e671a36/Notes/Day%208:%20Angular%20Momentum/Angular%20Momentum.ipynb?viewer=share
CC-MAIN-2020-16
refinedweb
2,405
62.27
Understanding Struts Controller Understanding Struts Controller In this section I will describe you the Controller.... It is the Controller part of the Struts Framework. ActionServlet is configured software making software making hello sir , sir you post me answer... in c and c++.sir i regueast you please you guid me. i hope you will help me make..., There are so things you can do with C and C++. Please let's know the description software making software making hello sir you asked me language.... how i will do coding, and how i will give the graphical structure. and how i... software. You can learn java at Thanks   Thanks - Java Beginners Thanks Hi Rajnikant, Thanks for reply..... I am not try for previous problem becoz i m busy other work... please tell me what is the advantage of interface and what is the use of interface... Thanks Reply Me - Struts visit for more information. Thanks...Reply Me Hi Friends, I am new in struts please help me... file,connection file....etc please let me know its very urgent   software making accounting software.how i will do coding . sir i have not difficulty about c and c++. please you give me guidness about making software. sir you tell me its...software making software hello sir sir i have learned thanks - Development process . please help me. thanks in advance...thanks thanks for sending code for connecting jsp with mysql. I have completed j2se(servlet,jsp and struts). I didn't get job then i have learnt do this for me plzz - Java Interview Questions do this for me plzz Given the no of days and start day of a month... to print in the same line i.e., without printing a newline. 2)You do...)); } } ----------------------------------------- Visit for more informaton Thanks - Java Beginners and send me... Thanks once again...for sending scjp link Hi friend...Thanks Hi, Thanks ur sending url is correct..And fullfill...) { e.printStackTrace(); } %> For read more information and details Struts - Struts . thanks and regards Sanjeev Hi friend, For more information.../struts/ Thanks...Struts Dear Sir , I m very new to struts how to make a program-config.xml is used for making connection between view & controller.... The one more responsibility of the controller is to check.../struts/ Thanks Struts - Struts for more information. Thanks...Struts Hi, I m getting Error when runing struts application. i... /WEB-INF/struts-config.xml :// Thanks...Struts Is Action class is thread safe in struts? if yes, how it is thread safe? if no, how to make it thread safe? Please give me with good Reply Me - Struts to provide a better solution for you.. Thanks making a web application using Web-Logic Server - Struts making a web application using Web-Logic Server Hello , I am a beginner to the java platform so i am facing some problem in making a web aplication using a struts framework.Hence i referred the docs given in the link http Answer me ASAP, Thanks, very important Answer me ASAP, Thanks, very important Sir, how to fix this problem in mysql i have an error of "Too many connections" message from Mysql server,, ASAP please...Thanks in Advance Error - Struts these two files. Do I have to do any more changes in the project? Please.... If you can please send me a small Struts application developed using eclips. My...Error Hi, I downloaded the roseindia first struts example struts validations - Struts --------------------------------- Visit for more information. Thanks...struts validations hi friends i an getting an error in tomcat while best Struts material - Struts best Struts material hi , I just want to learn basic Struts.Please send me the best link to learn struts concepts Hi Manju...:// Thanks java - Struts in which one can add modules and inside those modules some more options please give me idea how to start with Hi Friend, Please clarify what do you want in your project. Do you want to work in java swing? Thanks does anybody could tell me who's the author - Struts the author's hard-working !! thanks roseindia you could send me mail...does anybody could tell me who's the author does anyone would tell me who's the author of Struts2 tutorial( Reply Me - Java Beginners use this i don't know... please tell me what is the use of this ....and also solve my previous problem.... Thanks Hello Ragini MVC... with databse. Controller are servlet,jsp which are act as mediater. If u want book for struts 1.2.9 - Struts book for struts 1.2.9 Can any body suggest me book for struts 1.2.9...? Thanks in advance, Hi friend, I think, Jakarta Struts...:// Thanks Thanks - Java Beginners Thanks Hi, thanks This is good ok this is write code but i... either same page or other page. once again thanks hai frnd.. all data means...?wat do u mean by that? that code will display all and send me... Thanks once again...for sending scjp link...Thanks Hi, Thanks ur sending url is correct..And fullfill requirement.. I want this.. I have two master table and form vendor Custom Validations - Struts into Validator ? Can anybody tell me how to do this with a sample example. Thanks in advance Vikrant Hi friend, For more information on struts 1...Custom Validations Hi, I am trying to do the custom validations thanks - Java Beginners thanks Sir , i am very glad that u r helping me a lot in all... to understood...can u please check it and tell me..becoz it says that any two... it to me .....thank you vary much Thanks Thanks This is my code.Also I need code for adding the information on the grid and the details must be inserted in the database. Thanks in advance help - Struts studying on struts2.0 ,i have a error which can't solve by myself. Please give me... Hi friend, Do Some changes in struts.xml... attribute "namespace" in Tag For read more information to visit this Doubts on Struts 1.2 - Struts visit for more information. Thanks...Doubts on Struts 1.2 Hi, I am working in Struts 1.2. My requirement... anyone suggest me how to proceed... Thanx in advance Hi friend Is Singleton Default in Struts - Struts (called a Controller in Spring MVC). If you have any problem then send me...:// Thanks..., Is Singleton default in Struts ,or should we force any use of Struts - Struts a link. This link will help you. Please visit for more information with running example. Thanks...use of Struts Hi, can anybody tell me what is the importance i have a problem to do this question...pls help me.. i have a problem to do this question...pls help me.. Write a program that prompts the user to input an integer and the output the number...(); System.out.println("Reversed Number: "+reverse(num)); } } Thanks do the combinations in java, pls help me its urhent - Development process do the combinations in java, pls help me its urhent import... one help me: action when condition1 and condition3 action when condition1... again : Thanks plz Help me - Java Beginners :// Thanks...plz Help me Hi, I want learn struts,I dont have any idea about... my personal id plz tell me that whose software installed.and give me brief validations in struts - Struts }. ------------------------------- Visit for more information. in struts hi friends plz give me the solution its urgent I an getting an error in tomcat while running the application in struts , sun, and sunw etc. For more information on Struts visit to : Thanks...Struts Tag Lib Hi i am a beginner to struts. i dont have Doubt in struts - Struts know how to do. Please help me in this regard. It will be helpful, if explained...Doubt in struts I am new to Struts, Can anybody say how to retrieve... : Thanks Struts 2.0.6 Released Struts 2.0.6 Released Download Struts 2.0.6 from This release is another grate step towards making Struts 2 more robust and usable.   2.0- Deployment - Struts Struts 2.0- Deployment Exception starting filter struts2... /* For more information on Struts2 visit to : Thanks I placed correct web.xml only. For first time I Struts for Java Struts for Java What do you understand by Struts for Java? Where Struts for Java is used? Thanks Hi, Struts for Java is programming... information and tutorials then visit our Struts Tutorials section. Thanks Integrating Struts 2 with hybernate - Struts Integrating Struts 2 with hybernate Can anyone please help me how... JDBC call? please help me thanks in advance Hi friend, Read for more information. Java Struts - Hibernate Java Struts I am trying to do a completed project so that I can keep it in my resume. So can anyone please send me a completed project in struts.... thanks in advance. Hi friend, Read for more information Money Transfer Applications ? Making Your Life That Much Easier Money Transfer Applications – Making Your Life That Much Easier... decade the industry has undergone an astounding amount of advancements thanks... certain tasks to help you manage your money. You can do just about everything What do you understand by Virtual Hosting? about the hosting terms. Just explain me about Virtual Hosting. Thanks  ... more at the following page: Check the tutorial Virtual Hosting. Thanks...What do you understand by Virtual Hosting? What do you understand file uploading - Struts Struts file uploading Hi all, My application I am uploading files using Struts FormFile. Below is the code. NewDocumentForm.... If the file size is more then 1 mb. I need to read the file by buffer MVC - Struts MVC CAN ANYONE GIVE ME A REAL TIME IMPLEMENTATION OF M-V-C ARCHITECTURE WITH A SMALL EXAMPLE...... Hi friend, Read for more information. Thanks struts - Struts struts how the database connection is establised in struts while using ant and eclipse? Hi friend, Read for more information. Business Intelligence for Decision Making Business Intelligence for Decision Making How do business intelligence helps in better decision making Hi - Struts know it is possible to run struts using oracle10g....please reply me fast its...:// Thanks. Hi Soniya, We can use oracle too in struts...Hi Hi friends, must for struts in mysql or not necessary Thanks for fast reply - Java Beginners Thanks for fast reply Thanks for response I am already use html... oh well... do not get confused with all that! these are very simple...(); } Just read the tutorial completely, and u'll able to do it. Good luck the struts action. Hi friend, For more information,Tutorials and Examples on Checkbox in struts visit to : Thanks Struts - Struts . Please visit for more information. Thanks java - Struts : In Action Mapping In login jsp For read more information on struts visit to : Thanks... friend. what can i do. In Action Mapping In login jsp   in jsp page/ How to to do the whole configuration. thanks Arat Hi...multiple configurstion file in struts Hi, Please tell me the solution. I have three configuration file as 'struts-config.xml','struts validation - Struts single time only. thank you Hi friend, Read for more information, Thanks...validation Hi, Can you give me the instructions about Hello - Struts :// Thanks Amarde... will abort request processing. For more information on struts visit to : Thanks Hi.. - Struts Hi.. Hi, I am new in struts please help me what data write in this file ans necessary also... struts-tiles.tld,struts-beans.tld,struts.../struts/ Thanks. struts-tiles.tld: This tag library provides tiles making trees - Java Beginners making trees pls i do't know what this yerms mean in terms of java trees and stacks? Inorder traverse Switch statement Doing something to the stack thanks in advance Struts - Struts . Struts1/Struts2 For more information on struts visit to : Hello I like to make a registration form in struts inwhich java - Struts java what do u mean by rendering a response in Struts2.0 Hi friend, Read for more information. is running code, read for more information. configuration - Struts /struts/ Thanks...configuration Can you please tell me the clear definition of Action class,ActionForm,Model in struts framework. What we will write in each Java making a method deprecated Java making a method deprecated java making a method deprecated In Java how to declare a method depricated? Is it correct to use depricated... to anyone who is using that method. Please tell me how to achieve that?   Tell me - Struts Struts tutorial to learn from beginning Tell me, how can i learn the struts from beginning Struts - Framework , Struts : Struts Frame work is the implementation of Model-View-Controller... of any size. Struts is based on MVC architecture : Model-View-Controller... are the part of Controller. For read more information,examples and tutorials Tell me - Struts Directory Structure for Struts Tell me the Directory Structure for Struts Advertisements If you enjoyed this post then why not add us on Google+? Add us to your Circles
http://www.roseindia.net/tutorialhelp/comment/19444
CC-MAIN-2015-18
refinedweb
2,157
77.33
Gabe Newell Slams Windows 8, Talks Steam Box on GT.TV Spike TV did a 30-minute scoop on what's currently going on at Valve including Newell's distaste for Windows 8, info on the Steam Box, the upcoming launch of Big Picture, and even talk about a DOTA 2 documentary. GT.TV promoted its 30-minute episode with Valve promising to announce something non-gaming. Turns out, all they talked about was Source Filmmaker which transforms gamers and non-gamers alike in to movie directors using Valve's own Source-based tool. Thus, the only real interesting part about the segment was bossman Gabe Newell dodging Half-Life 3 questions with jokes about getting eaten by sharks on his upcoming vacation, and his need to slam Windows 8 again. "I would really like it if Windows 8 was a blowout success, because we're going to make a lot more money -- there will be lots of happy customers," he said. "But I don't think that's going to be what happens. I think that Windows 8 will end up being really poorly received by customers. I think it will raise support calls. I think it will reduce hardware manufacturer margins. I think we'll actually sell fewer copies of our games on machines running Windows 8." After that, Newell and GT.TV host Geoff Keighley moved on to briefly talk about Steam Box which supposedly doesn't exist. Keighley asked if Valve's strategy is leaning towards having Steam Big Picture in living rooms first, and then have someone build a device that can hook up to a TV that can run Steam. "Yeah absolutely," he said. "That's what we hope. So we show hardware guys and say, 'look, if this is a useful tool for you to deliver your hardware to the living rooms, that's great. And if you want to run it on top of Windows, that's fine. If you want to run it on top of Linux, that's fine." When asked when he thought such a box would arrive, he said everyone will be able to tell a lot more [soon]. "We should have both Linux and 10-foot (Big Picture) betas out there fairly quickly and I think customers will say, 'this is really great,' or they'll say '[it's] another interesting, but not valuable contribution' fairly quickly." As for the Big Picture mode, Greg Coomer stepped in later in the clip and said it will arrive in early September, offering a better presentation when Steam is displayed on large HDTVs. Big Picture will support game controllers and the typical mouse/keyboard setup we've come to love over the years. "There are some games that are better made for a controller input than others so those will be the best experiences," Coomer said. "But everything will be there. You don't have to give up all your favorite stuff once you walk from the den to your living room." Towards the end of the 30-minute Valve extravaganza, Valve's Erik Johnson said that the studio is currently working on a documentary based on pro DOTA 2 players during last year's international tournament. He also shows an impressive trailer for the upcoming film, revealing that the documentary takes a dramatic, cinematic approach into the lives of numerous DOTA 2 players and how they juggle pro gameplay with family, friends, school and the desire to win one million dollars. One player was kicked out of his home, while another heard a threat from his parents, telling him "gaming will be the death of you." "We went into last year's international and just kinda on a fire thought we should bring along some cameras of our own and get a bunch of footage," Johnson explained. "Who knows what will come of it. And what ended up happening is we started to learn about these players, that we're following their story and kinda their background, and it was incredibly compelling." The stories were so compelling that the two people working on DOTA 2 at the time are now working full time on the documentary. "They personally are so interested in telling these players' stories," he added. "We think it's going to be super exciting and we're hoping to get it out by the end of the year." To see the full 30-minute episode of GT.TV invading Valve's Seattle headquarters, head here.. The only reason why you could see less sales from machines with win 8 is that some people in the PC gaming camp are too oblivious and ready to blindly flame Windows 8 just over the UI, completely ignoring the improvements and the fact that there is Desktop mode and an option to install a start button. So, it goes without saying that windows 7 will have a higher proportion of "PC enthusiasts" then windows 8. That may change a bit because OEM's run to the new OS no matter how bad or good it is, just look at Vista. That includes boutique PC builders.. pretty sure the greed developers will take this bait, and start developing games with linux support. Good for consumer also as they can finally save $100-200USD to buy a better GPU. and make all ur games linux support too. I'm going to disagree with you on the start menu being the single most organized thing. I've heard people make similar arguments (albeit, different circumstances) for their desktop or their fences etc. The start menu, metro splash-thing, desktop, etc. Is only as organized as the user is. For me, I have a few items pinned to the taskbar, a few items on the desktop, and from there mostly use the run prompt or press the start button, type in what I want, and press return (same for Windows 8). For your average consumer, their desktop and start menu are going to be cluttered with every piece of crapware they have ever downloaded and has 4 searchbars. Don't get me wrong, I don't care if upgrade or don't - if you want to stick with 7 - awesome. If you want to install Linux - great (I'd suggest Fedora), I think more people need to learn Linux - it will help you learn more about how an operating system works, which is something that can't hurt anyone :-) I just find some of what you are saying to be overly subjective to your particular user style and that you never took the time to try to optimize anything - you just threw the baby out with the bathwater. That's just my two cents though. Not gonna buy windows 7 when my machine runs perfectly on windows XP professional. See what I did there? People were saying that too. Under the hood Windows 8 is a similar upgrade to Windows 7 as Windows 7 is to Vista. It runs better and uses less resources, just like 7 did over Vista. It is also a NT kernel upgrade. Sure, the metro menu and lack of a start menu can be a nuisance, but it really has little effect on gamers. The thing is, UX and UI design are significant factors that help determine the success of a particular piece of software. The everyday joe doesn't care about how optimized the backend is, what he cares about is the ease of access, and the user experience. As a graphic designer and front end web developer, I can assure you that there is a certain "science" that goes into UX and UI design, and w8 is horrible on the desk space. In a nutshell, MS is forcing a tablet UI and UX unto the desktop segment, which is already a flawed approach in itself as they are two different market segments -regardless of their overall goal of unifying all their platforms, it's like forcing a car's dashboard be used on your truck, your bus, and your airplane, and saying that you want all their dashboards to look the same. My secondary OS is Arch Linux, babeh, "and I feel fine." (c) R-E-M Win7 is an actual upgrade over XP. Stability, features, style, protection, everything. Personally, I dont see myself upgrading to a new OS if the UI is a turnoff for me, simply because of how great Win7 is. I didnt upgrade from XP to vista for a reason, much like I wont upgrade from Win7 to Win8. Maybe Win9 depending on the scenario, but I dont see Win8 as being the same caliber of upgrade from XP to 7. You can still hit "Start" type Photoshop and hit enter to get to Photoshop just like Win7/Vista. Just now its a full screen search when you start to type. That is the part that takes getting used to, well that and not using the "Start Key" to bring up the taskbar. ME: fail xp: win vista: fail 7: win 8: to be determined, but if previous strategy from MS stays in place, it's going to be yet another fail. XP & 7 were pretty much directly adapted straight from server OS versions, which is part of why they turned out so awesome for WinOS's. Win8 is an "upgrade" to 7, just like vista was an "upgrade" from XP. I know where the smart money would be betting. Hell, I personally skipped vista altogether after trying it out once. My XP box was booting on 150mb with good functionality, which suited the box I had at the time to a T (1gb ram, yes, it was that old). The only question I have is whether or not the actual improvements in the background will pave the way in bringing techy people across to the new UI. For the most part, OEMs will try push you to the new OS as they're incentivized to do so. The average user will of course upgrade to 8 as they upgrade their computer - we saw this with Vista. A lot of people disliked Vista because it was "slow" (i.e put on hardware it wasn't suited for, especially when you add in all the bloatware oems push to lower their costs). Your average consumer will adjust to the new UI and complain, but learn it because apparently installing a different OS is too much of a challenge for them. But those who listen to their "techy" mates will no doubt be influenced towards win7 unless win8 is actually that much better all round that the advice won't be to stick to the more user-friendly win7. Start button is an integral part of most novice-intermediate users experiences. Hell, I know the starting file of most of my programs via Run, but even so, I still use the start button more often. It's just easy, to be frank. Yes, I realize not everything will be ported but its definitely a whole lot better than nothing. Desura is good, but has too few titles (many of which are still in development). That is exactly what MS is trying to do with Win 8, and that is exactly why many people think it will not work. Driving your bimmer (or beemer): Let's see now, what does this control marked "aileron" do? What MS should be doing is making different versions optimized for each environment, Have a professional Office OS, a Tablet OS and a Home Entertainment OS, the home Entertainment one being the most important for my members and myself who love to have a PC be just that, a personal computer that they can customize fully and call their own. MS needs to stop forcing all of us to conform to their vision of what a OS is meant to be and actually see what people want, don't just use their statistics gathered from their spyware telling them what we want, actually ask people and gather real feedback.
http://www.tomshardware.com/news/GT.TV-Gabe-Newell-Steam-Box-Big-Picture-Windows-8,16925.html
CC-MAIN-2014-35
refinedweb
2,008
67.69
Difference between revisions of "Programming Work" Revision as of 18:03, 26 January 2015 A list of things that must, should or could be done by programmers. Please, only programmers change this! Ask Geoff the Medio if you'd like to help, or need help, with a programming task on this page. Contents Misc - Keep an eye on SourceForge bug reports and fix non-minor ones. - Implement SourceForge feature requests (typically requires design discussion on forums) - Write up and maintain compilation User's Stories. - Keep MSVC and XCode project files and CMake build files updated (if anyone adds or removes source files) - Make the core / common library (mainly gamestate classes) be built as a shared / dynamic library instead of as a static library as it is now. This code should be the same for the server, human, and AI clients, so shouldn't need to be built into each of those binaries separately (Implemented for cmake build and Xcode project). - Add a binary flag and related checkbox in the options screen to make the game use the default location for the resources directory, rather than using the version stored in config.xml. Currently, if more than one freeorion is installed on a system, and their resources directories contents are incompatible, it's necessary to delete the config.xml every time to make the game use the proper set of resources. With this switch, the game would automatically determine its own resources location (using the existing code that determines the default location of these files) and both versions could be run and would use their own, separate, automatic default locations for the resources dir without requiring the user to update it each time the version is changed. - Stringtable entries can be formatted with <i>italics</i> or <rgba 0 255 0 255>colours</rgba>. It would be nicer if there were a few named colour tags available instead of requiring the clunky rgba as illustrated. <red>, <green>, <blue>, <white>, <black>, <defaultcolor>, etc. could be handy. - Change victory conditions so that players can continue in the same galaxy after defeating all other empires PARTLY DONE IN SVN, should they be so inclined. Optionally, add multiple victory conditions and a way to choose between them during galaxy setup. Perhaps start or continue a forum discussion about what victory conditions there should be. - Improve and extend the functions and data exposed to the Python AI. - Add a "__str__" function to the Universe class and the UniverseObject class, which uses the existing Dump functions of UniverseObject and ObjectMap to output a text representation of an object. Note that similar code exposing such a function already exists in the set wrapping header. - Design and implement FreeOrion galaxy map saving and loading routines. It should be possible to load a map when starting a new game, instead of randomly generating one, and to save maps from the GUI or extract them from FreeOrion saved games. Maps should store stars, planets and planet specials. When loading, it should be possible to use only the stars (and randomly populate the systems), or use only stars and planets (and randomly add specials), or use all of the data. - A way to do this might be to use a SVG image to store map data. Positions of stars would be indicated by circles in the image, and star colour would be indicated by the colour of the circle. Starlanes between systems could be indicated by lines between the system circles. Planets could be indicated by circles within the system circles, and planet type would be indicated by colour as well. Names of systems and planets could be text within their respective circles. Specials on objects could be indicated by boxes within the circle of a planet or system that contain the text that indicates the name of the special. Buildings on planets could be indicated by a different colour box that contains the name of the building. A zoomed-out (to see the whole universe) rendering of this SVG would resemble the in-game map, and zooming in would reveal details of the contents of systems and objects in systems or on planets in systems. - Add additional moderator actions in moderator mode (a multiplayer game player type). - Write code to get GG::Clr defined in a text file to determine the colours of meters in the GUI. The function GG::Clr MeterColor(MeterType meter_type) in InfoPanels.cpp should be updated to use this instead of hard-coded meter colours. Code to read colours already exists and is used for parsing tech category definitions in techs.txt, so doing the same for meters should be relatively simple. - Bug of sorts: When building an Imperial Palace, the empire stockpile location is moved. When doing this, if the old and new stockpile locations aren't able to share resources, the new stockpile location shouldn't retain the old location's stockpile. Instead, the stored amounts of minerals and food should be set to 0. - Modify the data transmission between the server and clients when sending turn updates and mid-turn updates, so that only data about changed Objects is sent. This should reduce the amount and duration of data sending, and should speed up unpacking / processing the results by clients. Player order-giving improvements - Make it possible to queue fleet orders (other than movement, which can already be queued), such as colonizing or invading a planet - Add rally points for ships on the production queue - Make it possible to give a production order a name, which will then be applied to all ships produced by that order. Multiple ships from the same order could have their object id appended to the name to disambiguate from other such ships. - Add some player-helping AI scripts so the player can order a fleet to "explore" - The ExecuteImpl functions of the various Order subclasses in Order.cpp should validate the orders they're about to execute, to ensure that invalid orders can't be sent by players using modified clients or improperly written AIs. For example, in FleetMoveOrder, a player could write a custom client that sends a FleetMoveOrder with a move route that doesn't follow the rules about where players can send ships. A bit of validity checking has been added to that function, but it should also check the route so that when the order is executed on the server, there's no way for an invalid order to be accepted. This validate should ensure that the series of systems in the order's route are all connected by starlanes known to the player that owns the fleet that issued the order. Other Order subclasses likely have similar checks that could be added as well. - Add text commands for all the possible orders players can issue. The messages window has a basic order parsing system set up, which presently handles zooming to objects. Any of the Issue*Order functions in AIInterface.cpp could be make usable for human players as well using this text input method. Parsing the input text might be a bit tricky for orders that need one or more UniverseObject or content name, but should be doable in most cases. It should be possible to work things out for names that have spaces (thus making it harder to tell which parts of the input text are for which order function parameter) in most cases, without needing wrapping quotes or similar means to clarify, although those might be useful options to have anyway. UI improvements NOTE: It is strongly recommended that you discuss non-trivial GUI changes on the forums so additions and alterations match the desired stylistic direction, and to minimize revisions or wasted effort. - Various feature requests on sourceforge are worth implementing. - Investigate making dragging items on queues (production, research) determine where to drop something based on something other than the mouse cursor position. When dragging a box like a tech or production item panel around the queues, it's strange to have the apparent position of the box be different from the active position determined by the mouse cursor position. This means that if the box is dragged from the top, it will appear lower than it would if it was dragged from the top, for a given "active" position. (Where the "active" position is the mouse cursor position which is actually used to determine where in the queue the box it dropped). Ideally the centre point of the box would be used to determine where a box will be dropped, regardless of where on the box the cursor was when dragging started. - Add "buildings of this type" list to building type entries in the encylopedia, similar to "ships of this design". - The encyclopedia search function could be improved. Possibilities include more intelligent searching of article titles, searching of article contents, or showing a list of results instead of jumping to the first matching page. - Improve 'Pedia navigation with a sidebar. See this thread Production screen - Make the buildable items list sortable, with resizable columns - When a building is selected in the buildable items list, get the building's effects groups and find all objects that would be targets of the building's effects if built at the selected location. Mark these objects in the UI somehow (discuss with graphics team). - Add lines in the top-left production summary for the currently selected system. Now the total empire PP and wasted PP are shown, but it would be good to also show the available and wasted PP in the selected system. - Make dragging a building from the buildable items list onto a planet attempt to order that building to be produced at the planet. Add the building to the end of the queue. Do the same for ships. - Make dragging a building or ship onto the production queue enqueue that building or ship at the selected planet. If no valid build location for the dragged item is selected, then do nothing. - Make dragging an item from the queue onto the empty space of the galaxy map, or onto the buildable items list, remove the item from the queue. - Add a way to order a full fleet to be produced, consisting of multiple different types of ships in specific numbers. All the ships produced would be put into one fleet together. They'd either be added to this fleet as they're produced, or all be produced on the same turn whenever the total PP for the whole fleet has been allocated. Implementing this would likely require a new variant of ProductionOrder and server modifications. Research screen - Make the tech list view resizable and sortable. - The tech tree layout currently produces very unoptimal placement of dependency lines, where long pathes around techs are used for no apparent reason. This could be fixed. - Make GUI layout changes persist between executions of the program. The user / player can rearrange and resize several windows on the tech screen, however these changes are lost when the user exits FreeOrion. The positions of the various windows could be stored in config.xml (similar to how galaxy setup selections are stored) and retreived the next time the program is run. Positions should probably be stored in a resolution-independent way, so that changing the resolution doesn't cause windows to disappear off screen, and/or sanity checks for size and position should be done when doing initial layout / retreiving from the options DB to ensure a reasonable layout. Entries in config.xml can be added by adding a function like void AddOptions(OptionsDB& db) in the anonymous namespace in ClientUI.cpp or MapWnd.cpp in files that don't already have one, or adding entries to an existing function of that sort in the file where a stored windows position needs to be retreived. The new options should store the x and y positions and height and width of the windows to have persistent locations between executions. The constructors for those windows could be passed (or modified to take) the positions and sizes as parameters, or the code that creates the new windows could reposition them, or an existing function to position windows could be altered to use them. Entries for these options aren't really needed in the Options screen. The SidePanel - Fix up the top portion with the system resource summary, system droplist and star graphic - Design and add a "shipyard in system" box to the system info section - Show ships being built, similar to buildings being built on planet panels - Make more aspects of planet appearance on the sidepanel vary depending on its in-game state: - Industry meter level could change what texture is used for planets. - There are currently hard-coded adjustments to rotation speed or axial tilt, but these would be better if implemented as effects. - An effect to add a ring texture to planets could also be added. Ideally, rings should cast shadows on their planet. Galaxy map screen - Add tooltip to system icons on the map, indicating their colour. see this post for motivation. Additional info like # of planets or empires with colonies in the system might also be added to the tooltip. - Add tooltip to the empire resource summaries at the top of the map screen. This should list, with text explanation, the stockpile, income, expenditures, and net change. - If all the details sound like to much work, just indicating what the icons represent with a tooltip would be helpful. - On empire resource summary, list all + and - contributions to the production and consumption of each resource. Something like " ObjectType ObjectName +/- ### " in a column. - In MapWnd::RenderFleetMovementLines, move_line_animation_shift (a file-level static variable) is set each frame. It's then used in RenderMovementLine to determine where to position the first fleet move line dot after the start of the first segment of the move line. If several empires' fleets are all leaving the same system along the same starlane, these dots will overlap, and only one will be visisble. It would be better if there was an empire-id-dependent additional offset for the dot positions, so that multiple empires' dots can be seen moving along the same starlane. Fleets Windows - Figure out a good way to move up and down the partition between the top third of the panel that shows fleets and the bottom panel that shows ships within the selected fleet. Some way to drag a partition would be appropriate. This needs to work whether or not there is a new fleet drop target in between the two. - If a fleets window is showing fleets not at a system, indicate that the fleets are "near SystemName" instead of just saying "Fleets". Design Window - Add DesignWnd::MainPanel::CanPartBeAdded should be used to determine if parts can be added to the current design, and appropriately grey out / disable parts that can't be added to the current design. - Make the parts list accept drag-drops of PartControls. If a PartControl is dragged from the parts list to itself, do nothing. If the PartControl is dragged from a SlotControl in the main design panel, then remove the part from the slot. New Effects - SetRotationSpeed / SetAxialTilt - A few specials (Slow Rotation, Tidal Lock, High Axial Tilt, Gaia) should modify their planet's appearance. Currently the rotation and tilt specials are checked for during universe generation, and any planets with them have their rotation or tilt modified. It would be better if the specials could do this with an effect themselves, so that we can remove the hard-coded special names from the c++ code, and could add these specials later in the game and have their effects be visible. New Conditions - PlanetSlot - which slot a planet or other object is located in, in its system - Speed - distance per turn an object is currently moving (and perhaps also max speed?). Most applicable to fleets and ships travelling between systems. - ShipDesign details: designing empire, designed on turn / age of design - OwnerControls - takes a special, building, ship hull or ship part name (which appropriate type indicator in the parameter) and a minimum and maximum number. Matches any object owned by an empire than also owns the a number of the indicated item that falls into the indicated range. This will be useful for, for example, limiting an empire to only owning one of a particular building or ship hull. For specials, the empire needs to own planets (or anything else that can have specials on it) with the indicated special attached to them. - Agressive / Passive - matches fleets that are set to be aggressive or passive. - HaveFocusAvailable - matches planets that have a particular focus available for their player to select (even if not presently selected). Referenceable Object Properties For effects and condition definitions: - DistanceToTarget - just like DistanceToSource, but relative to an effect's target object, rather than the source object. - SourceTargetJumps - number of starlane jumps between source and target being acted on, using starlanes known of by source's empire - PlanetSlot - which slot a planet or other object is located in, in its system - Speed - distance per turn an object is currently moving (as opposed to the BattleSpeed and StarlaneSpeed properties that indicate the movement speed if moving, which is different if the object isn't moving at the present time). It would also be nice if it were possible to reference properties of an entire effects group when defining effects that (like all effects) act on a single object. This would allow the CreateSitRepMessage effect to say something like "The explosion destroyed 10 ships!" instead of showing 10 variations of "The explosion destroyed %ship%!".
https://freeorion.org/index.php?title=Programming_Work&diff=prev&oldid=9059
CC-MAIN-2019-39
refinedweb
2,931
58.82
#include <genesis/utils/math/twobit_vector.hpp> Definition at line 41 of file twobit_vector.hpp. Constructor that initializes the vector with size many zero values. Definition at line 118 of file twobit_vector.cpp. Clear the vector, so that it contains no data. Definition at line 405 of file twobit_vector.cpp. Return a single word of the vector. This is useful for external functions that want to directly work on the underlying bit representation. Definition at line 176 of file twobit_vector.cpp. Return a single word of the vector. This is useful for external functions that want to directly work on the underlying bit representation. Definition at line 187 of file twobit_vector.cpp. Return the number of words (of type WordType) that are used to store the values in the vector. Definition at line 140 of file twobit_vector.cpp. Get the value at a position in the vector. Definition at line 149 of file twobit_vector.cpp. Calculate a hash value of the vector, based on its size() and the xor of all its words. This is a simple function, but might just be enough for using it in a hashmap. Definition at line 198 of file twobit_vector.cpp. Insert a value at a position. The size() is increased by one. Definition at line 290 of file twobit_vector.cpp. Inequality operator, opposite of operator==(). Definition at line 230 of file twobit_vector.cpp. Equality operator. Definition at line 214 of file twobit_vector.cpp. Definition at line 165 of file twobit_vector.cpp. Remove the value at a position. The size() is decreased by one. Definition at line 342 of file twobit_vector.cpp. Set a value at a position in the vector. Definition at line 269 of file twobit_vector.cpp. Return the size of the vector, that is, how many values (of type ValueType) it currently holds. Definition at line 131 of file twobit_vector.cpp. Validation function that checks some basic invariants. This is mainly useful in testing. The function checks whether the vector is correctly sized and contains zero padding at its end. Definition at line 241 of file twobit_vector.cpp. Underlying word type for the bitvector. We use 64bit words to store the 2bit values (of type ValueType), so that we get best speed on modern architectures. Definition at line 55 of file twobit_vector.hpp. Value Type enumeration for the elements of a TwobitVector. The values 0-3 are named A, C, G and T, respectively, in order to ease the use with nucleotide sequences. The underlying value of the enum is WordType, so that a cast does not need to convert internally. Definition at line 66 of file twobit_vector.hpp. Constant that holds the number of values (of tyoe ValueType) that are stored in a single word in the vector. As we use 64bit words, this value is 32. Definition at line 79 of file twobit_vector.hpp.
http://doc.genesis-lib.org/classgenesis_1_1utils_1_1_twobit_vector.html
CC-MAIN-2019-09
refinedweb
474
61.53
Advertising --On 5. Juli 2006 19:11:16 +0200 Florent Guillaume <[EMAIL PROTECTED]> wrote: On 5 Jul 2006, at 19:05, Andreas Jung wrote:--On 5. Juli 2006 18:56:25 +0200 Florent Guillaume <[EMAIL PROTECTED]> wrote:Is anyone opposed to me removing the stupid: _getattr = getattr _none = None marker = _marker local namespace """optimizations""" that are found in unrestrictedTraverse?I am pretty sure that the complete Zope core is still full of those optimizations.Does that mean you're for or against it? For (of course) :-) -aj pgpQrpt9LJe13.pgp Description: PGP signature _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org ** No cross posts or HTML encoding! ** (Related lists - )
https://www.mail-archive.com/zope-dev@zope.org/msg21301.html
CC-MAIN-2018-05
refinedweb
108
59.7
Django’s setup method in the primary init.py file consists of a whopping nine lines of code; five if we don’t count the import lines. def setup(set_prefix) Hidden behind these few lines of code is a surprising amount of complexity, and by studying them we can gain a better understanding of how Django’s developers approach design and architecture, as well as a deeper understanding of Python’s built-in functionality. Today’s post is the first of a four-part series on how Django’s setup process works. 1. How Django accesses project settings. 2. How Django and Python manage logging. 3. Why Django allows the script_prefix to be overridden and how this is used. 4. How Django populates and stores applications. You may notice that each post in this series corresponds to an import line in the setup function. This is because all four of these pieces rely on quite a bit of plumbing behind the scenes, and it’s exactly that plumbing that makes them so interesting. When setup gets called If you read the last post on how Django uses WSGI in its communication with the web server, you would have seen the following code from the wsgi.py file. import django from django.core.handlers.wsgi import WSGIHandler def get_wsgi_application(): django.setup(set_prefix=False) return WSGIHandler() We focused on the line return WSGIHandler() and the ensuing functionality. This series is focused on the preceding line, django.setup(set_prefix=False) meaning that everything that happens in this series takes place prior to the functionality described in the previous post. Settings Within the init.py file, there are two lines of code that we care about for the current topic. from django.conf import settings ... configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) The first line imports settings from Django’s conf package (i.e. config), and the second passes two of that object’s attributes to the configure_logging function. At first this looks simple; surely settings is just some simple object pulled from a settings or config file, and now Django is looking up some pre-existing attributes. Not quite. By navigating to the /django/django/conf/__init__.py file, we see that this file consists of three separate class definitions: LazySettings, Settings, and UserSettingsHolder. The actual settings variable isn’t defined until the very last line of the file, where we find the following. settings = LazySettings() I encourage you to take a moment and look at the code briefly, as it’s surprisingly involved. This a pattern we will see often in Django, in which an import object is actually just a variable set to the value of some object from the relevant package, and not necessarily the name of an actual class. Lazy Settings The LazySettings class has the following profile (I’ve removed comments and replaced some areas we won’t be focusing on with ‘ ...‘). ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE" class LazySettings(LazyObject): def _setup(self, name=None): settings_module = os.environ.get(ENVIRONMENT_VARIABLE) ... self._wrapped = Settings(settings_module) def __repr__(self): ... def __getattr__(self, name): if self._wrapped is empty: self._setup(name) val = getattr(self._wrapped, name) self.__dict__[name] = val return val def __setattr__(self, name, value): ... def __delattr__(self, name): ... def configure(self, default_settings=global_settings, **options): if self._wrapped is not empty: raise RuntimeError('Settings already configured.') holder = UserSettingsHolder(default_settings) for name, value in options.items(): setattr(holder, name, value) self._wrapped = holder @property def configured(self): return self._wrapped is not empty High level observations: 1. This class inherits from LazyObject. 2. There’s no __init__ function, as it’s getting inherited from LazyObject . 3. Of the seven methods, four are magic methods, one is considered private (via the preceding underscore in _setup), one has the @property decorator, and only one is a non-magic, public method. What we don’t see are any attributes getting set. That makes sense if it’s inheriting the __init__ function from LazyObject, so let’s take a look there and see if it’s setting the settings.LOGGING_CONFIG and settings.LOGGING attributes that get addressed in init.py. _wrapped = None def __init__(self): self._wrapped = empty Nothing, except for the _wrapped private attribute. What’s going on? In short, LazySettings isn’t actually the main settings object. It’s just a wrapper around another object that holds the actual settings. If that’s confusing, we’ll first look at how this interaction works, and then discuss why it’s designed this way. Get Attribute The key method for understanding how setup works within Django is LazySettings.__getattr__. def __getattr__(self, name): if self._wrapped is empty: self._setup(name) val = getattr(self._wrapped, name) self.__dict__[name] = val return val This method is called when an attribute that has not yet been defined gets accessed. This is exactly what happens with the settings.LOGGING_CONFIG attribute. When accessed within init.py, it hasn’t yet been set Accessing it results in a call to LazySettings.__getattr__, which checks if LazySettings._wrapped is empty. If so, it calls LazySettings._setup, causing all settings to get initialized. Once LazySettings._wrapped has been defined, the value is looked up from the LazySettings._wrapped object, assigned to the internal LazySettings.__dict__ attribute, and returned to the client. The __dict__ attribute is the dictionary that holds object-level attributes, which makes the following lines of code functionally equivalent. self.x = 5 self.__dict__[x] = 5 Django is looking up an attribute from whatever object is stored at self._wrapped, then saving that value as an attribute of the LazySettings object. Future lookups will then be able to access the LazySettings attribute directly, and won’t go through the LazySettings.__getattr__ method. LazySettings._setup The LazySettings._setup method does the following: It looks up the DJANGO_SETTINGS_MODULE environment variable, then passes this path into the __init__ method of the new Settings object. This object is then assigned to the LazySettings._wrapped attribute referenced earlier. def _setup(self, name=None): settings_module = os.environ.get(ENVIRONMENT_VARIABLE) ... self._wrapped = Settings(settings_module) This whole flow is a bit confusing, so let’s take a look at it visually. - After the initial import, we have an empty LazySettingsobject. - During the first lookup, after self._setup(name)has been run, but before self.__dict__[name] = valis executed. - After self.__dict__[name] = valhas been executed. Non-lazy settings We now have a LazySettings object that acts as a wrapper around a Settings object, which isn’t instantiated until one of the settings is actually accessed. Let’s take a look at the inner Settings object, to complete the picture of how settings get stored. As shown in the (abridged) snippet of code below, the actual Settings object is quite simple. There are two primary parts of the __init__ method. - Iteration over the global_settings, defined in the /django/django/conf/__init__.pyfile. This is the default Django settings module. Individual settings are saved as attributes of the Settingsobject. - Import the user-defined settings_modulepath that was received as an argument, and iterate over these values. These may override settings previously set via the global_settingsmodule, and each one is added to the Settings._explicit_settingsset, to keep a record of all user-defined settings. from django.conf import global_settings ... class Settings: def __init__(self, settings_module): for setting in dir(global_settings): if setting.isupper(): setattr(self, setting, getattr(global_settings, setting)) # store the settings module in case someone later cares self.SETTINGS_MODULE = settings_module mod = importlib.import_module(self.SETTINGS_MODULE) ... self._explicit_settings = set() for setting in dir(mod): if setting.isupper(): setting_value = getattr(mod, setting) ... setattr(self, setting, setting_value) self._explicit_settings.add(setting) ... def is_overridden(self, setting): return setting in self._explicit_settings ... Accessible Settings Now that Settings.__init__ has run, the individual settings are accessible within the rest of the project and framework. In fact, if we return to the initial two lines of code where we first encountered settings, this entire process takes place while settings.LOGGING_CONFIG is first being looked up. When settings.LOGGING is accessed, the LazySettings object simply grabs the attribute from an already-populated Settings object, stores it as an attribute of its own, and returns the value to the user. If LOGGING is accessed a second time, the __getattr__ method will be skipped entirely, and the attribute will be pulled from the LazySettings object just like any other attribute. configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) Wait, but why? We’ve covered how the settings are accessed, but we haven’t taken a look at why they work this way. It isn’t the most simple method for accessing settings. Why not just create a Settings object without a wrapper, which can be accessed directly? Additionally, why was the UserSettingsHolder class defined in this file if it wasn’t used for anything thus far? The answers are related. Django supports the ability of different modules to configure settings manually when they are run separately from the rest of the Django app. The documentation gives the example of using Django’s template system by itself. In this case, the module could include from django.conf import settings and access settings.{attribute} directly, thereby initiating the same configuration process described above in the __init__.py file. The problem is that the separate module might not want this group of settings, and it may not want to rely on DJANGO_SETTINGS_MODULE environment variable. Enter LazySettings.configure. This method allows custom, manual configuration of the settings. As shown below, the configure method receives the settings as parameters and passes them to the UserSettingsHolder object. In this case the self._wrapped attribute is stored as a UserSettingsHolder object rather than an instance of Settings, simply because the methods of retrieving and accessing settings are different in the two cases, and are best served by distinct classes. def configure(self, default_settings=global_settings, **options): if self._wrapped is not empty: raise RuntimeError('Settings already configured.') holder = UserSettingsHolder(default_settings) for name, value in options.items(): setattr(holder, name, value) self._wrapped = holder This capability is why the LazySettings class is necessary (or at least a useful solution). Django only allows the settings to be configured one time. If the settings were configured by default every time, then specific modules would be unable to custom-configure their settings. The existing solution may seem overly-complicated, but it allows a somewhat unique set of rules to be enforced with minimal overhead for the user. - Settings are guaranteed to only be configured one time. - Settings can be set manually if the developer would like. - Otherwise, the default configuration process takes place, and the developer doesn’t need to manually configure anything. Conclusion Settings may seem like an unlikely candidate for a (relatively) deep dive, but taking a closer look gives us a more nuanced understanding of how Django actually works, how it utilizes Python’s built in functionality, and perhaps more importantly, why Django is built in this manner. In building a fully featured framework, Django’s core developers clearly took great time and care to design solutions that make usage as simple as possible for developers and users. But simple and flexible end-products sometimes necessitate fairly complex architectures, and we see that here. Thanks for reading, and tune in next time when we dive into the (actually) exciting world of logging, as we continue this tour through Django’s setup process. Takeaway Questions: Does this solution seem like it adequately fits the problem, or does it seem like over-engineering? Assuming the purpose was for the end product to be simple and flexible, does it succeed in this job? Feel free to leave your thoughts in the comments below. One thought on “Lazy Django: How Django accesses project settings – Setup Part 1”
https://djangodeconstructed.com/2018/05/25/lazy-django-how-django-accesses-project-settings-setup-part-1/
CC-MAIN-2019-43
refinedweb
1,947
50.84