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 |
|---|---|---|---|---|---|
ZF Home Page
Issue Tracker
Code Browser
Wiki Dashboard
Contributors Wiki
Developers Wiki
Proposers Wiki
Most Wanted
Contributor License Agreement
Mailing Lists
Code Contributor Guide
Documentation Contributor Guide
Developer Notes
Zend_BitTorrent is a component that can be used to encode and decode data in the BitTorrent format. Zend_BitTorrent will contain convenient methods for accessing methods in the Zend_BitTorrent_Encoder and Zend_BitTorrent_Decoder classes.
The most common usage of a component such as this one would be to decode .torrent files. The information found in torrent files are the name of the file(s) included in the torrent along with file sizes and more info used by BitTorrent clients when downloading torrents.
The Zend_BitTorrent_Torrent class contain ways to generate .torrent files. It can generate files based on other torrent files, or a path to a file or a directory.
When decoding it will first figure out what kind of variable the BitTorrent encoded string represents and then iterate through the string decoding all nested parts (if any). When encoding it will follow the simple rules of the BitTorrent specification.
Encode a string using the Zend_BitTorrent class:
Encode a string using the Zend_BitTorrent_Encoder class:
Decode a torrent file using the Zend_BitTorrent class:
Decode a torrent file using the Zend_BitTorrent_Decoder class:
Use the factory to generate a new .torrent file
Use the factory to generate a .torrent file from a path
I have a tracker component lying around but right now it's not generic enough to fit in the Zend Framework. The tracker could maybe be added to this component at a later time as Zend_Bittorrent_Tracker...
I'm not that familiarly with Bittorrent development, so I really want to know what is the deal with this class.
This is not a critic!
Thank you
The most common usage would be to decode torrent files to get information about the files that are included in the torrent. All sites that offer .torrent files most likely use some sort of library to fetch this info from the torrent files, and I thought it would be nice to have this in the framework.
As I wrote in the first comment here I have a bittorrent tracker written in PHP that can be added later that would make the component more complete.
Apart from being able to read from files, I also would like to see either a separate function (akin to simplexml_load_string and simplexml_load_file) to load the torrent file data from a string. I have seen many implementations that always assume one wants a file and never give this option.
What do you mean? That one wants to give the decode method the content of the torrent file instead of the path to the file?
If that is what you mean you can just do a Zend_Bittorrent::decode(file_get_contents('/path/to/file)); since torrent files are just an encoded associative array.
My apologies, I was still a bit tired after getting up and reading up on some buffer of notifications. I'm personally looking forward for this class finalized and included in the framework.
I just updated the proposal with information about the Zend_Bittorrent_Torrent class that can be used to generate .torrent files.
I have added the code to the laboratory at. Feel free to play around with it.
Hi Christer,
Looks interesting. Note that it would be Zend_BitTorrent, with a capital T.
You might also try to split up the Zend_BitTorrent_Torrent::buildFromPath() method into a couple other methods, because it's pretty long at the moment.
-Matt
Thats my bad. I'll fix the capitalization tomorrow.
I'll be leaving for a week's vacation on saturday, so I'll get to the buildFromPath method as soon as I get back.
This looks like a promising component, and I'd very much like to see it in Zend Framework. Following are the results from my initial review for consideration:
The prolific use of static methods irks me a bit, as we might be better served by having instance methods, but perhaps it can be shown that static methods will not be a problem.
I would recommend different placement of the require_once statements for lazy-loading classes, especially those for exceptions.
There is no need to use Zend_Loader::loadClass() within this component. Just use require_once.
What about having exception classes inherit from Zend_BitTorrent_Exception?
Don't forget to use the one true brace convention, with method and class opening braces on the next line.
Per-class suggestions:
Zend_BitTorrent
Zend_BitTorrent_Encoder
Zend_BitTorrent_Decoder
Zend_BitTorrent_Torrent
Thanks for the comment. I'll try to answer everything (I'm a bit short on time, traveling to Spain tomorrow for a week of climbing).
The component might be better off without the static methods and having instances of the classes instead so users can more easily extend the classes.
I'm not sure how other components in ZF deal with caching. I suppose there is not too much hassle to have caching functionality in the component and just let the user enable/disable it. What do you think would be the best option? To implement it in the component or having users extend the classes?
When having instances I can also drop the is*() function calls in the methods that require variables of specific types. If I skip that function call and keep the methods static I would have to make them protected and force the user to only use the generic encode() method. That way I know the input to the protected methods are correct. That would probably work just fine. It does not produce that much overhead. But if we have an instance we could just check the input in the constructor and use that information to skip the is*() calls and have all methods public. Personally I tend to like to be able to call encodeString() if I know my data is a string and not a generic encode() method.
When you say "different placement of the require_once statements for lazy-loading classes" I'm not sure I understand correctly. Would you want them in the code where the exceptions are thrown instead of calls to Zend_Loader? If so, I agree.
The main reason for reencoding data in the decoder is because of how strings are handled. Lets say we want to decode "3:foobar". The decoder will give you (string) "foo" and just discard the rest of the input since the prefix of the encoded string is 3 (the length of the original string). Because of that we can't do a strlen($str) since that would return 6, and not 3 which is the correct length. This might be one good reason for implementing caching in the component instead of having users do it themselves.
What benefits does the static factory method have over the "new" operator?
What benefits does the static factory method have over the "new" operator?
Not much really. I know some users think it's easier to use factory methods because if often results in fewer lines of code and less possibilities for errors. Personally I think it's a bit cleaner to have a factory method but I'm not saying it's better or worse than having a public constructor.
What about extending the class?
What about extending the class?
Seems like ditching the factory method and sticking with __construct might be a better idea, yes.
On what basis have the values of the class constants been selected?
On no basis at all actually. There were just the first that came to my mind. I just read the part about class constants in the Coding Standard document and saw how it should be done. I could just change them to "TORRENT_CREATE_FROM_FILE" and so on. Would that be better?
Does isReadyToBeBuilt() return true even if the object has already been built?
Seems like it. I could just see if it was already built and if so, return false. That might be more logical since there is no reason for building the torrent twice.
If I have skipped a questions it's just because I agree and have nothing more to add.
I will get to the changes when I get back from my vacation.
Don't hesitate to add more comments if something is unclear.
Thanks
With respect to caching, I think that we can find candidates for caching opportunities during incubation (development in trunk/incubator). We should probably not spend much time on premature optimization at this point. Just something to keep in mind.
I don't see any need to drop the type-specific encode...() methods such as encodeString() from the public interface. As you noted, it will likely be desirable to call these methods directly when working with known types.
Regarding the use of require_once, yes, I mean to suggest that these statements be located immediately prior to the use of such classes, as in "lazy loading". For example, in a method that throws an exception:
Regarding constants, we have both names and values. I recommend that names begin with the general and end with the specific (e.g., PATH_CONFIG, LOCATION_COUNTRY). I don't see much problem with the names of the constants you have selected. I was wondering more about the values of these constants, and how these have been chosen.
Have a great vacation, and I look forward to your return!
Christer, is it your intention to get this in to core for the 1.5 release? If so, let us know as soon as the proposal is ready for core team review and we'll turn it around as quickly as possible so you can get it in incubator and the hands of our users. The other possibility is to have it in incubator during 1.5, where it will likely benefit from the general attention we'll be getting around the release.
It's probably better to let it stay in incubator during 1.5 as you say. I currently don't have too much time to spend on this. Since we use ZF at the place I work I might be able to convince my boss to let me work on ZF related stuff during my work hours though, but anyways I think it might be better to not rush with the component.
I have updated the proposal a bit. It now includes all source code of the component. The component is in the laboratory as well.
There are some changes that are not in svn yet because of some issues with my laptop. One of the changes I can remember is that I have prefixed the protected properties in the Zend_BitTorrent_Torrent class with an underscore. There are some other minor changes but I can't access my laptop now to see what it is as of now.
Thanks for this, Christer!
I had another comment and a question I wanted to share:
We should consider moving this component to the Zend_Service_* "namespace", especially as this component could be used in affiliation with remote services (e.g., a torrent tracker). What do you think about contributing the tracker component you've written? The API and/or implementation can be improved during its lifetime in the laboratory and/or incubator, if you're concerned about that.
I have actually started making the tracker I have more generic, but it's going to take some effort from the users wanting to use a tracker component to make it fit in with their database setup regarding users and storage of the torrent files and such. I can try to patch things up a bit and make something presentable and make a separate proposal for it. Does that sound ok? I would think that finishing up the tracker would take a bit more time than the rest of the BitTorrent stuff I am working on though.
I am not sure if I agree with putting this in Zend_Service_* though. I thought that was more suited for web services and not a "server" component like a tracker? Maybe I'm just missing out on something here (which is usually the case )
Sounds good to me.
This proposal exposes a nice API for working with torrent files. The provided functionality appears to be quite useful, but we're unsure about how much demand exists for the functionality among framework users. We can gauge this demand as the component is made available through the laboratory, and the community has time to understand and use it where appropriate. We suggest that adding a torrent tracker would add value to the component and may help increase adoption. The proposed component is at this time approved for continued development in the laboratory.
We have tentatively accepted this proposal for laboratory development provided this proposal can be rounded out and more information on this component "will not" intend to do (specifically with regards to the portions of bittorent implementation that this component will not touch).
Currently, our comments from before still exist. I have read up on the bittorrent technology and have a few areas where your comments and expertise are needed any our concerns met:
-ralph
First, sorry about my late reply!
I would love to discuss this proposal further. It should be mentioned that there is a separate proposal here about a Zend_BitTorrent_Tracker component over at.
Feel free to send me a mail as it's probably easier to discuss it via mail instead of comments here.
Powered by a free Atlassian Confluence Open Source Project License granted to Zend Framework. Evaluate Confluence today. | http://framework.zend.com/wiki/display/ZFPROP/Zend_BitTorrent+-+Christer+Edvartsen | crawl-002 | refinedweb | 2,248 | 63.49 |
Hey Finxters! Among the many daily tasks you can achieve with Python, there is one Siri-like task that comes quite handy: managing your emails in a programmatic way.
Of course, many emails need your human understanding to be processed properly, and this article is not about implementing a neural network to fine-tune every single email action.
However, it is about learning a key asset: how to implement a code to manage simple tasks on a Gmail account, with the
ezgmail module, such as:
- receiving and reading your unread messages
- sending emails, including attachments
- downloading attachments
- viewing your recent messages
Building on these simple tasks, you will then be able to endlessly tailor your mailbox according to your personal needs, such as for example:
- trigger automatic replies based on specific strings found in an email body and/or subject,
- block a sender by throwing to the bin emails based on sender email address, or
- albeit more elaborate, make your very own spam detector by injecting an NLP algorithm in your program.
Lets get started!
Setting It Up
For this project to work, you need two things:
- installing the right module
- enabling the Gmail API
Install the ezgmail Module
The module well be working with is called
ezgmail, and you can install it with the usual command:
pip install ezgmail
or
pip3 install ezgmail
Alternatively, you may run
pip install --user -upgrade ezgmail
on Windows, to make sure you get the latest version.
To check it installed correctly, you can then check the version with the following command line argument:
pip show ezgmail
Note that this module is not produced by or affiliated with Google. It was developed by software programer Al Sweigart and you can find all the details here:
Enabling the Gmail API
First of all, I highly recommend you setup a separate Gmail account for this project. This will prevent any unexpected event from altering your mailbox in any unwanted way.
So, start out by signing up for a new Gmail account, then visit this page:
Click Enable the Gmail API button, then fill in the form, after which you’ll see a link to a
credentials.json file, which you’ll have to download and place in the same directory as your Python file. This is a requirement for the code to work. (For those who don’t know, basically, json is a popular and widespread format that looks like a dictionary in Python.)
Consider this file content the same as your Gmail password, so keep it secret.
When you will run your Python code to manage your Gmail account, the code will first visit the
json file directory in order to fetch your credentials from the
credentials.json file.
This provides additional security as unlike other modules, with
ezgmail you do NOT have to type in plain text your credentials in the program.
Time to start: enter the following code:
import ezgmail, os # change dir to the one where json credentials are saved: os.chdir(r'C:/path_to_credentials_json_file') ezgmail.init()
As a side remark, notice that you could have achieved what the second line does (i.e., changing the current working directory to the directory containing the file
credentials.json) with the Python
exec() function!
Something like:
exec(import os; os.system(cd path_to_credentials_json_file))
The
.init() method will open your browser towards a Google page where you can login. Type your credentials, you may then see This app isn’t verified: this is OK (believe me, I did it before you and I’m fine!), click Advanced, then Go to quickstart (unsafe).
When the next page prompts you with Quickstart wants to access your Google account, allow it, then close the browser.
You’re almost done with the setup phase.
What just happened is a
token.json file was created, and this will be used to provide your Python code access to the Gmail account you created for this project. Keep this one safe, too.
So from now on, you will no longer need to manually type your credentials.
You’re good to go! Starting now, the
.init() method should no longer be necessary.
Sending emails
The method is quite straightforward:
ezgmail.send()
ezgmail.send('recipient@gmail.com', 'test', 'hello world!')
Here are the arguments that you can pass:
Mandatory
args are:
- recipient
- subject
- body
Optional,
kwargs are:
- attachment (you can pass a list if there are several)
- sender
- cc (might not work at the moment, as per the github page)
- bcc (might not work at the moment, as per the github page)
Forgot the email address the
token.json was setup for?
Just check the attribute
ezgmail.EMAIL_ADDRESS 🙂
ezgmail.EMAIL_ADDRESS
Receiving emails
There are two steps involved:
- Reading the email, and
- Downloading its attachments.
Reading mail
The
ezgmail package structures emails just like the GUI email client does: it organizes them into threads, that can in turn contain multiple messages.
Hence the method
.unread() lists the
GmailThread objects.
print(ezgmail.unread())
Want to read a specific email within a thread?
The
.messages attribute is just what you need. It is subscriptable:
unreadThreads = ezgmail.unread() print(unreadThreads[0].messages[0].body)
It comes with a bunch of attributes such as
sender,
recipient,
body,
timestamp etc.
Also check the
.recent() method: it yields the 25 most recent threads of your Gmail account.
recentThreads = ezgmail.recent() print(ezgmail.summary(recentThreads))
Downloading attachments
A
GmailMessage object carries an attachments attribute that’s a list of filenames.
Pass any combination of these filenames in the
.downloadAttachment() method to download the files, or if you want all of them, use the
.downloadAllAttachments() method, which even has an argument enabling you to specify where to download the files (default the current working directory).
Searching mail
You guessed it use the
ezgmail.search() method!
Enter a string in this method just like you would in a GUI mailbox.
resultThreads = ezgmail.search('json') ezgmail.summary(resultThreads)
This returns a list of threads (remember the
GmailThreads objects?)
You can then pass the above mentioned attributes to retrieve specific info about a message.
Where to go from here?
Try it yourself!
And do discover the other features provided by this efficient and user-friendly module!
- Maybe you need it to automate a newsletter?
- Or to setup email reminders for your personal need?
- Or at work?
A few concluding remarks:
- in general, for this to work the email account needs to be configured with the lowest level of security, else the email will end-up either blocked or in the spams
- you may not be able to send repeated emails with the exact same text (as these probably are spams) nor with
.exeattachments (since these are probably viruses)
- please use this technology responsibly
- thanks to Al Sweigart for creating and maintaining this awesome module
- just because it currently works doesn’t mean it will forever; it is reliant on Googles choices among other things, and this module behaviour through time cannot be guaranteed
Last, if you need to process emails from an account other than Gmail, you should check the right modules to send and receive emails from any account, respectively using SMTP and IMAP protocols.
Freelancer profile
LinkedIn profile | https://blog.finxter.com/ezgmail-python-managing-your-emails-programmatically/ | CC-MAIN-2021-43 | refinedweb | 1,194 | 62.07 |
HOUSTON (ICIS)--Here is Wednesday’s end of day ?xml:namespace>
CRUDE: Sep WTI: $103.12/bbl, up 73 cents; Sep Brent: $108.03/bbl, up 70 cents
NYMEX WTI crude futures traded higher on the first day for September as spot month in response to the weekly supply statistics from the US Energy Information Administration (EIA) showing a much greater than expected drawdown in crude stocks. A build in gasoline and distillate inventories helped cap the rally.
RBOB: Aug $2.8601/gal, down 2.06 cents/gal
Reformulated blendstock for oxygen blending (RBOB) gasoline futures settled lower after the EIA report showed a gain of more than 3m bbl in gasoline inventories and a decline in consumption rates.
NATURAL GAS: Aug $3.762/MMBtu, down 1.0 cent
The front month contract fell for the third straight session, losing ground once again on the mild near term weather outlook and fears over soaring domestic production.
ETHANE: lower at 22.25 cents/gal
Ethane spot prices fell to a year-and-a-half low, as ongoing cracker outages and weak natural gas futures continue to weigh on the market.
AROMATICS: styrene down at 71 cents/lb
US styrene spot prices were said to be at 71 cents/lb FOB (free on board) during the day, sources said. The styrene price was down from 74-75 cents/lb FOB from last week, on the back of weak demand.
OLEFINS: ethylene wider at 64.75-67.00 cents/lb, PGP wider at 67.0-69.5 cents/lb
US July ethylene widened on Wednesday to 64.75-67.00 cents/lb from two trades at 65.00 cents/lb as supply remained tight. US July polymer-grade propylene (PGP) widened to 67.00-69.50 cents/lb compared with a trade the previous day at 69.25 cents/lb.
For more pricing intelligence please visit | http://www.icis.com/resources/news/2014/07/23/9804372/evening-snapshot-americas-markets-summary/ | CC-MAIN-2016-36 | refinedweb | 313 | 76.52 |
I recently started to redesign every JSMonday featured image using a new format (the one you’re seeing in the above image). I needed to create 60 new images for 20 articles by hand. That’s 3 images per article — the Open Graph, Instagram story, and Instagram post images.
How great would it be to generate the new article image set by simply making it a REST request and sending the title, subtitle, and the background image?
Let’s see how to do so by setting up a simple project using React and Puppeteer.
First, let’s divide our project between the React app (the UI we build of the image + text) and the image render script, we want a folder structure like this:
[root] | +----[react] | +----[render]
Let’s get started by creating a new React app with create-react-app:
$ npx create-react-app react-project
Great! Now let’s think about which kind of image we want to create.
For this article, I’d like to create a FullHD (1920*1080px) image with some text on it. Let’s design it just to have a reference during development:
As you can see we’re using a Google Font (Roboto) and an image from Unsplash, so we’ll need to render them inside our components.
Let’s start by creating our background component. Please note that a clean React architecture is not a goal for this article. We just need to create something that works and render it as an image!
The Background Component
import React from "react"; import "./Background.css"; export default function background(props) { return ( <div className="background" style={{ backgroundImage: `url(${props.image})` }}> { props.children } </div> ) }
.background { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 1920px; height: 1080px; background-size: cover; background-position: center; }
As you can see, we’re just creating an easy component which will take the background image from props and will render all the content passed as a children prop.
The Title Component
import React from "react"; import "./Title.css"; export default function title(props) { return ( <h1 className="title"> { props.text } </h1> ) }
.title { margin: 0; color: #fff; font-size: 144px; font-weight: 900; }
The
Title component is even simpler — it takes a prop called text and will render it inside an h1 tag.
The Subtitle Component
import React from "react"; import "./Subtitle.css"; export default function subtitle(props) { return ( <div className="subtitle"> { props.text } </div> ) }
.background { color: #fff; font-size: 48px; margin-top: 5px; }
Just like the Title component, Subtitle will take a prop called text and will render it inside a div. Pretty simple!
The App Component
import React from "react"; import Background from "./components/Background"; import Title from "./components/Title"; import Subtitle from "./components/Subtitle"; import "./App.css"; const <Subtitle text="Let's generate a beautiful image out of this React scene" /> </Background> ) }
@import url(';400,900&display=swap'); * { font-family: 'Roboto', sans-serif; }
With the App component, we’re mounting the entire image and text. Let’s see the result in a web browser:
Awesome! That’s exactly what we need.
Rendering the React Project as a PNG File
We need to create a production build of our React app. Let’s add the "homepage” property to our
package.json file. This will make it work locally just by opening the generated
index.html file with a browser:
now let’s launch the build using the default
create-react-app scripts:
$yarn build
Great! Now we have the following folder structure:
[root] | +---[react-project] | | | +--[build] | | | +-- index.html | | | +-- [static] | +---[render-project] | | | +-- index.js
We’ve separated the React app project from the Render project (the one which will generate the image for us). Inside the
/react-project/build directory, we can find the production build that we’ll use for generating our image.
Now let’s move inside our render-project folder and initialize a new package.json file.
$ yarn init -y
Now let’s add the only dependency we need, Puppeteer.
$ yarn add puppeteer
Puppeteer is an amazing library built by Google which exposes headless Chrome APIs. That means that most everything we can do on Google Chrome can be done using this amazing library!
Let’s see how to implement the image generation:
const puppeteer = require("puppeteer"); async function generateImage() { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto(`{__dirname}/../react-project/build/index.html`); await page.setViewport({ width: 1920, height: 1080 }); await page.screenshot({ path: "./myAwesomeImage.png" }); await browser.close(); }
And that’s it! Just 14 lines of code that will generate a PNG image from our React scene!
Let’s analyze in depth what we’re doing:
- We create a new Puppeteer browser.
- We create a new page.
- We set its destination URL to our generated
index.htmlfile. Please note that we’re using
file://, http protocol won’t work locally for this specific case!
- We set the viewport to 1920x1080 pixels. That way we’ll cover the entire React scene and we’ll capture it whole with the next script.
- We take the screenshot of the page and save it to
./myAwesomeImage.pngfile.
- We close the browser.
And now let’s see the result:
Can you guess which one is the original image and which one has been generated with React? Me neither!
You can find the full project in this repository:
github.com/jsmonday/jsm22
Next Steps
So now, what can we do next? I’ve just open sourced the code for a Google Cloud Function (it would also work as a AWS Lambda) which generates Instagram post/stories and Open Graph images just by sending title, subtitle, and image link over a REST API: github.com/jsmonday/sigf
The possibilities are endless. You could build an Express server which generates images based on certain parameters, or you could also generate PDF invoices using Puppeteer and React. It’s all up to your imagination! | https://www.hackdoor.io/articles/vPNzGp8w/generate-images-using-react-vue-or-angular-by-using-puppeteer | CC-MAIN-2020-10 | refinedweb | 987 | 57.06 |
Robert Hensing's BlogSoftware Security . . . and stuff. Community 7.1.12.36162 (Build: 7.1.12.36162)2008-09-03T09:34:00ZBluehat V8: Mitigations Unplugged<P>I first got to see Matt Miller speak in person a few Bluehat's ago when he was talking about <A href="" mce_href="">'Temporal return addresses'</A> . . . ah yes - the talk was entitled "Temporal Chronomancy" according to <A href="" mce_href="">Mr. Shostack's blog</A>.</P> <P>Anyways - I told you <EM>that</EM>: <A href=""></A></P> <P><STRONG>TIP</STRONG>: Be on the lookout for future blog posts from Matt over on the <A href="" mce_href="">SVRD</A> blog . . . </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing stuff and the end is near (for my blog)<P>First off - OneCare is dead - long live . . . OneCare . . . err Morro?<BR><A href=""></A></P> <P>Next up - Zune 3.1 is out - download it - love it. <BR><A href=""></A><BR>Also - the flash memory based Zunes are getting price chopped from $10 - $30 in time for Christmas:<BR><A href=""></A><BR><BR>Things.)</P> <P>Also came across a new commerical I hadn't seen yet for the 360 today: <A href=""></A></P> <P>Finally - all good things must come to an end - and my blog is no exception. :)<BR><BR!).</P> <P>So that said - my farewell post will probably be an explanation of why I have <A href="" mce_href="">'El Conquistador'</A> in my display name since it's probably the most frequently asked question I get. :)</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing week's Fail Open Goat Award goes to - Credit Card Processing<A href="" mce_href=""></A><div style="clear:both;"></div><img src="" width="1" height="1">rhensing SideSight? cool: <A href=""></A><div style="clear:both;"></div><img src="" width="1" height="1">rhensing<P>Akamai / IIS7 / SilverLight 2.0 / VC-1 == HD over broadband happiness. It's sort of cool - the video started off a tad blurry and then got sharper after a few seconds and I didn't have a single glitch. <BR>Pretty impressive stuff: <A href=""></A><BR>Also see: <A href=""></A></P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing SQL Injection : The Chinese Way<P>The blog pretty much speaks for itself: <A href=""></A></P> <P>Client-side browser vulns are of little use without an effective way of spreading them to the victims - unfortunately - it's still relatively easy for the miscreants to spread them around using tools like this.<BR>Interesting the comment about SQL injection via cookies . . . </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing of band security update planned for today (MS08-067)<P><STRONG>Updated 10/23/2008 @ 1:17pm EST</STRONG><BR>We have pushed the update live - here's the direct link to the bulletin:> (if it doesn't work for you - keep trying - it will be live real soon now).<BR>Also n</SPAN>ote that the Microsoft Malware Protection Center also has generic detection for the malware dropped in the targeted attacks!<BR>You can read more about it at the MMPC blog: <A href=""></A><BR>Finally my team has released a blog post with an interesting .C file linked at the end - for those who like to compile stuff and play around with ACLs: <A href=""></A><BR>--------------------------------------------- </P> <P>The MSRC, SWI and some Windows product team folks have been working really hard to get a critical security update out the door this week and they just pushed the advanced notification thing live early this morning (EST).</P> <P><A href="" mce_href=""></A></P> <P><A href="" mce_href=""></A></P> <P>It's likely that by the time many of you read this - the update will already be available for download via WU/MU/WSUS etc. <BR>Be sure to go out and grab it - especially if you are running Windows XP or lower operating systems (as you can tell by the severity ratings in the advance notification thinger - it's critical on that platform).</P> <P>As always we apologize in advance if this ruins anyone's weekend plans - I personally blame the miscreants. :)</P> <P>P.S. Keep an eye on my team's blog later today for more technical information: <A href=""></A></P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing 10 & IE8b2 Per Site ActiveX<P></SPAN>).</P> <P>Some people may hate this - I actually <EM>like</EM> that I can now selectively control which sites get to use Flash <STRONG>and</STRONG>.</P> <P mce_keep="true"> </P> <P mce_keep="true"> </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing 10 is out - install it like . . . yesterday.<P about everything these days. Adobe released Flash 10 recently and I'm just guessing it's got some security bug fixes in it that would probably be good to have. I'd install it ASAP.</P> <P mce_keep="true">Oh and has anyone else noticed that Acrobat 9 still:</P> <OL> <LI> <DIV mce_keep="true">Opens PDFs by default in a browser *without prompting* the user</DIV></LI> <LI> <DIV mce_keep="true">Runs JavaScript by default (I'm sure it's 'sandboxed' - whatever - i still disable this by default on all my boxes).</DIV></LI></OL> <P mce_keep="true">And does this remind anyone of Office circa 2000 when we let VBA macros run by default and didn't prompt users before opening documents via the web? How is it possible that in 2008 this still happens with our competitors?</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing to officially be called . . . Win7?<P call it "Veesta"). Longhorn sounds cool . . . manly . . . Vista is pretty much the exact opposite in my mind . . . it sounds serene and 'pretty'.</P> <P>Anyhoo - we seem to be doing all the right things with Win7 (you'll know why I'm saying that soon enough <G>): <A href=""></A></P> <P>Wish I could tell you more about it - but I can't. All I can say is that it freaking rocks. I <EM>already</EM> use it as my daily driver OS at work and can't wait until it's out in the public for testing (which it will be very soon at PDC / WinHec next week).</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing + Exploitability Index == Protected Customers, Better Security Update Prioritization<P>Today we officially launched our MAPP program (<A href=""></A>) as likely to be epxloited or exploited reliably (trivia: Did you know that only about 30% of all of our vulns ever have exploit code written for them?). </P> <P>You can see the exploitability index for the October release here: <A href=""></A></P> <P>Here's the breakout of the numbering system used for the exploitability index - it uses 3 numbers - simple - like me: <A href=""></A></P> <P><A href="" mce_href="">Code monkey</A> very simple man.</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing II / OSU Security Day / SafeCode<P!!).</P> <P>And having said all of that, it's a nice segue into this: <A href="" mce_href=""></A></P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing on "Threat Modeling"<P. <A href=""></A><FONT size=1 face=CMR9><FONT size=1 face=CMR9></P></FONT></FONT><div style="clear:both;"></div><img src="" width="1" height="1">rhensing running WM 6.1?<P>Okay - I'm not sure if this is real or not - but the interview itself is hilarious - the questions the woman asks at the end and the kid's responses are hysterical: <A href=""></A></P> <P mce_keep="true"> </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing<P>OMG - how is it possible that I JUST today found out about this?</P> <P><A href=""></A></P> <P>What is it? It's a new FREE (for now) browser for WM phones . . . that doesn't absolutely positively suck. I just installed it on my Q9 smartphone and it rendered <A href=""></A>!!</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing'm a PC and I fight for the users . . .<P>Tron Guy makes a cameo in our "I'm a PC" video wall: <A href=""></A></P> <P>Here's the algorithm for finding direct links to videos based on user name:[1st letter of username]/[2nd letter of username]/[3rd letter of username]/[username]/username]_336_252.wmv (thanks for the tip Jiri)</P> <P>I sort of like the video wall (and no the irony of having a video wall for a 'Life without walls' campaign has not escaped me) . . . its fun watching some of the videos and it reminds me a bit of <A href="" mce_href="">DeepLOL</A> (zoom in with the mouse wheel or by clicking with the mouse on the pic)</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing Ad Makeover - We are now entering "the 2nd phase"?<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>You know, I have one simple request. And that is if we are to have an ad campaign with sharks, that we have sharks with frickin’ laser beams attached to their heads!</FONT></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><A href=""><FONT size=3 face=Calibri></FONT></A></P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing 3.0 - Using wifi to download songs right from the ZMP (speed test)<P>Today. </P> <P>But the cool thing about the ability to access the ZMP wirelessly is that you don't have to <EM>stream</EM> the songs - you can add them to your 'cart').</P> <P>So I decided to do a speed test - tonight I found a newly released album - it was a Buckcherry album that showed up right on the main 'New). </P> <P.</P> <P><IMG style="WIDTH: 589px; HEIGHT: 335px" title="Zune 80 wifi download from the ZMP" alt="Zune 80 wifi download from the ZMP" src="" width=589 height=335</P> <P 'Gym Class Heroes' and the song was a rather amusingly named 'Drnk Txt Rmeo' ('cause who HASN'T txt'd while drnk? :) . . .</P> <P><IMG style="WIDTH: 584px; HEIGHT: 324px" title="Drnk Txt Rmeo download" alt="Drnk Txt Rmeo download" src="" width=584 height=324</P> <P>Welp - those are my numbers - YMMV . . . </P> <P><STRONG>UPDATE</STRONG>:)</P> <P><IMG style="WIDTH: 586px; HEIGHT: 335px" title="Zune wifi download - Take 2" alt="Zune wifi download - Take 2" src="" width=586 height=335</P> <P>). </P> <P>Well - I'm pleased to report that not only did it push the downloaded content back to my PC (as one would expect) - but it also averaged about 5Mbps while doing it! <BR>That's up about 50% faster than the last time I tested (with the last version of the firmware I averaged about 2 - 2.5Mbps).</P> <P><IMG style="WIDTH: 586px; HEIGHT: 327px" title="Zune wifi sync throughput" alt="Zune wifi sync throughput" src="" width=586 height=327</P> <P mce_keep="true"> </P> <P>So it looks like what we've learned is:</P> <OL> <LI>The Zune 3.0 firmware can download / upload at about 5mbps - and this is much faster than the Zune 2.0 and older firmwares</LI> <LI>Download speeds from the ZMP range from 600kbps to 3Mbps depending on time of day, color of shirt, album downloaded etc.</LI></OL><div style="clear:both;"></div><img src="" width="1" height="1">rhensing 3.0 - Insanely great creamy goodness from the Zune team<P).</P> <P.</P> <P).</P> <P.</P> <P>What else is cool? Well games - I now have Hexic and NLHE poker on my Zune (two of my favorite games - what are the odds?).</P> <P>I dunno man . . . the Zune is finally a seriously, "insanely great" entertainment device . . . the fact that we give the new hotness to even the original Zune 30 owners is IMHO very impressive - you don't see our competition doing anything like that.</P> <P>Welcome to the social.</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing and German authorities recommend against installing Chrome!?<P.</SPAN><">Shrugs - definitely using IE8b2 on all my machines now. :) </SPAN></P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing on 6? (Hot IE on WM action)<P>Whoa . . . a full fledged browser on my Smartphone! Yes please!</P> <P><A href=""></A></P> <P . . . </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing Microsoft Ad with Bill and Jerry - it's actually sorta FUNNY!<P>And holy crap - it's 4.5 minutes long!!!</P> <P>You can watch the ad in better definition than you can on Youtube by going here (and it looks like down on the timeline we'll have them all up there soon): <A href=""></A></P> <P>Okay - I have to admit - I officially think this ad campaign is sort of cool now . . . I see where they're going with it and well . . . it's not bad. ;)</P> <P mce_keep="true"> </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing I'm not running Chrome anymore (back to IE8 beta 2 for me)<P><A href=""></A><BR>Long. :)</P> <P>Another interesting read is how they implemented some of their 'enhanced' BIBA security model stuff to prevent the read-up (from Low to Medium or higher) stuff that Low IL on Vista still allows: <A href=""></A></P> <P>Function patching? Really? Wow. Just . . . wow.</P> <P>It's pretty obvious that the code quality just isn't there . . . this browser is not ready for prime time on anyone's machine IMHO.</P> <P mce_keep="true"> </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing begins . . .<P><STRONG>UPDATE</STRONG>: Go here and watch the video - it's higher resolution and better: <A href=""></A> </P> <P>Our $300MM ad campaign featuring Seinfeld: <A href="" mce_href=""></A></P> <P>I was left wanting so much more . . . Apple's probably breathign a collective sigh of relief right about now . . . </P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing out of the Chrome sandbox - 2 interesting vulns in 24 hours? Got IE8? :)<P>So it hasn't even been out 24 hours yet but Chrome is, as predicted, getting scrutinized heavily and well . . . it's falling down at a pretty alarming rate (as say compared to say - IE8 beta 2 which has been out longer :))<BR>So yesterday Aviv Raff discovered that Chrome is vulnerable to the Safari carpet bomb issue as reported here: <A href=""></A>.).<BR><BR>Then this morning we have a new, more interesting (IMHO) crash that was posted here: <A href=""></A><BR>So, I slapped WinDBG on both processes to see what's going on - and I visited the PoC site from my Vista++ machine and this is what I observed in the debugger attached to the <EM><STRONG>medium IL</STRONG></EM> kernel process:<BR><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>0:022> g<?xml:namespace prefix = o<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>(1078.fe4): Break instruction exception - code 80000003 (first chance)<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>eax=553a2ff0 ebx=0024e238 ecx=553a2ff0 edx=775cea74 esi=0024e238 edi=00000002<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>eip=553a2ff3 esp=0024e180 ebp=0024e180 iopl=0 nv up ei pl nz na pe nc<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>*** ERROR: Symbol file could not be found. Defaulted to export symbols for D:\Users\rhensing\AppData\Local\Google\Chrome\Application\0.2.149.27\chrome.dll - <o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>chrome_553a0000+0x2ff3:<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2ff3 cc int 3<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>0:000> ub eip<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>chrome_553a0000+0x2fe3:<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2fe3 56 push esi<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2fe4 e8d5dc5d00 call chrome_553a0000!ChromeMain+0x5ddb99 (55980cbe)<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2fe9 59 pop ecx<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2fea 8bc6 mov eax,esi<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2fec 5e pop esi<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2fed c20400 ret 4<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2ff0 55 push ebp<o:p></o:p></FONT></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>553a2ff1 8bec mov ebp,esp<o:p></o:p></FONT></SPAN></P> <P>Why is this crash interesting? Because it crashes the medium IL 'kernel' process and <EM>not</EM> the low IL 'sandbox / rendering engine' process (though that process does exit when the parent process dies)!! Why is that interesting? Because it points to protocol handler abuse as a potential way to bypass the protection measures of the low IL rendering engine sandboxes! </P> <P 'interesting' discovery / crash - that is certainly going to draw attention to fuzzing protocol handlers and maybe lead to the discovery of something even more interesting.</P> <P?</P><div style="clear:both;"></div><img src="" width="1" height="1">rhensing | http://blogs.technet.com/b/robert_hensing/atom.aspx | CC-MAIN-2014-23 | refinedweb | 3,252 | 58.42 |
NAME
uwildmat, uwildmat_simple, uwildmat_poison - Perform wildmat matching
SYNOPSIS
#include <inn/libinn.h> bool uwildmat(const char *text, const char *pattern); bool uwildmat_simple(const char *text, const char *pattern); enum uwildmat uwildmat_poison(const char *text, const char *pattern);
DESCRIPTION
uwildmat compares text against the wildmat expression pattern, returning true if and only if the expression matches the text. "@" has no special meaning in pattern when passed to uwildmat. Both text and pattern are assumed to be in the UTF-8 character encoding, although malformed UTF-8 sequences are treated in a way that attempts to be mostly compatible with single-octet character sets like ISO 8859-1. (In other words, if you try to match ISO 8859-1 text with these routines everything should work as expected unless the ISO 8859-1 text contains valid UTF-8 sequences, which thankfully is somewhat.
WILDMAT EXPRESSIONS
A wildmat expression follows rules similar to those of shell filename wildcards but with some additions and changes. A wildmat expression is composed of one or more wildmat patterns separated by commas. Each character in the wildmat pattern matches a literal occurrence of that same character in the text, with the exception of the following metacharacters: ? Matches any single character (including a single UTF-8 multibyte character, so "?" can match more than one byte). * Matches any sequence of zero or more characters. \ Turns off any special meaning of the following character; the following character will match itself in the text. "\" will escape any character, including another backslash or a comma that otherwise would separate a pattern from the next pattern in an expression. Note that "\" is not special inside a character range (no metacharacters are). [...] A character set, which matches any single character that falls within that set. The presence of a character between the brackets adds that character to the set; for example, "[amv]" specifies the set containing the characters "a", "m", and "v". A range of characters may be specified using "-"; for example, "[0-5abc]" is equivalent to "[012345abc]". The order of characters is as defined in the UTF-8 character set, and if the start character of such a range falls after the ending character of the range in that ranking the results of attempting a match with that pattern are undefined.. [^...] A negated character set. Follows the same rules as a character set above, but matches any character not contained in the set. So, for example, "[^]-]" matches any character except "]" and "-"..
BUGS
All of these functions internally convert the passed arguments to const unsigned char pointers. The only reason why they take regular char pointers instead of unsigned char is for the convenience of INN and other callers that may not be using unsigned char everywhere they should. In a future revision, the public interface should be changed to just take unsigned char pointers.. 9074 2010-05-31 19:01:32Z iulius $
SEE ALSO
grep(1), fnmatch(3), regex(3), regexp(3). | http://manpages.ubuntu.com/manpages/oneiric/man3/uwildmat.3.html | CC-MAIN-2015-27 | refinedweb | 489 | 52.6 |
Adding Batch Systems¶
Fyrd is intended to be fully modular, meaning anyone should be able to implement support for any batch system, even other remote submission systems like DistributedPython if they are able to define the following functions and options.
To add a new batch system, you will need to:
- Edit __init__.py to:
- Update DEFINED_SYSTEMS to include your batch system
- Edit get_cluster_environment() to detect your batch system, this function is ordered, meaning that it checks for slurm before torque, as slurm implements torque aliases. You should add a sensible way of detecting your batch system here.
- Create a file in this directory with the name of your batch system (must match the name in DEFINED_SYSTEMS). This file must contain all constants and functions described below in the Batch Script section.
- Edit options.py as described below in the Options section.
- Run the pyenv test suite on your cluster system and make sure all tests pass on all versions of python supported by fyrd on your cluster system.
- Optionally add a buildkite script on your cluster to allow CI testing. Note, this will technically give anyone with push privileges (i.e. me) the ability to execute code on your server. I promise to do no evil, but I can understand a degree of uncertainty regarding that. However, using buildkite will allow us to make sure that future updates don’t break support for your batch system.
- Become a fyrd maintainer! I always need help, if you want to contribute more, please do :-)
Options¶
Fyrd works primarily by converting batch system arguments (e.g. –queue for torque and –partition for slurm) into python keyword arguments. This is done by creating dictionaries in the fyrd/batch_systems/options.py file.
Option parsing is done on job creation by calling the options.options_to_string() function on the user provided keyword arguments. The primary point of this function is to convert all keyword arguments to string forms that can go at the top of your batch file prior to cluster submission. Therefore you must edit the dictionaries in options.py to include your batch system definitions. The most important section to edit is CLUSTER_CORE, this dictionary has sections for each batch system, e.g. for walltime:
('time', {'help': 'Walltime in HH:MM:SS', 'default': '12:00:00', 'type': str, 'slurm': '--time={}', 'torque': '-l walltime={}'}),
This auto-converts the time argument provided by the user into –time for slurm and -l walltime= for torque.
As all systems are a little different, options.options_to_string() first calls the parse_strange_options() function in the batch system definition script to allow you the option to manually parse all options that cannot be handled so simply. Hopefully this function will do nothing, but return the input, but in some cases it makes sense for this function to handle every argument, an obvious example is when running using something like multiprocessing instead of a true batch system.
Batch Script¶
The defined batch script must have the name of your system and must define the following constants and functions in exactly the way described below. Your functions can do anything you want, and you can have extra functions in your file (maybe make them private with a leading _ in the name), but the primary functions must take exactly the same arguments as those described below, and provide exactly the same return values.
Constants¶
- PREFIX: The string that will go before options at the top of a script file, could be blank for simple shell scripts, for slurm is is ‘#SBATCH’
Functions¶
queue_test(warn=True)¶
Input:
- warn: bool, warn on failure, optional
Output:
- functional: bool, True if this system can be used
Description:
Use this function to write code to test that your system can function. If you are using a specific command line tool in your code, consider adding it to the config file to allow users to specify an absolute path or alternate name.
Use a combination of _run.which() (which returns a full path to an executable if the executable is in the user’s PATH and is executable) and _run.is_exe() (which tests if a file is executable) to check your command line tools.
Use the warn parameter with _logme.log() to set a log level, e.g.:
log_level = 'error' if warn else 'debug' _logme.log('Cannot use me :-(', log_level)
Try not to raise any Exceptions, instead try to just log the problem and return False.
This code is run very frequently to test that the queue is usable, so make your code as simple and efficient as possible.
normalize_job_id(job_id)¶
Input:
- job_id: string, return value from job submission
Output:
- job_id: string, a normalized job id
- array_id: string or None, a normalized array job id
Description:
Take a string returned by your job submission script (e.g. qsub) and turn it into a normalized (hopefully string version of an int) job ID or process ID and an array_id, if that is implemented by your system. The array_id can be None if not implemented and should be None if not present (i.e. the job is not an array job).
normalize_state(state)¶
Input:
- state: string, a state description from the queue, e.g. ‘running’, or ‘R’
Output:
- state: string, a state normalized into one of: - ‘completed’, - ‘completing’ - ‘held’ - ‘pending’ - ‘running’ - ‘suspended’ - ‘running’ - ‘suspended’
gen_scripts(job_object, command, args, precmd, modstr)¶
Input:
- job_object: Job, a fyrd.job.Job object for the current job
- command: string, a string of the command to be run
- args: any additional arguments that are to be submitted, generally not used
- precmd: string, the batch system directives created by options_to_string, you can edit this or overwrite it if necessary
- modstr: string, a string of module imports (e.g. module load samtools) set by the user
Output:
- submission_script: fyrd.submission_scripts.Script object with the script to run
- exec_script: fyrd.submission_scripts.Script object with an additional script called by submission script if necessary, can be None
Description:
This is one of the more complex functions, but essentially you are going to just format the fyrd.script_runners.CMND_RUNNER_TRACK script using the objects in the inputs. This just makes an executable submission script, so you can build this anyway you want, you don’t have to use the CMND_RUNNER_TRACK script. However, if you make your own script, the STDOUT must include timestamps like this:
date +'%y-%m-%d-%H:%M:%S' echo "Running {name}" {command} exitcode=$? echo Done date +'%y-%m-%d-%H:%M:%S' if [[ $exitcode != 0 ]]; then echo Exited with code: $exitcode >&2 fi exit $exitcode
This is because we parse the first two and last 2/3 lines of the file to get the job runtimes and exit codes.
Here is an example function:
def gen_scripts(job_object, command, args, precmd, modstr): """Create script object for job, does not create a sep. exec script.""" scrpt = _os.path.join(job_object.scriptpath, '{}.cluster.qsub'.format(job_object.name)) sub_script = _scrpts.CMND_RUNNER_TRACK.format( precmd=precmd, usedir=job_object.runpath, name=job_object.name, command=command ) return _Script(script=sub_script, file_name=scrpt), None
submit(file_name, dependencies=None, job=None, args=None, kwds=None)¶
Input:
- file_name: string, The path to the file to execute [required]
- dependencies: list, A list of dependencies (job objects or job numbers) [optional]
- job: fyrd.job.Job, A job object of the calling job (not always passed) [optional]
- args: list, A list of additional arguments (currently unused) [optional]
- kwargs: dict or str, A dictionary or string of ‘arg:val,arg,arg:val,…’ (currently unused) [optional]
Output:
- job_id: string, A job number
Description:
This function must actually submit the job file, however you want it to. If possible, include dependency tracking, if that isn’t possible, raise a NotImplemented Exception. You can make use of fyrd.run.cmd, which allows you to execute code directly on the terminal and can catch errors and retry submission however many times you choose (5 is a good number). It also returns the exit_code, STDOUT, and STDERR for the execution.
The job object is passed whenever a job is submitted using the normal submission process, and will contain all keyword arguments. If your batch system requires command line arguments, you can parse the keyword arguments with the parse_strange_options function and store them in the submit_args attribute of the Job object. You can then access that attribute in this submission function and pass them to fyrd.run.cmd (or any other method you choose) as command line arguments.
Note, this submit function can also be called on existing scripts without a job object, so your function should not require the job object. The args and kwds arguments exist to allow additional parsing, although they are currently unused; right now args gets the contents of Job.submit_args and kwds gets the contents of the additional_keywords argument to Job.submit(). This argument is currently ignored by all batch scripts.
Please add as much error catching code as possible in the submit function, the torque.py example is a good one.
kill(job_ids)¶
Input:
- job_ids: list, A list of job numbers
Output:
- bool: True on success, False on failure
Immediately terminate the running jobs
queue_parser(user=None, partition=None)¶
Input:
- user: string, optional username to limit to
- partition: string, optional partition/queue to limit to
(Fine to ignore these arguments if they are not implemented on your system)
Yields (must be an iterator):
- job_id: string
- array_id: string, optional array job number
- name: string, a name for the job
- userid: string, user of the job (can be None)
- partition: string, partition running in (can be None)
- state: string a slurm-style string representation of the state
- nodelist: list, the nodes the job is running on
- numnodes: int, a count of the number of nodes
- threads_per_node: int, a count of the number of cores being used on each node
- exit_code: int, an exit_code (can be None if not exited yet) Must be an int if state == ‘completed’. must be 0 if job completed successfully.
Description:
This is the iterator that is the core of the batch system definition. You must somehow be able to parse all of the currently running jobs and return the above information about every job. If your batch system implements array jobs, this generator must yield one entry per array child, not parent job.
parse_strange_options(option_dict)¶
Inputs:
- option_dict: dictionary, a dictionary of keywords from the options.py file prior to interpretation with option_to_string, allowing parsing of all unusual keywords.
Outputs:
- outlist: list, A list of strings that will be added to the top of the submit file
- option_dict: dictionary, A parsed version of option_dict with all options not defined in the appropriate dictionaries in `options.py` removed.
- other_args: a list of parsed arguments to be passed at submit time, this will be added to the submit_args attribute of the Job or passed as the args argument to submit.
Summary¶
The modularity of this system is intended to make it easy to support any batch system, however it is possible that some systems won’t fit into the mold defined here. If that is the case, feel free to alter other parts of the code to make it work, but be sure that all tests run successfully on every defined cluster on every supported version of python. Feel free to reach out to me to request testing if you do not have access to any system. | https://fyrd.readthedocs.io/en/latest/adding_batch_systems.html | CC-MAIN-2019-09 | refinedweb | 1,882 | 58.72 |
Sunday, October 17, 2010 | $1
TAKING ON THE VA
Interest in Rowan sites high Economic development officials say 34 companies looking at possibility of setting up shop here BY EMILY FORD eford@salisburypost.com
JON C. LAKEY/SALISBURY POST
Grace Campbell and her husband, Randy, are at odds with the VA over a change in policy involving home care.
Grace Campbell will keep seeking best in-home care for her husband ‘as long as he needs it’ OODLEAF — Randy Campbell, once a robust workaholic, spends his days confined to either an in-home hospital bed or a wheelchair. First diagnosed in 1998, his multiple sclerosis has progressively worsened. He now relies on a male nurse for moving him from the bed to his wheelchair, giving him a bath and helping him to eat sometimes. The nurse — Mike Fletcher from Bayada Nurses — comes for three hours in the morning and two MARK hours in the evening. WINEKA Otherwise, Randy is in the care of his wife, Grace. At 114 pounds, Grace cannot do much to move Randy, who is 6-7 and 290 pounds. “He’s a big man,” she says of the Vietnam War veteran to whom she has been married 20 years. Over recent months, Grace Campbell has waged her own personal war against the U.S. Department of Veterans Affairs and its decision to change the delivery of Randy’s home care services. She hasn’t won yet, but she also hasn’t given up. “I’m going to fight as long as I can — as long as he needs it,” Grace says.
W
••• Randy experienced a particularly
Grace Campbell holds family pet Ailee, a 3year-old dachshund. Ailee spends a lot of time on Randy’s chest.
rough patch in 2007 when he was so physically and mentally sick that he stayed in the hospital for a month, then rehabilitated at Genesis Care for another month. Hospice nurses actually were called in to help provide his care when he returned home. But Randy outlived what Hospice could provide, and the week its care ended, he qualified for the VA’s Homemaker/Home Health Aide program. In the beginning, the VA approved sending a nurse to Randy and Grace’s country home off South River Road for four hours a day, five days a week. But a VA team, including his doctor, nurse, nurse practitioner, psychiatrist, occupational therapist and physical therapist evaluated Randy’s
case further and recommended nursing care of five hours a day, seven days a week. “That worked out perfectly,” Grace says, impressed that the decision was made after members of the team personally visited Randy at the house. The nurse’s daily visits were important in helping with Randy’s physical health, personal hygiene, his feeding, getting him in and out of bed, moving him in general and conducting range-of-motion exercises. For almost two years, Randy had a nurse coming every day for five consecutive hours on each visit. “Then in March, I got the phone call,” Grace remembers. •••
See VA, 6A
Interest in Rowan County’s industrial sites and buildings continues to surge, with local economic developers pursuing 34 potential new companies. Since August, 13 firms have inquired about Rowan County, said Robert Van Geons, executive director for RowanWorks Economic Development. “The level of activity is incredibly high,” Van Geons said. “It’s only gotten more and more active since December of last year.” Companies are starting to understand where they fit in the new economy, he said. During the recession, companies that survived put off decisions about relocations or expansions, Van Geons said. Now they’ve accepted the new economic baseline and are trying to gain market share through product growth or a
reduction in competition, he said. Companies that need to consolidate or reorient themselves are looking for a good deal, he said. “A lot of companies can no longer wait,” he said. “They have an opportunity they need to seize.” RowanWorks has 34 active projects that represent between three to 350 new jobs with investments ranging from $250,000 to $60 million. “We’re having a bit of a hard time keeping up,” said Van Geons, who handles development with Scott Shelton, a project manager for RowanWorks. Four projects are possible expansions of existing businesses in Rowan County. About half of the 34 have visited Rowan County, with five making their first visit in the past two weeks. If combined, the projects
See INTEREST, 2A
Hefner among Southern Gospel Hall of Fame inductees for 2010 The late U.S. Rep. Bill Hefner of Kannapolis di- HEFNER rector Charlie Waller. “He was a recipient of the GOGR Living Legend Award in 1998. His final concert appearance was at the
2009 Grand Ole Gospel Reunion.” He was born in Elora, Tenn. He grew up in Sardis, Ala., and after his graduation from Sardis High School, attended the University of Alabama. Hefner, who died in 2009,, Waller said. “The quartet enjoyed immense popularity from 1954
See HEFNER, 2A
After-school advocates say working together can boost ranking up from 66th BY SARAH CAMPBELL scampbell@salisburypost.com
Imagine a program that would reduce the high school dropout, teenage pregnancy and juvenile delinquency rates. It shouldn’t be hard to imagine because the North Carolina Center for Afterschool Programs says it already exists: It’s after-school care. The center, founded in 2002, says high-quality after school programs can have a positive impact on communities, but lack of funding means such programs are dwindling “Our children are at the most risk that they have ever been in the history of the state and nation,” Salisbury Mayor Susan Kluttz said. “At
[|xbIAHD y0 0 2ozX
the same time we are facing the economic crisis and programs have been cut.” The advocacy group ranked Rowan County 66 out of 100 counties in a “Roadmap to Need,” which uses 10 indicators to determine where young people are most at risk. “When you think about children who are not supervised in the afternoon or during the summer, they are getting their views from television and learning from their peers,” Kluttz said. “We are seeing our children becoming dropouts, turning to crimes and, most recently, to gangs.” Rowan County fell in the bottom half of the rankings in several areas: a 62 percent graduation rate in 200809 ranked 73rd; it was 69th for short-
Today’s forecast 76º/43º Sunny, breezy
Deaths
term suspensions, 244 in 2008-09; and 69th for child abuse/neglect cases, 36 cases per 1,000. The county scored in the top half in several others areas, ranking 38th in the number of single-parent households, 9 percent Roadmap to Need for this year; Rowan, Cabarrus, 9A and 41st in median household income, $43,000. Edgecombe County was ranked last, demonstrating the most need for after-school programs to help improve its 58 percent graduation rate, ranked 96th in the state, and reduce the number of short-term suspen-
A look at the numbers
Bennett Campbell Faye Holshouser Cooper John Farmer
Hilda Lee G. Foreman James Nelson Spencer
sions that stands at 87th in the state with 330. On the opposite end of the spectrum, Camden County ranks No. 1 overall, with the lowest juvenile delinquency rates in the state at 7 and the No. 7 graduation rate at 81 percent. • • • The Center for Afterschool Programs is hosting five regional afterschool summits, the most recent one in Salisbury on Friday, to discuss ways to foster collaboration among leaders in education, juvenile justice and health and human services to provide programs for disadvantaged youth. “How can all of us working on behalf of young people and their fam-
Contents
Books Business Celebrations Classifieds
5D 1C 4E 4C
ilies work together more effectively instead of working separately,” said Geoff Coltrane, director of program and policy for the James. B. Hunt Jr. Institute for Educational Leadership and Policy. During Friday’s summit, more than 120 representatives from 18 counties discussed ways to break down barriers and provide access to all those children in need of afterschool care. Ellen Boyd, director of community relations for Kannapolis City Schools, said after-school providers need to look past their particular programs and work together. “Put simply, put the children first
See RANKING, 8A
Deaths Horoscope Opinion People
4A 9C 2D 1E
Second Front 3A Sports 1B Television 9C Weather 10C
2A • SUNDAY, OCTOBER 17, 2010
SALISBURY POST
S TAT E
Furniture store manager says she saw Hickory girl two weeks before she was reported missing HICKORY (AP) — A missing 10-year-old North Carolina girl was seen in public as recently as two weeks before she was reported missing, police said Saturday, narrowing an uncertain timeline that has hindered their investigation. Investigators said previously they couldn’t find anyone outside Zahra Clare Baker’s’t believe the story given by her father and stepmother.’s picture on the news and recall-
ing the visit. tle girl’s prosthetic leg. what had happened,� said first reported by WCNC-TV in “They had come in and the “We were just wondering Adams, whose account was Charlotte. little girl, Zahra, was standing in the aisleway at a children’s room and we have cartoons playing in there and she was just standing there in the middle of the aisle looking into the TV room, watching the cartoon,� Adams told the Associated Press. “As I walked past her, I put my hand on her shoulder and said ‘Excuse me, sweetheart,’ and she looked up at me and smiled.� Adams said other employees were talking about the lit-
HEFNER
man built a reputation as an advocate for military veterans. The Veterans Affairs Medical Center in Salisbury was renamed in his honor in 1999. Hefner’s widow, Nancy, joined his sister, Louise Hibbs; brother, Jimmy Hefner; and his grandchildren Joseph Hawk and Parker Rose at the induction ceremony. Southern Gospel Music Hall of Fame member Les Beasley presented the induction. Hefner’s daughter, Stayce, accepted on his behalf. “Having accomplished so much in a short 79 years, Dad will continue through his music, his sense of humor, his humanity,� she said. “He will reign among the greats.�
“The truth is about my daddy is after every performance, any tribute, any song, the ultimate and most important tribute for him was ‘Nancy, How did I do?’ ‘Wonderful as always,’ (she’d reply).� The other 2010 SGMA class of Hall of Fame inductees are Danny Gaither, Little Jan Buckner-Goff, Sam Goodman, Connie Hopper and Arthur Smith. Country Music Hall of Famer Dolly Parton received the James D. Vaughn Impact Award at the event. The Southern Gospel Music Association is a nonprofit organization that maintains the Southern Gospel Museum and Hall of Fame at Dollywood in Pigeon Forge, Tenn.
FROM 1a until their retirement in 1967, appearing on numerous national and North Carolina TV channels,� Waller said. “Bill became best known for his comedy, first-class emcee work, and his performance of the song ‘He’ll Pilot Me.’ Bill continued promoting gospel music for many years in North Carolina following the disbandment of the Harvesters.� He was elected to the 94th U.S. Congress in 1974, where he served 12 terms, from 1975 through 1999, when he retired. Waller said the congress-
INTEREST FROM 1a represent more than 3,000 possible jobs and $400 million of potential investment, Van Geons said. “Some of these projects will take months to decide, some will never happen and others will pick competing regions of the country or globe,� he said in an e-mail to the Post. “We are realistic that we must compete for every job, but each of these projects represents an opportunity that could lead to additional employment in Rowan County.� Among companies that initiate contact themselves, Rowan County will win about 20 percent, Van Geons said. The rate is lower for companies that RowanWorks pursues, he said. “You can’t judge at an early stage. You never know exactly which one is going to hit,� Van Geons said. “But if we are not engaged, there are plenty of others who are and those projects will go there.� RowanWorks has several projects that look promising, he said. He’s discussing with city staff a custom machinery manufacturer that would bring 12 jobs, Van Geons said. Shelton added that several companies in the food processing and distribution industries have shown interest in the past month and a half. Two auto parts manufacturers who have visited would bring 80 and 100 jobs, he said. A company with 110 potential jobs in the pharmaceutical industry is interested. Rowan is among five finalists for a business that makes protective coatings, Shelton said. Landing the company would mean up to 100 new jobs and capital investment of between $6 million and $8 million, he said. Incentives and other assis-
Rowan County Tea Party Patriots
tance play a key role in luring 152, which will employ 15, Van new jobs, Van Geons said. Geons said. “Every company in these Contact Emily Ford at 704tough times is looking for 797-4264. some form of assistance,� he said. But it’s not always tax relief, he said. RowanWorks will ask the Rowan County Board of Commissioners on Monday to consider providing three acres for free at the Summit Corporate Park for “Project BCINF.� The company is interested in the Service Supply building at the park and would bring 36 jobs to Rowan County, Van Geons said. The company proposes making a $6 million investment in equipment and building improvements, he said. But BCINF needs additional land for storage of finished plastic products and would like the county to provide it for free, he said. Expansions and relocations are under way throughout the county. Magna Composites, an auto parts maker that received a tax grant from the county, has exceeded its promised employment goal and is now up to 440 workers, Van Geon said. Freightliner has hired back employees due to a military truck project, as well as new demand. Henkel has completed an expansion, adding 103 employees, and Akzo Nobel recently completed an expansion. W.A. Brown is up 42 jobs since Jan. 1, and PGT is up more than 200 since 2007, according to RowanWorks. The expansion at Norandal — lured by state, county and city incentives — is under construction, and Boral Composites has broken ground in East Spencer. After a year-long delay due to the recession, Altec is constructing an industrial equipment service center on N.C.
Lottery numbers —
RALEIGH (AP) — These North Carolina lotteries were drawn Saturday: Cash 5: 02-05-25-32-37 Pick 4: 8-4-8-0 Evening Pick 3: 3-8-2 Midday Pick 3: 0-0-2 Powerball: 11-12-15-16-28, Powerball: 11, Power Play: 2
Congressman JD Hayworth Featured Speaker
Tues. Oct. 19th 7:00 P.M.
Vince Coakley Master of Ceremonies
T HE E VENT C ENTER
315 W EBB R D . • S ALISBURY Free Admission
Donations Appreciated
R127286
R125084
CommunityONE Bank is open in Enochville, and everyone’s invited to lunch.
HOW TO REACH US Phone ....................................(704) 633-8950 for all departments (704) 797-4287 Sports direct line (704) 797-4213 Circulation direct line (704) 797-4220 ClassiďŹ ed direct line Business hours ..................Monday-Friday, 8 a.m. to 5 p.m. Fax numbers........................(704) 630-0157 ClassiďŹ ed ads (704) 633-7373 Retail ads (704) 639-0003 News After-hours voice mail......(704) 797-4235 Advertising (704) 797-4255 News Salisbury Post online........
Daily & Sun. Sunday Only
Home Delivered Rates: 1 Mo. 3 Mo. 6 Mo. 11.25 33.75 66.00 8.00 24.00 46.80
Yr. 132
It took a brief spell, but CommunityONE Bank has reopened in Enochville after a fire burned down our office in July. To celebrate our return, we’re hosting a luncheon on Friday, October 22nd with grilled hotdogs, traditional fixings and assorted cookies for dessert. It’s our way of thanking local citizens for their patience and support while we restored service in a community that’s dear to our heart. We hope to see you there!
Enochville Grand Reopening Friday, October 22, 2010 11:00 a.m. - 1:00 p.m. 100 S. Enochville Ave. Open to the public!
t.Z:FT#BOLDPN
Š2010 CommunityOne Bank, N.A., Equal Housing Lender, Member FDIC R125608
SECONDFRONT
The
SALISBURY POST
Not singin’ the blues Blues and Jazz fest fans happy to pay
3A
SUNDAY October 17, 2010
Company asks Rowan for free use of land Business seeks incentive to bring 36 jobs to county BY KARISSA MINN kminn@salisburypost.com
WAYne hinshAW/FoR the SALISBURY PoSt
Max Arnold and the Plate Full of Blues Band perform at the Rowan Blues and Jazz Festival. People attending the festival had to pay this year for the first time, and most said they didn’t mind. BY SARAH CAMPBELL scampbell@salisburypost.com
arty Holiday packed the bags and told her husband, Carter, to get in the car, they were taking a road trip. The couple, from Floyd, Va., ended up at the 12th annual Rowan Blues and Jazz Festival, a surprise for their anniversary. “My husband is a blues aficionado, so to speak,” Marty said. “We’re having a great time, he loves it.” Before purchasing tickets and typing Salisbury into her GPS, Marty Holiday contacted Blues and Jazz Festival organizer Eleanor Qadirah to make sure the price was right. Holiday, who frequently attends similar events with her husband, said she couldn’t believe the ticket prices. “It’s very reasonable,” she said. This year is the first time admission has been charged for the festival that has grown from an operating cost of about $1,500 to nearly $30,000. General admission was $5 and VIP seating cost $10. “There’s been a pretty good crowd,” Qadirah said Saturday night. “Charging
M
See LAND, 4A
Above, a big crowd showed up for the night show at the Rowan Blues and Jazz Festival. At left, Blazin’ Blues Bob Paolino of Salisbury performs.
Church offers free haircuts, styles to Henderson students BY SHAVONNE POTTS
Saturday blaze destroys Kannapolis home at the house three minutes later, a department press release said. Finding smoke coming from the structure, the firefighters entered quickly and worked to extinguish the flames. Investigators estimated the fire caused about $80,000 damage to the house, which is at least 55 years old, according to Cabarrus County tax records.
“Fire got into the roof and that's why there was such damage to the structural integrity of home, making its dollar loss so high,” she said in an e-mail. She said the house was a “total loss” and uninhabitable due to its age and the extensive damage. The Cabarrus County Chapter of the American Red Cross helped the family who lived there with
lodging Saturday night. Bostian said two adults and four children lived at the home, but only one adult and three children were home when the fire started. Cabarrus County EMS assisted the fire department at the scene and Landis and Odell volunteer fire departments assisted with district coverage.
Cabarrus board will hear pitch for tax break Monday CONCORD — The Cabarrus County Board of Commissioners will conduct a public hearing Monday on an incentive request that could lure 65 new jobs and nearly $1.7 million in capital investment to the county. The board meets at 6:30 p.m. in the county government building, 65 Church St. S.E. Distribution Technology Inc. would buy the former JEVIC facility at 432 Pitts School Road in Concord, spending just over $1 mil-
Good hair days spotts@salisburypost.com
See BLUES, 5A
KANNAPOLIS — A fire that started in a kitchen destroyed a home and forced a family of six out into the cold Saturday night. No one was injured, Kannapolis Fire Department spokeswoman Maria Bostian said. A resident at 116 Rankin St. off South Main Street called in the fire by cell phone at 7:19 p.m. Kannapolis firefighters arrived
County commissioners will hear a presentation Monday about a company making a unique incentive request to help it bring at least 36 jobs to the county. RowanWorks Director Robert Van Geons will present “Project BC-INF” and proposed incentives to the Rowan County Board of Commissioners at 7 p.m. Monday in the J. Newton Cohen Sr. Rowan County Administration Building, 130 W. Innes St. The presentation was originally scheduled for the board’s Oct. 4 meeting, but Van Geons said it was postponed to allow for further negotiations. The company is considering a vacant building in the Summit Corporate Park. Van Geons wrote in a letter to commissioners that the building meets the company’s requirements, but the lot is not large enough to meet “outside storage needs.” The county owns the adjacent lot. In lieu of the standard assistance grant program, which provides a cash grant, the company is requesting a no-cost lease of approximately 5.3 acres of land. An earlier letter dated Sept. 27 only requested a lease of 3 acres. “Three acres would be utilized for outside storage, with the rest needed to accommodate setbacks, storm water drainage and to ensure the county is not left with an irregularly shaped lot,” Van Geons wrote in the more recent letter, dated Oct. 8. County Manager Gary Page has said the lease would be temporary, not long term. The company wants to use the land for a “lay-down” area during renovation and other construction, but it doesn’t want to buy the property. Van Geons wrote that the company is “a world leader in production of products utilized to manage wastewater.” “This operation would produce a variety of
lion for equipment and $650,000 on renovations, according to county documents. The company would create 65 full-time jobs in the first year of operation and expand that to 86 jobs by the third year. The jobs would pay on average between $14 and $16 per hour. To help seal the deal, Distribution Technology is asking for a refund of 85 percent of its property taxes on the new investment
Since 1954
for the first three years of operation. The board will also: • Consider a budget amendment that will add $50,000 to the $212,000 the board had approved for the Cabarrus Economic Development Corp. this fiscal year. • Consider adopting a local food purchasing policy and signing on to the N.C. Farm to Fork 10 Percent Local Food Campaign.
HILBISH
An East Spencer church that gave kids free back-to-school haircuts now wants to provide free haircuts and styles to students at Henderson Independent School. Michael Mitchell, associate pastor of Southern City A.M.E. Zion Church, is organizing the effort being offered through the Community Mentoring Ministry. Organizers are offering haircuts for 20 boys and hair styles for 20 girls. Tickets will be distributed at the school at 3:45 p.m. Wednesday. “We just want to let them know somebody does care,” Mitchell said. Henderson is the Rowan-Salisbury School System’s alternative school, and students there get a bad reputation, Mitchell said. The church, he said, wanted to let them know someone out there doesn’t see them as bad teens. “We want the kids to realize they aren’t bad kids and to encourage them to do better and be better,” Mitchell said. He said this is also a way to build self-esteem. Three barber shops will participate: Johnson’s Barber Shop on Old Concord Road, White’s Barber Shop on Main Street and 2-TheTee Barber Shop in East Spencer. Local hair stylist Maranda Faggart will do all of the girl’s hair styles. Students will have from Oct. 20 to Nov. 20 to redeem their tickets. Mitchell said organizers hope to give more haircuts away before Christmas. Anyone who wants to make a donation toward the effort can contact Mitchell or mail the ministry at P.O. Box 386, East Spencer, NC 28309. For more information contact, Faggart at 704-701-4594 or Mitchell at 704-245-0729.
FORD MERCURY LINCOLN
Make the Deal Directly with a Manager
YOUR CABARRUS/ROWAN FORD STORE
Low Miles, J11081
704.938.3121
Only
$
7,795
I-85 S • Exit 58B (US29) • Kannapolis • 1 Mile • Minutes from Salisbury
CALL MY CELL
704-907-9440 or email herbie@hilbish me ford.com
R127311
2003 Mercury Mountaineer
Herbie
‘Leave it to Beaver’ actress Billingsley dies LOS BILLINGSLEY.”-athome 1950s mom, was always there to gently but firmly nurture both through the ups and downs of childhood. Beaver, meanwhile, was a typical boy whose adventures landed him in one comical cri-
sis after another. Billingsley’s own two sons said she was pretty much the image of June Cleaver in real life, although the actress disagreed. A wholesome beauty with a lithe figure, Billingsley began acting in her elementary school’s plays and soon discovered she wanted to do nothing else. Although her beauty and figure won her numerous roles in movies from the mid1940.
Kittens, dog need homes The Rowan County Animal Shelter has several animals waiting to be adopted and taken to a good home. Kittens: Chilling out after a hard day of playing with his litter mates, this kitten is more than ready to bounce his way into your home. He is approximately 9 weeks old and he has two littermates that need a home, too. Dog: Simply precious best describes this female Bichon mix. This beautiful lady came to the shelter as a stray. She is absolutely a sweetheart with a terrific personality and would make someone a great companion. From rescued animals to those abandoned by owners who couldn’t afford them, and all others in between, the Animal Shelter has them all. Adoption fees are $70, a downpayment for spay/neuter costs. The voucher can be used at any veterinarian’s office. Before adopting any animal, a person must agree to take the pet to a veterinarian for an exam and spaying/neutering. If the animal isn’t already vaccinated for rabies, the person must agree to begin shots within three business days. Rabies shots can be given as soon as the pet turns 4 months old. The animal shelter isn’t equipped with a medical facility, and cannot administer
LAND FROM 3a extruded plastic products and represent an initial investment of $4 million, bringing 36 jobs to Rowan County,” Van Geons wrote. “It is estimated that four of these will be transfers.” In the earlier report, Van Geons said jobs provided by the company would increase to 45 as the economy rebounds, but the new one simply says the company expects to “increase employment” and invest an additional $1 million. Also at Monday’s meeting, the board will consider awarding a bid to DH Griffin Construction to build the county’s new satellite jail. Page said the nearly $4.8 million bid, the lowest of 17 received, came in under budget. The revised budget for the jail still totals nearly $6.7 million after accounting for water and sewer line construction, purchase of land, furnishings, site preparation, engineering fees and professional
PLAYFUL KITTEN
PRECIOUS DOGFr Web site at .us/animalshelter/. Photos by Fran Pepper.
service fees. The county plans to borrow $6.27 million from RBC Bank upon approval of the bid. “We started collecting the quarter-cent sales tax in July,” Page said. “We will have collected a quarter (of those revenues), so we’re going to be able to pay the money we’ve collected down and not have to borrow so much.” Commissioners also plan to: • Receive the schedules, standards and rules for the 2011 countywide reappraisal and set a public hearing for Nov. 15. The document serves as a guide for valuing property in Rowan County. • Hold a public hearing for a rezoning and an amendment to the conditional use permit regarding property at 735 Gin Road in Gold Hill. The amendment would allow Blandy Hardwoods to use a buffer area to unload and reload trucks. • Consider approval of budget amendments. Contact Karissa Minn at 704-797-4222.
SALISBURY POST
NEWS/OBITUARIES James Nelson Spencer MT. GILEAD — James Nelson Spencer, 61, of Mt. Gilead, died Friday, Oct. 15, 2010, at the Brian Center of Salisbury. Mr. Spencer was born Sept. 22, 1949, in High Point. He was a son of the late James Clarence Spencer and Marjorie Nelson Spencer. He was a graduate of West Montgomery High School and Northern Virginia Community College and served in the United States Air Force. He was formerly employed by Michelin Tire of Norwood and was a member at Hamer Creek Baptist Church. He is survived by his brother, Brian Spencer and wife, Nora of Salisbury; and three nephews, Cameron of Wilmington, Travis of Chapel Hill and Davis also of Salisbury. Service and Burial: Funeral Services will be held at 2 p.m. Monday, Oct. 18, at Hamer Creek Baptist Church in Mt. Gilead. Rev. Brantley Moore will officiate and burial will follow in the church cemetery. Visitation: The family will receive friends from 1-2 p.m. Monday, Oct. 18, at the church before the service. Edwards Funeral Home is assisting the Spencer Family. Online condolences to edwardsfuneralhomes.com.
Faye H. Cooper ROCKWELL — Faye Holshouser Cooper, 94 of Rockwell, passed away on Saturday, Oct. 16, 2010, at the Autumn Care Nursing of Salisbury. Born Aug. 17, 1916, in Rowan County, she was the daughter of the late Paul Holshouser and Beulah Misenheimer Holshouser. Mrs. Cooper was educated in the Rowan County Schools and had retired from Wiscassett Mills in Albemarle. In addition to her parents, Mrs. Cooper was preceded in death by her husband, Ben B. Cooper on April 27, 1980; and a brother, James Lee Holshouser. Survivors include a brother, Glenn Holshouser and wife, Frances of Rockwell; and sisters, Blanche Welch and Willie Shue of Rockwell. Visitation: 1-2 p.m. Monday, Oct. 18, at Powles Funeral Home, Rockwell. Service and Burial: Funeral Services at 2 p.m. Monday, Oct. 18, at the Powles Funeral Home Chapel, conducted by Rev. Charles Carver, pastor of West Park Baptist Church , Rockwell. Burial will follow at Ursinus United Church of Christ Cemetery, Rockwell. Powles Funeral Home of Rockwell is assisting the Cooper family. Online condolences may be made to.
Bennett Campbell TROUTMAN — Bennett Campbell, age 60, of 142 Single Oak Drive, Troutman, died at W. G. Hefner V. A. Medical Center in Salisbury following an extended illness. Born Sept. 21, 1950, in Jamaica, New York, he was the son of the late James and Mable Lucille Turner Campbell. He was married to Viola Betty Jackson Campbell, who survives. He was a graduate of R. A. Clement High School in Salisbury, and Mitchell Community College where he received a Business Degree and a Computer Business Degree. He was a member of Greater New Mt. Olive Holiness Church where he was Assistant Pastor, Superintendent of the Sunday School, Vice President of the Brotherhood, church secretary, a member of the trustee committee; he was also a member of the Regional N.C. State Convention where he served as Sgt. at Arms, Assistant Secretary for the Brotherhood and Treasurer. Over the years he has served in several capacities including President, Vice President, Secretary, and Assistant Treasurer for the Brotherhood on the local and Regional levels. Survivors in addition to his wife, Mrs. Viola Campbell; are one son, Willie James (Lisa) Phillips of the home; one daughter, Davakie Viola Parsons of the home; one brother, Donald (Frances) Campbell of Stone Mountain, Ga.; one sister, Jane Campbell of Cleveland; seven grandchildren, Kawaii Steele, Christopher Steele, II., Brimington Steele, Jasmine (Kermitt) Wilder, Jamie Phillips, Jahair Parsons and Justice Phillips; a great-grandchild, Kermitt Wilder, Jr.; he was reared in the home with, Helena Turner, Eve Turner, Matilda Turner, Anthony Turner, Harrison (Pam) Turner, Ray (Gladys) Tuner, Phobee Nichols; an aunt, Helen Turner-Linyear of Salisbury; an uncle, Walter “Peel” (Frances) Jackson of Statesville; two goddaughters, Nita (Demond) Sharpe and Felicia Mott; brothers-in-law and sisters-in-law, Thomas and Patricia Jackson, Nathaniel (Barbara) Jackson, Dr. Thomas (Evangelist Patricia) Jackson and Johnny Matthew (Sherry) Lewis; a host of nieces and nephews including a special nephew, Malcolm Campbell; and cousins, other relatives, church family and friends. Service and Burial: Celebration of Life Services will be conducted Tuesday, Oct. 19, at 1:30 p.m. at Greater New Mt. Olive Holiness Church. Dr. Thomas Jackson will officiate and Pastor Robert Witt will eulogize. Burial will follow in the Veterans Section of Belmont Cemetery with Military Rites being performed by the Iredell Veterans Service Council. Visitation: Members of the family will receive friends at the church from 1-1:30 p.m., but will assemble at the residence at all other times. Notes of sympathy may be emailed to the Campbell family at rutledgeinc@bellsouth.net. Rutledge and Bigham Mortuary, Statesville is serving the Campbell Family.
- Marine Cpl. Stephen C. Sockalosky, 21, of Cordele, Ga., died Oct. 6 while conducting combat operations in Helmand province, Afghanistan. ----------------
- Navy Hospital Corpsman Edwin Gonzalez, 22, of North Miami Beach, Fla., died Oct. 8 from wounds sustained from an improvised explosive device while supporting combat operations in Helmand province, Afghanistan. ----------------
- Marine Lance Cpl. John T. Sparks, 23, of Chicago, Ill., died Oct. 8 while conducting combat operations in Helmand province, Afghanistan. ----------------
- Marine Sgt. Frank R. Zaehringer III, 23, of Reno, Nev., died Oct. 11 while conducting combat operations in Helmand province, Afghanistan. ----------------
- Army Staff Sgt. Dave J. Weigle, 29, of Philadelphia, Pa.; and - Army Spc. David A. Hess, 25, of Ruskin, Fla, died Oct. 10 of wounds suffered when insurgents attacked their unit with an improvised explosive. ----------------
- Army Spc. Matthew C. Powell, 20, of Slidell, La., died Oct. 12 at Kandahar Airfield, of wounds suffered at Ghunday Ghar, Afghanistan when insurgents attacked his military vehicle using an improvised explosive device. ----------------
- Marine Lance Cpl. Raymon L.A. Johnson, 22, of Midland, Ga., died Oct. 13 while conducting combat operations in Helmand province, Afghanistan. ----------------
- Marine Cpl. Justin J. Cain, 22, of Manitowoc, Wis.; and - Marine Lance Cpl. Phillip D. Vinnedge, 19, of Saint Charles, Mo.; and - Marine Lance Cpl. Joseph E. Rodewald, 21, of Albany, Ore.; and - Marine Pfc. Victor A. Dew, 20, of Granite Bay, Calif., died Oct. 13 while conducting combat operations in Helmand province, Afghanistan. ----------------
- Army Pfc. Jordan M. Byrd, 19, of Grantsville, Utah, died Oct. 13 in Yahya Kheyl, Afghanistan, of wounds suffered when insurgents attacked his unit using small arms fire.
Hilda G. Foreman
Mrs. Hilda Goodman Foreman Memorial Service 11:00 AM - Tuesday First Presbyterian Church Visitation: Following service in Lewis Hall
Comfort. Care. Confidence.
Hairston Funeral Home, Inc.
1748 Dale Earnhardt Blvd. • Kannapolis, NC 28023 • 704-933-2222
Serving Cabarrus & Rowan Counties
Since 1913
- Hospitality Center with Kitchen - 2 Chapels on Premises - Audio/Visual System - Spacious Parking
Family Owned & Operated R117876
SALISBURY — Hilda Lee Goodman Foreman, 78, died Friday, Oct. 15, 2010, at Rowan Regional Medical Center. Born July 12, 1932, in McDowell County, she was a daughter of the late Ralph Watts Goodman and Annie Lee Morris Goodman. A graduate of Western Carolina with a Masters in Math Education, she was affiliated with Catawba College for 30+ years, first as a teacher of mathematics and later as a library technical associate. Mrs. Foreman was a member of First Presbyterian Church for more than 50 years, where she was active in the music programs, especially the handbell choir, and served as a volunteer in numerous other roles. She served as treasurer of the Helen S. and Julian L. Goldman Scholarship Fund since its inception in 1965 and was a life member of AAUW (American Association of University Women). Her parents and her brother, Harold Watts Goodman, preceded her in death. Survivors include her husband of 52 years, Thomas Alexander Foreman, Jr.; her daughter, Daphne Anne Foreman, of New York City; sisters, Agnes Lowder of Hampton, Va. and Daphne Nelson of Wilmington; and numerous nieces and nephews. Service: Memorial Service Tuesday at 11 a.m. at First Presbyterian Church, with the Rev. Dr. Jim C. Dunkin and the Rev. Dr. Randal V. Kirby officiating, to be followed by a reception in Lewis Hall. Memorials: Rowan Helping Ministries, PO Box 4026, Salisbury, NC 28145 or First Presbyterian Church, Handbell Fund, 308 W. Fisher St., Salisbury, NC 28144. Summersett Funeral Home is in charge of arrangements. Online condolences may be made at.
John Farmer
SEPARATE HUMAN AND PET CREMATORIES
R112479
4A • SUNDAY, OCTOBER 17, 2010
CHINA GROVE — John Farmer, age 66, died Saturday, Oct. 16, 2010, at his residence. Survivors include his wife, Betty Propst Farmer; five children; seven great-grandchildren; and three sisters. Service: A memorial service will be held at a later date. Memorials: Memorials may be made to Linn Honeycutt Funeral Home to defray funeral costs.
Hess completes Air Force basic training Air Force Airman Justin S. Hess graduated from basic military training at Lackland Air Force Base, San Antonio, Texas. The airman completed an intensive, eight-week pro-
ll Fa
le Sa
Man charged with making meth A Salisbury has been jailed on charges of manufacturing methamphetamine and possession of drug paraphernalia. The Rowan County Sheriff’s Office c h a r g e d James Timothy Russell, 47, of 7225 Stokes Ferry Road. Authorities say Russell extracted p s e u RUSSELL doephedrine, an ingredient commonly found in cold medicines, from pills and mixed it with ammonia and lithium to convert it into methamphetamine. The drug paraphernalia charge stems from the discovery of aluminum foil fashioned into a pipe. Russell was being held Saturday night in the Rowan County Detention Center under a $25,000 secured bond.
Force. The son of Teresa Hess of Rockwell, Hess is a 2009 graduate of East Rowan High School.
No Leaf
WE BUY GOLD!
Gutter
Guaranteed Best Prices ONLY for Your Gold! VALID
FREE FLOWING WATER CONTROL
DRIVER’S LICENSE NEEDED!
J.A. FISHER
Anna Mills Wagoner: Your First Choice on Nov. 2
A Specialty Contractor Since 1979 With Over 7000 Completed Jobs Salisbury
704-788-3217
Kannapolis
“A Name You Can Trust” 314 S. SALISBURY AVE., SPENCER, NC (704) 633-0618
Anna Mills Wagoner has practiced law in Salisbury and served as District Court Judge and Chief District Court Judge in Rowan County. Most recently, she served as the United States Attorney for North Carolina’s Middle District, including Rowan County.
Put her knowledge and experience to work for you! Support her commitment to make our community safe for everyone.
Paid for by Anna Mills Wagoner for Superior Court
R127371
Rowan Is
My Strength
__________________ I remember it like it was yesterday … It was right before the
“Thanks to Rowan Regional I am cancer free and living strong”
hholidays, my family was coming to visit and it was time for my annual mammogram. Little did I know that mammogram would save my life. m They found a tiny lump and follow up testing confirmed that I had breast cancer. My doctors developed a treatment plan that fit my needs, and gave me the confidence to stay here for my care. m
I didn’t to leave Rowan County – what a blessing. did ’ have h l R C The wonderful thing about Rowan Regional is the team approach to medicine. The expert doctors and caring staff all worked together to give me the best care possible. I felt like they knew me. They were treating Jane Welch, not just another patient. In February, I came back to work. And in March I did a 10K, carrying my
granddaughter across the finish line. It feels great to say, “I have beat this disease.” And it’s why Rowan Regional Medical Center is my hospital. Children’s Literacy Champion
October is Breast Cancer Awareness Month Octo
A mammogram saved my life. Schedule yours today.
704-210-7762
R127199
was just a small fee,” Wiggins said. Salisbury native Erica House said she hasn’t atFROM 3a tended the festival in the people did not deter many past, but didn’t mind paying. people from coming.” “The ticket price was Qadirah said future ticket fine,” she said. “I really like prices could eventually injazz and blues.” crease to $25. Friends Lena Pistone of “People will get used to Charlotte and Dawn Nickloy the fact that this festival, of Statesville said they’ve atlike any other festival, has tended the festival for years. fees,” she said. “That’s the Pistone said she doesn’t only way we can survive.” want prices to rise any Qadirah doesn’t think more. cost is going to be a factor in “Paying was no big deal, attendance because people as long as they don’t go over are already traveling from $5,” Pistone said. Florida, Georgia and MaryThe friends were looking land. forward to listening to Bob Last year, the Blues and Margolin, a guitar player Jazz Society announced it and vocalist who won a would charge $15 a ticket to Blues Music Award for Guiget into the festival, but tar in 2008. dropped that plan when a “We’re really here for the donor stepped in to help with blues,” Nickloy said. funding. Several attendees said Todd Jenkins of Lexingthey felt this year’s lineup ton said he came to the festifeatured more jazz musival with his wife and four cians. children for the first time “I liked the previous this year and didn’t mind years because there were paying. more blues than jazz,” Walk“I’m used to going to feser said. “There definitely tivals where you have to seems to be more jazz this pay, so it’s not a big deal,” he year.” said. “If it helps raise money The blues might have for the cause, then I’m all been lacking because of a for it.” last-minute cancellation by Jenkins said he didn’t Hurbert Sumlin. hear about the festival until Sumlin was unable to perthis year. He was scoping form at the festival because the talent on hand Saturday of health reasons. night. Contact Sarah Campbell “I actually might try to at 704-797-7683. play next year,” he said. “I have a friend who plays guitar and I play harmonica, so we may try to get together and play. “But if we don’t, I’ll still come back.” Robin Patterson of Concord and Mike Walker of Charlotte said they’ve attended the festival for years and were a bit surprised when they found out about the ticket prices. “We snuck in as a protest,” Walker said. Patterson said they plan to continue attending the festival, but aren’t exactly thrilled about the tickets. “I think it’s better to be free,” she said. “You attract more people that way.” Cost was far from the minds of many as they soaked in the sounds of the evening. “I’m really enjoying it, it’s a very diverse group,” Levonia Corry of Salisbury said. Corry attends the festival with her friend Vera Wiggins almost every year. “I didn’t mind paying; it
gram that included training in military discipline and studies, Air Force core values, physical fitness and basic warfare principles and skills. Airmen who complete basic training earn four credits toward an associate in applied science degree through the Community College of the Air
R124211
WAYne hinshAW/FOR the saLIsBURY POst
Rowan Blues and Jazz Festival organizer eleanor Qadirah thanks the crowd after being presented with a giant portrait of herself at the event.
BLUES
SUNDAY, OCTOBER 17, 2010 • 5A
CONTINUED/AREA
R124462
SALISBURY POST
6A • SUNDAY, OCTOBER 17, 2010
JON C. LAKEY/SALISBURY POST
Grace Campbell talks of her troubles getting a home health nurse to visit her husband, Randy, a Vietnam War veteran suffering from multiple sclerosis. The first MRI showed that he had multiple sclerosis. After Randy went on disability, the couple sold their home on High Rock Lake and moved to Harkers Island, where their house had
for
water views in the front and back. Early on, he was still able to get on and off his boats for fishing and trips to places such as Cape Lookout. “We just loved it,� Grace says. “We met the best people down there.�
C RAIG PIERCE Rowan County School Board
(North Seat)
• Opposed to redistricting by promoting a more effective way to repopulate schools • Believes in prudent budget policies • Will work to improve graduation rates and academic levels by adding new curriculum & career skills & goals to prepare beyond graduation
VOTE FOR CRAIG PIERCE on November 2nd
DUI $
50
per month
LOW DOWN PAYMENTS!
Liability Insurance
36 per month $
Paid for by the Committee to Elect Craig Pierce
R127268
The VA informed her Randy’s care was being cut back to three hours a day — a decision that seemed arbitrary to Grace because no one had visited Randy to reevaluate his condition. “His home-based primary care team did not change anything,â€? says Grace, who worked 25 years at the Hefner VA Medical Center in respiratory therapy and as a cardiology assistant. “Why should some stranger on a committee change this?â€? She became even angrier because the day she received the telephone call, U.S. Sen. Kay Hagan was touring the Hefner VA Medical Center in Salisbury to see how $5.7 million in stimulus funding for infrastructure such as waterlines, elevators and heating and airconditioning would be spent. “Yet they’re cutting back on patient care?â€? Grace asks. “That doesn’t make sense.â€? Grace wrote a letter to the newspaper, then a letter to U.S. Rep. Mel Watt, DN.C. The VA told her to take her complaint to a patient advocate, but that went nowhere, Grace says. Dr. Kathleen Wolner, acting chief of staff at the VA, informed her officially by letter that her request for seven days a week at five hours a day had been denied, “based upon clinical review of your Activities of Daily Living.â€? It would be three hours a day instead. Wolner said she could appeal to Daniel F. Hoffmann, network director for VISN 6 in Durham. Meanwhile, Grace was having surgery in April, and her own physician said she could not be doing any lifting, pulling or turning until July 19. The VA agreed to extend the five-hours-a-day care until then. Then, the VA’s home and community based coordinator offered Grace two new options: four consecutive hours of a nurse for seven days a week, or five hours a day — only the five hours would be split into three hours in the morning and two hours in the evening. While she was appealing, Grace opted for the fivehour split. On Sept. 3, Hoffmann wrote her and said she would have to live with those terms, not the five consecutive hours Randy used to receive and that Grace still prefers. Hoffmann wrote: “The home care agency from which Mr. Campbell receives care reported that if they were to provide five consecutive hours of care, they would not be able to guarantee that hands-on care would be provided the whole time, thus custodial care would then ensue.â€? He said that is why the options of four consecutive hours or split days of five hours were offered. “It is our goal to ensure that Mr. Campbell receives the personal care he requires within the parameters of the H/HHA program,â€? Hoffman concluded. “The H/HHA program cannot provide custodial care for veterans.â€? Grace argues that the split day makes no sense. It tries to fix something that wasn’t broken, she adds. From his bed, Randy adds, “It’s a good program they’ve got. The time thing is just inconvenient.â€? Last week, Grace sent her latest letter to Hoffman asking him to reconsider, and copies have gone to Watt and the U.S. secretary of Veteran Affairs. “As I told Daniel Hoffmann, everybody has a boss,â€? Grace says. ••• Randy’s nurse, Mike Fletcher, comes to the house from 9 a.m. to noon and from 5-7 p.m. “He’s really, really good with Randy,â€? Grace says. In the morning, breakfast alone — with the eating and cleaning up — takes about an hour. Randy also has to receive an enema every other day. His bath and all the maneuvering involved with that takes another hour, followed by bed changing, the cleaning of dishes, wiping down the bed with Clorox, preparing fresh drinking water,
UNITED I NSURANCE OF KANNAPOLIS 2005 S. Cannon Blvd., Kannapolis, NC
Jenny (Formerly of Direct General) has opened United Insurance and is excited to offer all types of insurance: Auto - Home - Life - Health
We Insure Any Driver and Car - Accidents & Points No Problem Monday-Friday 9am-5pm
Jenny Daniel
Mobile Home Insurance $
704-932-2005
R125612
FROM 1A
Grace, who is responsible for his care the 19 hours of every day that a nurse isn’t helping. Sometimes she pays for a caregiver, allowing her to take a longer break from the house. In June, Randy had to be hospitalized on twice and he has relied on portable oxygen since then. As you might expect, Randy Campbell is seen durRandy sleeps in stops and ing his time in Vietnam. starts through the day and But by 2005, his multiple night. He tends to talk in his sclerosis had progressed to sleep and often is heard disthe point where they wanted cussing his old jobs with felto be closer to the VA in Sal- low workers. isbury and his own doctors. “When he sleeps, he He was depending on a moworks,â€? Grace says. “He’s torized wheelchair, and their still, in his mind, working.â€? increasing number of trips Grace remains deterto the Durham VA from mined in both his care and Harkers Island had proved her small battle with the VA. tiring. “I’m not the only veterThey sold their Harkers an’s wife going through Island house in seven days this,â€? she says. “I want them and remodeled the home to know there are options place off South River Road. out there. They may not get ••• the end result they want, but Randy, 63, has his good at least they know they can days and bad days, as does try.â€?
50
per month
Quality Q uality ccare are iiss ô than than yyou ou tthink. hink. ô In 1989, I chose Salisbury as the place to start my career as a family physician. After more than 20 great years here, my wife, three children and I are proud to call Rowan County home. I’m also proud that my family and my patients can receive high quality care close to home. Folks don’t have to travel far for leading-edge treatment, including specialized care such as cardiology, urology and oncology. Rowan Regional Medical Center delivers advanced technology with a caring touch. And you don’t have to take my word for it – national quality scores rank us among the nation’s top hospitals.
David DiLoreto, MD Rowan Family Physicians
TOP 10% In
w ww.rowan.org//quality
The Nation
R125476
VA
giving Randy medications and getting him settled into bed again. The two hours at night involve getting Randy in his wheelchair, eating supper, taking him out for fresh air and preparing him for bed. Randy relies on his good right hand — his left arm has become pretty much useless — to brush his teeth with an electric toothbrush and shave with an electric razor. Grace or Fletcher help with any spots he might have missed. Randy takes medications for depression, spasms and post traumatic stress disorder. The couple’s 3-year-old dachshund, Ailee, spends a lot of time on Randy’s chest. ••• Randy Campbell grew up in this house, which is part of 50-plus acres that has been in his family for years. There’s a “For Sale by Ownerâ€? sign by the road today. Grace would like to sell the property and move them to an apartment in Salisbury. Randy quit Catawba College and joined the Army, serving from 1967-70, including a year’s tour in Vietnam. After the war, he built careers with Power Curbers and PAPCO. For Power Curbers, he handled many assignments — from building the machines to overseeing parts and service to training foreign buyers in the Middle East on how to use the curbing machines. When he tired of the travel, he joined Benny Lawson and Bernie Smith for a 10year stint with PAPCO, before rejoining Power Curbers. When he found spare time, Randy liked to go fishing or duck hunting. His marriage to Grace is the second marriage for both. They have no children. In 1998, he woke in the night to use the bathroom and fell down on the way, complaining to Grace that his legs were asleep. “I knew there was something wrong,â€? she said.
SALISBURY POST
CONTINUED
SALISBURY POST
GPS tracking device hidden in student’s vehicle among cases drawing scrutiny SAN FRANCISCO (AP) — Yasir Afifi, a 20year-old computer salesman and community college student, took his car in for an oil change earlier this month and his mechanic spotted an odd wire hanging from the undercarriage. The wire was attached to a strange magnetic device that puzzled Afifi and the mechanic. They took pictures of it and posted the images online, asking for help in identifying it. Two days later, FBI agents arrived at Afifi’s Santa Clara apartment and demanded the return of their property — a global positioning system tracking device now at the center of a dis-
sent in which a three-judge panel from his court ruled that search warrants weren’t necessary for GPS tracking. terrorists. Scholars predict the U.S. Supreme Court will have to resolve the issue since so many courts disagree.
Sound, Decisive Justice, Fairly Rendered!
Cast Your Vote November 2 for SUPERIOR COURT JUDGE
associated press
Money raised from this set of stamps will go to the audrey Hepburn children’s Fund.
Audrey Hepburn stamps bring in $606,000 at auction
R127096
Paid for by Anna Mills Wagoner for Superior Court
CARPET QUEEN HOURS: Mon-Fri 9:30 am-5:00 pm • Sat 10:00 am-2:30 pm
Rowan’s Largest Store of Carpet, Vinyl, Wood and Laminate Flooring
2 DAYS ONLY w w w . f l o o r m y p l a c e . c o m
SPECIAL 3 SPECIAL 4 DAY DAY SPECIAL 3DAY BUYING EVENT BUYING EVENT BUYING EVENT THURSDAY & FRIDAY 9:30AM-5:30PM
Fri., Sat., Sun. Mon. Thurs., Fri. Sat. 1010am am to 6 pm andand to6pm SATURDAY 9:30AM-4:00PM FORTUNES GLADLY PAID FOR TREASURES 3 days week, we’rebringing bringing ininour NEW YORK BUYERS NEW YORK BUYERS days thisthis week, we’re our For 3 4For who willpay payTOP TOP DOLLAR DOLLAR for treasures. who will foryour your treasures. REMEMBER: WE’LL ALWAYS, chances are you won’t wear or use it again.”
MEET OUR EXPERT APPRAISERS Jewellery.
WANTED – Diamond Jewelry
WANTED – Fine Antique.
1,199
00 *Based on 450 sq. ft.
$
00
699
00
811 W. Innes St., Salisbury,
704. 633.5951
AS YOUR SUPERIOR COURT JUDGE,.
WANTED – Fine Sterling Solid gold chains, bracelets, rings, earrings, charms, pendants, pins, broaches, clips. gold nuggets, dental gold (white and yellow), broken bits and pieces of gold. YES. WE BUY ALL OLD AND UNWANTED GOLD IN ANY CONDITION. PLEASE SEE US FOR YOUR BEST OFFER.
will
1ST T REAT
Diamonds Platinum Gold Watches Coins and Silver
BEST QUALITY CARPET
NOW $ ONLY
$
PAYMENT FOR
You may rest assured that your property will be accurately and professionally appraised for its MAXIMUM CASH MARKET VALUE by our qualified expert appraisers. APPRAISALS ARE FOR PURCHASE ONLY– NO CURIOSITY SEEKERS, PLEASE.
3 ROOMS of OUR
IMMEDIATE
OUR KNOWLEDGEABLE BUYERS CAN MEAN MORE MONEY FOR YOU.
BERLIN (AP) — A rare sheet of 10 stamps depicting Audrey Hepburn fetched German postal service originally printed 14 million of the Hepburn stamps in 2001 showing the Belgian-born actress in her most famous role as the ebullient Holly Golightly in “Breakfast at Tiffany’s.” Other items being auctioned include a pair of Hepburn’s black ballet slippers and a portrait of the actress.
P RESERVE
SUNDAY, OCTOBER 17, 2010 • 7A
W O R L D / N AT I O N
We Offer Top Dollar Our Expert Appraisers know the International Markets and are prepared to offer you top New York Prices. Don’t sell for less.
Immediate Payment
YOUR RIGHTS .
You will be paid immediately for the items we purchase..
Private and Confidential All transactions conducted in a safe, secure, discreet and confidential manner.
If your treasure is worth more than its gold or metal value, we'll tell you and pay you accordingly. TV Gold Buyers won’t. Don't risk selling your fine jewelry for scrap to TV or hotel gold buyers – See the Treasure Experts at the Gem Gallery.
EVERYONE FAIRLY.
M AKE RULINGS WITHOUT BIAS . U SE COURTROOM TIME EFFICIENTLY.
THURSDAY, FRIDAY, SATURDAY FRIDAY, SATURDAY, SUNDAY and MONDAY THURSDAY, FRIDAY AND SATURDAY OCTOBER 21, 22, 23 25th, 26th, 27th, MarchJUNE 18, 19 and 20, 10 28th AM to 6 PM NO APPOINTMENT NEEDED.
1ST CHOICE FOR SUPERIOR COURT JUDGE Paid for by Bingham for Judge
R127322
5890 S. Virginia Ave. #3 Reno, Nevada 1810 West Innes Street, Salibury (775) 825-3499 704-633-7115 Hours: 10 am to 6 pm
R126645
GEM GALLERY
CONTINUED
RANKING
my issue.”
FROM 1A
Rowan County already offers a variety of after-school programs that are working to keep children on the right path. The Rowan County YMCA provides elementary and middle school students with afterschool care at 17 different sites. Executive Director Jaime Morgan said the program is based on five Christian principals including honesty, caring, respect, responsibility and faith. “That’s something we don’t shy away from,” he said. “We really try to teach those core values to our kids.” Students who attend the program receive help on their homework and advice on how to make healthy choices. “We also make sure that we are putting good, positive role models in front of them.” The Salvation Army offers children a similar Christianbased after-school program. Jennifer Chambers, afterschool and summer program director, said she works with students on their homework and makes sure students follow a daily routine. Chambers said the program also provides personalized attention and help that some children may not always receive at home. “A lot of parents that we have are single parents and it’s really difficult for them to be fully involved in their school work.” Chambers said the program doesn’t just end when students leave to go home. She
• • •
and not the program,” she said. Coltrane said if individual providers can find ways to pair their services, more funding opportunities will be available. He said it’s also important for providers to get the word out about their programs. “It’s much harder to cut funding for programs that seem to be working,” he said. Several after-school providers said they want to find ways to eliminate hurdles such as cost and transportation so that every child has a safe place to go and learn after school. “One of the top priorities needs to be improving the level of access to all children,” Coltrane said. Jo Ann Norris, executive director of the Public Forum of North Carolina, said the first step to solving access problems is educating the community and policymakers on the positive effects associated with after-school programming. “Each one of you should know your legislators on a first-name basis,” she said. “You should be calling them at home and letting them know about these issues.” Norris said if communities don’t voice their concerned, problems oftentimes go unnoticed and unchanged. She said policymakers can get the mindset, “I’m not hearing about this from my constituents. Therefore, it’s not
JOHN
monitors their grades and behavior and comes up with ways to make improvements if needed. Communities in Schools of Rowan County began a graduation program last year at North Rowan Middle School. About 75 students, who were targeted based on endof-grade test scores, behavior and attendance, received one hour of after-school tutoring in the subjects of math, reading and science three days a week. “Of the students considered at risk, 99 precent of them showed improvement scores on the EOGs taken in the spring,” said Traci Fleming, Communities in Schools graduation coach for North Rowan High School. Fleming said the success at North Rowan Middle has provided a foundation to start similar programs at other schools. “As the program continues to grow, new opportunities are being offered to the students at North Rowan High School,” she said. “For example, tutoring has now evolved to homework assistance in the after-
See RANKING, 9A
R127005
KEEP
R127195
Paid For By The Committee To Elect John Brindle
Judge Beth Dixon with husband Glenn and children Roy (17) Spencer (15) Susannah (14) and Grace (14)
My family inspires me to work to bring safety, security and happiness to all families.
As a wife and the mother of four teenagers, I have a special interest in our juvenile and family courts. Even before I was a judge, I was a legal advocate for the abused and neglected children of our county. I am now a NC Certified Juvenile Court Judge and responsible for securing a $250,000 Reclaiming Futures grant to improve our juvenile courts in Rowan County. I love raising my family here, and I am committed to keeping Rowan County the best place to work and live.
In the Courtroom Experience Counts
Re-elect the Judge who is already getting the job done
BRINDLE
Vote for Experience, Integrity and a Conservative Leader for Rowan County!
SALISBURY POST
REGISTER OF DEEDS
Experienced — Ethical — Effective Paid for by Committee to Re-elect Judge Beth Dixon
R127317
8A • SUNDAY, OCTOBER 17, 2010
R126791
C
CKWELL, N RO
SALISBURY 317 FAITH ROAD
30 Carolina Locations
MOORESVILLE
168-U NORMAN STATION BLVD. 10001 WEDDINGTON RD.
Next to Lowes, The Movies at Innes St. Market Consumer Sq. Shop Ctr., across from Wal-Mart
704-639-1009
CONCORD MILLS
704-660-3900
Speedway Blvd. at Garden Ridge
704-979-1112
Since 1974
CHARLOTTE 6153 INDEPENDENCE Between Harris Blvd. & Idlewild Rd.
704-535-8383
OPEN MON.-FRI. 9:30-8 • SATURDAY 9:30-6:00 • SUNDAY 1:30-5:00 *SOLD IN SETS *OAC *ON SAME NAME AND MODEL * DISCOUNT DO NOT APPLY TO TEMPUR-PEDIC & CLOSEOUTS
R127180
factorymattressusa.com
R125146
SALISBURY POST
CONTINUED
73
66%
69
244
44
74%
43
$43,000
38
9%
63
14%
62
56
60
36
69
40
55
15
• • • After-school program advocates also feel mentoring is an essential part of providing quality programs. Norris said getting parents, teachers and community members involved in children’s lives is essential. “It is all about relationships,” she said. Bradford Sneeden, a member of Gov. Bev Perdue’s education cabinet, said mentoring is the first step to keeping children on the right track. “We know how important mentoring is because there is an absence of that right now,” he said. “Everybody seeks relevance; they want to belong to something. “If you don’t give them something positive, they’re going to find something negative. Contact Sarah Campbell at 704-797-7683.
Cabarrus County Indicator
Ranking
Data
Cohort graduation rate
34
75%
34
138
25
78%
5
$56,700
38
9%
72
14%
33
60
5
16
31
28
23
6
Discuss top stories on our forums page
year. • Juvenile Delinquency Rate — The juvenile delinquency rate is defined as the number of delinquent complaints received by court services offices. • Child Abuse/Neglect Reported Cases — The child abuse/neglect reported cases depicts the number of children (under age 18) with a report of abuse and neglect for each year. • Children in DSS Custody — The annual number of children in custody looks at the caseload count in foster care under Division of Social Services custody during a year.
Losing Your Medicare Advantage Plan, Dec. 31?
Jeff Saleeby Agency 704-633-1311
67
51
or email: jsaleeby@carolina.rr.com ALSO, part D drug plans & new advantage plans
12
ote for Judge Beth Dixon
Do You Have Type 2 Diabetes?.
Rowan County District Court Paid for by Committee to Re–elect Judge Beth Dixon
NEED CA$H FOR FALL EXPENSES?
We have a Bushel of Cash waiting for you right now!
$850 – $2500
NFC
LOANS AVAILABLE NOW!
Come and Visit Our Friendly Staff Today!
National Finance Company
440 Jake Alexander Blvd. West • Salisbury, NC 28147 Phone: (704) 633-5291 Fax: (704) 637-5532 Mary H. Smith, Mgr.
DO YOU HAVE TOENAIL FUNGUS ON BIG TOE?
There is no substitute for experience
ReElect Judge
KEVIN EDDINGER
Fair, honest and experienced Paid for by Committee to re-elect Kevin Eddinger, District Court Judge. Qualified participants may receive financial compensation up to $385 for time and travel.
For more information call 704.647.9913 or visit
R127170
CHAPARRAL, N.M. (AP) — Investigators in New Mexico say a Chaparral man who was cleaning his handgun Saturday morning accidentally shot his 4-year-old son and the bullet passed through the boy and hit the man’s mother. Both are in critical condition but their wounds aren’t believed to be life-threatening. The bullet struck the boy in his stomach and continued through to the grandmother and hit her in the abdomen.
For more information call 704.647.9913 or visit
For more information call 704.647.9913 or visit
District Court Judge
Bullet passes through boy into woman
If you qualify, you will receive study medication and study related medical care at no cost while participating in the study. If eligible, financial compensation will be provided for time and travel.
TNL0904
• Cohort graduation rate — This indicator reports the four-year cohort graduation rate for a Local Education Agency (LEA). • Short term suspension rate — This indicator reports data for students who were suspended for 10 days or less from the 115 LEAs and charter schools. • Adults with high school diploma — This indicator reports the percentage of the population 25 years of age and older who have completed at least a high school diploma or GED. • Median household income — This indicator reports the exact middle of the household income distribution in a particular county. • Single parent households — Single parent households is the percent of all households run by a single parent (male or female householder with no spouse present) with one or more of their own children (under age 18) living at home. • Children without health insurance — This indicator reports the percentage of children (under age 18) in North Carolina who are not covered by health insurance at any point during the year. • Teen pregnancy rate — The N.C. Teen Pregnancy Prevention Initiative uses a five-year average of teen pregnancy rates because rates and ranks can fluctuate significantly from year to
Lowest prices in N.C. on F, G, M and N plans. For simple enrollment call
R
About the indicators
You are entitled to a guaranteed issue Medicare Supplement.5601
Rowan County’s overall ranking is 66 out of 100 counties on The North Carolina Center for After-school Programs’ Roadmap to Need, while Cabarrus County ranks sixth overall. The center identified 10 indicators to demonstrate where the state should make its largest investments in preventative care such as afterschool programs. The data collected shows where students are most at risk of not succeeding in school and as adults.
R127377
About the Roadmap to Need
Do you have trouble breathing? Or a persistent cough?
BREATHING BOE205452
Cohort graduation rate
R126987
Data
TYPE2DIABETES
Ranking
FROM 8a noons with a certified teacher providing students help in core subjects.” The program is available to the entire school. Fleming also works to helps students with life skills. “Although my primary focus is on my students meeting graduation requirements, I strive to help them find the area in which they can contribute to society,” she said.
Rowan County Indicator
RANKING
R126983
N.C. Center for Afterschool Programs’ Roadmap to Need
SUNDAY, OCTOBER 17, 2010 • 9A
R124636
10A • SUNDAY, OCTOBER 17, 2010
SALISBURY POST
When we needed someone to put a cap on Gas Taxes for Working Families…
Representative Lorene Coates was the one who stood up for us in Raleigh. Re-Elect
Lorene Coates
She stands with us as OUR VOICE in Raleigh Paid for by Friends of Lorene Coates
SPORTSSUNDAY
Ronnie Gallagher, Sports Editor, 704-797-4287 rgallagher@salisburypost.com
SALISBURY POST
ECU edges Pack in OT
SUNDAY October 17, 2010
1B
UNC breaks through with win at Virginia BY HANK KURZ JR. Associated Press
BY AARON BEARD Associated Press
GREENVILLE — With each week, Ruffin McNeill sees East ECU 33 Carolina’s spread offense N.C. State 27 becoming a little more efficient and his struggling defense gaining extra confidence. Just think how the coach feels now, after a thrilling win against N.C. State. Dominique Davis scored on a 1-yard keeper and Damon Magazu intercepted Russell Wilson’s final pass to help the Pirates beat the Wolfpack 33-27 in overtime Saturday, giving McNeill his first victory against a challenging nonconference schedule. associated press
See ECU, 4B
east carolina’s damon Magazu yells after his game-ending interception.
McMurray upstages top dogs
CHARLOTTESVILLE, Va. — All week, 44 N o r t h UNC 10 C a r olina’s Virginia players downplayed their streak of futility at Virginia, the one that had seen them lose 14 straight at Scott Stadium. And all week, defensive end Tim Jackson said, it was “pounded into our heads pretty thoroughly,” and “we just knew we were going to get it snapped this weekend.” T.J. Yates threw for three touchdowns and North Carolina did just that Saturday
associated press
North carolina’s dwight Jones had two touchdown catches. night, beating Virginia 44-10 — the Tar Heels’ first road win since 1981 in one of the South’s oldest rivalries.
See UNC, 4B
SAC FOOTBALL
BY JENNA FRYER Associated Press
CONCORD — Jamie McMurray’s career came full circle at Charlotte Motor Speedway on Saturday night, where he returned to Victory Lane eight years after grabbing his first win with the team that gave him a s e c o n d chance. The celebration with Chip his Ganassi Racing team was MCMURRAY ‘Be.
See MCMURRAY, 2B
WAYne hinshAW/saLisBUrY post
catawba’s Josh Wright runs past carson-Newman’s dontaye Hall (20) and Mario russell (5). Wright had 105 yards and one touchdown on 19 carries.
Fake ’n Shake at Shuford Trick play, pair of picks finish off Indians in loss
Catawba left with what ifs T
here are no consolation prizes in the South Atlantic Conference. No one gives you a silver star or extra credit for doing what Catawba’s football team did Saturday — hanging with preseason favorite Carson-Newman until the wheels fell off in the fourth quarter. “I know,” defensive end Brandon Weedon acknowlDAVID edged. “But still, it SHAW wasn’t supposed to be like this. We didn’t expect to hang around. We expected to beat them.”
See SHAW, 3B
BY MIKE LONDON mlondon@salisburypost.com
WAYne hinshAW/saLisBUrY post
catawba’s L.J. Mccray tries to elude patrick Moore while returning a kickoff against the eagles.
Carson-Newman’s 42-16 victory C-N 42 a g a i n s t Catawba 16 C a t a w b a probably was the most deceptive final score in SAC history. That was no consolation to the Indians, who were clobbered 21-0 in the last three minutes. “Coach (Chip) Hester said not to look at the scoreboard because we know how hard we played,” Catawba cornerback Jumal Rolle said. “We just didn’t execute. That’s all it was. I really thought we’d take this one.” A handful of plays did the
WAYne hinshAW/saLisBUrY post
catawba’s eric Morman, left, is knocked out of bounds by defensive back tarvin Jones. Indians in. The biggest was a successful faked punt by the Eagles (4-3, 2-1) with just over five minutes left when they were clinging to a 21-16 lead.
See INDIANS, 3B
2B • SUNDAY, OCTOBER 17, 2010
TV Sports Sunday, Oct. 17 NFL 1 p.m. CBS — Baltimore at New England FOX — Atlanta at Philadelphia 4:15 p.m. FOX — Dallas at Minnesota 8:20 p.m. NBC — Indianapolis at Washington GOLF 4 p.m. TGC — PGA Tour, Frys.com Open MAJOR LEAGUE BASEBALL 8 p.m. FOX — San Francisco at Philadelphia
Prep football Standings 1A Yadkin Valley YVC Overall Albemarle 4-0 7-1 3-1 6-2 West Montgomery East Montgomery 3-1 6-2 North Rowan 3-1 3-5 2-2 2-6 South Davidson South Stanly 1-3 1-7 Chatham Central 0-4 1-7 0-4 0-8 North Moore Friday’s games Albemarle 44, North Rowan 14 West Montgomery 45, South Stanly 35 South Davidson 20, Chatham Central 13 East Montgomery 28, North Moore 12 Next week’s games North Rowan at Chatham Central East Montgomery at Albemarle North Moore at South Stanly South Davidson at West Montgomery
2A Central Carolina Overall CCC Thomasville 2-0 8-0 Salisbury 2-0 5-3 2-0 5-3 Lexington Central Davidson 0-2 5-3 West Davidson 0-2 4-4 0-2 2-6 East Davidson Friday’s games Salisbury 56, Central Davidson 37 Thomasville 63, East Davidson 6 Lexington 55, West Davidson 0 Next week’s games Lexington at Salisbury West Davidson at Thomasville Central Davidson at East Davidson
3A North Piedmont Overall NPC West Rowan 4-0 9-0 West Iredell 3-1 5-3 2-1 4-4 Statesville Carson 2-2 7-2 South Rowan 1-2 2-6 0-3 1-7 North Iredell East Rowan 0-3 1-7 Friday’s games West Rowan 40, Statesville 0 Carson 56, North Iredell 14 West Iredell 37, South Rowan 21 Next week’s games South Rowan at Carson East Rowan at West Rowan West Iredell at West Wilkes Statesville at North Iredell
3A South Piedmont SPC Overall A.L. Brown 4-0 7-1 3-1 5-3 Concord Hickory Ridge 3-1 4-4 Cox Mill 2-2 5-3 2-2 4-4 NW Cabarrus Robinson 2-2 4-4 Mount Pleasant 0-4 2-6 0-4 0-8 Central Cabarrus Friday’s games A.L. Brown 21, Mt. Pleasant 13 Cox Mill 20, Concord 13 Robinson 35, Central Cabarrus 28 NW Cabarrus 10, Hickory Ridge 7 Next week’s games A.L. Brown at Hickory Ridge Concord at Mt. Pleasant Central Cabarrus at NW Cabarrus Cox Mill at Robinson
4A Central Piedmont Overall CPC North Davidson 2-0 7-1 Mount Tabor 2-0 7-1 2-0 4-4 Davie County West Forsyth 0-2 6-2 Reagan 0-2 4-4 0-2 0-8 R.J. Reynolds Friday’s games Davie 21, West Forsyth 17 Mount Tabor 39, R.J. Reynolds 7 North Davidson 24, Reagan 14 Next week’s games Mount Tabor at Davie Reagan at West Forsyth R.J. Reynolds at North Davidson
How They Fared Class 4A 1. Butler (8-0) beat Ardrey Kell 46-15. 2. Mallard Crk. (8-0) beat North Meck 48-0. 3. Britt (8-0) beat Pine Forest 67-13. 4. Richmond Co. (7-1) beat Swett 34-14. 5. A.C. Reynolds (7-1) beat Enka 69-17. 6. Rolesville (8-1) lost to Wakefield 31-21. 7. Hillside (8-0) beat Jordan 34-14. 8. Gbo. Smith (9-0) beat Page 28-18. 9. Mt. Tabor (7-1) beat R.J.Reynolds 39-7. 10. New Bern (7-0) beat Hoggard 27-7. Class 3A 1. W. Rowan (9-0) beat Statesville 40-0. 2. Catholic (9-0) beat Waddell 49-12. 3. Hibriten (81-) beat S. Caldwell 44-7. 4. Burns (7-1) beat E. Rutherford 52-18. 5. N. Guilford (7-1) beat McMichael 49-6. 6. Marvin Ridge (6-2) lost to Sun Valley 9-7. 7. S. Nash (6-2) lost to N. Nash 21-7. 8. Crest (6-1) beat North Gaston 31-3. 9. Hope Mills Gray’s Creek (7-1) idle. 10. Hunt (7-1) beat Rocky Mount 14-7. Class 2A 1. Reidsville (7-1) lost to Cummings 28-7. 2. Tarboro (8-0) beat Kinston 41-14. 3. Lincolnton (8-0) beat E. Lincoln 42-28. 4. Thomasville (8-0) beat E. Davidson 63-6. 5. Starmount (8-0) beat W. Wilkes 55-7. 6. SW Edgecombe (8-1) beat N. Pitt 40-6. 7. N-Conover (8-0) beat Bunker Hill 65-32. 8. Kinston (7-2) lost to Tarboro 41-14. 9. S. Iredell (8-0) beat Draughn 49-14. 10. Polk (7-1) beat Avery County 36-12. Class 1A 1. W-Rose Hill (8-0) beat Pender 29-22. 2. Pender (6-1) lost to W-Rose Hill 29-22. 3. Albemarle (7-1) beat N. Rowan 44-14. 4. Plymouth (8-0) beat Riverside 41-20. 5. SW Onslow (7-1) beat Pamlico 52-7. 6. Avery (6-2) lost to Polk County 36-12. 7. Mt. Airy (6-2) beat North Surry 37-7. 8. W. Montgomery (6-2) beat S. Stanly 45-35. 9. Hendersonville (6-2) beat Mitchell 35-14. T10. Murphy (7-2) beat Andrews 56-14. T10. Riverside (6-2) lost to Plymouth 41-20.
NFL Standings AMERICAN CONFERENCE East W L T Pct PF PA N.Y. Jets 4 1 0 .800 135 81 New England 3 1 0 .750 131 96 Miami 2 2 0 .500 66 92 Buffalo 0 5 0 .000 87 161 South W L T Pct PF PA Houston 3 2 0 .600 118 136 Jacksonville 3 2 0 .600 107 137 Tennessee 3 2 0 .600 132 95 Indianapolis 3 2 0 .600 136 101 North W L T Pct PF PA Baltimore 4 1 0 .800 92 72 Pittsburgh 3 1 0 .750 86 50 Cincinnati 2 3 0 .400 100 102 Cleveland 1 4 0 .200 78 97 West W L T Pct PF PA Kansas City 3 1 0 .750 77 57 Oakland 2 3 0 .400 111 134 Denver 2 3 0 .400 104 116 San Diego 2 3 0 .400 140 106 NATIONAL CONFERENCE East W L T Pct PF PA Washington 3 2 0 .600 89 92 N.Y. Giants 3 2 0 .600 106 98 Philadelphia 3 2 0 .600 122 103 Dallas 1 3 0 .250 81 87 South W L T Pct PF PA Atlanta 4 1 0 .800 113 70 Tampa Bay 3 1 0 .750 74 80 New Orleans 3 2 0 .600 99 102
CAROLINA
0 5 0 .000 52 110 North L T Pct PF PA Chicago 1 0 .800 92 74 2 0 .600 119 89 Green Bay Minnesota 3 0 .250 63 67 Detroit 4 0 .200 126 112 West W L T Pct PF PA Arizona 3 2 0 .600 88 138 Seattle 2 2 0 .500 75 77 2 3 0 .400 83 96 St. Louis San Francisco 0 5 0 .000 76., CBS Atlanta at Philadelphia, 1 p.m., FOX New Orleans at Tampa Bay, 1 p.m. N.Y. Jets at Denver, 4:05 p.m. Oakland at San Francisco, 4:05 p.m. Dallas at Minnesota, 4:15 p.m., FOX Indianapolis at Washington, 8:20 p.m. Open: Buffalo, Cincy, Arizona, CAROLINA Monday’s game Tennessee at Jacksonville, 8:30 p.m. W 4 3 1 1
Auto racing Sprint Cup Bank of America 500 Saturday At Charlotte Motor Speedway Lap length: 1.5 miles (Start position in parentheses) 1. (27) Jamie McMurray, Chevrolet, 334 laps, 130.1 rating, 190 points, $287,256. 2. (6) Kyle Busch, Toyota, 334, 143.8, 180, $212,004. 3. (10) Jimmie Johnson, Chevrolet, 334, 108.9, 170, $194,353. 4. (23) Denny Hamlin, Toyota, 334, 112.7, 165, $139,400. 5. (22) Greg Biffle, Ford, 334, 99, 160, $126,000. 6. (17) Matt Kenseth, Ford, 334, 92.9, 155, $144,551. 7. (12) Joey Logano, Toyota, 334, 110.7, 151, $136,626. 8. (24) Kevin Harvick, Chevrolet, 334, 100.2, 147, $123,365. 9. (16) David Reutimann, Toyota, 334, 96, 138, $116,206. 10. (26) David Ragan, Ford, 334, 85.7, 134, $89,125. 11. (34) Juan Pablo Montoya, Chevrolet, 334, 89.6, 135, $99,400. 12. (2) Carl Edwards, Ford, 334, 87.2, 132, $97,198. 13. (32) Regan Smith, Chevrolet, 334, 70, 124, $119,498. 14. (4) Mark Martin, Chevrolet, 334, 108.8, 126, $110,356. 15. (13) Martin Truex Jr., Toyota, 334, 99.5, 118, $82,950. 16. (14) Marcos Ambrose, Toyota, 334, 72.5, 115, $110,698. 17. (20) Clint Bowyer, Chevrolet, 334, 74.4, 117, $79,800. 18. (7) Reed Sorenson, Toyota, 334, 72, 114, $139,201. 19. (21) Scott Speed, Toyota, 334, 70.7, 106, $107,173. 20. (18) Jeff Burton, Chevrolet, 334, 75.4, 108, $80,300. 21. (29) Tony Stewart, Chevrolet, 334, 66.2, 100, $79,625. 22. (30) Bobby Labonte, Chevrolet, 333, 57.2, 97, $110,551. 23. (1) Jeff Gordon, Chevrolet, 333, 87.1, 99, $94,823. 24. (5) Paul Menard, Ford, 333, 73.8, 91, $103,940. 25. (3) A J Allmendinger, Ford, 333, 71, 93, $66,025. 26. (9) Elliott Sadler, Ford, 332, 63.4, 85, $95,535. 27. (31) Brad Keselowski, Dodge, 332, 53.9, 82, $87,210. 28. (36) David Gilliland, Ford, 332, 46.1, 84, $76,300. 29. (8) Dale Earnhardt Jr., Chevrolet, 331, 56.8, 76, $110,248. 30. (15) Kurt Busch, Dodge, 331, 51.7, 73, $75,950. 31. (42) Travis Kvapil, Ford, 331, 39.4, 70, $65,250. 32. (41) Dave Blaney, Ford, 331, 37, 67, $78,598. 33. (39) Robby Gordon, Toyota, 327, 38.2, 64, $76,923. 34. (38) Andy Lally, Chevrolet, 315, 31.8, 61, $64,775. 35. (37) Bill Elliott, Ford, 305, 35.6, 58, $63,625. 36. (11) Ryan Newman, Chevrolet, 272, 29.9, 55, $101,079. 37. (35) Patrick Carpentier, Ford, accident, 217, 38.2, 57, $71,325. 38. (25) Kasey Kahne, Ford, 214, 44, 49, $105,690. 39. (33) Michael McDowell, Chevrolet, rear gear, 127, 35, 51, $63,075. 40. (19) Sam Hornish Jr., Dodge, accident, 122, 47.7, 43, $70,950. 41. (43) Jeff Green, Toyota, transmission, 91, 32, 40, $62,795. 42. (28) Landon Cassill, Chevrolet, rear gear, 89, 29.4, 37, $62,670. 43. (40) J.J. Yeley, Chevrolet, ignition, 73, 34.2, 34, $63,060. Race Statistics Average Speed of Race Winner: 140.391 mph. Time of Race: 3 hours, 34 minutes, 7 seconds. Margin of Victory: 1.866 seconds. Caution Flags: 9 for 39 laps. Lead Changes: 27 among 19 drivers. Lap Leaders: J.Gordon 1-7; C.Edwards 8; Ky.Busch 9-25; D.Gilliland 26; M.McDowell 27-28; Ky.Busch 29-76; M.Martin 77; J.Burton 78; J.Montoya 79-80; M.Kenseth 81; C.Bowyer 82; P.Carpentier 83; Ky.Busch 84-127; M.Martin 128-135; J.McMurray 136-169; Ky.Busch 170-173; D.Hamlin 174; J.Logano 175; K.Harvick 176; G.Biffle 177; C.Edwards 178; J.McMurray 179-188; J.Johnson 189-203; Ky.Busch 204-292; R.Sorenson 293; A.Allmendinger 294-298; Ky.Busch 299-313; J.McMurray 314-334. Leaders Summary (Driver, Times Led, Laps Led): Ky.Busch, 6 times for 217 laps; J.McMurray, 3 times for 65 laps; J.Johnson, 1 time for 15 laps; M.Martin, 2 times for 9 laps; J.Gordon, 1 time for 7 laps; A.Allmendinger, 1 time for 5 laps; J.Montoya, 1 time for 2 laps; C.Edwards, 2 times for 2 laps; M.McDowell, 1 time for 2 laps; D.Hamlin, 1 time for 1 lap; G.Biffle, 1 time for 1 lap; M.Kenseth, 1 time for 1 lap; J.Logano, 1 time for 1 lap; K.Harvick, 1 time for 1 lap; C.Bowyer, 1 time for 1 lap; R.Sorenson, 1 time for 1 lap; J.Burton, 1 time for 1 lap; D.Gilliland, 1 time for 1 lap; P.Carpentier, 1 time for 1 lap. Top 12 in Points: 1. J.Johnson, 5,843; 2. D.Hamlin, 5,802; 3. K.Harvick, 5,766; 4. J.Gordon, 5,687; 5. Ky.Busch, 5,666; 6. T.Stewart, 5,666; 7. C.Edwards, 5,643; 8. G.Biffle, 5,618; 9. Ku.Busch, 5,606; 10. J.Burton, 5,604; 11. M.Kenseth, 5,587; 12. C.Bowyer, 5,543.
Baseball LCS schedules American League Friday, Oct. 15 New York 6, Texas 5 Saturday, Oct. 16 Texas 7, New York 2, Series tied 1-1 Monday, Oct. 18 Texas (Lee 12-9) at New York (Pettitte 11-3), 8:07 p.m Tuesday, Oct. 19 Texas (Hunter 13-4) at New York (Burnett 10-15), 8:07 p.m. Wednesday, Oct. 20 Texas at New York, 4:07 p.m., if needed Friday, Oct. 22 New York at Texas, 8:07 p.m., if needed Saturday, Oct. 23 New York at Texas, 8:07 p.m., if needed
National League Saturday, Oct. 16 San Francisco 4, Philadelphia 3, San Francisco leads 1-0 Sunday, Oct. 17 San Francisco (Sanchez 13-9) at Philadelphia (Oswalt 13-13), 8:19 p.m. Tuesday, Oct. 19 Philadelphia (Hamels 12-11) at San Francisco (Cain 13-11), 4:19 p.m. Wednesday, Oct. 20 Philadelphia at San Francisco, 7:57 p.m. Thursday, Oct. 21 Philadelphia at San Francisco, 7:57 p.m. Saturday, Oct. 23 San Francisco at Philadelphia, 3:57 p.m. or 7:57 p.m.
SALISBURY POST
SCOREBOARD Sunday, Oct. 24 San Francisco at Philadelphia, 7:57 p.m.
Saturday’s boxes
Catawba soccer teams split
Rangers 7, Yankees 2 New York ab Jeter ss 4 Grndrs cf 2 Teixeir 1b 4 Rdrgz 3b 5 Cano 2b 5 Swisher rf 3 Posada c 3 Brkmn dh 3 Gardnr lf 2 Thams lf 2 Totals 33
r 0 0 0 0 2 0 0 0 0 0 2
Texas h bi ab 1 0 Andrus ss 4 0 0 MYong 3b 5 0 0 JHmltn cf 1 1 0 Guerrr dh 5 2 1 N.Cruz rf 4 1 0 Kinsler 2b 3 1 0 DvMrp lf 3 1 1 Francr rf 1 0 0 BMolin c 4 0 0 Morlnd 1b 3 7 2 Totals 33
r h bi 1 2 0 0 1 1 0 0 0 0 1 0 2 2 0 1 1 1 2 2 2 0 0 0 0 1 1 1 2 1 7 12 6
New York 000 101 000 — 2 Texas 122 020 00x — 7 Dp — New York 2. Lob — New York 12, Texas 9. 2b — Cano (1), Swisher (1), M.young (2), N.cruz 2 (2), Dav.murphy (1), B.molina (1). 3b — Kinsler (1). Hr — Cano (2), Dav.murphy (1). Sb — Andrus 2 (2), J.Hamilton 2 (3). S — Kinsler. IP H R ER BB SO New York P.hughes L,0-1 4 10 7 7 3 3 Chamberlain 1 1 0 0 0 2 11⁄3 1 0 0 0 2 D.Robertson 2 ⁄3 0 0 0 1 1 Logan Mitre 1 0 0 0 2 1 Texas 2 6 2 2 3 6 C.lewis W,1-0 5 ⁄3 1 ⁄3 0 0 0 0 1 Rapada 1 1 0 0 1 1 Ogando 2 ⁄3 0 0 0 1 1 D.Oliver 1 ⁄3 0 0 0 0 0 O’Day 1 0 0 0 2 1 N.Feliz P.Hughes pitched to 2 batters in the 5th. Logan pitched to 1 batter in the 8th. HBP — by C.Lewis (Granderson). WP — P.Hughes, C.Lewis. T — 3:52. A — 50,362 (49,170).
Giants 4, Phillies 3 San Francisco Philadelphia ab r h bi ab r h bi ATorrs cf 5 0 1 0 Victorn cf 5 0 0 0 Snchz 2b 5 0 0 0 Polanc 3b 4 0 1 0 A.Huff 1b 4 0 1 0 Utley 2b 3 1 1 0 BrWlsn p 0 0 0 0 Howard 1b 4 0 1 0 Posey c 4 1 1 0 Werth rf 3 1 2 2 Burrell lf 3 0 2 1 Rollins ss 4 0 0 0 Schrhlt rf 1 1 0 0 Ibanez lf 3 0 0 0 Uribe ss 4 0 1 1 C.Ruiz c 3 1 1 1 Fntent 3b 4 0 1 0 WValdz pr 0 0 0 0 C.Ross r 3 2 2 2 Hallady p 2 0 1 0 Linccm p 3 0 0 0 DBrwn ph 1 0 0 0 JaLopz p 0 0 0 0 Madson p 0 0 0 0 0 0 0 0 Ishikaw 1b0 0 0 0 Lidge p Gload ph 1 0 0 0 Totals 36 4 9 4 Totals 33 3 7 3 San Francisco 001 012 000 — 4 001 002 000 — 3 Philadelphia Dp — San Francisco 1. Lob — San Francisco 7, Philadelphia 7. 2b — Burrell (1), Polanco (1), Howard (1). Hr —C.Ross 2 (2), Werth (1), C.ruiz (1). Sb — Fontenot (1). IP H R ER BB SO San Francisco Lincecum W,1-0 7 6 3 3 3 8 2 ⁄3 0 0 0 0 1 Ja.lopez H,1 1 0 0 0 4 Br.wilson S,1-1 11⁄3 Philadelphia Halladay L,0-1 7 8 4 4 0 7 1 0 0 0 0 1 Madson Lidge 1 1 0 0 1 2 HBP — by Br.Wilson (C.Ruiz), by Lidge (Ishikawa). PB — Posey. T – 2:59. A — 45,929 (43,651).
NBA Preseason Saturday’s Games Houston 95, New Jersey 85 CHARLOTTE 97, Detroit 94 Orlando 105, Chicago 67 Utah 103, L.A. Clippers 91 Boston 97, New York 84 Memphis 91, Milwaukee 77 Atlanta 84, New Orleans 74 Golden State at Portland, 10 p.m. Denver at L.A. Lakers, 10:30 p.m. Sunday’s Games Phoenix at Toronto, 1 p.m. Washington at New York, 6 p.m. Milwaukee vs. Minnesota at Sioux Falls, SD, 8 p.m.
Bobcats 97, Pistons 94 DETROIT (94) Prince 2-9 2-2 7, Villanueva 7-13 1-2 19, B.Wallace 1-2 0-2 2, Bynum 4-7 0-2 8, Gordon 2-10 4-4 10, Stuckey 9-17 6-6 25, Daye 5-11 2-2 14, Monroe 4-12 1-4 9, Summers 03 0-0 0. Totals 34-84 16-24 94. CHARLOTTE (97) G.Wallace 2-6 5-6 9, Diaw 5-9 0-0 11, Mohammed 0-4 0-0 0, Augustin 2-5 11-14 16, Jackson 4-8 3-4 12, Diop 3-3 0-1 6, Thomas 7-12 9-11 23, Henderson 1-4 0-0 2, Carroll 0-1 0-0 0, D.Brown 5-7 5-7 15, Collins 1-2 00 3, Miles 0-1 0-0 0, Rogers 0-2 0-0 0. Totals 30-64 33-43 97. Detroit 15 29 25 25 — 94 Charlotte 23 22 21 31 — 97 3-Point Goals — Detroit 10-21 (Villanueva 4-6, Gordon 2-4, Daye 2-4, Stuckey 1-1, Prince 1-3, Bynum 0-1, Summers 0-2), Charlotte 4-12 (Jackson 1-2, Diaw 1-2, Collins 12, Augustin 1-4, Henderson 0-1, G.Wallace 0-1). Fouled Out — None. Rebounds — Detroit 53 (Monroe 8), Charlotte 49 (Thomas 7). Assists — Detroit 20 (Bynum, Stuckey 5), Charlotte 23 (Augustin 8). Total Fouls — Detroit 30, Charlotte 21. Technicals — Detroit defensive three second 2, Diaw, G.Wallace. A — 6,847 (18,000).
NHL Schedule EASTERN CONFERENCE Atlantic Division GP W L OT Pts GF N.Y. Islanders 5 2 1 2 6 18 Pittsburgh 6 3 3 0 6 18 Philadelphia 5 2 2 1 5 11 N.Y. Rangers 3 1 1 1 3 13 New Jersey 6 1 4 1 3 10 Northeast Division GP W L OT Pts GF Toronto 4 4 0 0 8 16 Montreal 5 3 1 1 7 14 3 2 1 0 4 9 Boston Ottawa 5 1 3 1 3 10 Buffalo 6 1 4 1 3 12 Southeast Division GP W L OT Pts GF Washington 5 4 1 0 8 17 Tampa Bay 4 3 1 0 6 12 Carolina 3 2 1 0 4 8 Atlanta 4 2 2 0 4 13 Florida 4 2 2 0 4 12 WESTERN CONFERENCE Central Division GP W L OT Pts GF Nashville 4 3 0 1 7 13 Detroit 5 3 1 1 7 14 Chicago 6 3 2 1 7 20 St. Louis 4 2 1 1 5 12 Columbus 4 2 2 0 4 10 Northwest Division GP W L OT Pts GF Colorado 5 3 2 0 6 16 Edmonton 3 2 1 0 4 9 Minnesota 4 1 2 1 3 10 Vancouver 4 1 2 1 3 7 Calgary 3 1 2 0 2 3 Pacific Division GP W L OT Pts GF Dallas 4 4 0 0 8 16 Los Angeles 4 3 1 0 6 10 San Jose 2 1 0 1 3 5 Phoenix 3 1 1 1 3 6 Anaheim 5 1 3 1 3 10 Saturday’s Games Dallas 3, St. Louis 2, SO Pittsburgh 5, Philadelphia 1 Montreal 4, Ottawa 3 Boston 4, New Jersey 1 N.Y. Islanders 5, Colorado 2 Florida 6, Tampa Bay 0 Washington 3, Nashville 2, OT Columbus 3, Minnesota 2 Chicago 4, Buffalo 3 Detroit 2, Phoenix 1, OT Edmonton at Calgary, late Atlanta at San Jose, late Sunday’s Games Phoenix at Anaheim, 8 p.m. Carolina at Vancouver, 9 p.m. Sunday’s Games Phoenix at Anaheim, 8 p.m. Carolina at Vancouver, 9 p.m. Monday’s Games N.Y. Islanders at Toronto, 7 p.m. Colorado at N.Y. Rangers, 7 p.m. Ottawa at Pittsburgh, 7 p.m. Dallas at Tampa Bay, 7:30 p.m. St. Louis at Chicago, 8:30 p.m.
GA 16 14 14 13 21 GA 9 13 6 16 18 GA 11 14 7 14 5 GA 9 12 18 9 12 GA 18 6 11 11 8 GA 10 6 5 7 21
From staff reports
Catawba’s men’s soccer team lost to Lincoln Memorial 1-0 at Frock Field on Saturday. Lucas Pereira scored just before the half for the Railsplitters. Catawba (7-6-1, 1-5) had nine shots in the second half but couldn’t break through. Keeper Luke McCarthy made seven stops for the Indians in a physical match. Erinn Wescoat’s goal with five seconds remaining lifted Catawba’s women’s soccer team to a 3-2 win against Lincoln Memorial at Frock Field on Saturday. Juliana Conte’s cross led to the winning goal. Catawba (6-5-2, 2-3-1 SAC) ended a four-game losing streak. Wescoat followed up a shot by Conte and scored for a 2-1 lead in the final five minutes. Athena Bless scored the other Catawba goal in the 29th minute. Lindsay Webster made seven saves. Pfeiffer’s women’s soccer team rolled over Converse 3-0 at Lefko Field on Saturday. Pfeiffer (8-5, 5-2 Conference Carolinas) honored six seniors.
College volleyball
the fourth time in five races. He was second overall with a time of Catawba’s volleyball team was 26:45 in an 8K race. swept 25-21, 27-25, 25-18 by Carson-Newman in Jefferson City, 8th-grade football Tenn., on Friday. Corriher-Lipe beat Southeast Kaitlyn Whitmer had 17 kills 30-8 on Wednesday. for Catawba (9-11, 4-8). On Saturday, Catawba ralQwan Rhyne rushed for touchlied to beat Lincoln Memorial 16- downs of 11, 26 and 54 yards to 25, 25-17, 15-25, 25-20, 15-10. lead the Yellow Jackets. Shay Meeks led Catawba with A-Rod Kennerly scored on a 514 kills. Libero Jenny Young had yard run and passed to Burke 26 digs. Fulcher for a two-point conver Livingstone fell to North sion. Jose Sanchez kicked a PAT. Greenville 25-12, 25-13, 25-16 in James Littlejohn had tackle in Tigerville, S.C., on Friday. the end zone for a safety. The Lashaundra Ferguson led the Corriher-Lipe defense was led by Blue Bears with 14 kills Fresh- Jon Fleming, Alex Parham and man Janell John recorded two Grex Urey. Urey had a fumble solo blocks. recovery.
Cross country
Junior Bobcats
Both Catawba cross country teams posted sixth-place finishes at the Royal Cross Country Challenge at Charlotte’s McAlpine Park on Friday. Catawba’s Olivia Myers ran a career-best 20:08 in the 5K women’s race and was ninth overall. Catawba’s Christian Crifasi topped Division II runners for
Salisbury Park and Recreation Junior Bobcats boys basketball registration for ages 7-15 is under way at Hall Gym, 1400 West Bank St., through Oct. 22. Practices begin the first of November and games the first of December. Contact Larry Jones (ljone@salisburync.gov) or C.M. Yates (cyate@salisburync.gov) at (704) 638-5289.
Purdue standout will miss season Associated Press WEST LAFAYETTE, Ind. — Robbie Hummel is injured again. Purdue announced that the versatile forward will miss the upcoming season after tearing the anterior cruciate ligament in his right knee in practice on Saturday. It’s the same knee he injured Feb. 24 against Minnesota, knocking him out for the remainder of last season. He had surgery in March and expected to be ready for his senior season. It’s a major a blow for a team many experts predicted to be a Final Four contender. “This is obviously disappointing for Robbie, as well as our team, since he worked so hard to return from the tear he suffered in February,” coach Matt Painter said. “As he begins his rehab and recovery, we’ll persevere together and provide Robbie with all the support possible. I have no doubt he’ll continue to play a pivotal role this season as a leader of our team.” Hummel was second on the team last season with 15.7 points and 6.9 rebounds a game. The Boilermakers were ranked No. 3 in the nation when he was hurt, then stumbled at first without him, before recovering to reach the round of 16 in the NCAA tournament. Hummel also missed significant time his sophomore year with a back injury. “Rob does something for us offensively and defensively that balances our team,” Painter said in February 2009, while Hummel was recovering from his injury. “He’s a facilitator. He moves the basketball, he makes the extra pass, he gets the ball inside. “Some of the basic things that don’t show up in a box score is what we miss.” NHL
MCMURRAY FROM 1B
second straight to improve to 33. Bruins 4, Devils 1 NEWARK, N.J. — Rookie Jordan Caron sparked Boston’s four-goal second period with his first NHL tally, and Tim Thomas made 31 saves in a win over New Jersey. Michael Ryder, Shawn Thornton and Milan Lucic also scored for the Bruins, who played their first game since opening the season by splitting two games in the Czech Republic against the Phoenix Coyotes. Islanders 5, Avalanche 2 UNIONDALE, N.Y. — Milan Jurcina scored twice and Dwayne Roloson stopped 28 shots as the New York Islanders beat Colorado. Josh Bailey, Michael Grabner and John Tavares also scored for the Islanders, who won their second straight at home. Panthers 6, Lightning 0 SUNRISE, Fla. — David Booth had two goals for Florida, which jumped out to a big lead and handed Tampa Bay its first loss of the season. Cory Stillman, Booth, Steven Reinprecht, and Dennis Wideman each scored in the first period. Booth added his second, and Rostislav Olesz also scored in the third. Canadiens 4, Senators 3 MONTREAL — Tomas Plekanec scored the tiebreaking goal with 3:59 remaining to give Montreal a win over Ottawa., OT NASHVILLE, Tenn. — Brooks Laich tipped in Alex Ovechkin’s slap shot at 1:44 of overtime, finishing Washington’s rally to a win against Nashville. The Capitals trailed 2-0 heading into the third period, but Alexander Semin and Tomas Fleischman scored to force overtime.
Blue Jackets 3, Wild 2 ST. PAUL, Minn. — R.J. Umberger scored a short-handed goal with just more than nine minutes to play and Mathieu Garon made 21 saves as Columbus beat Minnesota. Blackhawks 4, Sabres 3 CHICAGO — Patrick Sharp scored his second goal of the game with 7:08 left in the third, powering Chicago over Buffalo. Stars 3, Blues 2, SO DALLAS — Brad Richards, Loui Eriksson and Mike Ribeiro scored in Dallas’ perfect shootout and lifted the Stars to a come-from-behind victory over St. Louis. Red Wings 2, Coyotes 1, OT GLENDALE, Ariz. — Niklas Kronwall scored a power-play goal 4:44 into a wild overtime to give Detroit a win over Phoenix in the Coyotes’ home opener. NBA COLUMBIA, S.C. — Charlotte coach Larry Brown wasn’t too pleased that the Bobcats’ game Saturday night got close in the end, but if it was going to happen, at least they got to work on late-game situations. D.J. Augustin and Derrick Brown combined for 10 of 12 free throws in the final 1:03 to help Charlotte to its first win of the exhibition season, a 97-94 victory over the Detroit Pistons (2-4). PGA SAN MARTIN, Calif. — Ro. LPGA DANVILLE, Calif. — Michele Redman holed out from 126 yards for an eagle on the par-4 18th holefor a 4under 68 and a share of the third-round lead in the CVS/pharmacy LPGA Challenge with Spain’s Beatriz Recari and South Korea’s Ilhee Lee.
was a decent day. Johnson, who spun early and dropped to 37th, completed an improbable comeback in histime.
SALISBURY POST
SUNDAY, OCTOBER 17, 2010 • 3B
DIVISION II FOOTBALL
Blue Bears shut out in Winston Staff report
Livingstone’s football t e a m 58 was domWSSU Livingstone 0 inated on the road by Winston-Salem State. The Rams, bouncing back from a loss to St. Augustine’s, beat the Blue Bears in every statistical category and romped 58-0. Tyheim Pitt played well for Livingstone’s defense, recording eight tackles, including three for loss. Devonta Harmon also had eight stops. Kenneth White PITT and Aaron Williams made six tackles each. Livingstone quarterback Levon Stanley was sacked six times and intercepted once. He threw for 80 yards. The Blue Bears never their got ground game untracked, settling fora meager 29 yards in 33 attempts. STANLEY Stanley was the leading rusher with 20 net yards. The Rams (7-1, 5-1) rushed for 292 yards and passed for 182 against a Livingstone defense that took the field without standouts Bryan Aycoth and Shawntez Jones. Nicholas Cooper rushed 19 times for 175 yards to lead the Rams, while Kameron Smith threw two touchdown passes to Jahuann Butler. Akeem Ward produced two sacks. Winston-Salem State took advantage of a short field to score on its second possession. Smith’s 33-yard TD pass to Butler opened the scoring with 7:44 to play in the first quarter, and Landon Thayer kicked the first of his seven PATs. Cooper’s 23-yard scoring burst made it 14-0 late in the first quarter of the CIAA contest. Livingstone’s first possession in the second quarter may have been the low point of a difficult season. The Blue Bears (0-8, 0-4) started on their 45 but wound up punting out of their end zone. A running play with Terril Gourdine carrying lost 6 yards on first down. Stanley was sacked for a loss of 9 on second down. Jamel Moore replaced Stanley and was sacked for a loss of 25 on third down. On fourth-and-50, Logan Haynes punted, and WSSU’s promptly Dominique Fitzgerald returned the kick 35 yards for a touchdown and a 21-0 lead. Then the Rams scored 17 points in the last four minutes of the first half to put the game away. Butler reeled in a 53-yard scoring pass from Smith, Cooper broke a 54-yard run, and Thayer booted a 45-yard field goal on the last snap of the half to make it 38-0. WSSU tacked on three TDs in the second half. Livingstone is at Fayetteville State next Saturday.
WssU 58, Livingstone 0 First downs Rushing yardage Passing yardage Passing (C-A-I) Punting Fumbles-Lost Penalties Livingstone W-salem st.
LC Ws 7 21 29 292 80 182 8-20-1 10-16-0 9-37.4 3-47.7 2-2 1-0 8-70 5-48
0 0 0 14 24 13
0 — 0 7 — 58
WS — Butler 33 pass from Smith (Thayer kick), 7:44, 1st WS — Cooper 23 run (Thayer kick), 2:47, 1st WS — Fitzgerald 35 punt return (Thayer kick), 13:53, 2nd WS — Butler 53 pass from Smith (Thayer kick), 4:02, 2nd WS — Cooper 54 run (Thayer kick), 2:30, 2nd WS — Thayer 45 FG, 0:00, 2nd WS — Cooper 5 run (kick failed), 9:22, 3rd WS — Spriggs 6 run (Thayer kick), 0:16, 3rd WS — Kinzer 20 pass from Hawkins (Thayer kick), 4:31, 4th individual statistics Rushing — LC: Stanly 12-20; Haynes 2-16; Gourdine 12-12; Mishoe 2-8; WS: Cooper 19-175; Spriggs 7-40; Thomas 7-36; Hickman 5-34. Passing — LC: Stanly 8-20-1, 80; Moore 0-0-0, 0. WS: Smith 7-10-0, 132; Hawkins 3-5-0, 50. Pass receiving — LC: McFadden 2-24; Harris 2-20; Holland 2-10; Harrison 1-14. WS: Butler 2-86; Fitzgerald 2-28; Akinbiyi 1-23; Kinzer 1-20.
WAYne hinshAW/SALISBURY POST
Catawba coach Chip Hester makes a point while being surrounded by quarterbacks Chance Green (left), Daniel Griffith (5) and Jacob Charest (12).
INDIANS FROM 1B Catawba had reason to believe it had finally roadblocked a methodical, clockburning drive by the Eagles, who had started on their 8 with 12:05 left. A diving tackle by Rolle had wrecked a third-down play on the edge for a 3-yard loss. Carson-Newman lined up to punt facing fourth-and-6 at the Catawba 37, but coach Ken Sparks is an unusually crafty 63-year-old. Back Jamie Bennett took the snap. He rumbled 12 yards to move the chains, and the clock rolled along with the Eagles. When Brandon Baker capped the 92-yard drive with a 4-yard TD run, it was 28-16 with only 2:39 remaining. “Carson-Newman’s a great football team, and when you give them an inch, they’ll take a mile,” Hester said. The game got out of hand when Jaycob Coleman and Oliver Davis returned picks for TDs in the final 79 seconds. “On that faked punt, I was just very focused on them punting,” Rolle said. “Just a good call by them.” Catawba specials teams had covered kickoffs like demons, but the Indians were victims of trickery on one perfectly executed play. “We got caught completely off-guard,” special-teams ace Aaron Cauble said. “Their outside guy had been washing out all day, and all of a sudden, he’s blocking down. That’s when I start thinking, ‘Uh, oh. Something’s up.’ ” It was Sparks’ 291st career win, tops in Division II. He’s won 27 times against Catawba. The loss was costly as the Indians (4-2, 2-1 SAC) fell into a four-way tie for second place. Mars Hill owns the only unbeaten record in a balanced league where 5-2 might earn
WAYne hinshAW/SALISBURY POST
Catawba receiver Brandon Bunn (7) fights for extra yardage against Oliver Davis. a tie for first. “This was the game I wanted to win most, so it’s disappointing,” Cauble said. “But we’re not out of anything.” Catawba couldn’t have started better, scoring on its first two possessions with crisp drives of 63 and 55 yards. Patrick Dennis threw a 13-yard pass to Gerron Bryant to finish one drive. Josh Wright, who had 105 rushing yards, crashed into the box from the 2 for the second TD. Thomas Trexler’s second PAT failed, but Catawba led 13-7 early in the second quarter. “We were focused on just one thing — winning this ballgame,” Carson-Newman quarterback Doug Belk said. “We had a very hard loss to Wingate last week, and Catawba came out very fast and strong at us today. But I was able to look at the defense and check to good plays. We had long drives. That let our defense get some rest, and it had to wear them down some.” Down six, Carson-Newman
was in desperation mode on its next possession, going for it on fourth-and-1 from its 24. The gamble paid off when Nate Inman ran for the first down. That conversion was critical in a game-changing drive that produced no points but lasted 20 plays and deleted nine minutes from the Shuford Stadium scoreboard. The Indians finally stopped the Eagles at the Catawba 39 when Julian Hartsell put a hard rush on Belk on a thirddown pass attempt. Carson-Newman punted, but Catawba went three-andout with three pass plays. A weary defense had to trudge right back on the field. This time, Inman popped a 60-yard run up the gut for a touchdown. After Matt Gossett’s PAT, the Eagles had their first lead at 14-13 with 2:29 left in the half. Catawba wanted to push into field-goal range prior to the half, but Dennis was sacked on second down. Looking for Brandon Bunn on third
down, Dennis was intercepted by Tarvin Jones. He snared a tipped ball and returned it Carson-newman 42, Catawba 16 to the Catawba 37. C-n CAT “They adjusted after our First downs 19 17 good start,” Wright said. Rushing yardage 316 130 42 165 “They started bringing a lot Passing yardage (C-A-I) 2-7-0 17-26-4 more pressure and bringing it Passing Punting 4-43.0 2-34.0 from some different places.” Fumbles-Lost 0-0 2-0 10-76 2-14 Carson-Newman fooled the Penalties Indians after the pick. Baker Carson-newman 7 14 0 21 — 42 7 6 0 3 — 16 swept toward the Catawba Catawba sideline but pulled up and CAT — Bryant 13 pass from Dennis (Trexler threw downfield to wide-open kick), 6:59, 1st CN — Belk 11 run (Gossett kick), 2:00, 1st Jason Brown for a 32-yard CAT — Wright 2 run (kick failed), 12:25, 2nd CN — Inman 60 run (Gossett kick), 2:29, score with 1:06 left in the half. The stunned Indians went to 2nd CN — Brown 32 pass from Baker (Gossett the locker room trailing 21-13. kick), 1:06, 2nd CAT — Trexler 38 FG, 12:11, 4th “We made them dig down CN — Baker 4 run (Gossett kick), 2:39, 4th pretty deep in their playbook CN — Coleman 62 interception return today, but they had great ex- (Gossett kick), 1:19, 4th CN — Davis 37 interception return ecution,” Hester said. (Gossett kick), 0:27, 4th individual statistics One of Carson-Newman’s — CN: Inman 26-162; Baker five sacks stopped Catawba’s 1 4Rushing -74; Belk 10-57; Bennett 3-17. first possession of the second C AT: Wright 19-105; Terwilliger 2-13; Rainey 1-11; Charest 1-(minus 4); Griffith half. Wright’s running 1-(minus 6); Gaither 1-(minus 7); Dennis sparked a nice drive on the 4-(minus 19); Team 1-(minus 16) Passing — CN: Baker 1-1-0, 32; Belk next possession. 1-6-0, 10. CAT: Dennis 17-25-3, 165; On second-and-5 at the Car- Griffith 0-1-1, 0. Pass receiving — CN: Brown 2-42. son-Newman 12, Dennis fired Terwilliger 4-27; Peoples 3-41; Bunn for the end zone — Bunn and CAT: 2-34; Downs 2-23; Morman 2-12; Wright 2-11; Bryant 1-13; Charest 1-4. Eric Morman were both in the
SHAW FROM 1B And rightly so. Catawba entered the game unbeaten in the conference and tied for first place. This was going to be one of those statement games, a chance to alter the SAC landscape and trumpet its return to prominence. Instead, Carson-Newman scored three touchdowns in the final three minutes and muffled the Indians 4216, possibly car-jacking their postseason hopes in the process. “It’s Carson-Newman, man,” senior left guard Zane Gibson said. “You circle this game every year. I love and hate playing them. What’s disappointing is that it was our game to win. We had a chance. It hurts even more knowing we could have put ourselves in the driver’s seat and didn’t. I guess it’s all besides the point now.” Perhaps. But as statement games go, this one produced a number of questions. Where was the combatready Catawba defense that had yielded only 81.4 yards per game and carried the Indians to a 4-1 start? Not at Shuford Stadium, where Carson-Newman accumulated 310 yards on the ground. And where was the ferocious, sure-handed tackling that hadn’t allowed an opposing runner to reach 100 yards before slippery Nate Inman ripped off 162 yesterday?
WAYne hinshAW/SALISBURY POST
Doug Belk pitches away from Alex Hartsell (96) and Corey Steward (93). Finally, who was that wearing No. 10 for Catawba and what did he do with the real Patrick Dennis? Half an hour after it ended, coach Chip Hester was reaching for answers but, to his credit, not excuses. “Part of it was Carson-Newman being Carson-Newman,” he said. “It’s what they do — and they’re good at it. When it’s all said and done, you’ve got to find ways to get your defense off the field. Offensively, you’ve got to keep drives going and can’t go three-and-out. In games like this, three-and-outs are amplified because you get fewer possessions.” Just the same, Catawba played well enough to trail only 21-16 early
vicinity — and Jones came up with another interception. “I wanted to be aggressive with our play calls, and it backfired,” Hester said. “We were running the ball so well, but we wanted to mix it up. Maybe we should’ve kept running it.” Early in the fourth quarter, Catawba had first-and-10 at the Carson-Newman 26 when an errant snap resulted in a disastrous 23-yard loss. A pair of passes to Chris Peoples moved the Indians back into field-goal range, and Trexler’s 38-yard boot made it 21-16 with 12:11 left. Nate Charest’s hustling tackle on the kickoff, plus a penalty, forced the Eagles to start at their 8. Eighteen plays later, one the huge faked punt, Baker was in the Catawba end zone. “It’s hard standing there and watching a running team like that make a long drive and keep the ball,” Bryant said.
in the fourth quarter. That’s when Carson-Newman initiated a dehydrating 18-play, 92-yard touchdown drive that melted nine minutes, 25 seconds off the stadium clock — leaving the Indians worn and battered. “You can’t blame anybody,” linebacker Cory Johnson insisted. “Sometimes that’s how the football rolls. The coaching staff had us prepared. We just didn’t execute on that drive.” Two decisive plays come to mind. Carson-Newman was awarded a first down in Catawba territory following a defensive holding call on cornerback Jumal Rolle with 7:49 to go. “As far as I could see, it wasn’t
holding at all,” defensive tackle Julian Hartsell said. “The guy tripped over his own feet. But, you can’t argue with the refs.” Only 5:30 remained when the guests caught Catawba off-guard and made the play of the game. On fourth-and-6 from the 37, the Eagles faked a punt and watched Anson County native Jamie Bennett skitter 12 yards for another first down. “That’s the play that decided the ballgame,” Hester said. “The turning point. Our guys were actually looking for it, and they still executed the play. It’s one of those things that if you catch that little crease, you’re running downhill.” Six plays later Carson-Newman was ahead 28-16. It padded its lead with a pair of interception returns for touchdowns in the final 1:19. “They should never have scored that many points,” Hartsell said. “We’re better than that.” The cold, hard, Sunday-morning truth is that a Catawba victory would have been sweeter than a glass of grandma’s iced tea. It’s pregame strategy didn’t entail a lategame collapse. “It’s disappointing,” Weedon said. “But it’s in the past. We’re moving on, and we’re still in the race.” He’s right. The Indians remain in contention for the conference title — dents and all — with a contest at Newberry looming next Saturday. “It’s a big game,” Hartsell said, “because it’s the next one.”
4B • SUNDAY, OCTOBER 17, 2010
Regional Standings SAC SAC Overall Mars Hill 3-0 5-2 2-1 4-2 catawba Newberry 2-1 3-3 Wingate 2-1 4-2 2-1 4-3 carson-Newman Lenoir-rhyne 1-2 4-3 tusculum 0-3 4-3 0-3 3-4 Brevard Saturday’s results Mars Hill 48, Newberry 36 Wingate 33, tusculum 27 carson-Newman 42, catawba 16 Lenoir-rhyne 24, Brevard 8 Next Saturday’s games Mars Hill at carson-Newman, 1 p.m. Wingate at Brevard, 1 p.m. tusculum at Lenoir-rhyne, 2:30 p.m. catawba at Newberry, 4 p.m.
CIAA Northern CIAA Overall Bowie state 4-1 4-4 3-1 5-2 Virginia state chowan 3-1 3-4 elizabeth city state 3-2 4-3 2-3 2-5 Virginia Union st. paul’s 1-3 1-6 Lincoln 0-4 1-6 CIAA Overall Southern st. augustine’s 4-0 6-1 shaw 4-0 5-2 7-1 Winston-salem state 5-1 Fayetteville state 1-3 2-5 Johnson c. smith 0-4 1-6 0-4 0-8 Livingstone Saturday’s results Winston-salem state 58, Livingstone 0 chowan 31, st. paul’s 20 Virginia Union 44, J.c. smith 21 Bowie state 24, Lincoln 18 st. augustine’s 21, central state 14 shaw 34, Fayetteville state 27 Next Saturday’s games st. paul’s at Virginia Union, 1 p.m. elizabeth city state at Bowie state, 1 p.m. st. augustine’s at J.c. smith, 1 p.m. UNc pembroke at Winston-salem st., 1:30 Lincoln at Virginia state, 1:30 p.m. Livingstone at Fayetteville state, 2 p.m. chowan at shaw, 4 p.m.
Southern SC Overall 4-0 6-0 appalachian state Wofford 3-0 5-1 chattanooga 3-1 3-2 Furman 2-1 4-2 1-2 3-3 Georgia southern elon 1-2 2-4 samford 1-3 3-4 1-3 2-5 Western carolina the citadel 0-4 2-5 Saturday’s results Wofford 45, Western carolina 14 Furman 27, samford 10 appalachian state 39, the citadel 10 chattanooga 35, Georgia southern 27 Next Saturday’s games Georgia southern at the citadel, 1 p.m. Wofford at elon, 1:30 p.m. chattanooga at Furman, 2 p.m. appalachian st. at Western carolina, 3 p.m.
ACC Atlantic ACC Overall 4-0 6-1 Florida state N.c. state 2-1 5-2 Maryland 1-1 4-2 1-2 3-3 clemson Wake Forest 1-3 2-5 Boston college 0-3 2-4 ACC Overall Coastal Virginia tech 3-0 5-2 Georgia tech 3-1 5-2 2-1 4-2 Miami North carolina 2-1 4-2 Virginia 0-3 2-4 0-3 1-5 duke Saturday’s results east carolina 33, N.c. state 27, ot Florida state 24, Boston college 19 clemson 31, Maryland 7 Miami 28, duke 13 Georgia tech 42, Mid. tennessee 14 Virginia tech 52, Wake Forest 21 North carolina 44, Virginia 10 Next Saturday’s games duke at Virginia tech, Noon Maryland at Boston college, 1 p.m. Georgia tech at clemson, 3:30 p.m. eastern Michigan at Virginia, 6 p.m. North carolina at Miami, 7:30 p.m.
SEC Eastern SEC Overall south carolina 2-2 4-2 2-3 4-3 Florida Georgia 2-3 3-4 Vanderbilt 1-2 2-4 1-3 4-3 Kentucky tennessee 0-3 2-4 Western SEC Overall 4-0 7-0 auburn LsU 4-0 7-0 alabama 3-1 6-1 2-2 5-2 Mississippi state arkansas 1-2 4-2 Mississippi 1-2 3-3 Saturday’s results Georgia 34, Vanderbilt 0 auburn 65, arkansas 43 Kentucky 31, south carolina 28 LsU 32, McNeese state 10 Mississippi state 10, Florida 7 alabama 23, ole Miss 10 Next Saturday’s games Mississippi at arkansas, 12:20 p.m. LsU at auburn, 3:30 p.m. alabama at tennessee, 7 p.m. UaB at Mississippi state, 7 p.m. south carolina at Vanderbilt, 7 p.m. Georgia at Kentucky, 7:30 p.m.
Conference USA Eastern C-USA Overall 3-0 4-2 east carolina UcF 2-0 4-2 southern Miss 2-1 5-2 1-2 2-4 UaB Marshall 0-2 1-5 Memphis 0-4 1-6 C-USA Overall Western sMU 3-0 4-3 Houston 2-1 3-3 2-2 5-2 Utep tulsa 2-2 4-3 rice 1-2 2-5 tulane 0-2 2-4 Saturday’s results southern Miss 41, Memphis 19 east carolina 33, N.c. state 27, ot UaB 21, Utep 6 rice 34, Houston 31 Navy 28, sMU 21 tulsa 52, tulane 24 Next Saturday’s games Houston at sMU, 3:30 p.m. rice at UcF, 3:30 p.m. Marshall at east carolina, 4:15 p.m. UaB at Mississippi state, 7 p.m. tulane at Utep, 9:05 p.m.
National Other scores EAST Brown 17, princeton 13 Bucknell 24, Georgetown, d.c. 21 colgate 44, cornell 3 dartmouth 27, Holy cross 19 delaware 24, rhode island 17 duquesne 37, sacred Heart 17 Lafayette 28, stony Brook 21 Lehigh 21, Harvard 19 penn 27, columbia 13 pittsburgh 45, syracuse 14 richmond 11, Massachusetts 10 rutgers 23, army 20, ot san diego 14, Marist 10 temple 28, Bowling Green 27 Villanova 48, Maine 18 Yale 7, Fordham 6 SOUTH Bethune-cookman 14, s. carolina st. 0 coastal carolina 35, presbyterian 7 davidson 17, Morehead st. 10 delaware st. 31, N. carolina a&t 26 drake 14, campbell 12 Ferrum 28, Greensboro 20 Florida a&M 31, savannah st. 0 Gardner-Webb 35, chas. southern 25 Georgia st. 20, N.c. central 17, ot Grambling st. 38, alcorn st. 28 Hampton 7, Norfolk st. 6 Jackson st. 49, southern U. 45 Jacksonville st. 24, tennessee st. 0 Liberty 41, VMi 7
Louisiana tech 48, idaho 35 Louisiana-Monroe 35, W. Kentucky 30 troy 31, Louisiana-Lafayette 24 MIDWEST dayton 33, Butler 13 e. Michigan 41, Ball st. 38, ot illinois st. 34, N. dakota st. 24 indiana 36, arkansas st. 34 indiana st. 38, Missouri st. 35, ot iowa 38, Michigan 28 Jacksonville 86, Valparaiso 7 Miami (ohio) 27, cent. Michigan 20 Michigan st. 26, illinois 6 N. illinois 45, Buffalo 14 N. iowa 19, south dakota 14 Notre dame 44, W. Michigan 20 ohio 38, akron 10 purdue 28, Minnesota 17 s. dakota st. 31, s. illinois 10 texas 20, Nebraska 13 W. illinois 40, Youngstown st. 38 Wisconsin 31, ohio st. 18 SOUTHWEST ark.-pine Bluff 21, alabama a&M 14 Fla. international 34, North texas 10 Missouri 30, texas a&M 9 Nicholls st. 47, texas st. 45, 4ot oklahoma 52, iowa st. 0 oklahoma st. 34, texas tech 17 prairie View 45, Lincoln, Mo. 12 sam Houston st. 57, se Louisiana 7 south alabama 26, Lamar 0 stephen F.austin 30, cent. arkansas 7 tcU 31, BYU 3 FAR WEST arizona 24, Washington st. 7 Baylor 31, colorado 25 Boise st. 48, san Jose st. 0 colorado st. 43, UNLV 10 e. Washington 35, N. colorado 28 Montana 23, portland st. 21 N. arizona 34, Montana st. 7 san diego st. 27, air Force 25 southern cal 48, california 14 Utah 30, Wyoming 6 Weber st. 16, idaho st. 13
Summaries ECU 33, N.C. State 27 (OT) N.C. State East Carolina
0 21 0 6 0 — 27 21 3 0 3 6 — 33 First Quarter ecU—J.Williams 5 run (Barbour kick), 11:32. ecU—Lewis 11 pass from d.davis (Barbour kick), 3:49. ecU—J.Jones 3 pass from d.davis (Barbour kick), :05. Second Quarter Ncst—Graham 49 pass from r.Wilson (czajkowski kick), 13:09. Ncst—r.Wilson 2 run (czajkowski kick), 9:07. ecU—FG Barbour 35, 6:25. Ncst—Haynes 1 run (czajkowski kick), 1:44. Fourth Quarter Ncst—FG czajkowski 22, 11:47. Ncst—FG czajkowski 37, 2:59. ecU—FG Barbour 31, 1:04. Overtime ecU—d.davis 1 run (kick failed). a—50,410. NCSt ECU 26 24 First downs rushes-yards 39-154 33-120 passing 322 376 26-52-3 37-53-0 comp-att-int return Yards 0 76 punts-avg. 6-40.7 5-42.8 1-1 4-4 Fumbles-Lost penalties-Yards 6-49 10-90 time of possession 32:31 27:29 INDIVIDUAL STATISTICS rUsHiNG—N.c. state, Greene 16-75, r.Wilson 10-37, Haynes 10-36, Washington 3-6. east carolina, ruffin 15-74, J.Williams 11-31, d.davis 5-19, Harris 1-(minus 1), team 1-(minus 3). passiNG—N.c. state, r.Wilson 26-52-3322. east carolina, d.davis 37-53-0-376. receiViNG—N.c. state, spencer 6-98, Williams 5-44, Haynes 4-33, Bryan 3-29, Graham 2-77, t.Gentry 2-17, payton 1-12, davis 1-5, Greene 1-5, J.smith 1-2. east carolina, Harris 9-91, Lewis 8-87, J.Williams 6-44, Bowman 5-93, ruffin 3-14, Bodenheimer 2-29, arrington 2-11, price 1-4, J.Jones 1-3.
Miami 28, Duke 13 Miami Duke
0 14 14 0 — 28 3 0 7 3 — 13 First Quarter duke—FG snyderwine 25, 14:07. Second Quarter Mia—Hankerson 14 pass from J.Harris (Bosher kick), 14:53. Mia — J.Harris 13 run (Bosher kick), 3:58. Third Quarter Mia—regis 22 interception return (Bosher kick), 14:11. duke — connette 1 run (snyderwine kick), 9:16. Mia — Berry 1 run (Bosher kick), 5:28. Fourth Quarter duke—FG snyderwine 43, 6:14. Mia Duke 22 22 First downs rushes-yards 42-224 41-105 passing 224 187 17-34-0 22-44-5 comp-att-int return Yards 22 (-2) punts-avg. 5-42.2 7-35.7 3-2 4-2 Fumbles-Lost penalties-Yards 12-90 4-25 time of possession 28:04 31:56 INDIVIDUAL STATISTICS rUsHiNG—Miami, Berry 25-111, James 8-84, J.Harris 3-19, cooper 2-12, armstrong 1-0, team 3-(minus 2). duke, Hollingsworth 10-69, d.scott 7-34, snead 7-28, thompson 1-1, connette 11-(minus 2), renfree 5-(minus 25). passiNG — Miami, J.Harris 17-34-0-224. duke, renfree 18-38-5-157, connette 4-6-030. receiViNG — Miami, Hankerson 6-80, Benjamin 3-67, Byrd 2-33, cleveland 2-20, Gordon 1-9, a.Johnson 1-9, p.Hill 1-5, James 1-1. duke, Kelly 6-60, Varner 4-50, Vernon 3-33, Helfet 3-19, d.scott 2-16, t.Watkins 28, Hollingsworth 1-5, B.King 1-(minus 4).
Clemson 31, Maryland 7 0 7 0 0— 7 3 14 7 7 — 31 First Quarter clem—FG catanzaro 42, 13:10. Second Quarter Md—o’Brien 4 pass from scott (Baltz kick), 11:33. clem — ellington 87 kickoff return (catanzaro kick), 11:21. clem — Harper 1 run (catanzaro kick), :32. Third Quarter clem—ellington 1 run (catanzaro kick), 11:02. Fourth Quarter clem—Brewer 61 interception return (catanzaro kick), 5:31. INDIVIDUAL LEADERS rUsHiNG—Maryland, Meggett 8-29. clemson, K.parker 10-41, ellington 16-41, Harper 8-8. passiNG — Maryland, o’Brien 24-45-3302, scott 1-1-0-4, J.robinson 0-1-0-0. clemson, K.parker 7-20-0-106, Boyd 1-1-0-13. receiViNG — Maryland, cannon 7-67, Furstenburg 5-98, to.smith 4-55, Yeatman 3-41. clemson, McNeal 2-12, M.Jones 2-10, Harper 1-40. Maryland Clemson
Va. Tech 52, Wake 21 Wake Forest Virginia Tech
7 7 7 0 — 21 21 28 3 0 — 52 First Quarter Vt—thomas 2 pass from t.taylor (Hazley kick), 13:29. Vt—d.evans 5 run (Hazley kick), 7:36. Wake—J.Harris 33 run (Newman kick), 6:17. Vt—coale 25 pass from t.taylor (Hazley kick), 3:02. Second Quarter Vt—d.evans 8 run (Hazley kick), 12:34. Wake—J.Harris 87 run (Newman kick), 12:16. Vt—t.taylor 1 run (Hazley kick), 8:49. Vt—d.evans 1 run (Hazley kick), 3:36. Vt—Boykin 10 pass from t.taylor (Hazley kick), :52. Third Quarter Wake—Givens 78 pass from price (Newman kick), 11:35. Vt—FG Hazley 33, 4:52. a—66,233. Wake VT First downs 9 35 rushes-yards 25-254 54-291 passing 92 314 comp-att-int 4-17-0 22-35-0 return Yards 0 55 punts-avg. 8-35.3 2-47.5 Fumbles-Lost 0-0 3-0 penalties-Yards 8-75 4-35 time of possession 18:34 41:26 INDIVIDUAL STATISTICS rUsHiNG—Wake Forest, J.Harris 20-241, campanaro 1-12, adams 2-2, price 2-(minus 1). Virginia tech, d.Wilson 15-105, d.evans 12-52, oglesby 4-44, Gregory 7-34, t.taylor 7-31, thomas 3-15, M.davis 1-12, roberts
SALISBURY POST
COLLEGE FOOTBALL 2-5, team 3-(minus 7). passiNG—Wake Forest, price 3-16-0-92, s.Jones 1-1-0-0. Virginia tech, t.taylor 19-27-0-292, thomas 3-8-0-22. receiViNG—Wake Forest, Givens 2-84, Bohanon 1-8, Brown 1-0. Virginia tech, Boykin 8-62, roberts 6-134, coale 5-103, dunn 1-9, Boyce 1-4, thomas 1-2.
UNC 44, Virginia 10 North Carolina 17 10 10 7 — 44 3 7 0 0 — 10 Virginia First Quarter Nc—d.Jones 81 pass from Yates (Barth kick), 14:43. UVa—FG randolph 25, 8:56. Nc—FG Barth 36, 5:45. Nc—d.Jones 20 pass from Yates (Barth kick), 1:17. Second Quarter Nc—FG Barth 34, 7:25. Nc—pianalto 1 pass from Yates (Barth kick), 6:10. UVa—payne 5 run (randolph kick), 2:46. Third Quarter Nc—FG Barth 32, 9:24. Nc—reddick 22 interception return (Barth kick), 9:12. Fourth Quarter Nc—draughn 1 run (Barth kick), 4:53. a—50,830. NC UVa First downs 19 19 35-140 42-151 rushes-yards passing 339 184 comp-att-int 18-23-0 18-34-5 95 1 return Yards punts-avg. 2-34.5 2-51.0 Fumbles-Lost 1-1 3-0 9-84 8-63 penalties-Yards time of possession 28:22 31:38 INDIVIDUAL STATISTICS rUsHiNG—North carolina, draughn 1765, White 13-57, Yates 3-16, Boyd 1-3, team 1-(minus 1). Virginia, payne 23-107, Jones 11-53, Horne 4-9, Metheny 2-(minus 8), Verica 2-(minus 10). passiNG—North carolina, Yates 17-220-325, renner 1-1-0-14. Virginia, Verica 15-25-3-139, rocco 3-8-145, Metheny 0-1-1-0. receiViNG—North carolina, d.Jones 7198, pianalto 3-54, Barham 3-27, White 212, Highsmith 1-42, cooper 1-4, Byrd 1-2. Virginia, Burd 5-37, M.snyder 4-44, Milien 225, phillips 2-17, Keys 1-28, payne 1-13, Mathis 1-8, Green 1-6, Jones 1-6.
FSU 24, Boston College 19 6 0 10 3 — 19 Boston College Florida St. 7 7 3 7 — 24 First Quarter Bc—FG Freese 33, 13:10. Bc — FG Freese 37, 9:33. FsU — pryor 3 pass from ponder (Hopkins kick), 1:19. Second Quarter FsU—reliford 10 pass from ponder (Hopkins kick), 1:03. Third Quarter Bc—FG Freese 28, 13:56. FsU — FG Hopkins 26, 6:30. Bc — Noel 43 interception return (Freese kick), 4:20. Fourth Quarter Bc—FG Freese 38, 12:49. FsU — reed 42 run (Hopkins kick), 10:50. INDIVIDUAL LEADERS rUsHiNG—Boston college, Harris 26191, Florida st., thomas 5-44, reed 1-42. passiNG — Boston college, rettig 9-240-95. Florida st., ponder 19-31-3-170. receiViNG — Boston college, pantale 3-34, swigert 2-38. Florida st., r.smith 6-49, reed 4-35, easterling 3-42, Haulstead 3-19
Appalachian 39, Citadel 10
6-43.3 4-47.0 punts-avg. Fumbles-Lost 0-0 1-1 penalties-Yards 6-45 6-60 28:46 time of possession 31:14 INDIVIDUAL STATISTICS rUsHiNG—Mississippi st., Ballard 20-98, relf 22-82. Florida, Hines 6-58, Burton 8-43, demps 5-36. passiNG—Mississippi st., relf 4-9-0-33. Florida, Brantley 24-39-1-210. receiViNG—Mississippi st., Bumphis 130. Florida, Hammond 5-69, Burton 5-37.
Kentucky 31, S. Carolina 28 14 14 0 0 — 28 South Carolina Kentucky 0 10 7 14 — 31 First Quarter sc—Lattimore 30 run (Lanning kick), 11:53. sc—a.Jeffery 3 pass from Garcia (Lanning kick), 4:40. Second Quarter Ky—King 10 pass from Hartline (Mcintosh kick), 13:10. sc—Lattimore 10 run (Lanning kick), 9:55. Ky—FG Mcintosh 26, 3:15. sc—Lattimore 47 pass from Garcia (Lanning kick), 2:03. Third Quarter Ky—King 5 pass from Hartline (Mcintosh kick), 3:49. Fourth Quarter Ky—Matthews 38 pass from Hartline (pass failed), 13:09. Ky—cobb 24 pass from Hartline (cobb run), 1:15. a—67,955. SC Ky First downs 17 21 23-90 33-52 rushes-yards passing 382 349 comp-att-int 20-32-2 32-42-0 8 (-5) return Yards punts-avg. 4-44.3 6-41.5 Fumbles-Lost 3-2 2-0 8-58 7-59 penalties-Yards time of possession 25:13 34:47 INDIVIDUAL STATISTICS rUsHiNG—south carolina, Lattimore 1579. Kentucky, russell 18-41, cobb 8-27. passiNG—south carolina, Garcia 20-322-382. Kentucky, Hartline 32-42-0-349. receiViNG—south carolina, a.Jeffery 665, Lattimore 4-133, Maddox 3-9, a.sanders 2-70, Gurley 2-43, scruggs 1-39. Kentucky, Matthews 12-177, cobb 8-63, russell 7-70 .
Ohio St. Wisconsin
0 3 7 8 — 18 14 7 0 10 — 31 First Quarter Wis—Gilreath 97 kickoff return (Welch kick), 14:48. Wis—clay 14 run (Welch kick), 10:00. Second Quarter Wis—clay 1 run (Welch kick), 13:15. osU—FG Barclay 21, 6:48. Third Quarter osU—Herron 13 run (Barclay kick), 10:08. Fourth Quarter osU—Herron 1 run (Fragel pass from pryor), 11:38. Wis—White 12 run (Welch kick), 6:57. Wis—FG Welch 41, 4:14. a—81,194. OSU Wis First downs 22 21 41-155 43-184 rushes-yards passing 156 152 comp-att-int 14-28-1 13-16-1 18 13 return Yards punts-avg. 3-38.0 2-50.5 Fumbles-Lost 1-0 0-0 2-14 3-35 penalties-Yards time of possession 30:03 29:57 INDIVIDUAL STATISTICS rUsHiNG—ohio st., Herron 19-91, pryor 18-56. Wisconsin, clay 21-104, White 1775. passiNG—ohio st., pryor 14-28-1-156. Wisconsin, tolzien 13-16-1-152. receiViNG—ohio st., sanzenbacher 694, posey 4-38. Wisconsin, toon 6-72, anderson 2-13, White 2-9, pedersen 1-33.
10 7 3 0 — 20 0 3 3 7 — 13 First Quarter tex—FG tucker 27, 10:13. tex—Gilbert 3 run (tucker kick), 8:06. Second Quarter Neb—FG Henery 45, 14:09. tex—Gilbert 1 run (tucker kick), 8:44. Third Quarter tex—FG tucker 28, 8:52. Neb—FG Henery 28, :27. Fourth Quarter Neb—Hagg 95 punt return (Henery kick), 3:02. a—85,648. Neb Tex First downs 14 13 rushes-yards 46-209 44-125 62 77 passing comp-att-int 4-16-0 8-21-0 return Yards 52 111 7-46.7 7-49.4 punts-avg. Fumbles-Lost 1-0 5-1 penalties-Yards 4-53 10-94 29:50 time of possession 30:10 INDIVIDUAL STATISTICS rUsHiNG—texas, c.Johnson 11-73, Gilbert 11-71, Newton 10-41. Nebraska, Helu 11-43, Burkhead 9-35, Lee 10-25. passiNG—texas, Gilbert 4-16-0-62. Nebraska, Martinez 4-12-0-63, Lee 4-9-0-14. receiViNG—texas, Newton 2-16, Whittaker 1-41. Nebraska, paul 6-66.
Wofford 45, W. Carolina 14
Boise St. 48, San Jose 0
W. Carolina Wofford
Boise St. 21 20 7 0 — 48 San Jose St. 0 0 0 0— 0 First Quarter Boi — Martin 6 run (Brotzman kick), 12:19. Boi — Gallarda 17 pass from Ke.Moore (Brotzman kick), 6:48. Boi — Young 17 run (Brotzman kick), 1:19. Second Quarter Boi – Young 43 pass from Ke.Moore (kick failed), 5:16. Boi — tevis 43 interception return (Brotzman kick), 4:14. Boi — avery 2 run (Brotzman kick), :42. Third Quarter Boi— Martin 4 run (Harman kick), 10:53. Boi SJS First downs 28 6 39-213 29-(-12) rushes-yards passing 322 92 comp-att-int 23-32-0 10-23-1 143 29 return Yards punts-avg. 3-38.7 10-43.4 Fumbles-Lost 2-2 2-0 5-51 4-26 penalties-Yards time of possession 31:36 28:24 INDIVIDUAL STATISTICS rUsHiNG — Boise st., Martin 8-68, Kaiserman 15-49, southwick 1-25. passiNG — Boise st., Ke.Moore 1416-0-231, southwick 8-13-0-83. san Jose st., La secla 7-16-1-74. receiViNG — Boise st., Young 7-105, Martin 3-53, pettis 3-53.
Georgia 43, Vandy 0 Vanderbilt Georgia
0 0 0 0— 0 12 10 21 0 — 43 First Quarter Geo—FG Walsh 32, 7:41. Geo — thomas 15 run (Walsh kick), :28. Geo — safety, :14. Second Quarter Geo—durham 4 pass from a.Murray (Walsh kick), 8:43. Geo — FG Walsh 25, :18. Third Quarter Geo—Green 48 pass from a.Murray (Walsh kick), 12:14. Geo — thomas 9 run (Walsh kick), 6:25. Geo — ealey 1 run (Walsh kick), 3:22. GEORGIA LEADERS rUsHiNG—ealey 17-123, thomas 4-40, passiNG — Murray 15-24-0-287 receiViNG — durham 4-112, t.King 470, Green 3-64, a.White 3-50, Wooten 2-3
Mississippi St. 10, Florida 7 Mississippi St. 10 0 0 0 — 10 Florida 0 0 7 0— 7 First Quarter Msst—FG Brauchle 31, 8:03. Msst—relf 6 run (Brauchle kick), :45. Third Quarter Fla—Hines 5 run (Henry kick), 4:15. a—90,517. MSSt Fla First downs 16 20 rushes-yards 49-212 35-151 passing 33 210 comp-att-int 4-9-0 24-39-1 return Yards 12 5
Associated Press
BLACKSBURG, Va. — Tyrod Taylor threw for Va. Tech 52 292 yards with Wake 21 three touchdowns and also rushed for a touchdown to lead Virginia Tech past Wake Forest 52-21 on Saturday. The Hokies (5-2, 3-0 ACC) won their fifth straight game after opening the season with two losses. They scored touchdowns on seven of their eight first-half possessions against Wake Forest (2-5, 1-3). The 49 first-half points tied for the second most (Rutgers, 1999) scored in a first half by a Virginia Tech team under Frank Beamer. “I think Virginia Tech is a very talented football team,” Wake.” Wake tailback Josh Harris rushed for a career-high 241 yards on 19 carries and scored on touchdown runs of 33 and 87 yards to lead the Demon Deacons. He accounted for 241 of Wake’s 346 yards of total offense.
Defensively, Wake’s Tristan Dorty (West Rowan) made five tackles, including one behind the line of scrimmage, and broke up one pass. Taylor hit backup DORTY quarterback Logan Thomas — who was split out as a receiver — for a 3-yard score on the Hokies’ first possession. Later in the first half, Taylor threw touchdown passes of 25 yards to Danny Coale and 11 yards to Jarrett Boykin. Taylor also scored on a 1-yard sneak. Darren Evans handled the rest of the scoring in the first half, getting in the end zone on three short runs (5, 8 and 1). “Basically, they had a great day running and throwing the football and, from our standpoint defensively, we could’ve played better,” Grobe said. “But I’d give them the credit. They’re hitting their stride and really playing good football now.” Evans’ three rushing touchdowns were a career high, and he finished with 52 yards on 12 carries. Virginia Tech finished with a season-high 604 yards of total offense.
Wisconsin 31, Ohio St. 18
The Citadel 7 0 3 0 — 10 13 16 10 0 — 39 Appalachian St. First Quarter cit—M.thompson 1 run (r.sellers kick), 10:29. app—Quick 65 pass from presley (kick blocked), 10:13. app—Hillary 3 pass from presley (Vitaris kick), 3:23. Second Quarter app—FG Vitaris 36, 14:48. app—Jorden 5 pass from presley (kick blocked), 10:31. app—Quick 22 pass from presley (Vitaris kick), 2:07. Third Quarter cit—FG r.sellers 47, 10:52. app—FG Vitaris 39, 6:24. app—cadet 73 pass from presley (Vitaris kick), 1:24. a—29,519. Cit App First downs 10 17 53-197 39-155 rushes-yards passing 0 241 comp-att-int 0-6-1 14-26-1 0 40 return Yards punts-avg. 4-42.3 2-22.5 Fumbles-Lost 2-1 1-1 5-57 4-43 penalties-Yards time of possession 31:14 28:46 INDIVIDUAL STATISTICS rUsHiNG—the citadel, M.thompson 1069, robinson 14-56, s.Martin 10-48. appalachian st.: cadet 8-59, presley 4-27, Jackson 7-23, radford 7-22, c.Baker 5-21). passiNG—the citadel, s.Martin 0-3-0-0, M.thompson 0-3-1-0. appalachian st., presley 14-25-0-241, Jackson 0-1-1-0. receiViNG—appalachian st., Quick 399, cadet 3-79, Hillary 3-26, cline 3-25.
0 14 0 0 — 14 3 19 13 10 — 45 First Quarter Wof—FG c.reed 26, 10:02. Second Quarter Wof—Breitenstein 1 run (kick failed), 13:54. Wcar — M.Johnson 1 run (Bostic kick), 9:20. Wcar — pressley 51 fumble return (Bostic kick), 6:21. Wof — allen 9 run (run failed), 2:47. Wof — Bersin 47 pass from Kass (c.reed kick), :47. Third Quarter Wof—Breitenstein 34 run (c.reed kick), 8:55. Wof — allen 31 run (kick failed), 1:08. Fourth Quarter Wof—d.reed 11 pass from Kass (c.reed kick), 13:07. Wof — FG c.reed 31, 5:29. WCar Wof First downs 17 24 37-114 57-501 rushes-yards passing 105 89 comp-att-int 11-24-3 4-6-1 13 18 return Yards punts-avg. 7-34.9 3-33.0 Fumbles-Lost 4-1 1-1 penalties-Yards 2-27 4-48 time of possession 28:55 31:05 INDIVIDUAL STATISTICS rUsHiNG—W. carolina, M.Johnson 2069, Harris 6-48, Brindise 7-13, pechloff 4-(minus 16). Wofford, allen 15-178, Breitenstein 21-149, d.Johnson 9-123, rucker 5-29, Kass 2-22, c.White 2-5, Nocek 1-0, team 2-(minus 5). passiNG — W. carolina, Brindise 8-142-64, pechloff 3-10-1-41. Wofford, allen 2-41-31, Kass 2-2-0-58. receiViNG — W. carolina, rogers 3-43, cockrell 3-25, Mitchell 3-13, alexander 1-19, everett 1-5. Wofford, Bersin 2-68, d.reed 221.
Hokies hammer Wake
Texas 20, Nebraska 13 Texas Nebraska
Oklahoma 52, Iowa St. 0 Iowa St. Oklahoma
0 10
0 21
0 0—0 14 7 — 52 ISU Okl First downs 10 37 rushes-yards 33-59 56-325 passing 124 347 comp-att-int 15-27-0 32-38-0 return Yards (-1) 31 punts-avg. 8-49.1 2-38.5 Fumbles-Lost 1-0 1-1 penalties-Yards 4-23 3-31 time of possession 27:03 32:57 INDIVIDUAL STATISTICS passiNG — iowa st., arnaud 12-18-0102. oklahoma: L.Jones 30-34-0-334.
Stanford 24, Wash. St. 17 Arizona Redskins St.
7 7 7 3 — 24 0 0 7 0—7 First Quarter ari — antolin 9 run (Zendejas kick), 4:48. Second Quarter ari — antolin 1 run (Zendejas kick), 10:59. Third Quarter ari — Grigsby 7 run (Zendejas kick), 13:48. WsU — M.Wilson 23 pass from tuel (Furney kick), 3:27. Fourth Quarter ari — FG Zendejas 40, 11:57. Ari WSU First downs 22 15 rushes-yards 47-142 34-40 passing 210 257 comp-att-int 20-27-1 18-32-2 return Yards 0 18 punts-avg. 5-42.8 5-41.2 Fumbles-Lost 1-0 2-2 penalties-Yards 2-20 4-30 time of possession 31:06 28:54 INDIVIDUAL STATISTICS rUsHiNG — arizona, antolin 21-92, Grigsby 14-66 passiNG — arizona, scott 14-20-1-139. receiViNG — arizona, cobb 7-62.
UNC FroM 1B “It feels good to finally get that off our backs,” wide receiver Dwight Jones said. His day included seven catches for 198 yards and two touchdowns. The first set the tone as he took a short slant on the first play, broke a tackle and went 81 yards for a TD. Jones also made a sliding catch of a 20-yard touchdown pass from Yates. Jones had another apparent touchdown but was ruled to have stepped out at the half-yard line following a 54-yard catch and run down the sideline. He came into the game with 12 catches for 104 yards on the season. “Everybody knew he has this kind of talent,” Yates said after a fourth straight victory. “We were just waiting for him to have that breakthrough game. He’s had it.” The Tar Heels (4-2, 2-1 ACC) led 27-10 at halftime and coasted. They held Virginia on the opening secondhalf series and then drove to set up the third of Casey Barth’s three field goals. Kevin Reddick’s interception and 22-yard touchdown return later in the quarter sealed it. When it was over, first-year Virginia coach Mike London gathered his team on the field. “I wanted them to feel what it feels like to get beat like we did on your homecoming,” he said, “and never, ever forget that feeling ... when someone comes into your house and hands it to you like they
associated press
Virginia’s Kris Burd has a pass knocked away by deunta Williams. did. We’re going to win around here and I told them we’re going to win.” The victory came as UNC continued to get players back from a roster-depleting NCAA investigation into agent-related benefits and possible academic misconduct. It had defensive end Linwan Euwell and tailback Ryan Houston available for the first time, but only Euwell played. “One thing that’s really helping us out is all that stuff is kind of over,” Yates said. “We’ve been dealing with it for so long we’ve kind of moved past it and moved on.” The school said Saturday that junior safety Brian Gupton — who has also been held out of every game — won't play this season, though the school didn’t specify why. The school also said that senior cornerback Kendric Burney, who was set to serve the last of his sixgame suspension against Virginia, still is in question for next week’s game at Miami due to what the school called “an unresolved issue” connected to the NCAA probe.
ECU FroM 1B Davis threw for 376 yards and two touchdowns for the Pirates (4-2). They survived a game in which they blew a big lead and committed mistake after mistake before figuring out a way to win in front of a record home crowd. East Carolina ran out to a 21-0 first-quarter lead only to see the Wolfpack rally to take a 27-24 lead late in the fourth quarter on a field goal from Josh Czajkowski. When Magazu’s interception ended the game, the East Carolina sideline spilled onto the field to celebrate in front of a roaring home crowd in the newly finished end zone section of Dowdy-Ficklen Stadium. Heck, a jubilant McNeill even danced to the music blaring over the loudspeakers amid the impromptu victory party. “They have sacrificed and paid the price and have been battled and scarred,” McNeill said of his players. “And today, that was special.” One thing is clear: East Carolina has proven it can win close games. The two-time defending Conference USA champions beat Tulsa in the opener on a last-play touchdown pass, then rallied from 20-point deficit at Southern Mississippi and scored the go-ahead touchdown with 41⁄2 minutes left in last week’s 44-43 win. This time, Michael Barbour kicked a field goal with 1:04 left to send. Magazu stepped in and grabbed the ball at the goal line. Magazu, a true freshman and the son of Carolina Panthers offensive line coach Dave Magazu, credited a teammate for jamming Williams at the line and forcing him to alter his route. “I kind of broke on it with instinct and watched the quarterback all at the same time,” he said. “The reroute really made the play. I was just doing what I was supposed to do.” Wilson offered few details when asked what he saw on the final play.
associated press
east carolina’s dwayne Harris leaves andy Lefffler in the dust. “Just trying to get a touchdown, and the kid made a nice play on it,” Wilson said. “That’s basically it.” East Carolina committed countless mistakes, from 10 penalties to a pair of costly fumbles that both set up a touchdown for the Wolfpack and ended another drive just as the Pirates were crossing the goal line. There was even Barbour’s missed extra-point attempt on Davis’ keeper, meaning an N.C. State touchdown in overtime could win the game. And yet, the Pirates figured out a way to beat a team that had won seven of 10 matchups with the state’s four other Bowl Subdivision opponents under coach Tom O’Brien — including two meetings with the Pirates. “I told the team last night in the hotel: we’re going to face adversity,” Davis said. “It might be fumbles, it might be picks, it might be missed tackles. We’ve just got to stick together through the good and bad, and that’s what happened.” Lance Lewis (Concord) and Justin Jones had touchdown catches for the Pirates, and Jon Williams had a 5yard TD run to cap East Carolina’s first possession. The Pirates finished with 496 total yards, and their struggling defense held up against the Wolfpack’s strong passing game. Wilson threw for 322 yards and one touchdown to go with a rushing score, but he threw three interceptions and was charged with a fumble on a botched handoff late in the first half. “They played their hearts out and we didn’t execute,” Wolfpack tackle Jake Vermiglio said. “We’ll have to look ourselves in the mirror and figure out something we can do better as a team.”
SALISBURY POST
SUNDAY, OCTOBER 17, 2010 • 5B
COLLEGE FOOTBALL
Badgers upset top-ranked Buckeyes BY RALPH D. RUSSO Associated Press
Associated Press, ‘Wow,, with the teams combining on a record for points in a SEC game that didn’t go to overtime. Newton left little doubt he deserves to be in the mix for the Heisman Trophy after running for 188 yards, passing for 140 and having a hand in four touchdowns. He threw a 15-yard touchdown pass to Emory Blake with 11:44 remaining, giving Auburn the lead for good at 44-43. Arkansas quarterback Ryan Mallett went out in the first half after taking a blow to the head. Tyler Wilson took over at QB, and the Razorbacks didn’t miss a beat until the fourth quarter. Auburn scored the final 28 points in a dizzying display, putting up four touchdowns in a little over 5 minutes. No. 3 Boise State 48, San Jose State 0 SAN JOSE, Calif. — Titus Young ran for a score and caught a pass for another touchdown. Kellen Moore completed 14 of 16 passes for 231 yards and two touchdowns before putting on a headset to signal plays in the second half. No. 4 TCU 31, BYU 3 FORT WORTH, Texas — Andy Dalton threw four touchdown passes, including two barely a minute apart late in the first half. No. 6 Oklahoma 52, Iowa State 0 NORMAN, Okla. — Steve Owens’ record of 57 touchdowns. Owens played before freshmen were eligible. Broyles finished with 182 yards on 15 catches, including one touchdown. No. 8 Alabama 23, Mississippi 10 TUSCALOOSA, Ala. — Trent Richardson took a screen pass 85 yards for a touchdown in the third quarter and Alabama's defense was back to form against Mississippi. Greg McElroy completed 17 of 25 passes for 219 yards and two touchdowns for the Tide.. No. 11 Utah 30, Wyoming 6 LARAMIE, Wyo. — Jordan Wynn passed for 230 yards and two touchdowns, and Matt Asiata ran for 109 yards. No. 13 Michigan State 26, Illinois 6 EAST LANSING, Mich. — Kirk Cousins threw a 48-yard touchdown pass to B.J. Cunningham in the third quarter, helping Michigan State to its best start in more than four decades. The Spartans are 7-0 for the first time since 1966, when they won their first nine games before famously tying Notre Dame.. Denard Robinson left during the third quarter after he was hit hard on a run. He was 13 of 18 for 96 yards with an interception and touchdown and ran 18 times for 105 yards. No. 16 Florida State 24, Boston College 19 TALLAHASSEE, Fla. — Bert Reed’s 42-yard touchdown run on a reverse lifted Florida State to its fifth straight victory. The Seminoles overcame four turnovers by quarterback Christian Ponder. Boston College had taken a 19-17 lead early in the fourth on Nate Freese’s fourth field goal of the game. No. 17 Arizona 24, Washington State 7 PULLMAN, Wash. — Keola Antolin ran for two touchdowns and Arizona overcame the loss of quarterback Nick Foles, who was injured early in the second quarter when Travis Long rolled into his right leg and knocked him down after a completed pass. No. 20 Oklahoma State 34, Texas Tech 17 LUBBOCK, Texas — Justin Blackmon had a career-high 207 yards receiving with a touchdown to lead Oklahoma State to its first win in Lubbock since 1944. No. 21 Missouri 30, Texas A&M 9 COLLEGE STATION, Texas — Blaine Gabbert threw for a 361 yards and three touchdowns and Missouri remained unbeaten. Mississippi State 10, No. 22 Florida 7 GAINESVILLE, Fla. — Vick Ballard ran for 98 yards, Chris Relf added 82 and a touchdown on the ground and Mississippi State controlled the clock while dictating the tempo. The Gators lost consecutive home games for the first time since 2003 and dropped three in a row for the first time since the Steve Spurrier era. The Bulldogs won in Gainesville for the first time since 1965, snapping a 16-game skid at the Swamp.
OTHERS Miami 28, Duke 13 DURHAM — Micanor Regis returned an interception 22 yards for a touchdown, one of the season-high seven turnovers Miami forced. Jacory Harris threw for one TD and ran for another. Sean Renfree, who has thrown at least three interceptions in three of five games, finished 18 of 38 for 157 yards for Duke. Duke coach David Cutcliffe said he told his team that “the bottom line is, you will never win a game doing what we did today, and that’s giving the ball away. “The sad part of it is, so many things were done well enough to win,” he added. “We simply turned the ball over at a rate that’s unheard of.” Clemson 31, Maryland 7 CLEMSON, S.C. — Andre Ellington had an 87-yard kickoff return touchdown on the day C.J. Spiller had his No. 28 retired. Georgia Tech 42, Middle Tennessee 14 ATLANTA — Anthony Allen ran for two touchdowns and Joshua Nesbitt rushed for 106 yards to lead Georgia Tech. Georgia 43, Vanderbilt 0 ATHENS, Ga. — Carlton Thomas ran for the first two touchdowns of his career, Aaron Murray passed for two touchdowns and Georgia welcomed new mascot Uga VIII by beating Vanderbilt. Notre Dame 44, Western Michigan 20 SOUTH BEND, Ind. — Michael Floyd took a pass from Dayne Crist and raced 80 yards for a score on the game's first play from scrimmage. He also caught a 32-yarder on an option pass from John Goodman for a TD and later grabbed a 2-yarder in the third.
associated press
Wisconsin fans climb atop a crossbar to celebrate after Wisconsin upset No. 1 ohio state. to run over the Buckeyes in the first half, taking a 21-3 lead into the break. today. “We just blew it as a team,” Pryor said. His Heisman Trophy hopes may have taken a beating, too, after he went just 14 of 28 passing with an interception. Next up at No. 1 in the AP Top 25? Maybe, No. 2 Oregon, which has never been topranked before. The Ducks
must have enjoyed watching the show at.”
App. State rolls at home Associated Press
associated press
running back Marcus Lattimore sits on the sideline with ice on his ankle after being injured in the second half.
Gamecocks limp to loss BY WILL GRAVES Associated Press
LEXINGTON, Ky. — Steve Spurrier Kentucky 31 w o r r i e d S. Carolina 28 about the hangover against Kentucky. He kept reminding his South Carolina players not to get too high following an upset of Alabama. The 10th-ranked Gamecocks seemed as if they’d keep it together before freshman running back Marcus Lattimore went down with an ankle injury. Then they could only watch as Kentucky’s Randall Cobb caught a 24-yard touchdown pass with 1:15 remaining, then added the two-point conversion to cap a furious secondhalf rally and give Wildcats a stunning 31-28 victory, ruining South Carolina’s chance to get a leg up in the jumbled SEC East. “Give Kentucky credit, they kicked our tails,” Spurrier said. Mike Hartline threw for a career-high 349 yards and four touchdowns for the Wildcats (4-3, 1-3 SEC). They had lost 10 straight to the Gamecocks (4-2, 2-2) and never beaten Spurrier in 17 tries. It appeared Spurrier was ready to make it 18 for 18 when the Gamecocks stuffed Cobb for a 4-yard loss, setting
up a 4th-and-7 at the Kentucky 24. Hartline calmly set his feet and faked a slant to Chris Matthews. The South Carolina defense bit, and Cobb found himself wide open at the goal line. He then swept over left tackle for the twopoint conversion to put Kentucky up three. South Carolina drove to the Kentucky 20 in the final minute, but quarterback Stephen Garcia’s heave into the end zone was intercepted by Kentucky’s Anthony Mosley with 4 seconds remaining. Hartline took a knee to set off a raucous celebration. “We just can’t, as they say, put the nail in the coffin,” Spurrier said. “We can’t put a team away. We just can’t do it. I don’t know why. We just can’t do it.” Not without Lattimore anyway. The budding star had 212 yards of total offense and three touchdowns but spent most of the second half on the sideline after rolling his left ankle while getting tackled early in the third quarter. “I just heard it crack and I thought something really bad had happened, but it’s just a sprain,” Lattimore said. It was enough to force him to watch his team, which led 28-10 at halftime, implode while he sat on the bench.
Texas upends Nebraska BY ERIC OLSON Associated Press
LINCOLN, Neb. — Texas beat NeTexas 20 braska yet Nebraska 13, ‘You’ve got to be kidding, not again.’ ” The stakes became even higher after Nebraska announced over the summer that it was moving to the Big Ten. Barring a rematch in the conference championship game, Texas will have won nine of 10 meetings against the Huskers since 1996. “We’ll let the fans feel sorry for what happened,” coach Bo Pelini said. “We have to take an experience like this and have it make us stronger.”
BOONE — DeAndre Presley threw for five touchdowns and Appalachian State beat The Citadel 39-10 on Saturday night. Presley completed 14 of 25 passes for 241 yards for the Mountaineers (6-0, 4-0 Southern Conference). He had passing scores of 65, 3, 5, 22 and 73 yards. “Last year we stopped ourselves a lot in the red zone,” Presley said. “This week we know that if we don’t stop ourselves we could put up points. We didn’t stop ourselves and allowed ourselves to play football.” Appalachian extended its conference winning streak to 24 games — the secondlongest in the SoCon’s 89-year football history. West V i r ginia won 30 straight league games from 1952-59. Brian Quick had 99 yards receiving and two touchdowns and Travaris Cadet added 79 yards receiving and one touchdown. CoCo Hillary and Ben Jorden had one TD. Appalachian held The Citadel to 0-for-6 passing, including one interception. Wofford 45, W. Carolina 14 SPARTANBURG, S.C. — Mitch Allen scored two of
Wofford’s five unanswered touchdowns as part of 36 straight points against the Catamounts (2-5, 1-3). Eric Breitenstein added 149 yards and two TDs on 21 carries for Wofford (5-1, 3-0). Ga. State 20, N.C. Central 17 ATLANTA — Iain Vance kicked a 33-yard field goal in overtime. North Carolina Central’s Frankie Cardelle (Salisbury) sent the game to overtime by making a career-long 44-yard field goal with fiveseconds remaining. He missed a 45-yarder in the first portion of the overtime. Cardelle’s game-tying kick at the end of the fourth quarter came after the Eagles (2-4) had driven 36 yards in the final 30 seconds with no timeouts. The sophomore missed his first attempt but got a second chance when Georgia State called timeout in an effort to intensify the pressure on the kick. Delaware St. 31, N.C. A&T 26 DOVER, Del. — Olusegon Ayanbiola returned a fumble 22 yards for a TD with 2:13 left in the fourth quarter. Drake 14, Campbell 12 BUIES CREEK — Daniel Polk’s 10-yard run with 17 seconds left gave Campbell the final score.
Making 150 stops nationwid nationwide, de, g one locally! y including January 9 - Feb February ruary 13 3 Six weeks of advanced hitting, pitch pitching hing and catcher lessons as low as $99 9. $99. Don’t fall behind behin nd d the competition!
East E as st t Ro R Rowan o an H HS S Register now, Pay later! Sessions for Grades 1-8
TTop op o ar area ea ccoaches oaches t tGreat Great indoor facilities t5:1 t5:1 ratio ratio SSpace pace is limited. limited. Phone (866)-622-4487 or visit seballAcademy.com
R124617
Auburn outscores Hogs
Drive up and drop off your expired and unused medications, including controlled substances!
SATURDAY, October 23 9:30 am - 12:30 pm The Medicine Shoppe Pharmacy 1347 West Innes Street The Medicine Shoppe Pharmacy, Rufty-Holmes Senior Center, Home Instead & Salisbury Police Dept. want to help protect our families, community and environment.
Drive up, drop off and drive out! All participants receive a reusable tote bag filled with goodies. Enter to win a $25 gift certificate to bring to the Medicine Shoppe Pharmacy when you bring in medication to be discarded.
For more information please contact Teresa at The Medicine Shoppe Pharmacy, 704-637-6120
SM
S47300
associated press
cam Newton greets fans after auburn’s victory.
MADISON, Wis. — Ohio State is one Wisconsin 31 and done as Ohio State 18 No. 1 after Wisconsin bullied the Buckeyes all over the field, then celebrated by jumping around on it with a few thousand friends. John Clay ran for 104 yards with two touchdowns and James White darted in for the clinching score in the fourth quarter as No. 18 Wisconsin took down top-ranked Ohio State 31 it.” David Gilreath returned the opening kickoff 97 yards for a touchdown and the Badgers (6-1, 2-1) proceeded
6B • SUNDAY, OCTOBER 17, 2010
SALISBURY POST
NFL/MLB
Richardson remains silent during 0-5 start duck this season and ordered a payroll-slashing roster overhaul that’s produced the NFL’s youngest team and worst offense. Richardson also raised ticket prices, so fans paid more to watch the Panthers (0-5) fail to reach double digits in all three home games so far this season — contests in which RICHARDSON they were outscored 63-20. Carolina enters its bye weekend off to its worst start in 12 years. “Rebuilding the team is something I’m confident is paramount in his mind,” said Max Muhleman, a Charlotte-based sports consultant who helped Richardson’s efforts to get the expansion franchise in the early 1990s. “How he’s doing it, probably only he and a very small needto-know group of people in the franchise know.”
BY MIKE CRANSTON Associated Press
CHARLOTTE — Owners of two of the NFL’s three winless teams came forward last week to try to explain what’s gone wrong. Jed York of San Francisco was ultra-positive, declaring the 49ers would rebound and “win the division” this year in an exchange with ESPN. Buffalo Bills owner Ralph Wilson warned it would take three years to rebuild, telling The Associated Press, “I’m not going to try to explain it or make excuses. It’s bad.” Jerry Richardson of the Carolina Panthers stayed quiet. It’s been nearly three years since the 74-year-old Richardson has answered questions from anyone other than the team-run magazine. During his silence he’s had a lifesaving heart transplant, fired two sons from top jobs with the organization, decided against extending coach John Fox’s contract to make him a lame-
It was just two years ago Carolina went 12-4. Now the Panthers are averaging 10.4 points with five touchdowns and 16 turnovers. “I don’t think you envision something like this,” said quarterback Matt Moore, benched after Week 2. “It’s something that snuck up on us quickly.” The Panthers let Julius Peppers and other veterans go in the offseason while making no major free-agent signings, and some wondered if Carolina was guarding against the chance of a work stoppage next season — Richardson is co-chairman of the NFL’s management council executive committee. He told the in-house Roar magazine his moves had nothing to do with the league’s labor situation. “We were at a point with our football team that we had to make tough football decisions which were separate from the CBA (collective bargaining agreement),” Richardson said in April. “We have a number of younger players who showed prom-
ise at the end of last season and need to get on the field.” With the way things have turned out, Richardson’s motives are being questioned again. “It seems likely it’s a factor in his process for sure,” Muhleman said of the CBA talks. “He’s probably as preoccupied with that as anybody, if not everybody, in the league.” Yahoo! Sports quoted an unidentified person at the March league meetings who said Richardson made an impassioned speech with colorful language, telling owners “we’re going to take back our league” after signing what he thinks was a bad labor deal in 2006. Preparing for a possible lockout next year and a potential new world order of player contracts could explain why more than half the roster is made up of rookies or players in the last year of their deals and coached by a man who appears all but gone but after this season. Just how young are the Panthers?
In last week’s 23-6 stinker against Chicago, they became the first NFL team since Cleveland in 1999 to start a rookie at quarterback (Jimmy Clausen) and both receiver positions (David Gettis and Brandon LaFell). Why didn’t the Panthers sign a veteran receiver after letting Muhsin Muhammad go in the offseason? “Those all aren’t my decisions,” Fox said. “We coach who we’ve got.” By jettisoning several veterans in a year without a salary cap, the Panthers got rid of a large amount of “dead money” from prorated bonuses of released players. That would free up space to go on a shopping spree next year if the cap returns. General manager Marty Hurney’s contract expired earlier this year, but it’s believed he’s safe and could be making those decisions next year. It’s everything else that’s uncertain, with no message coming from the top. “The fans know,” Muhleman said, “that Jerry is a guy who acts and doesn’t talk much.”
Rangers even series BY STEPHEN HAWKINS Associated Press
associated press
Josh Hamilton fouls a pitch off his face in the first inning.
0
SHOP 24 HRS @
%
larrykingchevy.com
Financing Available
New 2011 Traverse LS
ARLINGTON, Texas — There were Rangers 7 no pep Yankees 2 talks, no extended discussions after a meltdown by the Texas Rangers’ bullpen. Just quick redemption and the Rangers’ first postseason victory at home in the franchise’s 50 seasons. A night after a bullpen debacle, Elvis Andrus got the Rangers off to a running start, Colby Lewis pitched effectively into the sixth inning and five relievers made it stand in a 7-2 victory over the Yankees. The ALCS is even at a game apiece. “(Friday) night, we didn’t get it done,” manager Ron Washington said. “We didn’t make any excuses about it. We took the whipping, we took a shower. ... I was going to give the ball back to those guys if it presented itself. It presented itself, they did a great job.
I expected that.” The Rangers again built an early 5-0 lead in Game 2. New York got only one hit over 3 1⁄3 scoreless innings against the bullpen this time, including three relievers that were part of Game 1. The series now switches to Yankee Stadium for Game 3 on Monday, when Texas will have lefthander Cliff Lee on the mound. “Today was a lot more important for the Rangers after having lost that lead yesterday,” Yankees DH Lance Berkman said. “You knew it would be a hard-fought series.” Andrus led off the first with an infield single, went to second on a wild pitch, then stole third before Josh Hamilton drew a walk. With Nelson Cruz batting and two outs, Hamilton took off for second, and Andrus ran home when Jorge Posada threw to second. David Murphy homered in the second inning. An inning later, he and Bengie Molina had consecutive RBI doubles to make it 5-0.
New 2010 Tahoe LTZ
Stk#5538
Stk#5554
List $30,114 Sale $25,879
List $19,770 Sale $13,986
List $52,725 Sale $45,924
Savings $4,235
Savings $5,784
Associated Press
PHILADELPHIA — Tim Lincecum Giants 4 outdueled Phillies 3 Roy Halladay, Cody Ross hit a pair of solo homers and the San Francisco Giants beat the Philadelphia Phillies 4-3 in Game 1 of the NL championship series Saturday. Halladay’s bid for a second straight no-hitter lasted until Ross connected with one out in the third. “It was just enough to $4,755
Savings $8,128
Savings $8,033
No Games ★★★ No Gimmicks ★★★ GOOD PEOPLE TO DEAL WITH ★★★ Save Up To $13,000 09 Chevy Cobalt GM Certified, One Onwer, Clean History, Auto, Cruise,Control, Aluminum Wheels, 2.9 Financing for 60 Months
Stk#P1464
$
09 Chrysler Sebring LX
8,990 09 Hyundai Elantra GLS
Auto, AC, Low Miles and More!! Stk#P1440
Auto, AC, CD, Low Miles & More! Stk#P1465
12,495
$
12,990
$
16,45012
$
CRUZE FOR KIDS,
$
squeak by for us,” Lincecum said. Lincecum gave up three runs on homers to Jayson Werth and Carlos Ruiz in seven innings. But the Freak got the big outs when he needed them, and the Giants earned their fourth one-run win in the playoffs. Lincecum gave way to Javier Lopez, who got two outs in the eighth. Brian Wilson finished with a four-out save. “Lincecum, he hung in there and he battled and he pitched pretty good," Phillies manager Charlie Manuel said.
Come Register to win a
List $22,110 Sale $17,355
List $23,310 Sale $19,696
Savings $3,614
BY ROB MAADDI
TRUCK MONTH CELEBRATION NEW HHR
Stk#5707
San Francisco strikes first
Family Owned & Operated KANNAPOLIS
Stk#5710
New 2011 Colorado Ext Cab LT
associated press
tim Lincecum allowed three runs in seven innings.
BUSINESS
SUNDAY October 17, 2010
SALISBURY POST
Paris Goodnight, Business Page Editor, 704-797-4255 pgoodnight@salisburypost.com
1C
PASSION FOR
Business Roundup
CAKES PAYING OFF
Real estate investing club meeting
Bakery churning out custom treats in China Grove BY SUSAN SHINN For The Salisbury Post
HINA GROVE — Amy Huffman had her eye on the building at 107 S. Main St. for some time. She had an idea for a business. Her hopes were dashed when she saw it had been rented. Two months later, the building was available again, and Huffman called the landlord and made an offer. On May 1, Huffman opened The Cake Co. “We’ve had no flyers, no advertising,” Huffman says. “All the business we have is word of mouth.” You’ll pardon the pun, but that’s the truth. Huffman’s first client was her sister-in-law, who needed a wedding cake but didn’t have much money to spend. “I told her I would attempt to make a wedding cake if she would buy me a Kitchen Aid mixer,” Huffman says. “I figured it was a fair trade.” Huffman made an enchanting five-layer cake that tasted as good as it looked. “After I did that, it just gave me the passion for it,” Huffman says. Then the building became available. Huffman and several part-time employees make 10 to 12 custom cakes every week. She sells cakes by the slice, as well as cupcakes, cream-filled cookies, brownies and egg custard pies. By far, her two biggest sellers are cream horns and chess squares. “I make double batches of chess bars every day we’re open,” Huffman says. “The cream horns fly out, too.” Hours are noon-6 p.m. Tuesday-Friday and 11 a.m.-3 p.m. Saturday. Huffman got the recipe for chess squares out of a church cookbook her dad gave her. The egg custard pie is her great aunt’s recipe. Huffman seems to have a recipe for success with her business. She also came up with something called cake balls. When she makes custom shapes for cakes, Huffman uses what’s left to make cake balls, dipped in milk chocolate. They’ve been a huge hit with customers, she says. Pauletta Harrington is a frequent customer. She asked Huffman to make her son’s one-year anniversary cake. “I stressed to her that it needed to be flaw-
The Rowan Real Estate Investors and Associates is a new group formed to provide information regarding real estate investing in Rowan county. The group hopes to exchange ideas regarding how to buy, sell, rent and rehab properties.) This month (Oct. 26) Terry Whitesell of Community One Bank will present information regarding the financing of real estate in today’s market. He’ll discuss current financing guidelines, what options are available to those wishing to finance property, and he will also be taking questions.
C
‘Public Speaking for Non-Speakers’ Wednesday
JON C. LAKEY/SALiSBURy POSt
Amy Huffman adds the final touches to a custom birthday cake at the Cake Co.
less,” says Harrington, secretary at China Grove Middle School. “The cake was delicious and it was beautiful.” She ordered a large sheet cake for the school’s principal, Dr. James Davis, when he was named Principal of the Year. The teachers loved it. She ordered cupcakes for bosses’ day. “They’re just on top of their game,” she says of the business. “They’re very prompt with their deliveries.
They’re great.” Huffman’s kitchen is in the back of the building. “We just got on craigslist and got what we could,” Huffman explains. It’s nothing fancy: two stoves, two refrigerators, two freezers and countertops she put together from Lowe’s.
See CAKES, 2C
Chamber of Commerce adds nearly 150 new members The Rowan County Chamber of Commerce recruited almost 150 new members into the business organization during its recent annual new member drive. The effort was sponsored by Duke Energy and Walmart and surpassed the Chamber’s budgeted goal by more than one third. Judy Grissom, superintendent of the Rowan-Salisbury School System and the Chamber’s membership chair, led the annual new member recruitment effort with the help of some 80 volunteers. The drive was headquartered at the Gateway Building — the Chamber’s home. “Once again, we challenged the
volunteers to reach an aggressive goal and, once again, they came through for us,” Grissom said. “The drive was an outstanding success in every way.” The team selling the most new memberships was led by Salisbury City Manager Dave Treme and recruited almost 50 new members. Len Clark, also of the city of Salisbury, was the top individual sales person with 20 new members. Team captains for the 2010 drive were Arbe-Arbelaez (Toys for Tots), Donna Barnes (Citizens South Bank), Sherry Boyd (Carolinas Medical Center-NorthEast), Monte Burns (PGT Industries), Dari Cald-
Business calendar October 18 — Chamber of Commerce’s Business After Hours, Ben Mynatt Nissan, 629 Jake Alexander Blvd., 5-7 p.m., Call 704-6334221 to RSVP 19 — Chamber Business Council, Chamber, 9 a.m. 20 — Chamber’s Workforce Development Alliance, Chamber, 8 a.m. 21 — Chamber’s Leadership Rowan ‘Local Government’ Day, 8 a.m.-5 p.m. 22 — Chamber Friday Forum, ‘Health Care in Rowan County,’ Chamber, 7-8:30 a.m. Call 704-633-4221 for reservation 26 — Chamber new member reception, Chamber, 5-6:30 p.m. 27 — Rowan Partners for Education, Chamber, 7 a.m.
well (Rowan Regional Medical Center/Novant), Kenny Dietz (K-Dee’s Jewelers), Seamus Donaldson (Community Bank of Rowan), Ted Goins (Lutheran Services for the Aging), Dave Johnston (Salisbury Printing Co.), Jeanie Moore (RowanCabarrus Community College), Patty Overcash (Rowan-Salisbury Schools) and Dave Treme (city of Salisbury). The Chamber sets aside just a few days per year to actively recruit new members. The effort provides an annual injection of new members, volunteers and financial support necessary to accomplish the organization’s goals.
Chamber Chair of the Board Skip Wood (Sharp Capital Group) said, “The Rowan County business community has rallied around the Chamber and we now have some 925 members. Because of this tremendous support, the Chamber is better positioned to lead the business community forward and meet head-on the many challenges we face. We can’t thank enough the new members who have joined us and the many volunteers who played a part in this tremendous success.” Linda Sherrill is membership director for the Chamber of Commerce.
KANNAPOLIS — The Small Business Center at Rowan-Cabarrus Community College will offer “Public Speaking for Non-Speakers” from 9 to 11 a.m. Wednesday at the N.C. Research Campus in Kannapolis. Presenter Jeff Corbett, a radio personality and public speaker for 35 years, will teach the art of small group presentations, how to give a 30-second “elevator speech,” calming public speaking jitters, using voice mail effectively, speaking well off-the-cuff and more. Participants will not be required to speak. To make a reservation, call 704216-3512 or visit.
BB&T chief to speak at Catawba lecture Oct. 27 Kelly King, chairman and chief executive officer for BB&T, will deliver Catawba College’s Distinguished CEO Lecture at 4 p.m. Oct. 27. King will present “Our Best Days are Ahead,” part of the lecture series sponsored by the Ralph W. Ketner School of Business at the college. King joined BB&T’s Management Development Program in 1972. His service as a director for the Federal Reserve Bank of Richmond has provided BB&T with valuable insight into monetary policy and the regulation and supervision of financial services companies and their products.
Trophy House: Granite Quarry to Salisbury The Trophy House of Salisbury has completed its return to Salisbury. The Trophy House has been
See ROUNDUP, 2C
Another tale of woe involving a timeshare BY BRUCE WILLIAMS United Feature Syndicate
DEAR BRUCE: We have owned our timeshare for many years and have enjoyed family trips and vacations. Due to age and health problems, we have not used it for a few years. Paying maintenance fees is like throwing money to the wind. With the poor economy, how can we get rid of this burden? Should we just stop paying out these fees and walk away? What options would you suggest? — Rich via e-mail
DEAR RICH: Your story is one I hear time and time again. As you must know, I have not been a fan of timeshares for a great many reasons. It
Smart money does work for some folks, but the vast majority end up overpaying. The reality is that there is no after market. There are companies that say they will sell your timeshare, but every one I’ve investigated wants money up front. Can you image a real estate agent who is selling your home, saying, “I want my commission up front”? Totally absurd. And in most cases, a sale never takes place. In some cases, if you stop making payments, the management of these firms will just foreclose upon your unit and that’s the end of it. But sometimes, they know the property has little to no value and
they’ll litigate. Before you take any moves, as painful as this may be, please see a local attorney and let him look at all the documents. Perhaps he can lead you in the best direction, despite how unpleasant. Most of the time, you can’t give these things away because buyers know that they may be obliged to pay the maintenance fees you mentioned. Interested in buying or selling a house? Let Bruce Williams’ “House Smart” be your guide. Price: $14.95, plus shipping and handling. Call: 800337-2346. Send your questions to: Smart Money, P.O. Box 2095, Elfers, FL 34680. Email to: bruce@brucewilliams.com. Questions of general interest will be answered in future columns. — UNitED FEAtURE SyNDiCAtE
2C • SUNDAY, OCTOBER 17, 2010
ROUNDUP
SALISBURY POST
BUSINESS
Nine Rowan Regional Medical Center employees honored
FROM 1C
FAITH — Gary Hess Studios Tattooing & Custom Painting, 107 N. Main St. in Faith, will offer $20 tattoos to celebrate the studio’s first anniversary. The one-day sale begins at 10 a.m. Oct. 30. Artwork can’t exceed the size of a standard business card and must be in hand, ready to run through a thermal stencil machine. One tattoo is allowed per person. The studio will not make appointments — customers will be seen on a first come, first served basis. To learn more, call 704-431-4878 or e-mail garyhessstudios@yahoo.com
Home Health Professionals’ national honor Home Health Professionals has earned national recognition for the third year. Home Care Elite 2010 put the Salisbury business in the top 25 percent of all home health providers in the country. Home Health Professionals is located at 1910 Jake Alexander Blvd. W, Suite 102-103. To learn more, call 704-633-7213.
Comfort Keepers’ clinical care coordinator Sheena Head, a registered nurse, has been promoted to clinical care coordinator for Comfort Keepers. She earlier was employed as a part-time registered nurse with Comfort Keepers. She will train and supervise the clinical competencies and performance of the CNA and home health aide staff at Comfort Keepers as well as conducting initial assessments, care plan development and ongoing quality assurance reviews for Comfort Keepers clients. Before completing her nursing degree in 2009, Head worked as a CNA with Comfort Keepers. She lives in Salisbury with her 9-year-old daughter. For more information about Comfort Keepers, call 704-630-0370.
Golf center offering clinics for $20 Carolina Golf & Practice Center, 890 W. Ritchie Road off I-85 at Exit 74, is offering Pro Shop Clinics for $20, including a large bucket of balls: • Juniors Tuesday, 6-7 p.m. • Men Tuesday and Wednesday, 7-8 p.m. • Women Wednesday, 6-7 p.m. Locally owned, Carolina Golf & Practice Center sells, fits and repairs golf clubs and offers a full-service driving range. Call 704-639-0011 for winter hours and other specials.
Richmond County hires Walker Marketing The Richmond County’s Tourism Development Authority has retained the services of Walker Marketing of Concord to develop a marketing communications plan and conduct digital and media outreach as a means to enhance tourism development. According to the U.S. Travel Association, 79 percent of online Americans plan travel on the Internet. As part of the strategic planning process, Walker Marketing conducted an audit of online tourism marketing in North Carolina and developed a program designed to increase Richmond County’s visibility on the Internet. “An enhanced digital presence will ultimately help Richmond County expand its tourism base beyond its immediate area and educate outdoor enthusiasts about the many eco-assets available in the county,” said Gary Walker, president and CEO of Walker Marketing.
Real estate company’s Panthers fan package CHARLOTTE — Allen Tate Realtors is sponsoring the Ultimate Fan Package Sweepstakes —a grand prize package (retail value $2,110) that includes four lower-level seats and four field passes to the Dec. 12 Carolina Panthers vs. Atlanta game at Bank of America Stadium. The winner will also take home a signed, framed Carolina Panthers jersey and a 50-inch LG Plasma HDTV. The contest is open to North and South Carolina residents who are 18 or older at the time of entry. Contestants must provide a valid e-mail address. To register, visit allentate.com and complete an online entry form, or stop by any Allen Tate sales office. Deadline is Nov. 18. The winner will be announced on or before Dec. 1.
Bloom stores’ pilot program for 3GTv Networks Food Lion expects to run a pilot of the 3GTv Networks at nine Bloom stores in the Washington, D.C., area in early November, according to Automated Media Services. Supermarket News reported that a spokesperson for Food Lion, a Delhaize Group company, confirmed the.
Girl Scouts’ Flapjack Fundraiser at Applebee’s The Rowan County Girl Scouts will be hosting a Flapjack Fundraiser on Saturday from 7 to 10 a.m. at Applebee’s, 205 Faith Road. Tickets are $7 and can be purchased at the door or by calling Tine Coe at 704-636-4241. Nonprofit groups can hold the breakfasts on any Saturday or Sunday morning. Submit information about new businesses, honors and management promotions to bizbriefs@salisburypost.com. Include a daytime phone number.
orees will receive a special pin and certificate, a $50 gift card and an invitation to the special reception. Their names will be displayed on banners in the various facilities, and they will be spotlighted in internal communications and during various recognition week activities. Rowan Regional Medical Center is affiliated with Novant Health, a nonprofit health-care system from Virginia to South Carolina.
CAKES FROM 1C
Gel Nails ...................$2999 Full Set......................$1999 Fill-in ........................$1299
FREE Hot Stone Massage with pedicure service
Eyelashes .............................$1999 Refreshments Served
OPEN SUNDAY 12-5
1040 Freeland Dr., Ste 112 Salisbury, NC 28144
ll Fa
come in after school to pick out a ghost or scarecrow cupcake for a snack. “I just want this to be a fun place,” Huffman says. For more information about The Cake Company, call 704-856-1735 or visit thecakecocakery.com.
Please bring ad to receive special pricing. Exp. 10/31/10
WINDOWS
JON C. LAKEY/SALISBURY POST
Amy Huffman works on a custom birthday cake at her China Grove business.
704.636.0390
“The Best Insulated”
le Sa
$15
Tax C
00
red it
All Styles • Doors 100 Styles & Colors
FACTORY DIRECT DISCOUNTS
J.A. FISHER
A Specialty Contractor Since 1979 With Over 7000 Completed Jobs Salisbury
704-788-3217
Kannapolis
Freelance writer Susan Shinn lives in Salisbury.
R85721
Vote
Brandy Cook Rowan County District Attorney
Granite Auto Parts & Service
VOTE FOR EXPERIENCE
209-6331
704/
Hwy. 52 Granite Quarry
100% conviction rate: First Degree Murder Jury Trials
Tough on Repeat Offenders
DENTURES
Teaches Basic Law Enforcement Training
Most Insurance Accepted Now Accepting Medicaid
Prosecutor Liaison for the Kannapolis Police Department
Leader in Project Safe Neighborhood
Same Day Service On Repairs and Relines
Repairs $50 & up Relines $175 per Denture
Paid For By The Committee To Elect Brandy Cook
Dentures $475 ea.; $950 set Partials $495 & up Extractions $150 & up
Dr. B. D. Smith, General Dentistry 1905 N. Cannon Blvd., Kannapolis
R103631
NOTICE OF PUBLIC HEARING (704) 938-6136
ATTENTION
HOME Program Funds Budget Revisions Salisbury, North Carolina
Vendors & Buyers!
The City of Salisbury will hold a public hearing on Tuesday, November 2, 2010 at 4:00 p.m., City Hall, Council Chambers, 217 South Main Street, Salisbury, North Carolina. The purpose of this hearing is to receive citizen comments on the following HOME budget revisions:
The
Farmer's Market Flea Market
1. FY2009-2010 HOME budget - Reallocate approximately $63,000 from new construction to foreclosure purchase/rehabilitation. This change is prompted by the increased availability of foreclosed homes that are negatively affecting neighborhoods. Funds will be used to purchase and rehabilitate a vacant, foreclosed home that will be sold to an eligible low or moderate income first-time homebuyer.
has been open for over 40 years on Tuesdays from 7AM til 1PM. We are still open on Tuesday but are now adding Saturday and Sunday hours. The hours will be 7AM-2PM on the weekends.
2. FY2010-2011 HOME budget - Reallocate $75,000 from senior rental housing to family rental housing. The City received two similar requests for funding assistance for Low Income Housing Tax Credit developments during 2010, only one of which was funded by the LIHTC program. The City receives HOME funds from the U. S. Department of Housing and Urban Development through its participation in the Cabarrus/Iredell/Rowan HOME Consortium. The funds must be used to benefit low or moderate income persons and for the prevention or removal of slums or blight in accordance with HUD regulations. These changes are consistent with the City of Salisbury Consolidated Plan goals.
SATURDAY the rent for covered spaces will be $5.00 and FREE for field spaces.
Citizens are invited to attend and to provide comments at the public hearing or send written comments to City of Salisbury, Community Planning Services, PO Box 479, Salisbury, NC 28145-0479, or jgape@salisburync.gov. Comments on the proposals will be accepted for a 30-day review period ending November 21, 2010.
SUNDAY rent will be FREE to set up anywhere.
The meeting location is physically accessible to persons with disabilities. If any persons with limited English proficiency or persons with mobility, visual or hearing impairments need special accommodations, please notify Community Planning Services at 704-6385230 at least five (5) days in advance. This the 13th day of October 2010.
Massage Available
R126239
She has one Kitchen Aid mixer that belonged to her husband’s grandmother. The one from her first wedding cake project is right next to it. Although she has parttime employees who come in different days of the week — Nikki Johnson, Kayla Daniels and Melissa Yates — Huffman does the majority of baking and decorating. Two girlfriends, Carrie McNeely and Crystal Fidler come in to help decorate from time to time. Fidler, a wonderful baker, was the one who inspired Huffman to start the business. She’ll likely need their help more frequently soon. “I expect a mad rush at the holidays,” Huffman says. Huffman’s main goal is to provide inexpensive gifts. Single-serve, individually wrapped desserts, for example, sell for $4. “I really want to cater to the local community with really creative, inexpensive gifts that make a big impression but don’t break your pocketbook.” Huffman loves to see customers’ faces light up when they see a custom cake. “I think my prices are very reasonable for custom cakes,” says Huffman, who prices those cakes by the layer. So a wedding cake is priced the same as any other stacked cake. Huffman says that zebrastriped cakes are all the rage with teenage girls, while the guys like the beer barrel cakes, complete with sugar ice cubes. Huffman makes “baby bottom” cakes for baby showers. Boys love monster truck cakes. “Mommas are working now,” Huffman says. “They don’t have time to make their kids’ birthday cakes. We do. “Our cakes are very moist and they taste delicious. And they’re greatlooking cakes.” Huffman grew up in China Grove and she and husband Michael, a self-employed beverage distributor, moved back home several years ago from Tennessee. They have two daughters, Aubree, a sixth-grader at China Grove Middle, and Emma, 18 months. Huffman can’t wait for Halloween, when the kids
Pedicure.........................$1999 Kid Spa ............................$1500 New Spa Head ............... $2999
R124210
$20 tattoos at Faith studio for 1st anniversary
submit a nomination, and a committee consisting of leaders and staff review nominations and select final candidates. “These employees personally achieve excellence each and every day. I applaud them for their commitment to Rowan Regional Medical Center and Novant Health’s core values,” said Dari Caldwell, president of Rowan Regional Medical Center. Circle of Excellence hon-
R124638
Allstate Insurance Agent Robert Cockerl, whose office is located at 130 N. Arlington St., has received the Agency Hands in the Community Award for his commitment to volunteering in the community. With this award came a $1,000 grant from The Allstate Foundation for Meals On Wheels of Rowan, where Cockerl volunteers. “Robert is an active and respected member of the business community,” said Allstate’s Southeast Region Assistant Field Vice President John O’Donnell. “He also makes a point of getting involved personally by dedicating himself to making a difference in people’s lives.”
Sanchez were acknowledged for their achievement at a special reception held in their honor Thursday. Honoring employees who consistently exceed in demonstrating Novant’s core values in day-to-day work and have a minimum of one year of service with the organization, the Circle of Excellence is committed to recognizing employees and leaders up through, and including, the manager level positions. Anyone may
336-240-6870 308 Berrier Avenue Lexington, NC 27295
CITY COUNCIL OF THE CITY OF SALISBURY, NORTH CAROLINA
By: Myra B. Heard, CMC City Clerk ********************************** The above NOTICE was published in the SALISBURY POST in its issue on Sunday, October 17, 2010. R127178
(Take Bus 85 to the Old US 64 exit, then one mile on right) R127288
Allstate agent awarded for volunteer efforts
Nine Rowan Regional Medical Center employees are among those recognized for consistently demonstrating excellence in Novant Health’s core values and work to provide a remarkable patient experience in every dimension, every time. David Bush, Jim Cook, Stacey Davis, Connie Hoffner, Lisa Lennox, Susan Lewis, Alisha Mastro, Angela Odom and Rosemary
R 12 67 38
in Granite Quarry for more than 20 years. Burt Abernathy started the Trophy House with Ralph Williams in the late ’70s, and later moved the business to Granite Quarry. Luann and Gary Fesperman purchased the Trophy House more than three years ago. “The move to Salisbury gives our customers in the city and the western part of the county better access. The location at the corner of Jake Alexander and Faith Road is much closer to most of our customers,” Luann said. The Trophy House sells trophies, plaques, acrylics and other giftware. Laser engraving is also available on all surfaces from glass to blue jeans. The Trophy House also prints Tshirts with the latest direct-to-garment technology. It is 830 Faith Road in Salisbury and the phone number is the same, 704-279-5252.
DOUGLAS A. SMITH
Try all types of products including: • Food & Beverages • Pet Care Items
for School Board
• Personal Care Products • Household Products
GET PAID EVERY TIME!
Don’t miss out! Join today! (704) 250-1200 222 Oak Avenue Kannapolis, NC 28081 – Wise Spending – Traditional Values – Future Planning
Paid for by the committee to elect Mike Caskey
for DISTRICT COURT JUDGE
Liberty and Justice For All ď ? Military Veteran ď ? Emergency Medical Technician ď ? Former Rowan County Assistant District Attorney ď ? Over 10 years experience as a defense attorney in Rowan County ď ? NC Dispute Resolution Commission Certified Mediator in Superior Court, Family Financial, Estates & Guardianship ď ? President, Rowan County Bar Association Phil Barton, Campaign Manager
R126922
Paid for by the Committee to Elect Douglas A. Smith District Court Judge
To advertise in this directory call
R114364
704-797-4220
P.O. Box 1621 Concord, North Carolina 28026 Ph: 704-239-2074 jlbarch@ctc.net
R127364 S42814
Jack’s Furniture & Piano Restoration Complete Piano Restoration
We buy, sell, and move pianos We offer Steinway, Baldwin, Mason & Hamlin, & more Showroom located at 2143 C&E Statesville Blvd.
704.637.3367 • 704.754.2287 Ben Myna Nissan welcomes back Craig Hamilton also known as “Luckyâ€? to his friends. Craig has been a lifelong resident of Rowan County. He took an extended vacaon at the beach but is glad to return home. Craig has made many friends servicing Rowan County’s automove needs with great Nissans and Cerfied Pre-owned vehicles over the past 5 years. So if you’re in need of upgrading your transportaon and want to work with a great guy, stop by and ask for Craig and be ready to make a friend. Ben Myna Nissan is excited to welcome our newest addion to our family, Adam Soper. Adam has over 16 years of experience in the automobile service business. Adam’s professionalism and desire to take care of his customers has been his reputaon in Rowan County. He is Nissan as well as GM Cerfied and can assist his customers with any make of automobile. Adam is looking forward to serving Rowan County at his new home in the service department at Ben Myna Nissan.
Ben Myna Nissan is glad to introduce Wes Morgan. Wes is a Rowan County nave who has always loved cars and has made a career wanng to assist customers in taking care of their automobiles. He has worked as a technician and has made the move to join Ben Myna Nissan as a service advisor. Wes has the desire to connue to keep Ben Myna Nissan #1 in customer sasfacon.
S45590
704-633-7270
LOS ANGELES (AP) — was to start this verdict that could have been used against them in lawsuits by shareholders, or by prosecutors if a criminal probe into their activities leads to charges. It also gives the SEC the right to brag about what it said is the biggest financial penalty ever against a public company’s senior executive. The agency has been criticized for doing little to prevent much of the risky behavior that led to the financial meltdown and for failing to detect Bernard Madoff’s massive investment fraud. “This settlement is a desirable result for all the parties,� said Jacob Frenkel, a former SEC enforcement attorney now in private practice. “The SEC claims victory. The defendants get closure while preserving their ability to fight�’s “the fitting outcome for a corporate executive who deliberately disregarded his duty to investors by hiding what he saw in the executive suite,� SEC Enforcement Director Robert Khuzami said in a conference call with re-
versatility, medical assistants are proving to be the allied health professional of choice for this decade and beyond. In fact, according to the U.S. Bureau of Labor Statistics, medical assisting continues to be projected as one of the fastest growing occupations. For more information about the program at Cabarrus College, contact the Office of Admissions at 704-403-1555.
1-000-000-0000 2-000-000-0000
Bank of America likely to pay most of $67.5 million settlement
that this week will be a success by raising money for the Angel Tree and holding events that increase the awareness of the medical assistant program.� Medical assisting is an allied health profession whose practitioners function as members of the health care delivery team and perform administrative and clinical procedures. With their unique
VOTE Mike Caskey
R124635
Medical Assistants Recognition Week starts Monday CONCORD — The Cabarrus College of Health Sciences Medical Assistant Student Organization is gearing up to celebrate Medical Assistants Recognition Week, which starts Monday. As designated by the American Association of Medical Assistants (AAMA), medical assistants across the country will be recognized during this week and honored on Medical Assistants Recognition Day, Wednesday. In celebration of Medical Assistants Recognition Week, the Medical Assistant Student Group at Cabarrus College has planned the following special events and activities: • Several silent auctions and a raffle; • A Little Caesars Pizza Sale to raise funds for students to attend the North Carolina Medical Assistant Convention in April 2011; • A bake sale, with proceeds benefiting the Angel Tree Project, which assists children of Bostian Elementary School in Rowan County. These families are identified by the school guidance director based on need for assistance with food, shelter and essential medical care. These families have been affected by lost wages, jobs, injuries, illness, domestic violence or divorce. • A softball game will be played on Saturday against the Surgical Technology Student Organization, with proceeds also benefiting The Angel Tree Project. Cabarrus College offers a one-year diploma and twoyear associate degree for medical assistants. Currently, 17 students are enrolled in the program. All Cabarrus College medical assistant graduates over the past three years have passed the certification exam. Program Chair Stacey Wilson said, “The students have worked very hard to ensure
SUNDAY, OCTOBER 17, 2010 • 3C
BUSINESS
R118328
SALISBURY POST
Holiday
Farmers Market
for exhibit or vendor information call 704-250-5436
Reap a Wonderful Harvest of Cakes & Candles Cookies & Canned Goods Watches & Wood Crafters Food & Wine Vendors Jewelry & Jackets NC Grown Trees, Wreaths and Greenery NC Grown Wine & Tastings Unique and Juried Hand Crafted Gifts Silver & Copper Crafter Santa and Mrs. Claus Children’s Activities Horse & Carriage Rides (WEATHER PERMITTING) Live Entertainment with Jeff Whittington Food Vendors
Enjoy the splendor of the season in a Williamsburg-inspired Village under thousands of twinkling Lights Friday & Saturday, November 26 & 27, 10AM to 5PM
120 West Avenue, Old Cannon Towel Store NC Research Campus C46576
R127266
4C • SUNDAY, OCTOBER 17, 2010
Employment Clerical/Administrative
Part-Time to Full-Time Billing Clerk and Office Assistant Positions in small medical office. Day and Evening shifts. Pay is $9-$12. Please specify hours available to work. Send resume to Box 395, c/o The Salisbury Post, PO Box 4639, Salisbury, NC 28145.
Healthcare
CLINICAL LAB TECH Positions available for Hospital Clinical LAB MT or MLT Generalist. Ability to multi-task. F/T and PRN available. Send resume to: P.O. Box 1209 Mocksville, NC 27028 FAX 336-751-8402
Do you need help around the house?
CLASSIFIEDS!
$10 to start. Earn 40%. 704-754-2731 or 704278-2399 LIBRARIAN
Employment
Make Your Ad Pop! Color backgrounds as low as $5 extra* 704-797-4220 *some restrictions apply
The Town of Spencer is accepting applications for a part-time Librarian's position. Experience in library work and/or library science degree preferred. Responsible for daily library operations including purchasing and maintaining library resources. Ability to work with the public and to work independently is essential. Pay range $8.69 to $10.86 per hour. Starting pay DOQ. Submit application to Town Clerk, 600 S. Salisbury Avenue, P. O. Box 45, Spencer, NC 28159. Position open until filled. EOE.
Classifeds 704-797-4220
Medical
ATLANTIC COAST HOME CARE AGENCY, INC needs
Employment
Employment
Government
Property Manager Needed for Salisbury apts. Min. 2 + yrs mgmt exper. Fax resume: 704-636-8229 Tax preparers needed, exp. or will train. 25 full & part time positions to fill. Please call 704-267-4689 VOLUNTEERS Independent voters needed by Cecil for Congress.com
Police Officer Call 704-920-4009 to schedule assessment (limit 30 seats). Deadline for registration – Oct. 22, 2010 Apply at 246 Oak Ave. Kannapolis, NC 28081 or call 704-920-4300. EOE EOE Education
Rowan-Cabarrus Community College seeks applications for a:
Please visit for more details. Healthcare
Insurance Specialist Rowan Diagnostic Clinic seeks an individual experienced in claim coding, review, transmission, and insurer follow up. Pay relative to experience. Send resume to rdc@rowandiagnostic.com or RDC Administrator, 611 Mocksville Ave, Salisbury, NC, 28144.
Programmer Analyst I Required: Associate's degree in computer programming, computer science or information technology related field from an accredited institution and 1 year of full-time related work experience or 3 years of any combination of college-level coursework in computer programming or closely related disciplines and experience in computer programming. Deadline for applications: October 28, 2010. Interested applicants may apply online at. EOE.
Drivers
Doyouhave aserviceto provide? TO ADVERTISE CALL
(704) 797-4220 News 24/7
Drivers Wanted Full or part time. Req: Class A CDL, clean MVR, min. 25 yrs old w/3 yrs exp. Benefits: Pd health & dental ins., 401(k) w/match, pd holidays, vac., & qtrly. bonus. New equip. Call 704630-1160 Dump Truck Driver needed. Local. Exp. only apply. 704-6331136/704-202-4503 Healthcare
CNA's NEEDED Primary Health Concepts, Jake Alexander Blvd., 704-637-9461
2nd SHIFT RN SUPERVISOR
Assemblers, Window/Door Mfg Material Handlers, Loaders/Unloaders Circuit Board Wirers, CNC Brake Press CNC Punch Press, Machinists Manual Punch Press, Machine Maintenance
Responsible, organized, energetic & patient oriented RN needed to oversee & monitor resident care & service for 100 bed facility. Competitive pay & excellent benefits. Excellent opportunity to join a leading and progressive facility in Rowan County.
1st, 2nd, 3rd & 12 hr shifts Welcome, Lexington, Linwood, Kernersville
Admissions Assistant
If interested, please contact Denise Daugherty at (704) 636-8373 fax or denise.daugherty@genesishcc.com.
Employment
Healthcare
Genesis HealthCare Salisbury Center seeks seasoned for fast-paced office in Skilled Nursing Facility, 11am-8pm. Self-motivated, detail-oriented w/good communications & computer skills (Excel knowledge pref.).
Employment
$8.00-$20.00/hr
Healthcare
City of Salisbury Transit Operator #405 Closing Date: 10/26/2010
Employment
Skilled Labor
Available w/City of Kannapolis
CNAs & PCAs Up to $12/hr., no exp. necessary. Advancement opportunities. 704-549-5664
Employment
Apply at: Autumn Care of Salisbury 1505 Bringle Ferry Road EOE
Maintenance
Apply online at Current applicants call
Maintenance Technician Our company is looking for technicians with mechanical/electrical maintenance background.
(336) 243-5249 Skilled Labor
Job Responsibilities include:
Instrument Technician Opening for exp instrument Tech at our Salisbury, NC plant. Formerly National Starch and Chemical Co. now part of AkzoNobel. 2 year degree in industrial electrical/electronics, min 5+ years exp maintaining/calibrating industrial electronic control devices (flow, pressure, temperature, level) in control loops. Troubleshooting and maintaining PLC's AC drives and Digital Control Systems. Fluent w/electronic/electrical testing devices and instrumentation. Work exp at a chemical plant preferred. Predictive maintenance tools exp a plus. Programming PLC and DCS a plus. Excellent Benefits & Wages. EOE. Local applicants only. Please apply by sending a resume to AkzoNobel, Salisbury Plant, 485 Cedar Springs Rd., Salisbury, NC 28147, Attn: HR
Daily maintenance activities, troubleshooting or repair on high speed packaging machinery Following and recording daily preventive maintenance program Following company rules regarding safety, lock out-tag out procedures Small shop maintenance, fabrication and welding Requirements: Experience with food industry HVAC experience is a plus Fork lift maintenance Mechanical or electrical background. Please reply to Blind Box 396, c/o Salisbury Post, P.O. Box 4639, Salisbury, NC 28145.
Could you use
10 ,000 extra this year?
*
$
• Pay your subscription online: salisburypost.com/renew • Place a vacation hold: salisburypost.com/subscription
If interested, please come by the Post at 131 W. Innes Street, Salisbury and fill out an application or give us a call at the Circulation Department (704) 797-4213, Monday - Friday 8 am - 5 pm
• Send any comments: salisburypost.com/subscription C44624
*Profits vary and could be more or less than this amount
Tell everyone the
great news of your
wedding!
Call the Celebrations Department of the Salisbury Post and speak with Sylvia Andrews for information on how to publish your Wedding Celebration!
Call Sylvia at 704-797-7682
C43576
Employment
SALISBURY POST
CLASSIFIED
SALISBURY POST Flowers & Plants Antiques & Collectibles 36'' Leyland Cypress or Green Giant Trees Makes a beautiful property line boundary or privacy screen. $10 per tree. Also, Gardenias, Nandina, flowering banana, Ligustrum, Camelia, Emerald Green Arborvitae, Azalea AND MORE! $6 All of the above include delivery, installation, weed resistant liner & mulch! 704-274-0569
Hot Wheels car collection $30. Call Kim 704-636-0403
Trust. It s the reason 74% of area residents read the Salisbury Post on a daily basis. Classifieds give you affordable access to those loyal readers.
Furniture & Appliances
Misc For Sale
Misc For Sale
Dining room set, solid oak with six chairs and leaf $275 OBO. Call 704762-0345
Barbed wire. 15½ gauge tensile barbed wire. New roll. $20. Please call 704-633-4526
Hot chocolate. New Box of Hot Chocolate for Keurig Coffee Maker. $7. Call 704-245-8843
Great Bargains!
Bedframes, queen size, 2 piece metal. 3 pair. $10/pair. Call 704-6404373 after 5pm.
Wall unit $30, baby bed $35, Bassett twin beds $75. Huntersville area. Call after 5:30p.m. 704-274-9528 Refrigerator. GE side by side, $250. Frigidaire flat top stove, $225, Kenmore dryer, $75. 704-798-1926
Games and Toys Foosball table, Excellent condition. Call for more information. $55.00 704928-5062
Baby Items
Boardgames for kids. 5 games. $2 each. Wine glasses 3 left. $1 each. Call 704-640-4373 Decorative wicker baskets, set of 3. $5. Easter egg baskets, $3. Call 704-6404373 after 5pm.
Gone Fishing Catfish Master Rod & Reel (7ft. Long), $30. Pro Striker (9ft) Rod & Reel, $30. 704-278-0629
Great condition
Lawn and Garden EZ-RAKE mower leaf vacuum. Runs great. Has hand hose too. Ready to go. $150 obo . Call Dan 704-209-1376
Baby clothes. 0-12m. girl clothes Over 175 pieces. Very good cond., Smoke & pet free home. $120 cash. OBO. 704213-0190 Salisbury Area Baby Crib, white, with 1 underneath drawer, purchased at Babies R Us, in good condition, 704-9383452 in Kannapolis, $100. Bassinet / Cradle, with mobile, 3 white sheets, plays music, lights up, smoke and pet free home. $50 cash. 704213-0190 Salisbury
Leyland Cypress Trees, 3 ft. tall. $5 each. Green Giant's 6 ft. tall $20 each. Will plant for you for small fee. 704-213-6096
FOR SALE Mower Walkbehind 550 Series 115.00 OBO Call 704-762-0345
Trees. 3 Hibiscus $50 for all; 1 schefflera 6 ft. tall, $40; 50 potted plants, all kinds, $3 ea. 704-637-9173
Holshouser Cycle Shop Lawn mower repairs and trimmer sharpening. Pick up & delivery. (704)637-2856
Piano, Melodigrand spinet, walnut finish, wellcared for, tuned regularly, great condition. $750. 704-855-8353.
Food & Produce
Lawn Mower. Asking $35. Please call 704-433-0651 or 704-636-2234
Handbags, women's. 15 bag $1 to $5 each. Please call 704-640-4373 after 5pm for more info.
Fresh Veggies!
Chicco Cortina Travel System: Sahara pattern, car seat, stroller, and 2 bases. Very good used condition! $200. Please call 336-492-6050
Tiller, Bolens, new condition $290. Call 336751-7795, located in Mocksville.
Machine & Tools
Infant To Toddler Rocker, very good condition, has toy bar and vibrates. $20 704-213-0190 OBO Salisbury Area
Sweet potatoes by box of 25 lbs (48¢/lb). By pound 79¢. Mixed greens (you pick them) 50¢/lb. Collards, turnips and broccoli. Buddy's Produce, 9309 Wright Rd, 704-932Kannapolis. 2135.
Play yard. Eddie Bauer Soothen sway play yard. Never been used. $100. Call 336-998-8280 Rainforest Jumperoo, very good condition, smoke and pet free home. $40 OBO 704213-0190 Salisbury Area
Central Boiler Outdoor Wood Furnaces starting at $4,990. Limited time offer. Instant rebates up to $1,000. 704-202-3363
*All Boocoo Auction Items are subject to prior sale, and can be seen at salisburypost.boocoo.com
Firewood for sale. $75 a truck load and delivered.I have all sizes. 6 loads available. Call Mike at 704-785-1061 Gas fireplace logs with blower. $200 Please Call 704-855-4930
Computers & Software
Furniture & Appliances
Consignment
Air Conditioners, Washers, Dryers, Ranges, Frig. $65 & up. Used TV & Appliance Center Service after the sale. 704-279-6500
ANDERSON'S SEW & SO, Husqvarna, Viking Sewing Machines. Patterns, Notions, Fabrics. 10104 Old Beatty Ford Rd., Rockwell. 704-279-3647
Are you selling your home? Corner china cabinet. Flawless finish, medium color finish. $175 OBO 704-762-9197
74%
Misc For Sale
GOING ON VACATION? Send Us Photos Of You with your Salisbury Post to: famous@salisburypost.com
Stamps. Large collection of old cancelled US postage stamps. Some foreign. $25 obo. Call 704-636-1408
Want to Buy Merchandise
Business Opportunities
AA Antiques. Buying anything old, scrap gold & silver. Will help with your estate or yard sale. 704-433-1951.
AVON - Buy or Sell Call Lisa 1-800-258-1815 or Tony 1-877-289-4437
Let us know! We will run your ad with a photo for 15 days in print and 30 days online. Cost is just $30. Call the Salisbury Post Classified Department at 704-797-4220 or email classads@salisburypost.com
Want to Buy Old Biltmore Milk Jug Please Call 704-636-0111 Watches – and scrap gold jewelry. 704-636-9277 or cell 704-239-9298
X
Misc For Sale
Music Sales & Service
Toddler Bed, wooden. Can use a crib mattress, low to the floor. Good condition. Call 704-9383452 in Kannapolis, $40.
Camper shell, red, shortbed. excellent condition $500. Leave message 704-279-4106 or 704-798-7306
Cats
Dogs
thebennetts1@comcast.net
All Coin Collections Silver, gold & copper. Will buy foreign & scrap gold. 704-636-8123 Timber wanted - Pine or hardwood. 5 acres or more select or clear cut. Shaver Wood Products, Inc. Call 704-278-9291.
Free Stuff
Found small dog, in the area of Highway 158 and Farmington Road . Call 336-391-3278 to identify Free black eyed Susan plants. Please call 704636-9098 for more information. Free kittens. 6 weeks old, 2 black, 3 grey. 2 female cats, 1 white, grey & yellow. & 1 pretty white. Call 704-279-6946
Business Opportunities
Free Kittens. Gray & White, Black & White, Orange. Long hair and short hair. Males and females. 704-857-1579
J.Y. Monk Real Estate School-Get licensed fast, Charlotte/Concord courses. $399 tuition fee. Free Brochure. 800-849-0932
Free puppy. 4 month old Beagle/Pit mix. Male. Very playful. Shots and wormed. Needs good home, inside dog. 704-493-2936
Have a Seat! wood, Benches, backless, (4) 4-6 ft. long, $9-$13 each. Call 704431-4550 after 10am
Cats Free kittens to good home. 3 females. 1 gray, 1 gray with white paws, 1 white with butterscotch. loving, litter Sweet, trained. 336-284-2781
Dogs
Dogs
Free kittens. Female calico, litter box trained, dewormed. Please call 704-855-5623. Leave message if no answer
Found dog. Red Hound, neutered male found Sept. 28, Advance/Fork. Call to identify. 336-998-7220
Giving away kittens or puppies?
Free dogs. Two. They have had all their shots. One is lab mix, the other is chow mix. 336-284-5064
Free Spanky & “Our Gang” pups. Found on highway in Asheville. Males and females. Wormed. 704-209-1202
Boxer Puppies, AKC registered, brown and white, 1st Shots, dewormed. 6 weeks old. Parents on Site. $400. 704-239-4612
Cute & Furry! cars
HOT TUB. Rec Whse 93" square + chemicals. Gold Hill. Excel cond. $6,000 new, $1500. You move & haul. 704-279- 1066
Show off your stuff!
Want to get results?
See stars
Kitten - Black & white female tuxedo kitten. 8 mths old to a good home. Good w/kids & small dogs. 704-762-9099
vans
trucks
Cedar Chest with honey colored exterior finish. 4 ft. long seat. $175. 704762-9197
Farm Equipment, new & used. McDaniel Auction Co. 704-278-0726 or 704798-9259. NCAL 48, NCFL 8620. Your authorized farm equipment dealer.
Air compressor, 60 gallon tank. 120 or 230 volt cont. duty USA motor. $300. Call 704-857-9275
METAL: Angle, Channel, Pipe, Sheet & Plate Shear Fabrication & Welding FAB DESIGNS 2231 Old Wilkesboro Rd Open Mon-Fri 7-3:30 704-636-2349
Misc For Sale
With our
Bedroom suite, new 5 piece. All for $297.97. Hometown Furniture, 322 S. Main St. 704-633-7777
Farm Equipment & Supplies
A/C units. 24,000 btu used, $100. 25,000 bts new, $400. Please call 704-639-7007
Baker's rack, $25. Beige sofa, like new, $250. Twin bed w/frame, $200. TV table, $25. Call 704638-8965
Monitor. 19" LCD Flat Panel Monitor. $75 Please call 704-245-8843 for more information.
Growing Pains Family Consignments Call (704)638-0870 115 W. Innes Street
Cub Cadet, 42” Front Blade for GT series model 302. Purchased new, used twice, new cond. Has 3 position angle blade. Op. manual & maint. instructions. $350. 704-546-7717
Misc For Sale
Fuel & Wood
Boocoo Auction Items
SUNDAY, OCTOBER 17, 2010 • 5C
CLASSIFIED
Send us a photo and description we'll advertise it in the paper for 15 days, and online for 30 days for only
30*!
$
Dogs
all can be found in the
Classifieds! TO ADVERTISE CALL
(704) 797-4220
Call today about our Private Party Special!
704-797-4220 *some restrictions apply
NEWS 24/7
Free puppy. Labrador Retriever, nine month old puppy to a good home. call 704 636 1054 Free puppy. Six month old female black lab mix. All shots and preventatives. Great with kids and other pets. 704-431-4299
Got puppies or kittens for sale?
Pug Puppies. CKC 2 males fawn $400 each. 3 females fawn and 1 female black. $450 each. Shots. Cash. 704-603-8257.
Chow Puppy for sale. AKC Registered. $200. Call 704279-7520, leave message or 704-640-4224
Dog - Female choc. Lab mix, neutered, needs good home, lovable, great with kids & other pets, deploying overseas & cant keep her. 704310-6092 Free dog. Female Jack Russell, spayed. To good home only. Friendly & loving. Must find home quickly or may have to take to shelter. Call 704528-5454
BULLDOG PUPPIES AKC registered. 3 male, 3 female. $1,500. 704-640-1359 or 704-640-2541
Now That's a Face to Love!
Free dogs to good home. Female solid black Cairn Terrier and female Rat Terrier. 704603-4196. Ask for Caren
Other Pets $ $ $ $ $ $ $
JUST THE SWEETEST EVER! Supplies and Services Puppies, Chihuahuas. Two females ($300 each), one male ($275), black & tan and black & white. Ready now for their new home. 704-245-5238
20% off Dental in October. Call for appointment. Salisbury Animal Hospital 1500 E. Innes St. 704-637-0227 salisburyanimalhospital.com
Tell your realtor to advertise in the only product that reaches
AN OME TO INGS C WAY OUT, 4A OD TH N ALL GO ULPTURES O END: SC
d tinued col Sunny, con º / 19º 38 10C Forecast
of the real estate buyers in the Rowan County market*
cancer attle with A boy’s b
No other local media reaches as large a home-buying audience as the Salisbury Post and salisburypost.com
Sports 1B
l team h schoo ite hig | $1 ur favor , 2010 ing yo ary 10 s involv , Janu gallerie Sunday oto latest ph See the
ent Governmce n insura ikely option l table off thsysteem of exchanged s
sales = home s b jo w e N
Regulatedtter way to procee called be th care overhaul mocrats De ernHouse with heal N (AP) — Senior ing a govmise pro of includ
SALISBURY POST
l hopes al com INGTO WASH y abandoned ion in the fin ing to severan gel opt accord asures to rei have lar insurance shape, taking other me ment-run care bill pushing for ior Deare health other sen rec ent ls, and a in officia e insurers. ncy Pelosi and am urOb in privat Speaker Na ent Ba rac k to strip the insfedHouse Pre sid islation mption from is ts tol d want the leg g exe at provision mo cra Th g-standin gs they from meetin ustry of a lon icials said. was omitted e. off ance ind itrust laws, measure, but Christmas Ev e a sed on eral ant use-passed to includnce ate pas al measure Ho Sen the e insura nt, in that the the fin a nationwid me w w w. s a l i s b the bill also want govern l for ge. era al pos u r y p o sTh the fed vate covera ext .ey c osse ted by md pro -pa regula tem of p for pri House ge, to be ers could sho te-based sys SATURDAY exchan e , for a sta consum to requir where ate bill calls um ts want mocra ount of premi ilThe Sens. De use ava change ionally, Ho minimum am g what is er Addit nd a and oth y limitin thereb advertising t; the rs to spe percen t for insure on benefits, s, 85 POST use at URY LISB income salaries, bonsets the floor to 80 percen SMITH/SA for sale. SHELLEY uals. able for e House bill re lowers it Glen are be individ Th meron items. d measu groups and of anonymity et in Ca -passe all ion stre ate dit Sen to sm on this on con s sold homes policie officials spoke r. Three The an offe
This Week’s Featu red
Property 1050 Devonp ark Place, S alisbury
CAM
ERO self N l right it rket wil a m g in p o h ts n e ate ag Real est
es sell hom trying to People
ke them e to ma someon king for are loo
- 3 Bedrooms / 3.5 Bathrooms - Bonus room with full bath - Tall, tray and vaul ted ceilings Ceramic tile and wood floors
JANUARY 9, 2010 • 1D
GLEN
- Walk in pantry - TV niche above fireplace for HDT V - Covered porches Raised patio
In fact, no one even comes close. Call your realtor to get your home listed in color in the paper and online at
- On demand gas hot water heater - Quiet cul de sac street - Close to town, No city R46575A $279 900 taxes
*combined reach of Salisbury Post and SalisburyPost.com
6C • SUNDAY, OCTOBER 17, 2010
Auctions
Auctions
Carport and Garages
Cleaning Services
Home Improvement
Auction Thursday 12pm 429 N. Lee St. Salisbury Antiques, Collectibles, Used Furniture 704-213-4101
Lippard Garage Doors Installations, repairs, electric openers. 704636-7603 / 704-798-7603
Christian mom for cleaning jobs & ironing. Great rates. 704-932-1069 or 704791-9185
Want to get results?
Carolina's Auction Rod Poole, NCAL#2446 Salisbury (704)633-7369
Mr. Moms Cleaning Service. “Work your mom would be proud of.” Commercial, residential. Insured. 704-738-4006
Golden Palace Oriental Restaurant
REAL ESTATE AUCTION
Perry's Overhead Doors Sales, Service & Installation, Residential / Commercial. Wesley Perry 704-279-7325
Monday, November 8, 2010 11 a.m.
Executive Office Building
Save $$ ! RESTRETCH & CLEAN your CARPET before you buy new. Your friends will just THINK you bought new carpet! Kent 704-960-0187
Salisbury, NC Rowan County
Selling Regardless of Price in Excess of $350,000.00
Pursuant to the orders of the bankruptcy courts trustee Gerald Schafer will offer the following: Open sign, Oriental column lights, 13 booths & tables, 67 wooden chairs, 14 Oriental chandeliers, 10 Oriental light fixtures, 11 Oriental scones, glass show cases, l-shaped counter, cash register, 9 s.s. refrigerated table, 6 & 15 s.s. steam table, Oriental screens, Oriental decorative items, plate rack, s.s. refrigerator, ice maker, s.s. tables, coffee maker, coffee & tea dispenser, plates, glasses, single & double s.s. sink, aluminum rack, s.s. cart, bus cart, s.s. rack, pots, pans, s.s. drop ins, aluminum trays, cooling racks, mop buckets, ladders, freezer, 12 s.s. cooker, gas 6 burner stove, 2 deep fryers, rice cooker, 5 sandwich makeup unit, 6 4 door freezer, 5 2 sided stem table, 6 sandwich makeup unit, 24 s.s. hood system, 8 s.s. table, 4 s.s. table, 9 s.s. 2 compartment sink, 2 rice warmers, 5 & 3 s.s. work station, 20 quart Hobart mixer, rolling carts, microwave & lots more.
John Pait & Associates, Inc. 336-299-1186 NCAL#1064 NCFL#5461
6,200+/-Sq. Ft. Executive Office Building with 1 Bath Located at 530 East Innes Street, Salisbury, NC See Website for More Details – Broker Participation Invited
Iron Horse Auction Company, Inc.
Cleaning Services
C47461
COFFEE Have your Salisbury Post delivered to your home or business call 704-797-4213
H
H
H
Over 2 miles Paved Road Frontage
FREE ESTIMATES Licensed, bonded and insured. Since 1985.
C46814
AUCTION
Eddie Teeter Equipment Liquidation 785 London Road, Mooresville, N.C.
Tractors – 2005 Massey Ferguson 471 Tractor w/ cab, 4 wheel drive, front end loader, bucket, forks, 498 hours, excellent condition, like new; Farmall Super A w/ cultivators, good condition; Massey Ferguson 135 Tractor, gas, good condition; International Cub w/ belly mower ATV – 2007 John Deere Gator, 4 x 2; Trailers -2001 Delta 24' Gooseneck Trailer; Farm Hay Wagon with metal bed, dual axles; Homemade Cattle Trailer; Hay & Mowing Equipment –1997 John Deer e 1578 Bush Hog 15’; John Deere Mower Conditioner , Model 915; John Deere 335 Round Bailer, 4 x 4; 1986 New Holland Hayliner 315; 2008 Frontier WX2010 Hay Rake, 15'; 2008 Frontier 1316 Tedder; Frontier Bale Spear; 3pt. Bale Forks, Bale Spear, Equipment - Ford 2 Row Corn Planter; American 16” Turning Plow, International 350 Disc Harrow, Farm 500# Fertilizer Distributor; Agri Fab Fertilize Distributor, Baltic Fertilize Distributor, Post Hole Digger, Subsoiler, 11’ Culipacker, Hi-Co Fold up drag harrow, 9 shank tillage tool, 11 shank tillage tool, Bush Hog Box Blade, BX – 840; 6’ scrape blade, Boom pole, Drag Harrow, Cattle Chute – Southwest Squeeze Shute Guns – Savage Model 112, 22-250 w/ 10 power scope; Savage MK 1, 22 cal. Single shot; New England Arms Partner 410 ga. Single barrel; Fox Model B 16ga. Double Barrel, Remington Arms Cap & Ball Double Barrel Shotgun; Cap & Ball Double Barrel Marked D.R. on barrel’ Winchester WinLite 12 ga. M-59; Glenfield Mod. 25 22 Cal. Rifle; Ben Franklin Mod. 342 22 cal. BB gun; S&W 32 cal. 6 shot revolver; S&W 38 Cal. Revolver, nickel plated; S&W 32 cal revolver; Tools & Misc. –Stihl Chain Saws, Stewart Clippers, Andis Clippers, Weed Eaters, Craftsman Tool Box, tools, Power Pro Lawn Edger, Bolt cutters, Single Trees, Double Trees, Hames, Horse Collars, Silage Forks, Mowing Sickles, Ropers, Halters, Horse grooming supplies, Tools, Sockets, Buggy wrench, cotton scales, draw knife, shears, lanterns, pulleys, Misc. fence wire, and much more… Horse Drawn plows, cultivators, etc. and much more… Auctioneer’s Note – Mr. Eddie Teeter has leased his farm and retiring from his farming operation, and has commissioned us to sell his good farm equipment to the highest bidder. Take this opportunity to buy good equipment in excellent condition. Two of the tractors, MF 135 and the Int. Cub tractor are being sold for the Ballard Estate of Rowan County. Inspection: Friday October 22nd 9:00 am until 3 p.m. The guns are not located on the property but will be delivered to the sale on early Saturday morning for your inspection.
DON HORTON AUCTIONEER
C47134
Asset Services Corporation • Auctioneer & Brokers
Terms: Cash, Approved Check with Bank Letter of Credit; MasterCard, Visa; Buyers Premium – 5% for Cash, 8% for All Credit & Debit Cards; Removal Sale Day.
Call the Post to Sell the Most! 704-797-4220
All types concrete work ~ Insured ~ NO JOB TOO SMALL! Call Curt LeBlanc today for Free Estimates
Auctions
KEN WEDDINGTON Total Auctioneering Services 140 Eastside Dr., China Grove 704-8577458 License 392
Saturday October 23rd 10:00 am
Concrete Work
Rowan Auction Co. Professional Auction Services: Salis., NC 704-633-0809 Kip Jennings NCAL 6340.
Drywall Services
Quality Affordable Childcare Clean, smokefree, reliable 6 wks & up! 1st Shift Reasonable rates. 17 years experience.
Michelle, 704-603-7490 FReferences AvailableF
OLYMPIC DRYWALL Residential & Commercial Repair Service
704-279-2600 Since 1955 olympicdrywall@aol.com olympicdrywallcompany.com
Cleaning Services C.R. General Cleaning Service. Comm. & residential. Insured, Bonded. Spring Cleaning Specials! 704-433-1858
Ads that work pay for themselves. Ads that don’t work are expensive. Description brings results!
Fencing Free Estimates Bud Shuler & Sons Fence Co. 225 W Kerr St 704-633-6620 or 704-638-2000 Price Leader since 1963
Reliable Fence All Your Fencing Needs, Reasonable Rates, 21 years experience. (704)640-0223
AUCTION
Kitchens, Baths, Sunrooms, Remodel, Additions, Wood & Composite Decks, Garages, Vinyl Rails, Windows, Siding. & Roofing. ~ 704-633-5033 ~
House Cleaning Home Maid Cleaning Service, 10 yrs. exp, Free Estimates & References. Call Regina 704.791.0046
Anthony's Scrap Metal Service. Top prices paid for any type of metal or batteries. Free haul away. 704-433-1951 CASH FOR JUNK CARS And batteries. Call 704-279-7480 or 704-798-2930
Cathy's Painting Service Interior & exterior, new & repaints. 704-279-5335
Stoner Painting Contractor
• 25 years exp. • Int./Ext. painting • Pressure washing • Staining • Insured & Bonded 704-239-7553
Plumbing Services
Hodges Services
Complete plumbing and AC service. Rotten Floors. $45 service calls. Sr. Citizen's discounts.
Call today!
336-829-8721
Heating and Air Conditioning
WILL BUY OLD CARS Complete with keys and title, $175 and up. (Salisbury area only) R.C.'s Garage & Salvage 704-636-8130 704-267-4163
Bost Pools – Call me about your swimming pool. Installation, service, liner & replacement. (704) 637-1617
Piedmont AC & Heating Electrical Services Lowest prices in town!! 704-213-4022
Lawn Equipment Repair Services
Roofing and Guttering
Grading, Clearing, Hauling, and Topsoil. Please Call 704-633-1088
Home Improvement
Lyerly's ATV & Mower Repair Free estimates. All types of repairs Pickup/delivery avail. 704-642-2787
A HANDYMAN & MOORE Kitchen & Bath remodeling Quality Home Improvements Carpentry, Plumbing, Electric Clark Moore 704-213-4471
Lawn Maint. & Landscaping Brown's Landscape & Bush Hogging, plowing & tilling for gardens & yards. Free Est. 704-224-6558
Around the House Repairs Carpentry. Electrical. Plumbing. H & H Construction 704-633-2219
Earl's Lawn Care
Brisson - HandyMan Home Repair, Carpentry, Plumbing, Electrical, etc. Insured. 704-798-8199
Pools and Supplies
SEAMLESS GUTTER Licensed Contractor C.M. Walton Construction, 704-202-8181
3Mowing 3Yard Cleanup 3Trimming Bushes
3Leaf Removal 3Seeding 3Core Aeration 3Fertilizing
Browning ConstructionStructural repair, flooring installations, additions, decks, garages. 704-637-1578 LGC
FREE Estimates
704-636-3415 704-640-3842
Hometown Lawn Care & Handyman Service. Mowing, pressure washing, gutter cleaning, odd jobs ~inside & out. Comm, res. Insured. Free estimates. “No job too small” 704-433-7514 Larry Sheets, owner
GAYLOR'S LAWNCARE For ALL your lawn care needs! *FREE ESTIMATES* 704-639-9925/ 704-640-0542 Outdoors by overcash Mowing, Mulching, Leaf Removal. Free Estimates. 704-630-0120
Lawn Maint. & Landscaping
From Salisbury take I-85 South. Proceed to Exit 68 (China Grove) and turn right onto
Graham's Tree Service Free estimates, reasonable rates. Licensed, Insured, Bonded. 704-633-9304
Church St (becomes NC 152). Proceed 7.5 miles and turn left onto Allman Rd.
Yokeley’s Auction Company
BowenPainting@yahoo.com
Junk Removal
•
Visit Us at
Bowen Painting Interior and Exterior Painting 704-630-6976.
Custom Built Computer Systems with Windows 7 Used Computer Systems Starting at $150 Printer Repair & Maintenance FREE COMPUTER TRAINING CLASSES! 909 S. Main Street • Suite 102 • Salisbury 704-210-8028 M-F 12:00-6:00pm
ESTATE OF O.L. KARRIKER JR. (DECEASED)
TERMS: Cash or Good Check - No Buyers Premium - Food by Hopper’s Quick Bite All Items Sold As Is - Where Is - Auction Co. Makes No Guarantees. Keith Yokeley - Auctioneer - NCAL 5323 - NCAF 8708 - Phone: (336) 243-7404
Painting and Decorating
Virus Removal and Clean Up $50
SATURDAY, OCTOBER 23RD - 10:00 AM 170 ALLMAN RD - MOORESVILLE, NC
Ford 3000 Tractor, Farmall Super A Tractor w/Cultivators, Bush Hog, Double Turn Plow, Scrape Blade, Disc Harrow, Scoop Pan, 7 Shank Cultivator, Potato Plow, Pull Disc, Boon Pole, Drag Harrow, Cyclone Distributor, Yard Trailer, Sm. Farm Trailer, Rocky Mountain Elk Foundation BB Gun, Stevens Mod. 77B Pump 16ga. Shotgun, Springfield Mod. 120/22 cal. Rifle, J.C. Higgins Mod. 1101 Bolt 20ga., Remington Mod. 550-1/22cal. Semi Auto Rifle, RG 22cal. Pistol (Permit Required), Deer Scouting Cam, Motorola 2-way Radios, Coleman Stove, Ingersol 1212G Riding Mower, Murray 12 1/2 H.P. Riding Mower, Push Mower, Dome Top Trunk, Barstools, Table & 4 Chairs, Couch & Matching Chair, Window Table, Toshiba 32” TV, Coffee & End Tables, Upright Piano, Credenza, 3pc Drew BR Suite, Franklin Shockey Cedar Chest, Rattan Shelf, Cedar Chest, Cedar Wardrobe, Rocker, Telephone Stands, Recliners, Spool Bed, 5pc. BR Suite, 3pc. BR Suite, Elegant Depression Glass, Lamps, Pictures, Kaysons China (Golden Fantasy), Snow Sled, Gun & Hunting Magazines, Sewing Machine, Milk Can, Wash Post, 10 gal. Crock, Kitchenware, Compressor, Hand Tools, Yard Tools, Electric Tools, Pea Sheller, Drill Bit Sharpener, Car Ramps, Early Push Mower, Corn Fork Briar Scythe, IRon Wheels, Tiller, Aluminum Laddrs, Corn Sheller, Push Seeder, Cant Hook, Scroll Saw, Wheelbarrow, Washer & Dryer, Chest Freezer + MUCH MORE!!
TH Jones Mini-Max Storage 116 Balfour Street Granite Quarry Please 704-279-3808
Sick??
Beaver Grading Quality work, reasonable rates. Free Estimates 704-6364592
Moving and Storage
Is Your PC
Grading & Hauling
704-633-9295
Christian mom of 3 will care for children in my home, full or parttime. Fulton Heights. Weekdays only. 704-310-8508
Farm Equipment and Personal Property Call for information or brochure
Quality work at affordable prices NC Licensed General Contractor # 17608. NC Licensed Home Inspector #107. Complete contracting services, Under home repairs, light tractor work & Home maintenance. 36 years experience We accept Visa/MC 704-633-3584. Visit our website:
A message from the Salisbury Post and the FTC.
H
Child Care and Nursery Schools
Bid online at proxibid.com No standing open of bids - No buyer’s Premium
Professional Services Unlimited
H
to subscribe
Auction on Site @ 3222 Old Mtn. Rd, Stony Point, NC 28678 4.8 miles from I-40, 12.8 miles from crossroads of I-40 and I-77 9 miles to Statesville Regional Airport
See stars
The Federal Trade Commission says companies that promise to scrub your credit report of accurate negative information for a fee are lying. Under federal law, accurate negative information can be reported for up to seven years, and some bankruptcies for up to ten years. Learn about managing credit and debt at ftc.gov/credit.
MORNING
Sat., October 23rd – 10 am 333 +/- Acres – House, Barns, etc. 9 tracts (10.1 – 67.9 Acres)
HMC Handyman Services No Job too Large or Small. Please call 704-239-4883
“We can remove bankruptcies, judgments, liens, and bad loans from your credit file forever!”
GREAT WITH
Estate of Joe R Morrison (deceased)
256 Raceway Drive, Suite 2A, Mooresville, N.C. 704 663 1582 Office – Cell 704 363 9404 Don Horton NCAL 807, ASC NCFAL 7238
WOW! Clean Again! October Special! Lowest Prices in Town, Senior Citizens Discount, Residential/Commercial References available upon request. For more info. call 704-762-1402
800-997-2248 NCAL 3936
GOES
ABSOLUTE AUCTION NCAL #370 Bob Cline, NCBL # 7328 704-872-8585 ID#11592
We Build Garages, 24x24 = $12,500. All sizes built! ~ 704-633-5033 ~
Home Improvement
C46816
Auctions
C44133
Auctions
SALISBURY POST
CLASSIFIED
John Sigmon Stump grinding, Prompt service for 30+ years, Free Estimates. John Sigmon, 704-279-5763.
Home Improvement Garages, new homes, remodeling, roofing, siding, back hoe, loader 704-6369569 Maddry Const Lic G.C.
Manufactured Home Services Mobile Home Supplies~ City Consignment Company New & Used Furniture. Please Call 704636-2004
Miscellaneous Services
The Floor Doctor Complete crawlspace work, Wood floor leveling, jacks installed, rotten wood replaced due to water or termites, brick/block/tile work, foundations, etc. 704-933-3494
* 1 Day Class *
Large Groups Welcome!
Johnny Yarborough, Tree Expert trimming, topping, & removal of stumps by machine. Wood splitting, lots cleared. 10% off to senior citizens. 704-857-1731 MOORE'S Tree TrimmingTopping & Removing. Use Bucket Truck, 704-209-6254 Licensed, Insured & Bonded TREE WORKS by Jonathan Keener. Insured – Free estimates! Please call 704-636-0954.
FIND IT SELL IT RENT IT in the Classifieds
Lost & Found Found Collie - Behind Millbridge Elementary School. Please Call 704856-1000
Homes for Sale
GREAT INVESTMENT
Homes for Sale
Boston Terrier. Lost Wednesday, Oct. 13, male. No collar. Patterson Road area. 704-640-8022
WHY RENT?
Lost dog. Rottweiler, male, neutered. Last seen on Poole Road. Answers to Bear. 704239-9349 or 704-6389882 Lost Sterling Silver with Celtic Bracelet design. Not valuable just very sentimental. $50 reward. 704-224-5458
Homes for Sale Genesis Realty 704-933-5000 genesisrealtyco.com Foreclosure Experts
Land for Sale W. Rowan 1.19 acs. Old Stony Knob Rd. Possible owner financing. Reduced: $19,900. 704-640-3222
Salisbury, 2 BR, 1 BA, Cute home in city on corner lot. Easy access to shopping, great investment or for first time home buyer. R50827 704.633.2394 $49,900 B&R Realty
Why rent when you can OWN a home for less in one of Salisbury's most desirable condominium communities? 2BR, 2BA. $90's MLS # 50942 704-213-2464
Need customers? We’ve got them. The Salisbury Post ads are read daily in over 74% of the area’s homes!
Motivated Seller
Salisbury, Henderson Estates, 3 BR, 2.5 BA, Basement, Double Attached Carport, R48766 $149,900 Monica Poole 704.245.4628 B&R Realty
TRUE MODULAR ~ NO STEEL FRAMES New Modular Floor Plan – Great Kitchen, 3BR, 2BA over 1,600 sq. ft. Save over $15,000. Set up with foundation on your land, only.... $105,900 Call 704-463-1516 for Dan or Bobbie Fine to view at: Select Homes, Inc. Modular Outlet in Richfield, NC
Homes for Sale
A Great Home * * * A Fair Price
In the Reserve, next to Salisbury Country Club. A lovely 3BR, 2BA, 2,163
Land for Sale
Land for Sale BUYER BEWARE The Salisbury Post Classified Advertising staff monitors all ad submissions for honesty and integrity. However, some fraudulent ads are not detectable. Please protect yourself by checking the validity of any offer before you invest money in a business opportunity, job offer or purchase.
East Rowan
Salisbury, 3BR, 2 BA Wonderful neighborhood, no thru traffic, great for kids and pets. Open floor plan. Fresh paint and brand new carpet. R51361 $149,900 Monica Poole, B&R Realty 704.245.4628
FOR SALE BY OWNER
Salisbury. Forest Creek. 3 Bedroom, 1.5 bath. New home priced at only $98,900. R48764 Realty B&R 704.633.2394
Granite Quarry. 3BR, 2½BA. Completely remodeled home. Open floor plan, surround system, home office, hardwood flooring, 2 rock fireplaces, granite countertops, vessel sinks, finished basement, 2,450 sq, ft. $195,000. $5k closing. FSBO. 704-239-5936 512 Gold Hill Dr. Woodleaf 2BR, 1BA. $74,000. Please Call 704-855-5353
Lots for Sale
Salisbury. 2 or 3 bedroom Townhomes. For information, call Summit Developers, Inc. 704-797-0200
Farm Property for sale. 96 acres in Rowan County. Mahaley Rd. Call 336-766-8694
Homes for Sale
Southwestern Rowan County, Barnhardt Meadows. Quality home sites in country setting, restricted, pool and pool House complete. Use your builder or let us build for you. Lots start at $24,900. B&R Realty 704-633-2394
Drastically Reduced!
Salisbury, 3 BR, 1 BA Unfinished Full Basement. Sunroom with fireplace. Double garage. R50828 $89,900 B & R Realty 704.633.2394
Homes for Sale
Homes for Sale
Salisbury, 3 BR, 2 BA Well established neighborhood. All brick home with large deck. Large 2 car garage. R50188 $163,900 B&R Realty 704.633.2394
PRICED TO SELL
Granite Quarry-Garland Place, 3 BR, 2 BA, triple attached garage, single detached garage, whole house generator. Nice yard. R50640 $164,900 B&R Realty 704.633.2394
Salisbury. Nicely remodeled 3 BR, 1 BA close to everything. Only $55,900.00. R51250 Mi Casa Real Estate (704) 202-8195 "Hablamos Espanol"
Western Rowan County. Knox Farm Subdivision. Beautiful lots available now starting at $19,900. B&R Realty 704.633.2394
Manufactured Home Sales $500 Down moves you in. Call and ask me how? Please call (704) 225-8850
Fulton Heights Classic
Built in 1917. 417 Elm St. Stunning renovation! 10' ceilings, hdwd, 2FP. Open floorplan, 1800 sqft., 3 BR, 2 new BA, all new kitchen w/breakfast bar. New elec., AC, plumb., windows, doors, insulation & drywall. $127,900. 321-230-1380
Salisbury, 3 BR, 2 BA. Well cared for, kitchen with granite, eat at bar, dining area, large living room, mature trees, garden spot, 2 car garage plus storage bldgs. $154,900. Monica Poole 704.245.4628 B&R Realty
REDUCED
Rowan Realty, Professional, Accountable, Personable . 704-633-1071 William R. Kennedy Realty 428 E. Fisher Street 704-638-0673
Real Estate Commercial
Alexander Place
China Grove, 2 new homes under construction ... buy now and pick your own colors. Priced at only $114,900 and comes with a stove and dishwasher. B&R Realty 704-633-2394 Downtown Salis, 2300 sf office space, remodeled, off street pking. 633-7300 Salisbury 2400 SF retail business at 612 W. Innes St. Also, 500 SF & 750 SF upstairs ofc spaces. 864-350-0749 Spencer. 1500 SF ofc., previously medical. Also available, remodeled 590 SF space. 864-350-0749.
Myrtle Beach. 3BR/2BA “K” condo/rancher FOR SALE in Seagate Village at former Myrtle Beach Air Force base. Minutes from Market Commons. Call 704-425-7574
*Cash in 7 days or less *Facing or In Foreclosure *Properties in any condition *No property too small/large
MUST SEE!
For Sale By Owner
China Grove. 28 ft x 6ft, 2000 sq.ft., 4 bedroom doublewide, excellent condition, must be moved soon. $20,000. Call 704857-4406.
Will also consider leasing with option to buy
PRICE SLASHED!
Harrison Rd. near Food Lion. 3BR, 2BA. 1 ac. 1,800 sq. ft., big BR, retreat, huge deck. $580/mo. Financing avail. 704-489-1158
Salisbury Area 3 or 4 bedroom, 2 baths, $500 down under $700 per month. 704-225-8850
Call 24 hours, 7 days ** 704-239-2033 ** $$$$$$ Are you trying to sell your property? We guarantee a sale within 14704-245-2604 30 days.
Apartments $$ $ $ $ $ $
Salisbury. Owner Financing available. Large 4 BR, 2 BA home Ready to move in. R51222 only $79,900.00 Mi Casa Real Estate 704-202-8195 "Hablamos Espanol".
Southeast Rowan
Real Estate Services Allen Tate Realtors Daniel Almazan, Broker 704-202-0091
To advertise in this directory call
704-797-4220 Rockwell, 3BR, 2.5 BA Beautiful home with wood floors, open and airy floor plan, formal dining room. Large pantry. Nice sized deck. R50566. $219,900 Dale Yontz B&R Realty 704.202.3663
1, 2, & 3 BR Huge Apartments, very nice. $375 & up. 704-890-4587 1BR or 2BR units. Close to VA. Central HVAC. $450 - $600/mo. Call 704-239-4883. Broker 2 BR apts in Salisbury & Faith. Prices from $425$475/month. Rowan Properties 704-633-0446 2BR brick duplex with carport, convenient to hospita. $450 per month. 704-637-1020 3BR rentals available. East schools. Refrigerator & stove, W/D hook-up. Please call 704-638-0108 519/521 E. Cemetary St. 1 BR, $330; 2 BR $350. No pets. Deposit req. Call Jamie at 704-507-3915.
Fall Specials Ask about free rent, and free water. $300 - $1,200/mo. 704-637-1020 Chambers Realty 1 BR Garden Apt. Part of Historic District. Suitable for 1 person, all utilities, no pets. $475. Please Call 919-698-7893
To place an ad call the Classified Department at 704-797-4220
Quiet & Convenient, 2 bedroom town house, 1½ baths. All Electric, Central heat/air, no pets, pool. $550/mo. Includes water & basic cable.
West Side Manor Robert Cobb Rentals 2345 Statesville Blvd. Near Salisbury Mall
704-633-1234 China Grove 2BR Apt. Includes $550/month. water and garbage pickup. Call 704-857-2415. China Grove. Nice 2BR, 1BA. $525/month + deposit & references. No pets. 704-279-8428 TDD Relay 9:00-12:00. 1-800-735-2962 Equal Housing Opportunity. Clancy-hills@cmc-nc.com
Clean, well maint., 2 BR Duplex. Central heat/air, all electric. Section 8 welcome. 704-202-5790
“A Good Place to Live” 1, 2, & 3 Bedrooms Affordable & Spacious Water Included 704-636-8385 Eaman Park Apts. 2BR, 1BA. Near Salisbury High. $375/mo. Newly renovated. No pets. 704-798-3896 Equal information. Housing Opportunity. TDD Sect. 8 vouchers accepted. 800-735-2962 Moving to Town? Need a home or Apartment? We manage rental homes & apartments. Call and let us help you. Waggoner Realty Co. 704-633-0462
Rockwell Area. Apt. & Duplexes. $500-$600. 2BR Quiet Community. Marie Leonard-Hartsell at Wallace Realty 704-239-3096 S. Fulton St. Very nice 1500 sq ft 3 BR 2.5BA town house apartment. All elec., central heat/AC. Water incl., stove, refrig., dishwasher furnished. Outside storage. No pets. 1 yr lease. $625/mo. & $500 dep. 704-279-3808 Salisbury City. Very large 1BR/1BA, Lincolnton Rd, good neighborhood. $365 / mo + dep. 704-640-5750 Salisbury. 2BR duplex. Excellent condition with appls. $550/mo. Ryburn Rentals 704-637-0601 3BR, 2BA, quiet, lovely, very spacious. and $1,100/monthly includes water, gas, electric, HD cable, internet, lawncare. 704-798-8595 China Grove, Southern Charms Townhome, 2 BR, 1.5 BA. $575 month. 704-202-5784 location, newly City renovated. 2 BR, 2 BA, all appliances new. References req. 704639-0323. Lv. Message Wiltshire Village Condo for Rent, $700. 2nd floor. Looking for 2BR, 2BA in a quiet community setting? Call Bryce, Wallace Realty 704-2021319
PRIOR TO RENTING VISIT or CALL A PA R T M E N T S We Offer
PRICE~QUALITY~LOCATION 2BR ~ 1.5 BA ~ Starting at $555
Senior Discount
Water, Sewage & Garbage included
704-637-5588 WITH 12 MONTH LEASE
2205 Woodleaf Rd., Salisbury, NC 28147 Located at Woodleaf Road & Holly Avenue
Rockwell. 2 BR, 1 BA, hardwood floors, detached carport, handicap ramp. $99,900 R47208 B&R Realty 704.633.2394
Salisbury 3BR/1BA, 1300 SF, hardwoods, near City Park, central air and heat. Broker/Owner $69,900. 704-223-0893
OPEN SUNDAY 2-4 PM
GREAT HOME! GREAT LOCATION!
Salisbury. 125 Greenbrier Creek Place, 3BR/2BA, ranch for sale, 1400+ SF, 2 car garage, fireplace. $152,000. 704-637-0717
Rebecca Jones Realty 610 E. Liberty St, China Grove 704-857-SELL
Wanted: Real Estate
C47460
For Sale or Rent, near High Rock Lake. 520 sq. ft., needs cosmetic TLC but is structurally sound. Lake access. Assoc. fee $65/year. Ttreated wood deck, well & septic. Electric stove & refrigerator. Not suited for large family. Located at 785 Playground Ln., Salisbury. Priced to sell at $42,500 OBO. Email: funstar528@yahoo.com 704-209-1748
Privacy
KEY REAL ESTATE, INC. 1755 U.S. HWY 29. South China Grove, NC 28023 704-857-0539
American Homes of Rockwell Oldest Dealer in Rowan County. Best prices anywhere. 704-279-7997
West Schools. 3BR, 2BA. Kitchen with appliances, laundry room, living & dining room, fireplace with gas logs. 2 car detached garage. Central heat & air. House built in 2003. Large lot. $134,000. Please call 704-633-0229
Forest Glen Realty Darlene Blount, Broker 704-633-8867
Resort & Vacation Property
New Listing
Rockwell, 3 BR, 2 BA. Cute brick home in quiet subdivision. Outbuilding, wooded lot, nice deck off back. Kitchen appliances stay. R51385 $129,900 B&R Realty Dale Yontz 704.202.3663
BEST VALUE
New Listing
Rockwell 3 BR, 2 BA in Hunters Pointe. Above ground pool, garage, huge area that could easily finished upstairs. R51150A. B&R Realty $179,900. 704-633-2394
Colonial Village Apts.
Land for Sale
New Home
ACREAGE
Apartments
1 & 2BR. Nice, well maint'd, responsible landlord. $415-$435. Salisbury, in town. 704-642-1955
25 Acres Beautiful Land for Sale by Owner
Homes for Sale
NOTHING OVER 2 YEARS OLD!.
Homes for Sale
Apartments
Arey RealtyREAL Service in Real Estate 704-633-5334
Century 21 Towne & Country 474 Jake Alexander Blvd. (704)637-7721
Homes for Sale Landis. 2BR/1BA Brick home near school. Completely remodeled. floors, new Hardwood kitchen, claw foot tub, fireplace, new roof, energy efficient windows. $69,900. Call 980-521-3743.
Real Estate Services
B & R REALTY 704-633-2394
Lots for Sale
Monument & Cemetery Lots Carolina Memorial Pk, Concord. Plaza Mausoleum space for sale. Lot A-17. $4,000. 704-798-6821
Bank Foreclosures & Distress Sales. These homes need work! For a FREE list:
Lost cat. Yellow/Orange and buff colored male tabby cat. He doesn't have front claws. Missing since 9/30. East Rowan High School area. If found, call 704-279-4650 Lost dog. Poodle mix, white male, blind and deaf in Cauble Road/Ridge Road area. Missing since Oct. 12 p.m. No collar. 704636-4039
Homes for Sale
Salisbury
Found dog. Female, South Jackson Street, Call to identify. Call 704603-4196 Found Dog. Shih Tzu, by South Main Street in Kannapolis. Please call to identify. 704-933-5040
SUNDAY, OCTOBER 17, 2010 • 7C
CLASSIFIED
C46365
SALISBURY POST
No. 60632
P.O. Box 1621 Concord, North Carolina 28026 Ph: 704-239-2074 jlbarch@ctc.net
S42814
Jack’s Furniture & Piano Restoration Complete Piano Restoration.
We buy, sell, and move pianos We offer Steinway, Baldwin, Mason & Hamlin, & more Showroom located at 2143 C&E Statesville Blvd.
704.637.3367 • 704.754.2287
S45590
ELECTRONIC AUCTION The Town of Spencer will hold electronic auctions of the following items beginning November 1, 2010 @ 10:00am and ending November 10, 2010 @ 10:00pm. " HP Design Jet 750C Plus Plotter " Xerox 5328 Copier " 1994 GMC 3500 Flat Bed Dump Truck " 1976 Ford 2000 Tractor " 6' Finish Mower 3pt Hitch " John Deere GT262 Riding Lawn Mower " Tow-Behind Concrete Mixer " 3" Pump with Briggs Engine " 3" Pump with Honda Engine " Two (2) Large Military Style Shipping Containers " Stihl Weed Eater " Stihl Hedge Trimmer Website address to view and bid is. Items can be previewed Monday through Friday from October 25 through October 29 by appointment only. Contact Jeff Bumgarner, Public Works Director at 704.633.5331 or pwddir@ci.spencer.nc.us for appt or questions. The right is reserved to delete or "NO SALE" any item(s). Terms of payment: US Currency or certified cashier's check. All items must be removed by their respective buyer within 10 business days from the time and date that the auction ends.
8C • SUNDAY, OCTOBER 17, 2010 Condos and Townhomes
Houses for Rent
Houses for Rent
Wiltshire Village. 2BR. New appliances, carpet. Pool & tennis. $595/mo. 704-642-2554
Kannapolis. 314 North Ave. 3BR, 2BA. $850/mo. Kannapolis. 315 Tara Elizabeth Place. 3BR, 2BA. $825/ mo. KREA 704-933-2231
Salisbury. 3 & 2 Bedroom Houses. $500-$1,000. Also, Duplex Apartments. 704636-6100 or 704-633-8263 Salisbury/Spencer 2, 4 & 5 BR $450-$850/mo. 704202-3644 or leave message. No calls after 7pm
Houses for Rent $$$$$$$$$$$$$$ 2 Spectacular Homes $950-$1300 704-239-0691 3 & 4 BR homes in Salisbury & Faith. From $675 - $750/mo. Rowan Properties 704-633-0446 325 Wiley Ave. 3BR. Lg rooms, new appl. Great condition/location. Fence. $775 per mo. 704-798-2603
Spencer. 3BR, 2 baths. Ranch/basement, garage. $875/ mo + dep. Broker mang'd. 704-490-1121
Kannapolis. 3BR, 2BA. Nice house on large lot. Lots of privacy $775/mo. plus deposit. Please call 704-855-1201 Mon.-Fri.
Spencer. 3BR/1BA, new carpet/paint, excellent condition. No pets. $600/mo / dep. 704-633-5067
Kannapolis. 3BR, 2BA; Near I-85. garage. $725/mo. + dep. + credit check. 704-798-3208
W Rowan & Woodleaf school district. 2BR/1BA house. Taking applications. No pets. 704-754-7421
Nr. Hwy Patrol Station. 3BR/2BA, lease & dep req'd, all elec. $850/mo. 704-798-7233
Office and Commercial Rental
Rentals Needed 704-248-2520 Carolina-Piedmont Properties
1250 sq ft office building. 5,000 – 23,000 manufacturing distributing bld with office, loading docks. Call Bradshaw Real Estate 704-633-9011
Rowan Hosp. area. 3BR / 2BA. Appl., CHA. No Sect. 8. No pets. $700/mo. 1St & last mo's rent & dep. Call before 5pm 704-636-4251
Carolina Blvd. 2BR/2BA + ofc, all appls incl, 4 car carport, big yd. $800/mo + dep. 704-637-6618
Salisbury 2BR / 1BA, H/W floors, deck, garage, no pets, limit 2. $575/mo + dep. 704-633-9556
3500sf bldg - 6 offices w/ lg open area. Poss church, martial arts or dance studio. High traffic area - Jake & 150. $1,900/mo. 704721-6831
China Grove 2BR/1BA, appls furnished, storage bldg. Section 8 okay. No pets. 704-279-3990
Salisbury 2BR. $525 and up. GOODMAN RENTALS 704-633-4802
450 to 1,000 sq. ft. of Warehouse Space off Jake Alexander Blvd. Call 704279-8377 or 704-279-6882
Salisbury 3BR/1BA, new carpet, new floor, heat/AC, new paint. $525/mo + $450 dep. 828-390-0835
China Grove. 1200 sq ft. $800/mo + deposit. Call 704-855-2100
Salisbury 4BR/2BA, brick ranch, basement, 2,000 SF, garage, nice area. $1,195/mo. 704-630-0695
Commercial warehouses available. 1,400 sq. ft. w/dock. Gated w/security cameras. Convenient to I-85. Olympic Crown Storage. 704-630-0066
Clean/Quiet Near Catawba. 3BR Jack & Jill baths, brick house. New windows, flooring, carpet. Freshly painted. Refrigerator, stove, dishwasher. $800/mo. + dep. No pets. 704-636-0827 or 704-640-3555. E. Rowan, 3BR/2BA, deck, W/D hook-up, all electric, $750/mo + $750 dep. Sect. 8 OK. Credit ck. 704-2930168 or 704-293-2575 East Rowan. 3BR, 2BA singlewide. 390 N. Fishermans Cove, off St. Matthews Church Rd. $650/mo. All electric with water view. Call Waggoner Realty Co. 704-633-0462 East Rowan. Nice 3BR. Lots of storage. Quiet area. Private back yard. $565/mo. 704-279-5018 East Schools. 2BR, 1½BA brick. Appl., W/D hook-up. 2 car-carport. Fenced backyard. 704-638-0108 EXCEPTIONAL HOME FOR RENT
2 BR,1 BA, Private Country setting, completely renovated older home, brand new heating & air conditioning system. All appliances included. $700 per month plus security deposit. Call 704-798-5959 FOR RENT IN SPENCER 2 bedroom, one bath central heat and air, storage building, on 3 335 lots, nice area. McCubbins Street $525 a plus deposit. month References required.704636-0645 Houses: 3BRs, 1BA. Apartments: 2 & 3 BRs, 1BA Deposit req'd. Faith Realty 704-630-9650 Hurley School District. 3BR, 1½BA. Outside storage, W/D hookup. No pets. $600/mo. + deposit. 704-279-3518
Salisbury City Limits. 2 Bedroom, central heat and air. $500 per month + deposit. 704-232-9121
Furnished Key Man Office Suites - $250-350. Jake & 150. Util & internet incl. 704-721-6831
Salisbury N. Fulton St., 2BR/1BA Duplex, limit 3, no pets, $525/month + deposit. 704-855-2100
Granite Quarry Special Commercial Metal Bldgs for Small Trade Business, hobby shop space or storage. Units avail up to 1800 sq ft w/ office area. Video surveillance and ample parking. 704279-4422
GREAT LOCATION OFFICE SPACE FOR RENT
Salisbury, 314 American Dr. Very Nice 3BR, 2BA with garage. All electric. All appliances. Nice back yard. $800/mo. + deposit Call 704-754-5700, Spear Investments Section 8 Not accepted
Manufactured Home for Rent
Office and Commercial Rental Restaurant fully equipped. 85 feet In China Grove. $1700 per month. 704-855-2100 Salisbury. 900–950 sq ft. 421 Faith Rd. Water & sewer furnished $625/mo. 704633-9556 Salisbury. Six individual offices, new central heat/air, heavily insulated for energy efficiency, fully carpeted (to be installed) except stone at entrance. Conference room, employee break room, tile bathroom, and nice, large reception area. Perfect location near the Court House and County Building. Want to lease but will sell. Perfect for dual occupancy. By appointment only. 704-636-1850 Spencer Shops Lease great retail space for as little as $750/mo for 2,000 sq ft at. 704-431-8636
$$$$$$ $$$$$$$ Rockwell Offices 3 months free 704-239-0691
Rockwell 3BR, 2BA Central HVAC, appls. Storage bldg. $700/mo. All electric, 704279-6850/704-798-3035
275 sq.ft. to 1475 sq.ft. offices located just off Jake Alexander on S. Main St. Perfect for small or large business, utilities included. Rent $500$1000/mo. 704-855-2300
Salisbury, close to town. 3BR, 2BA duplexes. Sect. 8 OK. No pets. $550/mo. + deposit. 704-433-2899
Numerous Commercial and office rentals to suit your needs. Ranging from 500 to 5,000 sq. ft. Call Victor Wallace at Wallace Realty, 704-636-2021
Salisbury, in country. 3BR, 2BA. With in-law apartment. $1000/mo. No pets. Deposit & ref. 704855-2100
Office Space
Salisbury, Sells Rd, 2BR / 1BA Handyman Special! Large lot. Free water sewer, $295/mo. 704-633-6035 Salisbury- Hidden Creek. 2 bedrooms/2 baths. Ground level across from Clubhouse. No pets or smokers. $750.00 Call Waggoner Realty Co. at 704-633-0462
Salisbury. We have office suites available in the Executive Center. First Month Free with No Deposit! With all utilities from $150 and up. Lots of amenities. Call Karen Rufty at B & R Realty 704-202-6041
Salisbury. 2BR/1BA, Convenient location. No pets. No smoking. $600/mo. + $600 dep. 704-637-7524
Salisbury, Kent Executive Park office suites, $100 & up. Utilities paid. Conference room, internet access, break room, ample parking. 704-202-5879
Salisbury. 6BR, 2BA. 2 story. Central air. $700/mo. Please call for more info., 704-310-1052 or 704-637-1200
West Rowan, nice 3 BR, 2 BA double-wide mobile home located on private land. $675/month $675/deposit. Rent w/option to purchase 704-855-2300
Rooms for Rent
Motorcycles & ATVs
Autos
East Area. 2BR, water, trash. Limit 2. Dep. req. No pets. Call 704-6367531 or 704-202-4991
Toyota
Tim Marburger Honda 1309 N First St. (Hwy 52) Albemarle NC 704-983-4107
Nice Ride! Toyota, 2001, Avalon XLS. Silver, 6 cyl, leather, recent tires, trip computer, power everything. 126K, $6,995. 980-721-9815
Hurley School Rd area 2BR/1BA, nice subdivision, large lot. $460/mo + dep. 704-640-5750
Autos
BMW, 2005 325i Midnight Black on tan leather 2.5 V6 auto trans, am, fm, cd, sunroof, duel seat warmers, all power, duel power seats, RUNS & DRIVES NICELY!! 704-603-4255
Cadillac Catera, 2000. Satin Black on Tan leather interior, 3.0, V6, auto trans., BOSE am,fm,cd, steering wheel controls, SUNROOF , all power, alloy rims, LOADED !!! 704-603-4255
Financing Available!
Call Steve today! 704-603-4255
Volvo, 2006 S60 2.5T Onyx black with cream leather interior, sunroof, cd player, all power, alloy wheels, super nice! 704-603-4255
West & South Rowan. 2 & 3 BR. No pets. Perfect for 3. Water included. Please call 704-857-6951
Recreational Vehicles
Infinity FX35, 2005 Silver on Grey leather interior , 3.5L V6 with auto tiptronic trans, am,fm,cd,tape,sat radio, DUEL POWER & HEATED seats , SUNROOF, alloy rims, NONSMOKER, excellent condition !!! 704-603-4255
Trucks, SUVs & Vans
Service & Parts
Volvo, 2007 S40 Brilliant Red on ash leather interior 2.4 5 cylinder auto trans, am, fm, cd, sunroof, duel heated seats, all power ops, extra clean. 704-603-4255
HONDA, 2003, ACCORD EX. $500-700 down, will help finance. Credit, No Problem! Private party sale. Call 704-838-1538
2009 Motofino Scooter, RAD-10 (50cc), 4-stroke engine, orange. Scooter is like new. Only 1327 miles. Paid $1200, asking $1000 obo. Call 704-2791277 for more info. In Gold Hill Infinity, 2003 G35 Fireball Red with Black LEATHER interior, BOSE am, fm, cd system, SUNROOF, DUEL HEATED SEATS, all power ops, lowered, Brimbo brakes, Nismo air intake A REAL HEAD TURNER!! 704-603-4255
Salisbury. For Sale or Rent. 3990 Statesville Boulevard. Lot 17, 3BR. $439/mo. 704-640-3222 W. Rowan area. 3BR, 2BA SW. 365 Montega Ln. $400/mo. Avail. Nov. 1st. Oil heat. No smoking. No pets. 336-998-3133 Lv. msg.
Bad Credit? No Credit? No Problem! Tim Marburger Dodge 877-792-9700
We are the area's largest selection of quality preowned autos. Financing avail. to suit a variety of needs. Carfax avail. No Gimmicks – We take pride in giving excellent service to all our customers.
Motorcycles & ATVs
Rockwell. 2BR, 1BA. Appl., water, sewer, trash service incl. $475/mo. + dep. Pets OK. 704-279-7463
Salisbury, Woodleaf Road, 3-BR, 2-BA, private lot, fireplace, $725 month includes water. 704-636-2143.
Transportation Financing
Jayco Travel Trailer, 1999. $4,990. Please Call 704-279-2296 or 704-279-2122
Mobile homes for rent. Woodleaf area. $350$425/mo. Central heat 704-239-2130 and air.
Salisbury 3BR/1BA, large yard, Knollwood School District, $550/mo. No pets. 864-706-3007
Honda Pilot EXL, 2005 Burgandy Red on Tan leather interior, 3.5, V6, auto trans, 4X4, LOADED, all power, SUNROOF, am,fm,cd,tape, DUEL HEATED SEATS, steering wheel controls, MUST SEE TO APPRECIATE!!!!! 704-603-4255
Volvo, 2001 V70 Wagon. Black w/ gray leather interior 2.4 five cylinder turbo backed with auto trans, duel pwr seats, sunroof, all pwr options, extra clean needs nothing!! 704-603-4255
Hurley School Rd area, 2BR/1BA, nice subdiv, large yard, water incl'd, $410/mo 704-640-5750
S. Rowan area. 1BR, appliances, water, dumpster. No pets. $385/mo + dep. 704-857-9250
Troutman Motor Co. Highway 29 South, Concord, NC 704-782-3105
Want to sell quickly? Try a border around your ad for $5!
Faith. 2BR, 1BA. Water, trash, lawn maint. incl. No pets. Ref. $425. 704-2794282 or 704-202-3876
Gold Hill, 2 bedroom, trash and lawn service included. No pets. $450 month. 704-433-1255
Suzuki, 2003, Intruder. 800cc. Silver. Excellent condition. Only 4,000 mi. Call 704-637-5117 or 704-754-2258
Transportation Financing
Faith 2BR/1BA, $375/mo + dep. 2BR/2BA Kannapolis $475/mo. + dep. No pets. 704-239-2833
Faith. Very nice double wide 3B, 2BA w/ garage. $700 + deposit. No pets. 704-279-8428
Trucks, SUVs & Vans
TEAM CHEVROLET, CADILLAC, BUICK, GMC. 704-216-8000
Manufactured Home for Rent 950 Briggs Rd. 2BR, 1BA. No yard maint. Low util., priv. $500/mo. + dep. 2 person limit. 704-637-3939
Transportation Dealerships
ELLIS AUTO AUCTION 10 miles N. of Salisbury, Hwy 601, Sale Every Wednesday night 6 pm.
MILLER HOTEL Rooms for Rent Weekly $110 & up 704-855-2100
Warehouse space / manufacturing as low as $1.25/sq. ft./yr. Deposit. Call 704-431-8636
Kannapolis. Rent-to-own mobile homes. Model year 2007. $525 down, $525/mo. 704-933-2652
Salisbury, 716 N. Fulton, 4BR, $600/mo. 428 E. Council 3BR, $450/mo. 704-645-9986
SALISBURY POST
CLASSIFIED
Nissan Frontier, 2007 crew cab, Black with grey cloth interior, 4.0, V6, auto trans, am,fm,cd, NONSMOKER, cold ac, storage gate, RUNS & DRIVES GREAT!!!!! 704-603-4255. good until Coupon 9/30/10. 704-245-3660
Kia, 2008, Amonte. Silver/grey. Only 19,000 mi. Excellent condition. Amonte no longer produced. Call 704-6375117 or 704-754-2258
Ford XLT 1993, super cab, one owner, excellent condition, low mileage. $4,000. 704-637-9407
Ford, 2000, Ranger XLT. 4 door. Automatic, cruise, tilt, CD player, power windows, power locks. Very clean! $5,295. 704637-7327
Toyota Tundra Sr5, 2007, crew cab 2WD. Silver sky metallic w/grey cloth int., 4.7, V8, auto trans. AM/FM/CD, all power, towing pkg, non smoker, low mile, Extra Clean! 704603-4255
BATTERY-R-US
Wholesale Not Retail If it's a battery, we sell it! We Buy Old Batteries! Faith Rd. to Hwy 152 Store across from Sifford's Marathon 704-213-1005
Honda 50, 2001, Dirtbike. FOR SALE .... NO TRADES. Runs great, son has out grown. Comes with training wheels. 704-202-1776
Chevy, 1999 Silverado 2500 hd extended 6.0 engine auto trans, am/fm radio, lighted running boards, camper top, towing pkg. 73,628 LOW MILES for this vehicle!! 704-603-4255
Mercedes ML320, 1998 Onyx Black, Dk Grey interior, 3.2 V6 auto trans, all power, DUAL HEATED LEATHER SEATS, alloy rims wrapped in good tires, SUNROOF, runs & drives awesome!! 704603-4255
Ford, 2004, Ranger XLT. 4 door. Automatic with automatic door locks, power windows, cruise, tilt. 50,000 miles. Extra, extra clean. $7,495. Call 704-637-7327 $5 off with ad NEED CASH? We buy cars & scrap metal by the pound. Call for latest prices. Stricklin Auto & Truck Parts. Call 704-278-1122 or 888-378-1122
Transportation Dealerships CLONINGER FORD, INC. “Try us before you buy.” 511 Jake Alexander Blvd. 704-633-9321
Toyota, 2002 Sienna XLE LOADED! Grey leather seats, 3.0 V6 back with auto trans, tape, cd changer, all pwr. Duel heated seats, sunroof low price what more could you ask for! 704-603-4255
Want to Buy: Transportation Ford, 2007 Escape Brown on Grey cloth interior 3.0 V6 auto trans, am, fm, cd, SUNROOF, all power ops, luggage rack READY FOR TEST DRIVE!!! 704-603-4255
DONATED passenger van or bus needed for formed Youth newly Group. Call Pastor Rob at 980-721-3371. Thanks for letting your love shine!
SUNDAY, OCTOBER 17, 2010
It's your Birthday! Happy Birthday Jeff Watkins. Have a blessed day and hope you have many more. Luv Valarie D. Watkins Happy Birthday Marlene. Love Dad and Deb
We want to be your flower shop! JUST ADDED FOR 2010...NEW WATERSLIDE!
Happy Birthday Marlene, Don and Susie
We love you, Richard, Brandon, Justin and Joseph
Happy Birthday to Jeff Watkins, my cool dad! Have fun on your special day. Luv Jay Jay
EXIT 76 WEST OFF HWY 85!
THE HONEYBAKED HAM CO. & CAFE 413 E. Innes St., Salisbury of Salisbury 704-633-1110 • Fax 704-633-1510 HONEYBAKED HAM CLASSIC SANDWICH
4.99
W/CHIPS & DRINK
$
Must present ad. Not valid w/any other offer. Exp. 10/31/10
• Birthdays • Community Days
WHATEVER THE OCCASION… GIVE YOUR KIDS SOME JOY!
At Shear Angels Salon ONLY
35
$
1 FULL HOUR
5.00
MASSAGE TREATMENT
OFF
Meggan M. Alexander
1/2 Ham
520 Faith Road Salisbury
Team Bounce
FUN
We Deliver Parties, Church Events, Etc.
MawMaws Kozy Kitchen
SATURDAY 11-4 ....BUY 1 FOOTLONG GET 1 FREE
Hamburger, Fries & Tea ................$4.99
Every Night Kids Under 12 eat for 99¢ with 2 paying Adults PATTY MELT & FRIES $5.99
Thurs-Fri
CHICKEN & DUMPLINGS $5.99
25¢ 704-202-6200
limit 10
5550 Hwy 601 • Salisbury, NC 28147 • 704-647-9807 HOURS: Mon, Tues, Thurs, Fri, Sat: 11AM-8PM Wednesday 11AM-3PM • Closed on Sundays S46245
FOR FREE BIRTHDAY GREETINGS Please Fax, hand deliver or fill out form online
18 WORDS MAX. Number of free greetings per person may be limited, combined or excluded, contingent on space available.
Fax: 704-630-0157 In Person: 131 W. Innes Street Online: (under Website Forms, bottom right column)
LMBT#9438
(8 lbs. or more) Coupon expires 10/31/10 Not valid with any other coupon.
S40137
WINGS – ALL DAY MON. & TUES.
Pure Life Massage & Bodywork of Salisbury
Hours: Mon-Fri: 10-7; Sat 10-6; Sun 11-2
$
704 202-5610 WE DELIVER!
1628 West Innes St. Salisbury, NC • 704-633-5310
S44995
S47771
Inflatable Parties
Hours of daily personal attention and doggie fun at our safe 20 acre facility. Professional homestyle boarding, training, and play days with a certified handler/trainer who loves dogs as much as you do.
Salisbury Flower Shop
S38321
S45001
KIDS OF JOY
S46958
Happy Birthday to a man who will always have my back, no matter what, I LOVE YOU, Daddy-O: Jeff Watkins! Princess SieLooky Looky Marlene is 40
Birthday? ...
S45263
Happy Birthday Jeff Watkins. Pray that you have many more. Love Phyllis Houston
Happy Birthday Marlene, you have become a beautiful woman, Love Mom
704-797-0064 Expires Nov 15, 2010
The Salisbury Post reserves the right to edit or exclude any birthday submission. Space is limited, 1st come 1st served, birthdays only. Please limit your birthday greetings to 4 per Birthday.
SALISBURY POST SUNDAY EVENING OCTOBER 17, 2010 A
SUNDAY, OCTOBER 17, 2010 • 9C
TV/HOROSCOPE
6:30
7:00
7:30
A - Time Warner/Salisbury/Metrolina
8:00
8:30
9:00
9:30
10:00
10:30
11:00
11:30
The Amazing Race 17 (N) (In Undercover Boss CEO cleans a CSI: Miami A blind man hears a News 2 at 11 (:35) Criminal Stereo) Å plane’s lavatory. (N) Å girl’s abduction. (N) Å (N) Å Minds Å The Amazing Race 17 “We Should Undercover Boss “Frontier CSI: Miami “See No Evil” A blind WBTV 3 News (:20) Point After 60 Minutes (N) (In Stereo) Å Have Brought Gloves and Butt Airlines” CEO cleans a plane’s lava- man hears a girl’s abduction. (N) (In at 11 PM (N) With D and D Pads” (N) Å tory. (N) (In Stereo) Å Stereo) Å (4:00) NFL Football Dallas The OT (In MLB Baseball TBA at Philadelphia Phillies. National League Championship Series, Game 2. From Citizens FOX 8 10:00 News (N) Cowboys at Minnesota Vikings. (In Stereo Live) Å Bank Park in Philadelphia. (In Stereo Live) Å Stereo Live) Å ABC World America’s Funniest Home Videos Extreme Makeover: Home Edition Desperate Housewives Gabrielle (:01) Brothers & Sisters “A Eyewitness (:35) Hot Topic shares her secret. (N) (In Stereo) Righteous Kiss” Holly breaks down. News Tonight (Live). News Sunday A man has a run-in with a squirrel. “Arboleda Family” Man battles Å (N) Å (N) (In Stereo) Å childhood obesity. (N) (N) (In Stereo) Å (N) Å NBC Nightly Football Night in America Bob (:15) NFL Football Indianapolis Colts at Washington Redskins. From FedEx Field in Landover, Md. (In Stereo Live) Å WXII 12 News at News (N) (In Costas and others recap the day’s 11 (N) Å Stereo) Å NFL highlights. Å (4:00) NFL Football Dallas The OT (In MLB Baseball TBA at Philadelphia Phillies. National League Championship Series, Game 2. From Citizens Fox News at Fox News Got Cowboys at Minnesota Vikings. (In Stereo Live) Å Bank Park in Philadelphia. (In Stereo Live) Å 10 (N) Game Stereo Live) Å NBC Nightly Football Night in America Bob (:15) NFL Football Indianapolis Colts at Washington Redskins. From FedEx Field in Landover, Md. (In Stereo Live) Å NewsChannel News (N) (In Costas and others recap the day’s 36 News at Stereo) Å NFL highlights. Å 11:00 (N) (:00) Healthwise Cancer Story “New Directions” NOVA (In Stereo) Å (DVS) Secrets of the Dead “Michelangelo World War II in HD Colour Rise of World War II in HD Colour Clinical trials. Å militaristic dictators. Å Blitzkrieg operations. Å Revealed” (In Stereo) ABC World ACC Football N.C. State America’s Funniest Home Videos Extreme Makeover: Home Edition Desperate Housewives Gabrielle (:01) Brothers & Sisters Holly News Sunday (N) (In Stereo) Å “Arboleda Family” (N) - Impact shares her secret. (N) Coaches Show breaks down. (N) Å American Dad Family Guy (In Family Guy (In Movie: ››› “WarGames” (1983) Matthew Broderick, Dabney WJZY News at (:35) N.C. Spin (:05) NCSU Tim McCarver Stereo) Å Stereo) Å Coleman, Ally Sheedy. Å 10 (N) Coaches Show Show (:00) The Unit Without a Trace “Penitence” NUMB3RS “Provenance” Å Deadliest Catch Å Triad Today According-Jim Jack Van Impe Paid Program (:00) The Unit Tyler Perry’s Tyler Perry’s Stories of Seinfeld “The That ’70s Show That ’70s Show George Lopez George Lopez Seinfeld “The Frasier Crane “E.I.? E.I. OH.” “Prescription for Suicide” (In “Every Step You House of Payne House of Payne Honor Red Dot” (In (In Stereo) Å “Eric’s Burger brothers buy a Stereo) Å Take” Stereo) Å Job” Trouble” restaurant. Å Å Å Wild! “The Nature of Aggression” Nature “Echo: An Elephant to Masterpiece Mystery! “Wallander II: The Fifth My Heart Will PBS Previews: EastEnders (In EastEnders (In Aggressive behavior in wildlife. Å Remember” The elephant matriarch Woman” Trail of a serial killer. (In Stereo) Å Always Be in Circus Å (DVS) Stereo) Å Stereo) Å Echo. Å (DVS) (DVS) Carolina 60 Minutes (N) (In Stereo) Å
CABLE CHANNELS A&E
36 Paranormal State 66 76 46
HIST
65
INSP
78
LIFE
31
LIFEM
72
MSNBC NGEO
50 58
NICK
30
OXYGEN SPIKE SPSO
62 44 60
SYFY
64
TBS
24
TCM
25
TLC
48
TNT
26
TRU
75
TVL
56
USA
28
WAXN
2
WGN
13
Paranormal Paranormal Paranormal State West Virginia Paranormal Paranormal Psychic Kids: Children of the Psychic Kids: Children of the State Å State Å State Penitentiary. Å State Å State (N) Å Paranormal “Banishing Evil” Paranormal “Crossing Over” (:00) Movie: ››› “The Sum of All Fears” (2002) Ben Affleck, Morgan Freeman, James Rubicon Will demands the truth Mad Men “Tomorrowland” (Season (:02) Mad Men “Tomorrowland” Å Cromwell. Å from Truxton. Å Finale) (N) Å Monsters I Shouldn’t Be Alive (In Stereo) Fatal Attractions (In Stereo) I Shouldn’t Be Alive Å The Haunted (N) (In Stereo) I Shouldn’t Be Alive (In Stereo) (5:30) Movie: “The Wood” Å 2010 BET Hip Hop Awards Å Top 10 Rappers Å Terry Kennedy W.- Ed Gordon Trey Songz Housewives To Be Announced Housewives/Atl. Housewives/Atl. Real Housewives/Beverly Law & Order: Criminal Intent 90 Days! Diabetes Life Wall Street How I Made My Millions CNBC Titans “Hugh Hefner” Porn: Business of Pleasure Crime Inc.: Counterfeit Goods Newsroom Newsroom State of the Union Larry King Live Newsroom State of the Union Life “Creatures of the Deep” Deep- Life “Insects” Insects outnumber all Life “Primates” Primates have (:00) Storm Life Plants depend on sunlight, Life “Creatures of the Deep” Deepother species. Å sea marine invertebrates. Chasers Å water and nutrients for survival. learned to thrive. Å sea marine invertebrates. Jonas L.A. “Boat Jonas L.A. Wizards of Jonas L.A. Sonny With a Good Luck Sonny With a Sonny With a Sonny With a Sonny With a Good Luck Charlie Chance Waverly Place Trip” Charlie Chance Å Chance Chance Chance (:00) 15 Unforgettable Hollywood Tragedies Kardashian Kardashian Kardashian Kardashian Kardashian The Soup Fashion Police Chelsea Lately Baseball SportsCenter (Live) Å (:15) BCS Countdown (Live) Top Moments NBA Tonight Roundtable Special (Live) SportsCenter (Live) Å Tonight Å Bull Riding 2010 Poker 2010 World Series of Poker 2010 World Series of Poker 2010 World Series of Poker 2010 World Series of Poker 2010 Poker “The Princess Movie: ››› “Ever After” (1998) Drew Barrymore, Anjelica Huston, Dougray Scott. Å Movie: ››› “Mean Girls” (2004) Lindsay Lohan, Rachel McAdams, Melissa & Joey Diaries” (2001) Tina Fey. Å (:00) College Football McNeese State at LSU. NHL Hockey Carolina Hurricanes at Vancouver Canucks. (Live) Postgame (5:00) Movie: Movie: ›‡ “The Waterboy” (1998) Adam Sandler, Kathy Bates, Henry Movie: ››› “Forgetting Sarah Marshall” (2008) Jason Segel, Kristen Bell, Mila Kunis. Sons of “Baby Mama” Winkler. Anarchy Fox News FOX Report Huckabee The Fight to Control Congress Geraldo at Large Å Huckabee PGA Tour Golf Golf Central LPGA Tour Golf CVS/pharmacy LPGA Challenge, Final Round. PGA Tour Golf Frys.com Open, Final Round. From San Martin, Calif. Wild Hearts Movie: “Thicker Than Water” (2005) Melissa Gilbert. Å Movie: “Mending Fences” (2009) Laura Leighton. Å Cheers Å Cheers Å Designed/Sell Hunters Int’l Holmes on Homes (N) Å House Hunters Hunters Int’l House Hunters Holmes on Homes Å Income Prop. Income Prop. IRT Deadliest Roads Lisa transi- IRT Deadliest Roads Rick and To Be IRT Deadliest Roads “Facing Swamp People The gators mysteri- MonsterQuest Killer bees invade Lisa take on The Ledge. Å tion; Alex hits two vehicles. the United States. Å Announced Fears” (N) Å ously stop biting. (N) Turning Point Victory-Christ Fellowship In Touch W/Charles Stanley Billy Graham Ankerberg Giving Hope Manna-Fest Amazing Facts Presents “Maternal Movie: “Bond of Silence” (2010) Kim Raver, Charlie McDermott, Greg Movie: “Reviving Ophelia” (2010) Jane Kaczmarek, Kim Dickens, Nick Movie: “Reviving Ophelia” (2010) Obsession” Å Grunberg. Å Thurston. Å Jane Kaczmarek. Å (:00) Movie: “The Devil’s Teardrop” (2010) Natasha Movie: “Diamonds” (2009) James Purefoy, Judy Davis, Derek Jacobi. The African diamond trade affects the lives of a ruthless businessman, his Henstridge, Tom Everett Scott. Å father, a U.S. senator, a model and an orphan. Å Caught Caught on Camera Children for Sale Vegas Undercover Raw 3 Sex Slaves: Minh’s Story To Catch a Predator Locked Up Border Wars Drugs, Inc. “Cocaine” Drugs, Inc. “Meth” Drugs, Inc. “Marijuana” Drugs, Inc. “Cocaine” George Lopez George Lopez The Nanny (In The Nanny “The Everybody Big Time Rush Victorious (In iCarly (In Stereo) My Wife and My Wife and Everybody Å Å Å Å Hates Chris Stereo) Å Kids Å Kids Å Hates Chris Stereo) Å Will” (:00) Snapped Snapped “Shannon Torrez” Snapped “Lynn Turner” Å Snapped “Renee Poole” Snapped “Martha Pineda” Snapped “Lynn Turner” Å (:00) CSI: NY CSI: Crime Scene Investigat’n CSI: Crime Scene Investigat’n CSI: Crime Scene Investigat’n CSI: Crime Scene Investigat’n CSI: Crime Scene Investigat’n At Home Spotlight Spurrier College Football South Carolina at Kentucky. College Football Iowa State at Oklahoma. Movie: “The Cursed” (2010) Costas Mandylor, Louis Mandylor, Brad Movie: ››‡ “The Ferryman” (2007) Kerry Fox, John Rhys-Davies, (5:00) Movie: Movie: ›› “The Reeds” (2009) “Ghost Town” Thornton. Å Sally Stockwell. Å Eli Marienthal. (5:15) Movie: ››‡ “The Matrix Revolutions: The Movie: ››‡ “The Hulk” (2003) Eric Bana, Jennifer Connelly, Sam Elliott. Å (:41) Movie: ››‡ “The Hulk” (2003) Eric Bana, IMAX Experience” (2003) Jennifer Connelly. Å Movie: ›› “The Young Don’t Cry” (1957) Sal Mineo, James (:00) Movie: ››› “Return From Witch Mountain” Movie: › “Crime in the Streets” (1956) John Cassavetes, James (1978) Bette Davis. Å Whitmore, Sal Mineo. Whitmore, J. Carrol Naish. Say Yes: Bliss Sister Wives (In Stereo) Å Sister Wives Sister Wives Sister Wives Sister Wives Sister Wives Sister Wives Sister Wives Sister Wives (:00) Movie: ›› “Failure to Launch” (2006) Movie: ››› “Hitch” (2005) Will Smith, Eva Mendes, Kevin James. Å (:14) Movie: ››› “Hitch” (2005) Will Smith, Eva Mendes, Kevin Matthew McConaughey. Å James. Å Police Video Cops Å Cops Å Cops Å Cops Å Cops Å Over the Limit Over the Limit Forensic Files Forensic Files Cops Å EverybodyEverybodyEverybodyThe Andy The Andy The Andy M*A*S*H Å M*A*S*H “Peace M*A*S*H “Lil” Å M*A*S*H Å EverybodyRaymond Raymond Raymond Griffith Show Å Griffith Show Å Griffith Show Å on Us” Raymond Law & Order: Special Victims Law & Order: Special Victims Law & Order: Law & Order: Special Victims Law & Order: Special Victims Law & Order: Special Victims Unit A child is poisoned. Å Unit Abuse in a celebrity family. Unit “Legacy” (In Stereo) Å SVU Unit “Bound” (In Stereo) Å Unit A student dies at a party. Cold Case Grey’s Anatomy Å House “Fetal Position” Å Eyewitness Inside Edition Heartland Å NUMB3RS Hijackers. Å Just Shoot New Adv./Old New Adv./Old How I Met Your How I Met Your How I Met Your How I Met Your WGN News at (:40) Instant Monk Monk attends his college Nine (N) Å Mother Mother Mother Mother Christine Me Å Christine Replay Å reunion. Å
PREMIUM CHANNELS Boardwalk Empire “Nights in Boardwalk Empire “Nights in Bored to Death Eastbound & Ballygran” (In Stereo) Å Down (N) Ballygran” (N) (In Stereo) Å (N) “The Limits of Real Time With Bill Maher (In Bored to Death Movie: ››› “The Blind Side” (2009) Sandra Bullock, Tim McGraw, The Blind Side Movie: ››› “Panic Room” Å Control” (2009) Stereo) Å Quinton Aaron. (In Stereo) Å (2002) Jodie Foster. Movie: ››› “The Last Samurai” (:15) Movie: ››‡ “Yes Man” (2008) Jim Carrey. (In In Treatment Å In Treatment Å Movie: ›› “Fighting” (2009) Channing Tatum, Making: The Stereo) Å Terrence Howard. (In Stereo) Å Lovely Bones (2003) Å (:35) Movie: ›› “Cirque du Freak: The Vampire’s Assistant” (2009) Movie: ›››‡ “Fantastic Mr. Fox” (2009) Voices of Movie: ››› “Twelve Monkeys” (1995) Bruce Willis, Madeleine John C. Reilly, Ken Watanabe. (In Stereo) Å George Clooney. Å Stowe, Brad Pitt. (In Stereo) Å Dexter “Beauty and the Beast” (:15) Movie: “The Vicious Kind” (2009) Adam Scott, Dexter “Practically Perfect” (iTV) Weeds “Gentle The Big C (iTV) Dexter “Beauty and the Beast” Dexter must save a life. Å Å Dexter hires a nanny. Brittany Snow, Alex Frost. iTV. Puppies” (iTV) Dexter must save a life.
››‡ “The Lovely Bones” (2009) Mark Wahlberg, Rachel Weisz, Susan 15 Movie: Sarandon. (In Stereo) Å
HBO2
302
HBO3
304
MAX
320
SHOW
340
Rapper T.I. headed back to prison for 11 months ment,” Pannell told T.I. The. “We his release earlier this year, he was ordered not to commit another federal, state or local crime while on supervised release, or
R126803
to illegally possess a controlled substance. He was also told to take at least three drug tests after his release and to participate in a drug and alcohol treatment program..” Earlier this week, Atlanta po-
lice said T.I. helped them talk.”
FISH DAY!!! NOW IS THE TIME FOR STOCKING!
MY SOUL TO TAKE (R)* CASE 39 (R) 11:25 2:00 4:35 7:10 9:55 11:30 2:10 4:45 7:15 10:05 DEVIL (PG-13) RED (PG-13) * 12:30 2:40 4:55 7:30 9:30 1:05 4:05 6:40 9:20 EASY A (PG-13) SECRETARIAT (PG)* 11:45 2:05 4:20 6:45 9:05 12:55 4:00 7:00 9:50 JACKASS (3D)(R)* SOCIAL NETWORK (PG-13) 12:05 2:25 4:45 7:05 9:25 1:00 4:10 6:55 9:45 LEGEND OF THE GUARDIANS: THE TOWN (R) THE OWLS OF GA'HOOLE (PG) 12:45 3:35 6:25 9:15 11:50 2:25 4:50 7:25 10:10 WALL STREET 2 (PG-13) LET ME IN (R) 12:25 3:30 6:30 9:25 12:50 4:15 7:20 10:00 LIFE AS WE KNOW IT (PG-13)* YOU AGAIN (PG) 11:40 2:15 4:40 7:05 9:35 1:15 3:55 6:50 9:40 Times are good through Sunday Only
In Rockwell, NC From: 8 - 9 am
In China Grove, NC From: 2:15 - 3:15 pm
Today’s celebrity birthdays Actress Julie Adams (“Creature From the Black Lagoon”) is 84. Country singer Earl Thomas Conley is 69. Singer Jim Seals of Seals and Crofts is 68. Singer Gary Puckett of Gary Puckett and the Union Gap is 68. Drummer Michael Hossack of The Doobie Brothers is 64. Actor Michael McKean is 63. Actress Margot Kidder is 62. Actor George Wendt is 62. Country singer Alan Jackson is 52. Actor Grant Shaud (“Murphy Brown”) is 50. Animator Mike Judge is 48. Comedian Norm Macdonald is 47. Singer Rene’ Dif (Aqua) is 43. Reggae singer Ziggy Marley is 42. Singer Chris Kirkpatrick of ‘N Sync is 39. Rapper Eminem is 38. Singer Wyclef Jean of The Fugees is 38. Actress Sharon Leal (“Boston Public”) is 38.
VOTE FOR
Harry Warren House of Representatives District 77 National Federation of Independent Business North Carolinians for Free and Proper Elections North Carolina Right to Life, Inc.
THURS., OCTOBER 28, 2010 Rockwell Feed Service Goodman Farm Supply
United FeatUre Syndicate
Conservative Republican – Endorsed by:
Channel Catfish • Largemouth Bass Redear • Bluegill (BREAM) • Minnows Black Crappie (IF AVAIL) • Grass Carp • Koi Steele Feed & Seed In Mt. Ulla, NC From: 4 - 5 PM
TO PLACE AN ORDER CALL
1-800-247-2615
R126783
ATLANTA (AP) —Constitution reported. The Associated Press was relying on information from the newspaper because the judge closed the courtroom after it was filled and several media outlets including AP were not allowed inside. experi-
The desire to travel and acquire knowledge from personal experiences is something that’s always with you, and it’s likely to be even more prevalent in upcoming months. You’ll find the means and avenues to satisfy these urges. Libra (Sept. 23-Oct. 23) — It behooves you to keep your day as unstructured as possible, because social happenings that aren’t prearranged are likely to turn out to be the most fun. Hang loose and see what happens. Scorpio (Oct. 24-Nov. 22) — Plan something to do with the family that you know everyone will enjoy, even if it is as simple as making some popcorn or inviting some friends over. Sagittarius (Nov. 23-Dec. 21) — Don’t waste the fact that you are a fast thinker and that your ideas are likely to be ingenious. Be ready to apply your sharp mind to a number of productive uses. Capricorn (Dec. 22-Jan. 19) — There are strong possibilities that the day could turn out to be a profitable one, which you will have little to do with bringing about. It could happen through a strange chain of events. Aquarius (Jan. 20-Feb. 19) — Strive to initiate some fun happenings instead of just hanging back in the rear ranks. You’ll have little trouble convincing your peers that you belong at the head of the pack. Pisces (Feb. 20-March 20) — You can trust any judgment calls you have to make because they will be predicated upon your excellent deductive reasoning, as well as your intuitive perceptions. They’ll be right on the money. Aries (March 21-April 19) — Be careful when meeting new people, because you tend to be a bit more gullible than usual and could be subject to being taken in on someone’s latest deception or scheme. Taurus (April 20-May 20) — Don’t give up too quickly on achieving something you want. Although things might not go as you had hoped, victory can be had even after a struggle. Gemini (May 21-June 20) —You might be the recipient of some unusual but heartwarming information. What you learn could actually fit into something that you’ve been hoping would happen. Cancer (June 21-July 22) — Your attention may be drawn to some kind of hidden factor in your life, which will make you want to learn more about what makes you tick in certain instances. It’ll be worthy of further investigation. Leo (July 23-Aug. 22) — There’s a good chance that you could get an opportunity to make a new friend, one with whom you will be able to share many common interests. Be responsive to people you meet. Virgo (Aug. 23-Sept. 22) — Get your thinking cap working overtime. An ingenious idea you come up with may be of great interest to someone whom you would like to impress. It’ll be your ticket to getting close to him/her.
R122513
HBO
Sunday, Oct. 17
FARLEYS ARKANSAS PONDSTOCKERS, INC.
Paid for by Harry WarrenNC77 - Melissa Hill Treasurer
R125129
10C • SUNDAY, OCTOBER 17, 2010
SALISBURY POST
W E AT H E R
WITH EVERY NEW GM VEHICLE PURCHASED FROM TEAM THIS WEEKEND WE’LL MAKE A $100 DONATION TO THE SUSAN G. KOMEN BREAST CANCER FOUNDATION. N E W 2 011 C H E V R O L E T
40 MILES PER GALLON!
CRUZE LS s YR -ILE WARRANTY s 4URN BY 4URN .AVIGATION s YR 2OADSIDE ASSISTANCE s YR #OURTESY TRANSPORTATION s "LUETOOTH 4ECHNOLOGY s 53" | https://issuu.com/salisburypost/docs/10172010-sls-a01 | CC-MAIN-2021-17 | refinedweb | 48,522 | 75.3 |
# Alex' Thoughts 05/10/18
## Pleroma.Web.ActivityPub
This could be a completely independent library.
Maybe it is a good idea to keep separate ActivityStream (vocabulary and schemas) from ActivityPub (protocol and notifications).
I don't know if schema `Notification` should live in any library.
Specs talk about notifications but it isn't an object or something similar.
### Inbox & Outbox current implementation
I thought it could be like "InboxItem" in FunkWhale implementation:
`InboxItem` table could be a really good idea.
`Inbox` is a term very clear and specific in the ActivityPub specification,
and furthermore, it would be possible to implement an generic "Inbox" get.
However, it seems we don't implement `Inbox` external `get`s or "Outbox" internal `post`s:
Checking how a message is sent from external server to an actor's `Inbox` I discovered we only support:
* `Create` Activity types for
* `Article`, `Note` & `Video` Object type
* `Follow` Activity type.
* `Accept` (follows?)
* `Reject` (follows?)
* `Like`
* `Announce`
* `Update`
* `Person`, `Application`, `Service`, `Organization`
* `Delete`
* `Undo`
* `Announce`, `Follow`, `Block`, `Like`
* `Block`
We'll have to implement all of them.
This is going to be really hard to make generic or to add hooks to the possible specific application.
Secondly, reading the actor's `Outbox` it seems we are not sending the actor's activity,
we are sending actor's profile:
* summary
* name
* following list
* etc
ActivityPub specs says:
>>>.
>>>
So this has to be fixed.
I still don't know if `Notification` in our code would be similar to `InboxItem`,
but a good idea at least for ActivityPub library.
### Pleroma.Web.ActivityPub.Transmogrifier
The code around the `Inbox` implementation is in this module.
I didn't know what this module does but it has a little bit of doc:
> A module to handle coding from internal to wire ActivityPub and back.
It has difficult to understand function names like `fix_object` which doc says:
> Modifies an incoming AP object (mastodon format) to our internal format.
We have to split this module better.
For a generic library we should have any code related to Mastodon or any other app.
Of course, it is going to be very useful to have a mapper from external to internal data.
We have to find a better name.
# Alex' Thoughts 04/10/18
## Applications and Libraries
What is a Elixir/Erlang application, from elixir docs:
>>> lifecycle. Applications are loaded, started, and stopped.
>>>
We currently have only a single application, Pleroma.
I don't think we need more in the short or medium term.
However, we should split `lib/pleroma` directory in at least two directories:
* `lib/pleroma` where will live the core of our application
* `lib/pleroma_web` where will live the phoenix stuff
This is the new convention in Phoenix.
It tries to split the application logic and the web interface.
The web is an interface, but any application could have more than one.
We could add a command line interface or GraphQL API.
If we keep the logic in the web, reusing code will be much harder.
In later steps we could add more directories, and therefore, more decoupling.
So `lib/pleroma` will be a real application.
It will define an `Application` module.
However, `lib/pleroma_web` does not define an `Application` module,
it won't load, start and stop.
This will be done by `Pleroma`,
so `PleromaWeb` should not be called `application`.
In absence of a better terminology, we'll name it "library".
So, `PleromaWeb` will receive HTTP request from clients and other servers and
it will make calls to `Pleroma` application.
This means `Pleroma` should know nothing about HTTP
and `PleromaWeb` should know nothing about Repo or databases.
The main task `PleromaWeb` will be "translate" Pleroma terminology and send it using HTTP protocol.
# Contexts
It is interesting that currently we are not using contexts, at least, as explained in Phoenix.
The current convention of Phoenix would be:
```
lib
├── pleroma_web
│ ├── channels
│ │ └── user_socket.ex
│ ├── controllers
│ │ ├── page_controller.ex
│ │ └── user_controller.ex
│ ├── endpoint.ex
│ ├── gettext.ex
│ ├── router.ex
│ ├── templates
│ │ ├── layout
│ │ │ └── app.html.eex
│ │ ├── page
│ │ │ └── index.html.eex
│ │ └── user
│ │ ├── edit.html.eex
│ │ ├── form.html.eex
│ │ ├── index.html.eex
│ │ ├── new.html.eex
│ │ └── show.html.eex
│ └── views
│ ├── error_helpers.ex
│ ├── error_view.ex
│ ├── layout_view.ex
│ ├── page_view.ex
│ └── user_view.ex
└── pleroma_web.ex
```
I think current convention in Phoenix is bad and it is an inheritance of Ruby on Rails.
I prefer to create contexts,
very similar to what we are doing the now in:
```
lib/pleroma/web
├── mastodon_api
│ ├── mastodon_api_controller.ex
│ ├── mastodon_api.ex
│ ├── mastodon_socket.ex
│ └── views
│ ├── account_view.ex
│ ├── filter_view.ex
│ ├── list_view.ex
│ ├── mastodon_view.ex
│ └── status_view.ex
├── oauth
│ ├── app.ex
│ ├── authorization.ex
│ ├── fallback_controller.ex
│ ├── oauth_controller.ex
│ ├── oauth_view.ex
│ └── token.ex
├── ostatus
│ ├── activity_representer.ex
│ ├── feed_representer.ex
│ ├── handlers
│ │ ├── delete_handler.ex
│ │ ├── follow_handler.ex
│ │ ├── note_handler.ex
│ │ └── unfollow_handler.ex
│ ├── ostatus_controller.ex
│ ├── ostatus.ex
│ └── user_representer.ex
├── router.ex
```
Keeping this in mind, it is very interesting to read the (Phoenix documentation about this)[]
The main point is not creating too many applications or libraries just to separates concerns or application logic.
A context has a public API which should be used by other modules or applications, ie:
* `Pleroma.Actors` is a context main module and it is where the public API.
* `Pleroma.Actors.create(params)`
* `Pleroma.Actors.find_by(params)`
* `Pleroma.Actors.send_notification(actor, notification)`
This context could have internal modules, ie:
* `Pleroma.Actors.Actor # Schema`
* `Pleroma.Actors.Finders # Queries`
* `Pleroma.Actors.CreateCommand # Logic to create an Actor`
Those internal modules should not be used directly by an external contexts and they should not have documentation.
Contexts can talk each other.
In fact different libraries could share context name, ie:
* When `PleromaWeb.Actors.Controller` receives a new registration request and it will call `Pleroma.Actors.create_actor(params)`
However, sometimes we need to use different context in the same time.
Imagine we add new context: `Pleroma.Statistics`
So anytime a user is created we should call: `Pleroma.Statistics.new_registration(actor)`
If we make this call from `PleromaWeb.Actors.Controller` we can forget to add it in a future interface.
In this case, the appropriate way is to create a new function in the application level:
```
defmodule Pleroma do
def create_actor(params)
with {:ok, actor} <- Pleroma.Actors.create(params),
:ok <- `Pleroma.Statistics.new_registration(actor) do
{:ok, actor}
end
end
end
```
The `Pleroma` application is in charge of making the call between different contexts.
This could turn in a mess very quickly.
Too many big functions in the `Pleroma` module, which is the Public API for the application.
Well, we can just create helper modules like: `Pleroma.CreateActor`.
We can move this function and private helpers functions to this module.
So the only responsibility is to create the actor.
And of course it will be a private module:
```
defmodule Pleroma do
@doc """wherever"""
def create_actors(params), do: Pleroma.CreateActor.run(params)
end
defmodule Pleroma.CreateActor do
@moduledoc false
def run(params) do
...
end
end
```
This means no documentation at all.
The doc should be in the Contexts (if they are publics) or in `Pleroma` module.
### Contexts for Pleroma
* `Pleroma.Invitations` deals with Invitations
* `Pleroma.ActivityStream` has `Activity`, `Actor`, etc. schemas
* Think about if it makes sense to split `ActivityPub` and `ActivityStream` | https://gitlab.com/CommonsPub/Server/blame/documentation/arch.md | CC-MAIN-2019-18 | refinedweb | 1,171 | 50.23 |
KDEUI
#include <ktoolbarpopupaction.h>
Detailed Description
This action is a normal action everywhere, except in a toolbar where it also has a popupmenu (optionally delayed).
This action is designed for history actions (back/forward, undo/redo) and for any other action that has more detail in a toolbar than in a menu (e.g. tool chooser with "Other" leading to a dialog...).
In contrast to KActionMenu, this action is a simple menuitem when plugged into a menu, and has a popup only in a toolbar.
Use cases include Back/Forward, and Undo/Redo. Simple click is what's most commonly used, and enough for menus, but in toolbars there is also an optional popup to go back N steps or undo N steps.
Definition at line 48 of file ktoolbarpopupaction.h.
Constructor & Destructor Documentation
Create a KToolBarPopupAction, with a text, an icon, a parent and a name.
- Parameters
-
Definition at line 50 of file ktoolbarpopupaction.cpp.
Destroys the toolbar popup action.
Definition at line 57 of file ktoolbarpopupaction.cpp.
Member Function Documentation
Reimplemented from.
- See also
- QActionWidgetFactory.
Reimplemented from QWidgetAction.
Definition at line 70 of file ktoolbarpopupaction.cpp.
The popup menu that is shown when clicking (some time) on the toolbar button.
You may want to plug items into it on creation, or connect to aboutToShow for a more dynamic menu.
- Deprecated:
- use menu() instead
Definition at line 64 of file ktoolbarpopupaction.cpp.
If set to true, this action will create a delayed popup menu when plugged in a KToolBar.
Otherwise it creates a normal popup. Default: delayed.
Definition at line 105 of file ktoolbarpopupaction.cpp.
If set to true, this action will create a sticky popup menu when plugged in a KToolBar.
"Sticky", means it's visible until a selection is made or the mouse is clicked elsewhere. This feature allows you to make a selection without having to press and hold down the mouse while making a selection. Only available if delayed() is true. Default: sticky.
Definition at line 115 of file ktoolbarpopupaction.cpp.
Returns true if this action creates a sticky popup menu.
- See also
- setStickyMenu().
Property Documentation
Definition at line 51 of file ktoolbarpopupaction.h.
Definition at line 52 of file ktoolbarpopupaction. | https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKToolBarPopupAction.html | CC-MAIN-2019-30 | refinedweb | 366 | 51.55 |
#1 Members - Reputation: 128
Posted 05 November 2012 - 09:58 AM
I have been reading a book on C# for a while now and i think im beginning to have a somewhat rudimentary understanding of how it works, but so far the only things i have learned are console applications and different ways of making fancy methods and stuff. Before C# i learned Dark Basic mainly by trial and error by doing small graphics programs that looked cool.
So to the point. How do i do small graphics programs in C#? In Basic there are commands like line(x1,y1,x2,y2,color) and i assume that such stuff doesnt exist in C# so how do i do this? I checked the book and it only tells me how to use C#, not how to actually do things with it that anybody would like to use.
Thank you
#2 Crossbones+ - Reputation: 3726
Posted 05 November 2012 - 10:55 AM
not how to actually do things with it that anybody would like to use.
Even in games, graphical output is a very small percentage of the entire program. Knowing how to solve problems and make the code do what you want is what people want to use.
That said, the System.Drawing namespace has some things to do that. Not great things, and not things that can be used too much for games; but enough to get your feet wet. After that, you'll need to pick and use some API dedicated to graphical rendering. But learn the language first. It'll give you a good foundation once you start trying to use the APIs.
#3 Crossbones+ - Reputation: 4484
Posted 05 November 2012 - 12:29 PM
2. In the file "Form1.cs", add the following method:
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.DrawLine(Pens.Black, 0, 0, 100, 100); }
(This assumes you're using some version of Visual Studio)
If you've never written a WinForms app in Visual Studio before, you will have to right click on the Form1.cs item in the solution explorer and select "View Code" in order to view the C# (by default it will display the visual form designer).
ProTip: You can use the code viewer by default by right clicking Form1.cs, clicking "open with...", selecting "CSharp Editor", and clicking "Set as Default".
Edited by Nypyren, 05 November 2012 - 12:34 PM.
#4 Members - Reputation: 633
Posted 05 November 2012 - 01:20 PM
But c# is more like a general purpose language so it doesn't have a nice graphics tool designed for game.
You should start looking at XNA after getting comfortable with C#
Edited by lride, 05 November 2012 - 01:32 PM.
#5 Members - Reputation: 128
Posted 05 November 2012 - 03:07 PM
@ Telastyn : I know, but i just think that doing programs that you are interseted in is a good way to learn the language, instead of just doing endless examples of different method attributes etc. that just show you what it does. Of course this would only help me get comfy with C# basics as it is not like i would ever come up with something like abstracts or such except by reading it in the book. System.Drawing, okay thanks, but how do i use them, i cant just draw a line in the console. Are they used on windows forms?
@Nypyren : Thanks! will try it out
@Iride : Yeah, thats why i moved to C# from Basic.
#6 Members - Reputation: 141
Posted 06 November 2012 - 02:19 AM
#7 Crossbones+ - Reputation: 3159
Posted 06 November 2012 - 01:19 PM
It sounds as though you are a few months from getting good simple results from the graphics engine of your choice, probably by an existing game development system like XNA.
After you are good at basic programs, worked with XNA for a while, then look at SharpDX or MonoDevelop/Mono. Knowing that the communities which support these development environments have the knowledge and experience is your key, so once you get there put the key in the proverbial hole and open it.
><<
#8 Crossbones+ - Reputation: 3726
Posted 06 November 2012 - 02:07 PM
i just think that doing programs that you are interseted in is a good way to learn the language
And I think that having seen beginners bite off more than they can chew for more than a decade now, you should err towards getting a good foundation. | http://www.gamedev.net/topic/633946-lines/ | CC-MAIN-2014-49 | refinedweb | 745 | 68.3 |
Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
You can subscribe to this list here.
Showing
1
results of 1
Hello,
I'm a fairly naive user of Java Development Environments: I'm a technical
writer, not a developer. I'd like to use JDEE and Emacs to contribute
Javadoc documentation to our large library of Java sourcecode at work. Our
entire Java source environment is self contained into two directories: let's
call them /src/Java/Applications/com/myCompany/etc/etc and
/src/Java/Platform/com/myCompany/etc/etc.
I have JDEE 2.4.0.1 installed and it seems to be loading fine.
However, I can't get the code browsing features to work: when I open one
file, I'd like to be able to "hop to" another file to follow definitions for
classes and so on.
I've gotten so far as to define the variable "jde-sourcepath" and provided
the two directory paths listed above, but that doesn't seem to be working
(actually, the values are "/src/Java/Applications/" and
"/src/Java/Platform/" because I assumed that, from that point on, the Java
namespace expressed in the import statements in the Java files would work
from there.
Can someone please give me a hand with this?
--
Viktor Haag | http://sourceforge.net/p/jdee/mailman/jdee-users/?viewmonth=201002&viewday=19 | CC-MAIN-2015-22 | refinedweb | 226 | 59.84 |
5
Functions
Written by Matt Galloway
Functions are a core part of many programming languages. Simply put, a function lets you define a block of code that performs a task. Then, whenever your app needs to execute that task, you can run the function instead of copying and pasting the same code everywhere.
In this chapter, you’ll learn how to write your own functions, and see firsthand how Swift makes them easy to use.
Function basics
Imagine you have an app that frequently needs to print your name. You can write a function to do this:
func printMyName() { print("My name is Matt Galloway.") }
The code above is known as a function declaration. You define a function using the
func keyword. After that comes the name of the function, followed by parentheses. You’ll learn more about the need for these parentheses in the next section.
After the parentheses comes an opening brace, followed by the code you want to run in the function, followed by a closing brace. With your function defined, you can use it like so:
printMyName()
This prints out the following:
My name is Matt Galloway.
If you suspect that you’ve already used a function in previous chapters, you’re correct!
Function parameters
In the previous example, the function simply prints out a message. That’s great, but sometimes you want to parameterize your function, which lets the function perform differently depending on the data passed into it via its parameters.
As an example, consider the following function:
func printMultipleOfFive(value: Int) { print("\(value) * 5 = \(value * 5)") } printMultipleOfFive(value: 10)
Here, you can see the definition of one parameter inside the parentheses after the function name, named
value and of type
Int. In any function, the parentheses contain what’s known as the parameter list. These parentheses are required both when declaring and when invoking the function, even if the parameter list is empty. This function will print out any given multiple of five. In the example, you call the function with an argument of 10, so the function prints the following:
10 * 5 = 50
Note: Take care not to confuse the terms “parameter” and “argument”. A function declares its parameters in its parameter list. When you call a function, you provide values as arguments for the functions’ parameters.
You can take this one step further and make the function more general. With two parameters, the function can print out a multiple of any two values.
func printMultipleOf(multiplier: Int, andValue: Int) { print("\(multiplier) * \(andValue) = \(multiplier * andValue)") } printMultipleOf(multiplier: 4, andValue: 2)
There are now two parameters inside the parentheses after the function name: one named
multiplier and the other named
andValue, both of type
Int.
Notice that you need to apply the labels in the parameter list to the arguments when you call a function. In the example above, you need to put
multiplier: before the multiplier and
andValue: before the value to be multiplied.
In Swift, you should try to make your function calls read like a sentence. In the example above, you would read the last line of code like this:
Print multiple of multiplier 4 and value 2
You can make this even clearer by giving a parameter a different external name. For example, you can change the name of the
andValue parameter:
func printMultipleOf(multiplier: Int, and value: Int) { print("\(multiplier) * \(value) = \(multiplier * value)") } printMultipleOf(multiplier: 4, and: 2)
You assign a different external name by writing it in front of the parameter name. In this example, the internal name of the parameter is now
value while the external name (the argument label) in the function call is now
and. You can read the new call as:
Print multiple of multiplier 4 and 2
The following diagram explains where the external and internal names come from in the function declaration:
The idea behind this is to allow you to have a function call be readable in a sentence like manner, but still have an expressive name within the function itself. You could have written the above function like so:
func printMultipleOf(multiplier: Int, and: Int)
This would have the same effect at the function call of being a nice readable sentence. However now the parameter inside the function is also called
and. In a long function, it could get confusing to have such a generically named parameter.
If you want to have no external name at all, then you can employ the underscore
_, as you’ve seen in previous chapters:
func printMultipleOf(_ multiplier: Int, and value: Int) { print("\(multiplier) * \(value) = \(multiplier * value)") } printMultipleOf(4, and: 2)
This change makes it even more readable at the call-site. The function call now reads like so:
Print multiple of 4 and 2
You could, if you so wished, take this even further and use
_ for all parameters, like so:
func printMultipleOf(_ multiplier: Int, _ value: Int) { print("\(multiplier) * \(value) = \(multiplier * value)") } printMultipleOf(4, 2)
In this example, all parameters have no external name. But this illustrates how you use the underscore wisely. Here, your expression is still understandable, but more complex functions that take many parameters can become confusing and unwieldy with no external parameter names. Imagine if a function took five parameters!
You can also give default values to parameters:
func printMultipleOf(_ multiplier: Int, _ value: Int = 1) { print("\(multiplier) * \(value) = \(multiplier * value)") } printMultipleOf(4)
The difference is the
= 1 after the second parameter, which means that if no value is provided for the second parameter, it defaults to
1.
Therefore, this code prints the following:
4 * 1 = 4
It can be useful to have a default value when you expect a parameter to be one particular value most of the time, and it will simplify your code when you call the function.
Return values
All of the functions you’ve seen so far have performed a simple task: printing something out. Functions can also return a value. The caller of the function can assign the return value to a variable or constant, or use it directly in an expression.
With a return value, you can use a function to transform data. You simply take in data through parameters, perform computations and return the result.
Here’s how you define a function that returns a value:
func multiply(_ number: Int, by multiplier: Int) -> Int { return number * multiplier } let result = multiply(4, by: 2)
To declare that a function returns a value, you add a
-> followed by the type of the return value after the set of parentheses and before the opening brace. In this example, the function returns an
Int.
Inside the function, you use a
return statement to return the value. In this example, you return the product of the two parameters.
It’s also possible to return multiple values through the use of tuples:
func multiplyAndDivide(_ number: Int, by factor: Int) -> (product: Int, quotient: Int) { return (number * factor, number / factor) } let results = multiplyAndDivide(4, by: 2) let product = results.product let quotient = results.quotient
This function returns both the product and quotient of the two parameters: It returns a tuple containing two
Int values with appropriate member value names.
The ability to return multiple values through tuples is one of the many things that makes it such a pleasure to work with Swift. And it turns out to be a handy feature, as you’ll see shortly.
You can make both of these functions simpler by removing the
return, like so:
func multiply(_ number: Int, by multiplier: Int) -> Int { number * multiplier } func multiplyAndDivide(_ number: Int, by factor: Int) -> (product: Int, quotient: Int) { (number * factor, number / factor) }
You can do this because the function is a single statement. If the function had more lines of code in it, then you wouldn’t be able to do this. The idea behind this feature is that in such simple functions it’s so obvious and the
return gets in the way of readability.
For longer functions you need the
return because you might make the function return in many different places.
Advanced parameter handling
Function parameters are constants by default, which means they can’t be modified.
To illustrate this point, consider the following code:
func incrementAndPrint(_ value: Int) { value += 1 print(value) }
This results in an error:
Left side of mutating operator isn't mutable: 'value' is a 'let' constant
The parameter
value is the equivalent of a constant declared with
let. Therefore, when the function attempts to increment it, the compiler emits an error.
It is important to note that Swift copies the value before passing it to the function, a behavior known as pass-by-value.
Note: Pass-by-value and making copies is the standard behavior for all of the types you’ve seen so far in this book. You’ll see another way for things to be passed into functions in Chapter 13, “Classes”.
Usually, you want this behavior. Ideally, a function doesn’t alter its parameters. If it did, you couldn’t be sure of the parameters’ values and you might make incorrect assumptions in your code, leading to the erroneous data.
Sometimes you do want to let a function change a parameter directly, a behavior known as copy-in copy-out or call by value result. You do it like so:
func incrementAndPrint(_ value: inout Int) { value += 1 print(value) }
inout before the parameter type indicates that this parameter should be copied in, that local copy used within the function, and copied back out when the function returns.
You need to make a slight tweak to the function call to complete this example. Add an ampersand (
&) before the argument, which makes it clear at the call site that you are using copy-in copy-out:
var value = 5 incrementAndPrint(&value) print(value)
Now the function can change the value however it wishes.
This example will print the following:
6
6
The function increments
value and keeps its modified data after the function finishes. The value goes in to the function and comes back out again, thus the keyword
inout.
Under certain conditions, the compiler can simplify copy-in copy-out to what is called pass-by-reference. The argument value isn’t copied into the parameter. Instead, the parameter will hold a reference to the memory of the original value. This optimization satisfies all requirements of copy-in copy-out while removing the need for copies.
Overloading
Did you notice how you used the same function name for several different functions in the previous examples?
func printMultipleOf(multiplier: Int, andValue: Int) func printMultipleOf(multiplier: Int, and value: Int) func printMultipleOf(_ multiplier: Int, and value: Int) func printMultipleOf(_ multiplier: Int, _ value: Int)
This is called overloading and lets you define similar functions using a single name.
However, the compiler must still be able to tell the difference between these functions. Whenever you call a function, it should always be clear which function you’re calling. This is usually achieved through a difference in the parameter list:
- A different number of parameters.
- Different parameter types.
- Different external parameter names, such as the case with
printMultipleOf.
You can also overload a function name based on a different return type, like so:
func getValue() -> Int { 31 } func getValue() -> String { "Matt Galloway" }
Here, there are two functions called
getValue(), which return different types–one an
Int and the other a
String.
Using these is a little more complicated. Consider the following:
let value = getValue()
How does Swift know which
getValue() to call? The answer is, it doesn’t. And it will print the following error:
error: ambiguous use of 'getValue()'
There’s no way of knowing which one to call. It’s a chicken and egg situation. It’s unknown what type
value is, so Swift doesn’t know which
getValue() to call or what the return type of
getValue() should be.
To fix this, you can declare what type you want
value to be, like so:
let valueInt: Int = getValue() let valueString: String = getValue()
This will correctly call the
Int version of
getValue() in the first instance, and the
String version of
getValue() in the second instance.
It’s worth noting that overloading should be used with care. Only use overloading for functions that are related and similar in behavior.
When only the return type is overloaded, as in the above example, you loose type inference and so is not recommended.
Mini-exercises
- Write a function named
printFullNamethat takes two strings called
firstNameand
lastName. The function should print out the full name defined as
firstName + " " + lastName. Use it to print out your own full name.
- Change the declaration of
printFullNameto have no external name for either parameter.
- Write a function named
calculateFullNamethat returns the full name as a string. Use it to store your own full name in a constant.
- Change
calculateFullNameto return a tuple containing both the full name and the length of the name. You can find a string’s length by using the
countproperty. Use this function to determine the length of your own full name.
Functions as variables
This may come as a surprise, but functions in Swift are simply another data type. You can assign them to variables and constants just as you can any other type of value, such as an
Int or a
String.
To see how this works, consider the following function:
func add(_ a: Int, _ b: Int) -> Int { a + b }
This function takes two parameters and returns the sum of their values.
You can assign this function to a variable, like so:
var function = add
Here, the name of the variable is
function and its type is inferred as
(Int, Int) -> Int from the
add function you assign to it.
Notice how the function type
(Int, Int) -> Int is written in the same way you write the parameter list and return type in a function declaration.
Here, the
function variable is of a function type that takes two
Int parameters and returns an
Int.
Now you can use the
function variable in just the same way you’d use
add, like so:
function(4, 2)
This returns 6.
Now consider the following code:
func subtract(_ a: Int, _ b: Int) -> Int { a - b }
Here, you declare another function that takes two
Int parameters and returns an
Int. You can set the
function variable from before to your new
subtract function, because the parameter list and return type of
subtract is compatible with the type of the
function variable.
function = subtract function(4, 2)
This time, the call to
function returns 2.
The fact that you can assign functions to variables comes in handy because it means you can pass functions to other functions. Here’s an example of this in action:
func printResult(_ function: (Int, Int) -> Int, _ a: Int, _ b: Int) { let result = function(a, b) print(result) } printResult(add, 4, 2)
printResult takes three parameters:
functionis of a function type that takes two
Intparameters and returns an
Int, declared like so:
(Int, Int) -> Int.
ais of type
Int.
bis of type
Int.
printResult calls the passed-in function, passing into it the two
Int parameters. Then it prints the result to the console:
6
It’s extremely useful to be able to pass functions to other functions, and it can help you write reusable code. Not only can you pass data around to manipulate, but passing functions as parameters also means you can be flexible about what code executes.
The land of no return
Some functions are never, ever, intended to return control to the caller. For example, think about a function that is designed to crash an application. Perhaps this sounds strange, so let me explain: if an application is about to work with corrupt data, it’s often best to crash rather than continue into an unknown and potentially dangerous state. The function
fatalError("reason to terminate") is an example of a function like this. It prints the reason for the fatal error and then halts execution to prevent further damage.
Another example of a non-returning function is one that handles an event loop. An event loop is at the heart of every modern application that takes input from the user and displays things on a screen. The event loop services requests coming from the user, then passes these events to the application code, which in turn causes the information to be displayed on the screen. The loop then cycles back and services the next event.
These event loops are often started in an application by calling a function that is known to never return. Once you’re coding iOS or macOS apps, think back to this paragraph when you encounter
UIApplicationMain or
NSApplicationMain.
Swift will complain to the compiler that a function is known to never return, like so:
func noReturn() -> Never { }
Notice the special return type
Never, indicating that this function will never return.
If you wrote this code you would get the following error:
Function with uninhabited return type 'Never' is missing call to another never-returning function on all paths
This is a rather long-winded way of saying that the function doesn’t call another “no return” function before it returns itself. When it reaches the end, the function returns to the place from which it was called, breaching the contract of the
Never return type.
A crude, but honest, implementation of a function that wouldn’t return would be as follows:
func infiniteLoop() -> Never { while true { } }
You may be wondering why bother with this special return type. It’s useful because by the compiler knowing that the function won’t ever return, it can make certain optimizations when generating the code to call the function. Essentially, the code which calls the function doesn’t need to bother doing anything after the function call, because it knows that this function will never end before the application is terminated.
Writing good functions
Functions let you solve many problems. The best do one simple task , making them easier to mix, match, and model into more complex behaviors.
Make functions that are easy to use and understand! Give them well-defined inputs that produce the same output every time. You’ll find it’s easier to reason about and test good, clean, simple functions in isolation.
Commenting your functions
All good software developers document their code. :]
Documenting your functions is an important step to making sure that when you return to the code later or share it with other people, it can be understood without having to trawl through the code.
Fortunately Swift has a very easy way to document functions which integrates well with Xcode’s code completion and other features.
It uses the defacto Doxygen commenting standard used by many other languages outside of Swift. Let’s take a look at how you can document a function:
/// Calculates the average of three values /// - Parameters: /// - a: The first value. /// - b: The second value. /// - c: The third value. /// - Returns: The average of the three values. func calculateAverage(of a: Double, and b: Double, and c: Double) -> Double { let total = a + b + c let average = total / 3 return average } calculateAverage(of: 1, and: 3, and: 5)
Instead of the usual double-
/, you use triple-
/ instead. Then the first line is the description of what the function does. Following that is a list of the parameters and finally, a description of the return value.
If you forget the format of a documentation comment, simply highlight the function and press “Option-Command-/” in Xcode. The Xcode editor will insert a comment template for you that you can then fill out.
When you create this kind of code documentation, you will find that the comment changes the font in Xcode from the usual monospace font. Neat right? Well, yes, but there’s more.
First, Xcode shows your documentation when code completion comes up, like so:
Also, you can hold the option key and click on the function name, and Xcode shows your documentation in a handy popover, like so:
Both of these are very useful and you should consider documenting all your functions, especially those that are frequently used or complicated. Future you will thank you later. :]
Challenges
Before moving on, here are some challenges to test your knowledge of functions. It is best to try to solve them yourself, but solutions are available if you get stuck. These came with the download or are available at the printed book’s source code link listed in the introduction.
Challenge 1: Looping with stride functions
In the last chapter you wrote some
for loops with countable ranges. Countable ranges are limited in that they must always be increasing by one. The Swift
stride(from:to:by:) and
stride(from:through:by:) functions let you loop much more flexibly.
For example, if you wanted to loop from 10 to 20 by 4’s you can write:
for index in stride(from: 10, to: 22, by: 4) { print(index) } // prints 10, 14, 18 for index in stride(from: 10, through: 22, by: 4) { print(index) } // prints 10, 14, 18, and 22
- What is the difference between the two stride function overloads?
- Write a loop that goes from 10.0 to (and including) 9.0, decrementing by 0.1.
Challenge 2: It’s prime time
When I’m acquainting myself with a programming language, one of the first things I do is write a function to determine whether or not a number is prime. That’s your second challenge.
First, write the following function:
func isNumberDivisible(_ number: Int, by divisor: Int) -> Bool
You’ll use this to determine if one number is divisible by another. It should return
true when
number is divisible by
divisor.
Hint: You can use the modulo (
%) operator to help you out here.
Next, write the main function:
func isPrime(_ number: Int) -> Bool
This should return
true if
number is prime, and
false otherwise. A number is prime if it’s only divisible by 1 and itself. You should loop through the numbers from 1 to the number and find the number’s divisors. If it has any divisors other than 1 and itself, then the number isn’t prime. You’ll need to use the
isNumberDivisible(_:by:) function you wrote earlier.
Use this function to check the following cases:
isPrime(6) // false isPrime(13) // true isPrime(8893) // true
Hint 1: Numbers less than 0 should not be considered prime. Check for this case at the start of the function and return early if the number is less than 0.
Hint 2: Use a
for loop to find divisors. If you start at two and end before the number itself, then as soon as you find a divisor, you can return
false.
Hint 3: If you want to get really clever, you can simply loop from 2 until you reach the square root of
number, rather than going all the way up to
number itself. I’ll leave it as an exercise for you to figure out why. It may help to think of the number 16, whose square root is 4. The divisors of 16 are 1, 2, 4, 8 and 16.
Challenge 3: Recursive functions
In this challenge, you will see what happens when a function calls itself, a behavior called recursion. This may sound unusual, but it can be quite useful.
You’re going to write a function that computes a value from the Fibonacci sequence. Any value in the sequence is the sum of the previous two values. The sequence is defined such that the first two values equal 1. That is,
fibonacci(1) = 1 and
fibonacci(2) = 1.
Write your function using the following declaration:
func fibonacci(_ number: Int) -> Int
Then, verify you’ve written the function correctly by executing it with the following numbers:
fibonacci(1) // = 1 fibonacci(2) // = 1 fibonacci(3) // = 2 fibonacci(4) // = 3 fibonacci(5) // = 5 fibonacci(10) // = 55
Hint 1: For values of
number less than 0, you should return 0.
Hint 2: To start the sequence, hard-code a return value of 1 when
number equals 1 or 2.
Hint 3: For any other value, you’ll need to return the sum of calling
fibonacci with
number - 1 and
number - 2.
Key points
- You use a function to define a task that you can execute as many times as you like without having to write the code multiple times.
- Functions can take zero or more parameters and optionally return a value.
- You can add an external name to a function parameter to change the label you use in a function call, or you can use an underscore to denote no label.
- Parameters are passed as constants, unless you mark them as
inout, in which case they are copied-in and copied-out.
- Functions can have the same name with different parameters. This is called overloading.
- Functions can have a special
Neverreturn type to inform Swift that this function will never exit.
- You can assign functions to variables and pass them to other functions.
- Strive to create functions that are clearly named and have one job with repeatable inputs and outputs.
- Function documentation can be created by prefixing the function with a comment section using
///. | https://www.raywenderlich.com/books/swift-apprentice/v6.0/chapters/5-functions | CC-MAIN-2021-17 | refinedweb | 4,222 | 60.24 |
Populating a DropDownList from DB (ASP.Net)
Hi,
Me again :)
Wanting to hook in a drop down list to DB data, have the stored procedure ready to go. What's the best way to populate it?
I've seen various methods but what I haven't been able to figure out is how to hook it up with just the DropDownBox.Datasource property?
Anyone care to explain how?
Regards
James
James'Smiler' Farrer
Thursday, August 7, 2003
Here's a decent tutorial:. If you're using Sql Server, use the SqlClient namespace as opposed to the OleDb one. Also, remember to dispose of you Command objects in addition to closing your database connection.
You can probably find many similar ones with a quick search from Google.
rick
rick
Thursday, August 7, 2003
Here's a sub I use for a ddl. Output parameter could be an Input parameter. parameters need to be created in the same order they appear in the Stored Procedure.
earlofroberts
Private Sub TypeLoad()
'Fills the ddlTypes drop down list box
Dim dr As SqlDataReader
Dim sSql As String
Dim scn As String
Dim cmd As New SqlCommand()
Dim i As Integer
'ocosp_4000_GetAllContactTypes returns all the Types
'from TypeDriver table
sSql = "ocosp_4000_GetAllContactTypes"
scn = Session("ConnectString").ToString
With cmd
.Connection = _
New SqlConnection(scn)
.CommandText = sSql
.CommandType = CommandType.StoredProcedure
.Connection.Open()
With .Parameters.Add("@ct", SqlDbType.Int)
.Direction = ParameterDirection.Output
End With
.Parameters("@ct").Value = 0
dr = .ExecuteReader(CommandBehavior.CloseConnection)
End With
Try
'Fills ddlTypes
With ddlTypes
.DataSource = dr
.DataTextField = "TypeDesc"
.DataValueField = "TypeCode"
.DataBind()
End With
Catch
End Try
dr.Close()
cmd.Connection.Close()
End Sub
Ed Roberts
Tuesday, August 19, 2003
Recent Topics
Fog Creek Home | https://discuss.fogcreek.com/dotnetquestions/2099.html | CC-MAIN-2020-05 | refinedweb | 279 | 50.12 |
About once every 2 days during testing we get a ” An invalid parameter was passed to this function”. Each time its a different sound but they are all 44.1 32bit mono ogg files converted to the same specs in a batch operation. I try looping over the various offending files and load them over and over again without fail using the same code path.
The exact call is:
FSOUND_SAMPLE* const pSample = FSOUND_Sample_Load( FSOUND_UNMANAGED, ansiName, sampleType, 0, 0 );
if( pSample == NULL )
{
Engine::Report::Error( _T(“AudioSystem: LoadSample Failure: %s : %s\n”), GetFModErrorString( FSOUND_GetError() ), fileName );
}
sampleType is guaranteed to be FSOUND_2D for 2d sounds or FSOUND_HW3D for 3d sounds. There seems to be no pattern – both sampleTypes could fail.
The audiosystem is started as follows:
bool
Engine::AudioSystem::StartUp( void* hWnd ) const
{
bool startUpOK = true;
FSOUND_SetMaxHardwareChannels( 0 ); if ( FSOUND_SetHWND( reinterpret_cast< HWND >( hWnd ) ) == FALSE ) { Report::Error( _T("AudioSystem SetHwnd Failure: %s\n"), GetFModErrorString( FSOUND_GetError() ) ); startUpOK = false; } if ( FSOUND_Init( 44100, AudioSystem::Constants::MAX_NUM_SOFTWARE_CHANNELS, FSOUND_INIT_DSOUND_DEFERRED | FSOUND_INIT_GLOBALFOCUS ) == FALSE ) { Report::Error( _T("AudioSystem Init Failure: %s\n"), GetFModErrorString( FSOUND_GetError() ) ); startUpOK = false; } FSOUND_3D_SetRolloffFactor( Constants::ROLLOFF ); if ( FSOUND_Stream_SetBufferSize( Constants::STREAM_BUFFER_SIZE ) == FALSE ) { Report::Error( _T("AudioSystem SetStreamBufferSize Failure: %s\n"), GetFModErrorString( FSOUND_GetError() ) ); startUpOK = false; } return startUpOK;
}
MAX_NUM_SOFTWARE_CHANNELS is 32
STREAM_BUFFER_SIZE is 1000
ROLLOFF is 1
I’m at a loss to the cause. There seems to be no pattern and it doesn’t occur frequently enough to really nail down any neccessary conditions.
Any strategy for tracking this down would be much appreciated.
Thanks,
fyst
- fyst asked 12 years ago
- You must login to post comments
Any luck on this guys?
I’m approaching some final deadlines and we aren’t going to clear tester approval without this issue resolved. We had intended to purchase a license once we confirmed it performed as neccessary but I can’t pass it by the money men if its failing. Its a bit of a chicken and egg issue because I just read you will release the source code if we have a license, in which case i could track this myself but I can’t get the funds authorized if its deemed unstable.
thx for your time,
fyst
Hey,
That’s sounds great. Hope your demo went well.
Thanks,
fyst
Hi,
Thanks so much for the quick response. W/r to your comments:
1. Haha yes, my ‘random’ comment was not to suggest there isn’t a deterministic cause to this
2. There are no threads at all.
3. The hardwarecount to zero was vestigial from some earlier stress testing i was doing on machines to make sure it was runnable in software mode when the min hardware channels fell thru. Removal of it does not affect the results.
While i’m sure my testing in the engine successfully removed all other systems, i made a super stripped down version to 100% eliminate other factors. (shown below)
Notes relating to the following code:
-I cannot get sample loading to fail without loading at least one stream for up to ~500,000 tries. (it may fail but not for LONG time)
-With any number of streams loaded (below exceptions excluded) i can guarantee a failure on the sample load within ~100,000 tries (never a consistant number of times).
-I can get sample loading to fail on the first sample when i load 509 streams first.(probably unrelated)
-I can get stream loading to fail for 510 streams. (probably unrelated)
-Aside from the above cases there seems to be no relationship between number of streams loaded and the frequency of failure of sample loading.
It can occur anywhere from the 76th try to the 91,234 try.
I can’t hope to track this anymore without either reverse engineering your stuff (god help me) or access to your source code which is probably not in your best interest.
This is all the code but if you would like the ogg files i am using i would be more than happy to send them along for your testing dept to verify my results and help tracking this down. Ofcourse i’m willing to put the time in on this end before burdening you but i’m out of ideas.
Any suggestions?
Thanks,
fyst
//
// Test Code
//
include <stdio.h>
include <stdlib.h>
if defined(WIN32) || defined(_WIN64) || defined(WATCOMC)
#include <windows.h> #include <conio.h>
else
#include "../../api/inc/wincompat.h"
endif
include “../../api/inc/fmod.h”
include “../../api/inc/fmod_errors.h”
int main()
{
FSOUND_Init( 44100, 32, FSOUND_INIT_DSOUND_DEFERRED | FSOUND_INIT_GLOBALFOCUS );
FSOUND_Stream_SetBufferSize( 1000.f );
int countStream = 0; while( countStream < 1 ) //try this at 509 to crash on first sample load //try at 510 to crash on the stream loading. { countStream++; FSOUND_STREAM* const pStream = FSOUND_Stream_Open( "testmusic.ogg", FSOUND_2D | FSOUND_LOOP_NORMAL, 0 , 0 ); if( pStream == NULL ) { printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); exit(1); } } int countSample = 0; while( true ) { countSample++; FSOUND_SAMPLE* const pSample = FSOUND_Sample_Load( FSOUND_UNMANAGED, "testsound.ogg", FSOUND_2D, 0, 0 ); if( pSample == NULL ) { printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); exit(1); } else { FSOUND_Sample_Free( pSample ); } } return 0;
}
I should have also mentionned that the loop mode does not seem to affect the results.
Hi Brett,
I’ve done substantial testing with the new dll over the course of the day on multiple machines.
Here are the results:
- Minor point: the 509/510 issue still exists. There must be an internal amount of allocated memory for these fmod objects as this is invariant to the amount on various computers and the amount other applications consume.
- If i don’t load a single stream, and continuously load samples there is no crash for 1,000,000 tries. I assume for now it will not fail and has yet to with either dll for a combined total attempt count in excess of ~5,000,000.
- If i load but a single stream (or any number up to 509) it will fail to load a sample within 100,000 tries.
- I multiply verified that I was using the correct dll.
Summary: There is no change to the previous results.
Thanks,
fyst | http://www.fmod.org/questions/question/forum-13419/ | CC-MAIN-2017-13 | refinedweb | 995 | 61.16 |
How can a JVM terminate with an exit code of 141 and no other diagnostics?ekeithkw Jul 18, 2013 8:10 PM
Hello,
We are encountering a JVM process that dies with little explanation other than an exit code of 141. No hotspot error file (hs_err_*) or crash dump. To date, the process runs anywhere from 30 minutes to 8 days before the problem occurs. The last application log entry is always the report of a lost SSL connection, the result of an thrown SSLException. (The exception itself is unavailable at this time – the JVM dies before it is logged -- working on that.)
How can a JVM produce an exit code of 141, and nothing else? Can anyone suggest ideas for capturing additional diagnostic information? Any help would be greatly appreciated! Environment and efforts to date are described below.
Thanks,
-KK
Host machine: 8x Xeon server with 256GB memory, RHEL 6 (or RHEL 5.5) 64-bit
Java: Oracle Java SE 7u21 (or 6u26)
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
JVM arguments:
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=256m
-XX:NewSize=64m
-Xms128m
-Xmx1037959168
-Djava.awt.headless=true
-Djava.security.egd=
Diagnostics attempted to date:
- LD_PRELOAD=libjsig.so. A modified version of libjsig.so was created to report all signal handler registrations and to report SIGPIPE signals received. (Exit code 141 could be interpreted as 128+SIGPIPE(13).) No JNI libraries are registering any signal handlers, and no SIGPIPE signal is reported by the library for the duration of the JVM run. Calls to ::exit() are also intercepted and reported. No call to exit() is reported.
- Inspect /var/log/messages for any indication that the OS killed the process, e.g. via the Out Of Memory (OOM) Killer. Nothing found.
- Set ‘ulimit –c unlimited’, in case the default limit of 0 (zero) was preventing a core file from being written. Still no core dump.
- ‘top’ reports the VIRT size of the process can grow to 20GB or more in a matter of hours, which is unusual compared to other JVM processes. The RES (resident set size) does not grow beyond about 375MB, however, which is an considered normal.
This JVM process creates many short-lived Thread objects by way of a thread pool, averaging 1 thread every 2 seconds, and these objects end up referenced only by a Weak reference. The CMS collector seems lazy about collecting these, and upwards of 2000 Thread objects have been seen (in heap dumps) held only by Weak references. (The Java heap averages about 100MB, so the collector is not under any pressure.) However, a forced collection (via jconsole) cleans out the Thread objects as expected. Any relationship of this to the VIRT size or the JVM disappearance, however, cannot be established.
The process also uses NIO and direct buffers, and maintains a DirectByteBuffer cache. There is some DirectByteBuffer churn. MBeans report stats like:
Direct buffer pool: allocated=669 (20,824,064 bytes), released=665 (20,725,760), active=4 (98,304) [note: equals 2x 32K buffers and 2x 16K buffers]
java.nio.BufferPool > direct: Count=18, MemoryUsed=1343568, TotalCapacity=1343568
These numbers appear normal and also do not seem to correlate with the VIRT size or the JVM disappearance.
1. Re: How can a JVM terminate with an exit code of 141 and no other diagnostics?jschellSomeoneStoleMyAlias Jul 23, 2013 11:23 PM (in response to ekeithkw)
>How can a JVM produce an exit code of 141, and nothing else?
Because it executes some java code that does the following and nothing else.
Runtime.getRuntime().exit(141)
2. Re: How can a JVM terminate with an exit code of 141 and no other diagnostics?ekeithkw Jul 24, 2013 3:54 PM (in response to jschellSomeoneStoleMyAlias)
That's correct, but my code contains no such call, and neither does the JVM, as far as I can see (searching OpenJDK source). And even if the code existed, it's not being executed, or the LD_PRELOAD library would report it. For example, running the following application ..
public class GoodbyeWorld {
public static void main(String[] args) {
Runtime.getRuntime().exit(141);
}
}
.. produces a diagnostic of ..
JSIG: exit(141) called
JSIG: Call stack has 10 frames:
JSIG: /opt/rxadvantage/lib/linux-amd64/libjsigdebug.so [0x2b5484f87bff]
JSIG: /opt/rxadvantage/lib/linux-amd64/libjsigdebug.so(exit+0x29) [0x2b5484f88a04]
JSIG: /opt/jdk1.7.0_21/jre/lib/amd64/server/libjvm.so [0x2b548590db67]
JSIG: /opt/jdk1.7.0_21/jre/lib/amd64/server/libjvm.so [0x2b5485c6e6cc]
JSIG: /opt/jdk1.7.0_21/jre/lib/amd64/server/libjvm.so [0x2b5485c6d0e0]
JSIG: /opt/jdk1.7.0_21/jre/lib/amd64/server/libjvm.so [0x2b5485c6d666]
JSIG: /opt/jdk1.7.0_21/jre/lib/amd64/server/libjvm.so [0x2b5485c6dd00]
JSIG: /opt/jdk1.7.0_21/jre/lib/amd64/server/libjvm.so [0x2b5485b07010]
JSIG: /lib64/libpthread.so.0 [0x34ab00683d]
JSIG: /lib64/libc.so.6(clone+0x6d) [0x34aa0d4f8d]
So, more precisely, my question is, given a JVM on a RHEL6 platform which is running an application that does not call exit(), what can cause it to abort with an exit code of 141, bypass the JVM's exception handler, and not produce an entry in the system log, a system error message, a heap dump, or any other artifacts that normally accompany a severe JVM crash or shutdown?
3. Re: How can a JVM terminate with an exit code of 141 and no other diagnostics?jschellSomeoneStoleMyAlias Jul 25, 2013 7:06 PM (in response to ekeithkw)
JNI code that calls a OS system exit() API method would also produce the 141 exit code.
4. Re: How can a JVM terminate with an exit code of 141 and no other diagnostics?ekeithkw Jul 25, 2013 10:49 PM (in response to jschellSomeoneStoleMyAlias)
True, but the JNI call would still be reported by the LD_PRELOAD intercept, unless the native code could somehow circumvent that. Using a test similar to GoodbyeWorld (shown below), I verified that the JNI call to exit() is reported. In the failure case, no call to exit() is reported.
Can an OS (or a manual) 'kill' specify an exit code? Where could "141" be coming from?
Thanks,
-K2
=== GoodbyeWorldFromJNI.java ===
package com.attachmate.test;
public class GoodbyeWorldFromJNI
{
public static final String LIBRARY_NAME = "goodbye";
static {
try {
System.loadLibrary(LIBRARY_NAME);
} catch (UnsatisfiedLinkError error) {
System.err.println("Failed to load " + System.mapLibraryName(LIBRARY_NAME));
}
}
private static native void callExit(int exitCode);
public static void main(String[] args) {
callExit(141);
}
}
=== goodbye.c ===
#include <stdlib.h>
#include "goodbye.h" // javah generated header file
JNIEXPORT void JNICALL Java_com_attachmate_test_GoodbyeWorldFromJNI_callExit
(JNIEnv *env, jclass theClass, jint exitCode)
{
exit(exitCode);
}
=== script.sh ===
#!/bin/bash -v
uname -a
export PATH=/opt/jre1.7.0_25/bin:$PATH
java -version
pwd
LD_PRELOAD=./lib/linux-amd64/libjsigdebug.so java -classpath classes -Djava.library.path=lib/linux-amd64 com.attachmate.test.GoodbyeWorldFromJNI > stdout.txt
echo $?
tail stdout.txt
=== script output ===
[keithk@keithk-RHEL5-dev goodbyeJNI]$ ./script.sh
#!/bin/bash -v
uname -a
Linux keithk-RHEL5-dev 2.6.18-164.2.1.el5 #1 SMP Mon Sep 21 04:37:42 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
export PATH=/opt/jre1.7.0_25/bin:$PATH
java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
pwd
/tmp/goodbyeJNI
LD_PRELOAD=./lib/linux-amd64/libjsigdebug.so java -classpath classes -Djava.library.path=lib/linux-amd64 com.attachmate.test.GoodbyeWorldFromJNI > stdout.txt
echo $?
141
tail stdout.txt
JSIG: exit(141) called
JSIG: Call stack has 4 frames:
JSIG: ./lib/linux-amd64/libjsigdebug.so [0x2b07dc1bdc2f]
JSIG: ./lib/linux-amd64/libjsigdebug.so(exit+0x29) [0x2b07dc1bea41]
JSIG: /tmp/goodbyeJNI/lib/linux-amd64/libgoodbye.so [0x2aaab3e82547]
JSIG: [0x2aaaab366d8e]
=== ===
5. Re: How can a JVM terminate with an exit code of 141 and no other diagnostics?ekeithkw Aug 1, 2013 9:47 PM (in response to jschellSomeoneStoleMyAlias)
The Linux 'strace' utility reports:
17:45:52.333755 +++ killed by SIGPIPE +++
So exit code 141 apparently is from SIGPIPE (13) + 128.
A workaround for this might be to set the socket option MSG_NOSIGNAL (on Linux; equivalent is SO_NOSIGPIPE on BSD UNIX), but the Java Socket implementation doesn't support changing this socket option. Does the JVM internally manipulate this option? Is there any way it can be set on a Socket object?
6. Re: How can a JVM terminate with an exit code of 141 and no other diagnostics?ekeithkw Sep 4, 2013 6:28 PM (in response to ekeithkw)
We've discovered that a native library loaded via a PAM configuration is replacing the JVM's signal handler for SIGPIPE, reverting to the default handler. How this library is circumventing libjsig.so is TBD. | https://community.oracle.com/message/11131906 | CC-MAIN-2017-09 | refinedweb | 1,460 | 50.84 |
Kubernetes Autoscaling 101
Want to learn more about autoscaling in Kubernetes? Check out this post where we take a look at working with specific autoscalers in Kubernetes.
Join the DZone community and get the full member experience.Join For Free
Kubernetes, at its core, is a resources management and orchestration tool. In this post, we are going to focus day-1 operations to explore and play around with its cool features to deploy, monitor, and control your pods. However, you need to think of day-2 operations as well. In this post, we will focus on features like:
- How am I going to scale pods and applications?
- How can I keep containers running in a healthy state and running efficiently?
- With the on-going changes in my code and my users’ workloads, how can I keep up with such changes?
How do I know? In my work at Magalix, we help companies and developers find the right balance between performance and capacity inside their Kubernetes clusters. We went through a lot of pain and learning cycles to make Kubernetes work properly.
We have been using Kubernetes for more than a year now and what I’m sharing here are some highlights related to autoscaling Kubernetes.
Feel free to ask questions about your specific situation in the comments below. I’ll be happy to share how we solved similar problems in our infrastructure.
Configuring Kubernetes clusters to balance resources and performance can be challenging, and requires expert knowledge of the inner workings of Kubernetes. Your app or services’ workload isn’t constant; it fluctuates throughout the day (if not the hour) — think of it as a journey and ongoing process.
Remember, to truly master Kubernetes, you need to master different ways to manage the scale of cluster resources, that’s the core of promise of Kubernetes.
You need to focus on questions like:
- How am I going to scale pods and applications?
- How can I keep containers running in a healthy state and running efficiently?
- With the on-going changes in my code and my users’ workloads, how can I keep up with such changes?
Kubernetes Autoscaling Building Blocks
Effective Kubernetes autoscaling requires coordination between two layers of scalability: (1) Pods layer autoscalers, this includes Horizontal Pod Autoscaler (HPA) and Vertical Pod Autoscaler (VPA); both scale available resources for your containers, and (2) cluster level scalability, which managed by the Cluster Autoscaler (CA); it scales up or down the number of nodes inside your cluster.
Horizontal Pod Autoscaler (HPA)
As the name implies, HPA scales the number of pod replicas. Most DevOps use CPU and memory as the triggers to scale more pod replicas or less. However, you can configure it to scale your pods based on custom metrics, multiple metrics, or even external metrics.
High-Level HPA Workflow
HPA high-level workflow
- HPA continuously checks metrics values you configure during setup at a default 30-second intervals
- HPA attempts to increase the number of pods if the specified threshold is met
- HPA mainly updates the number of replicas inside the deployment or replication controller
- The Deployment/Replication Controller would then roll-out any additionally needed pods
Consider These as You Rollout HPA:
- The default HPA check interval is 30 seconds. This can be configured through the horizontal-pod-autoscaler-sync-period flag of the controller manager
- Default HPA relative metrics tolerance is 10 percent
- HPA waits for 3 minutes after the last scale-up events to allow metrics to stabilize. This can also be configured through the horizontal-pod-autoscaler-upscale-delay flag
- HPA waits for 5 minutes from the last scale-down event to avoid autoscaler thrashing. This is configurable through the horizontal-pod-autoscaler-downscale-delay flag.
- HPA works best with deployment objects as opposed to replication controllers. It does not work with a rolling update using direct manipulation of replication controllers. It depends on the deployment object to manage the size of the underlying replica sets when you perform a deployment.
Vertical Pods Autoscaler
Vertical Pods Autoscaler (VPA) allocates more (or less) CPU or memory to existing initially allocated for your pods. VPA can also react to OOM (out of memory) events. VPA currently requires the pods to be restarted to change the allocated CPU and memory. When VPA restarts pods, it respects the pods' distribution budget (PDB) to make sure there is always a minimum number of required pods. You can set the min and max of resources that the VPA can allocate to any of your pods. For example, you can limit the maximum memory limit to be no more than 8 GB. This is useful, in particular, when you know that your current nodes cannot allocate more than 8 GB historical metrics. It also provides an API that takes the pod descriptor and provides suggested resources requests.
It worth mentioning that VPA Recommender doesn’t work on setting up the “limit” of resources. This can cause pods to monopolize resources inside your nodes. I suggest you set a “limit” value at the namespace level to avoid crazy consumption of memory or CPU
High-Level VPA Workflow
VPA high-level workflow
- VPA continuously checks metrics values you configured during setup at a default 10-second intervals
- VPA attempts to change the allocated memory and/or CPU if the threshold is met
- VPA mainly updates the resources inside the deployment or replication controller specs
- When pods are restarted, the new resources are all applied to the created instances.
A Few Points to Consider as you Rollout the VPA:
- Changes in resources are not yet possible without restarting the pod. The main rationale, so far, is that such a change may cause a lot of instability. Hence, the thinking is to restart the pods and let them that lead to pods being killed by Kubernetes.
- VPA is in its early stage. It will evolve in the next few months, so be prepared for that! Details on known limitations can be found here and on future work here
Cluster Autoscaler
Cluster Autoscaler (CA) scales your cluster nodes based on pending pods. It periodically checks whether there are any pending pods and increases the size of the cluster if more resources are needed and if the scaled-up cluster is still within the user-provided constraints. CA interfaces work with the cloud provider to request more nodes or deallocate idle nodes. It works with GCP, AWS, and Azure. Version 1.0 (GA) was released with Kubernetes 1.8.
High-Level CA Workflow
- The CA checks for pods in a pending state at a default interval of 10 seconds.
- If there are one or more pods in the pending state, this is because there are not enough available resources on the cluster to allocate on the cluster, then it attempts to provide one or more additional nodes.
- When the node is granted by the cloud provider, the node is joined to the cluster and becomes ready to serve pods.
- The Kubernetes scheduler allocates the pending pods to the new node. If some pods are still in pending state, the process is repeated and more nodes are added to the cluster.
Consider These as You Roll-Out the CA
- the PodDisruptionBudgets to prevent pods from being deleted and end up part of your application fully non-functional.
How Kubernetes Autoscalers Interact Together
If you would like to reach the nirvana of autoscaling your Kubernetes cluster, you will need to use pod layer autoscalers with the CA. The way they work with each other is relatively simple, as shown in the below illustration.
- HPA or VPA update pod replicas or resources allocated to an existing pod.
- If there are not enough nodes to run pods for a post-scalability event, CA picks up some or all of the scaled pods in the pending state.
- CA allocates new nodes.
- Pods are scheduled on the provisioned nodes.
Common Mistakes
I’ve seen mistakes made in many different forums, such as Kubernetes, Slack channels, and StackOverflow questions, as well as common issues that many DevOps miss while getting their feet wet with autoscalers.
HPA and VPA depend on metrics and historical data. If you don’t have enough resources allocated, your pods will be OOM killed and never get a chance to generate metrics. Your scale may never take place in this case.
Scaling up is the mostly a time-sensitive operation. You want your pods and cluster to scale fairly quickly before your users experience any disruption or crash in your application. You should consider the average time it can take your pods and cluster to scale up.
Best Case Scenario — 4 Minutes
- 30 seconds — Target metrics values updated: 30–60 seconds
- 30 seconds — HPA checks on metrics values: 30 seconds ->
- < 2 seconds — Pods are created and go into a pending state — 1 second
- < 2 seconds — CA sees the pending pods and fires up the calls to provision nodes — 1 second
- 3 minutes — Cloud providers provision the nodes, and K8 waits for them until they are ready, this can take up to 10 minutes — it depends on multiple factors.
(Reasonable) Worst Case Scenario — 12 minutes
- 60 seconds — Target metrics values updated
- 30 seconds — HPA checks on metrics values
- < 2 seconds — Pods are created and go into a pending state
- < 2 seconds — CA sees the pending pods and fires up the calls to provision nodes
- 10 minutes — Cloud provider provision the nodes, and K8 waits for them until they are ready minutes. This depends on multiple factors, such as provider latency, OS latency, bootstrapping tools, etc.
Do not confuse cloud provider scalability mechanisms with the CA. CA works from within your cluster while the cloud provider’s scalability mechanism (such as ASGs inside AWS) work based on nodes allocation. It is not aware of what’s taking place with your pods or application. Using them together will render your cluster unstable and hard to predict behavior.
TL;DR
The insights I have shared in this article come from my work building Magalix — an AI that provides resource management and recommendations to companies using Kubernetes. Building fully elastic Kubernetes-managed microservices is difficult and still requires a lot of legwork.
Here’s the quick version of what you need to understand about Kubernetes Autoscaling:
- Kubernetes is a resources management and orchestration tool. Day-2 operations to manage your pods and cluster’s resources is a key milestone in your journey of mastering Kubernetes.
- Have the right mental model in mind, focusing the pods' scalability using HPA and VPA.
- CA is recommended if you have a good understanding of your pods and containers needs.
- Understanding how different autoscalers work together will help you configure your cluster.
- Make sure you plan for the worst case and best case scenarios when it comes to how long it will take your pods and cluster to scale up or down.
I have also written about Kubernetes Monitoring and will continue to share what I have learned here.
Feel free to ask questions in the comments below!
Published at DZone with permission of Mohamed Ahmed. See the original article here.
Opinions expressed by DZone contributors are their own. | https://dzone.com/articles/kubernetes-autoscaling-101-cluster-autoscaler-hori-2 | CC-MAIN-2022-40 | refinedweb | 1,856 | 60.04 |
Table of Contents
Remez tutorial 1/5: exp(x) the quick way
This is a hands-on example of the Lol Remez toolkit.
In this section we are going to approximate the exp(x) function on [-1,1] using a polynomial.
Getting started
If you do not have the full Lol Engine source code, download and unpack the latest LolRemez tarball.
The file you should edit is
remez.cpp.
What does Remez do?
Given a function f and a range [a,b], the Remez algorithm looks for the polynomial P(x) that minimises the following error value E:
Note that E is not a parameter. It is a value that the algorithm computes together with the polynomial. Though we will see ways to fine-tune the error, a general rule is: if you want a smaller error, ask for a polynomial of higher degree.
Source code
#include "lol/math/real.h" #include "lol/math/remez.h" using lol::real; using lol::RemezSolver; real f(real const &x) { return exp(x); } int main(int argc, char **argv) { RemezSolver<4, real> solver; solver.Run(-1, 1, f, 40); return 0; }
What does this mean?
- We declare function
fwhich returns the exponential of
x: this is the function we want to approximate.
- We create a
RemezSolverobject for 4th-degree polynomials and real numbers. As of now, no other number types are supported.
- We run the solver on the [-1,1] range, approximating function
fto 40 decimals of precision. The larger the precision, the more iterations are necessary, but the process usually takes only a few seconds for small functions.
Compilation
If you are using LolRemez, just put the above source code in
remez.cpp and type:
make
Execution
To launch the test, type:
./remez
After all the iterations the output should be as follows:
Step 7 error: 5.466676005137979474524666548947155992203e-4 Polynomial estimate: x**0*1.000090000102127639946253082819502265543 +x**1*9.973092516744464320538318907902496576588e-1 +x**2*4.988351170902359155314941477995868737492e-1 +x**3*1.773452743688412268810974931504564418976e-1 +x**4*4.415551762288022300015839013797254330891e-2
Using the results
The above results can be used in a more CPU-friendly implementation such as the following one:
double fastexp(double x) { const double a0 = 1.000090000102127639946253082819502265543; const double a1 = 9.973092516744464320538318907902496576588e-1; const double a2 = 4.988351170902359155314941477995868737492e-1; const double a3 = 1.773452743688412268810974931504564418976e-1; const double a4 = 4.415551762288022300015839013797254330891e-2; return a0 + x * (a1 + x * (a2 + x * (a3 + x * a4))); }
Analysing the results
Plotting the real exponential function and our
fastexp function gives the following curves:
The curves are undistinguishable. Actually they differ by no more than 5.46668e-4, which is the value the
./remez output gave.
It can be verified on the following error curve:
Conclusion
You should now be all set up for your own minimax polynomial computation!
Please report any trouble you may have had with this document to sam@hocevar.net. You may then carry on to the next section: switching to relative error.
Attachments (2)
- fastexp.png (13.0 KB) - added by 7 years ago.
- fastexp-error.png (23.2 KB) - added by 7 years ago.
Download all attachments as: .zip | http://lolengine.net/wiki/doc/maths/remez/tutorial-exponential | CC-MAIN-2018-47 | refinedweb | 513 | 59.19 |
Taginfo/Parsing the Wiki
Contents
- 1 Taginfo Parsing the Wiki
- 1.1 Problem reports from taginfo
- 1.1.1 description parameter should only contain plain text
- 1.1.2 has positional parameter
- 1.1.3 image/osmcarto-rendering parameter empty
- 1.1.4 invalid image/osmcarto-rendering parameter
- 1.1.5 wrong lang format
- 1.1.6 invalid lang parameter
- 1.1.7 lang is en
- 1.1.8 invalid value for ... parameter
- 1.1.9 multiple values for ... parameter
- 1.1.10 no value for tag page
- 1.1.11 parsing failed
- 1.1.12 slash in key/value
- 1.1.13 value in key page
- 1.1.14 wikidata parameter does not match Q###
Taginfo Parsing the Wiki
Taginfo needs information from the wiki, for instance the description of keys and tags. For this end, it gets a list of all pages starting with Key:, Tag:, and Relation: as well as their language equivalents starting with a language code and then :Key:, :Tag:, or :Relation:. It parses all those pages and finds the info box on the right created by the KeyDescription, ValueDescription, or RelationDescription templates and takes the information out of those templates.
This process is not without problems. The wiki can contain basically anything, and sometimes it happens that something that looks fine on the wiki page is not correctly understood by the taginfo wiki page parser. In some cases that is a bug in the parser and we can fix it, but making Taginfo understand everything the Wiki can understand is just not possible, it would be far too much work. So we have to occasionally live with some simplifications. And sometimes those templates change and nobody thought about telling the taginfo maintainers, so something breaks.
Problem reports from taginfo
When taginfo is trying to make sense out of the wiki, it will report on many things it can't understand. Sometimes this is taginfos fault, but often this is something that is not correct in the wiki and can be fixed there. You can see the report on this taginfo page. The report will be regenerated every night when taginfo does its update run. The reports in this form are rather new and can be considered beta. Tell us if you don't understand something or think a report is wrong.
Here are some of the problem reports you will see and what they mean:
description parameter should only contain plain text
The description parameter containing the short description of this key, tag, or relation type should only contain plain text, not wiki syntax. This is important so that taginfo, but also other software outside the wiki, can use this text properly.
has positional parameter
In general, wiki templates can have positional parameters and named parameters. The description templates only use named parameters. When you see this error, it usually means that the taginfo parser got confused. This can be the result of using wiki syntax in parameters that shouldn't have wiki syntax. Try to clean up the template parameters.
image/osmcarto-rendering parameter empty
The image or osmcarto-rendering parameter in the description template is empty. It should contains an image file name.
invalid image/osmcarto-rendering parameter
The image or osmcarto-rendering parameter in the description template has the wrong format. Usually it should be something like Image:name.jpg or File:name.png.
wrong lang format
The language in the wiki page name should be a valid BCP47 language code, usually of the format xx (for instance de for the German language), or xx-xx (for instance pt-br for Brazilian Portuguese), or xx-xxxx (for instance zh-hans for the Chinese language in its Simplified script). Capitalization doesn't matter for TagInfo, however underscores (valid in BCP47) should not be used (use equivalent hyphens instead).
invalid lang parameter
The lang parameter of the RelatedTerm and Wikipedia templates should be empty or have the BCP47 format (but converted to lowercase only on this wiki and in OSM tags, and using only hyphens and no underscores), usually xx (for example de for the German language) or xx-xx (for example pt-br for Brazilian Portuguese, but note that all pages previously using "Pt-br:" prefixes on this wiki are now redirected to "Pt:") or xx-xxxxxx (for example zh-hans for Simplified Chinese). Taginfo doesn't always correctly detect this.
Note that for legacy or technical reasons, language codes used in article names on this wiki for prefixing their title have their initial letter in uppercase (because this initial is not case-sensitive, it is implicitly converted to uppercase). As well 7 article namespaces are using capitals only: DE, ES, FR, IT, JA, NL, RU (and only these 7 languages that have their own dedicated namespace for their articles and talk pages; note that these namespaces are still case-insensitive in links, but not in "Category:" and "Template:" namespaces, where the language codes used for these languages are not namespaces but prefixes whose only the 1st letter is case-insensitive and must still be written consistantly with capitals to avoid creating and maintaining lots of redirecting pages).
This does not means that OSM data or or Wikidata should use capitals in their language codes, or in codes passed in various "lang=" parameters of templates for this wiki.
And for legacy reasons interwiki links for going to some Wikipedia editions still use legacy non conforming codes (in their current subdomain names) that should not be used for naming pages on this wiki or in Wikidata and OSM data (such as "en-simple", "roa-rup", "zh-classical", only valid for links to Wikimedia sites), or valid but deprecated codes (such as "zh-yue" to be replaced by the preferred code "yue"), or conforming but incorrect codes (such as "nrm", to be replaced by "nrf"): these codes are slowly being migrated by Wikimedia to use standard codes (and will thn become only local redirected aliases).
Finally note that Wikipedia uses a single interwiki language code (and domain name) for unifying multiple script used in the same language, only because it locally supports an automated transliterator, allowing its visitors to select their prefered form (This is the case for example with Chinese, Serbian, Kurdish, and a few other languages). But the OSM wiki (as well as many other sites) does not support this transliterator, so script codes are permitted (and even recommended) in this wiki for correct distinction of contents (even if this duplicates the editing and maintenance work by translators).
As well, this wiki implements some language fallbacks when a translation is not found in a language but another "convenient" language may still be useful and will likely be understood, instead of linking necessarily to the English version (for example a Catalan page may link first to an Spanish page before falling back to English).
lang is en
Sometimes pages are named En:Key:..., En:Tag:..., or En::Relation:.... But the language en is the default. The name should just be Key:..., etc.
- In most cases, these pages are now redirecting to the names without the prefix (this is already effective for all "Tag:" and "Key:" description pages).
- But still not in all other pages for specific local projects that were first created and still maintained in another default language than English, a conversion is still ongoing to have them redirected to pages explictly prefixed, because it allows the navigation bar to work properly and still allows creating and linking to at a least a basic introducting English version, but it will take time to convert some legacy links in those specific pages).
invalid value for ... parameter
The onNode, onWay, onArea, and onRelation parameters can only be set to yes or no.
multiple values for ... parameter
The named description template parameter appears multiple times in the template. This is not allowed for most parameters.
no value for tag page
All tag pages, ie pages of the form (lang:)Tag:... must have a complete tag in the name with the key and value separated by an equals sign, for instance Tag:highway=residential. If no equal sign is detected (for instance Tag:highway) this message is shown. If something only has a key, it should be a "key" page (for instance Key:highway).
parsing failed
This is a general "I give up" message. It means taginfo can't figure out what exactly is wrong.
slash in key/value
The forward slash (/) should not be used in keys or values. This sometimes happens if there are sub-pages in the wiki. Taginfo ignores those pages.
value in key page
All key pages, ie pages of the form (lang:)Key:... must have only the key in the name with no value and no equals sign, for instance Key:highway. If an equal sign is detected (for instance Key:highway=residential) this message is shown. If something also has a value, it should be a "tag" page (for instance Tag:highway=residential).
wikidata parameter does not match Q###
The wikidata parameter in the description template should always have the form Q and then a number. | https://wiki.openstreetmap.org/wiki/Taginfo/Parsing_the_Wiki | CC-MAIN-2018-05 | refinedweb | 1,517 | 52.29 |
Subject: Re: [boost] Formal Review: Boost.Polygon
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-09-14 12:37:02
Phil Endecott wrote:
> The first step was to add the "magic" required by the library to
> support my rectangle
> type. The examples don't seem to include a custom rectangle, and the
> decomposition
> of a rectangle into a pair of intervals rather than the more common
> pair of points or
> point and size, made this a bit tricky. More serious were the
> following problems:
>
> ** The library does not seem to use any sort of explicit concept
> checking; if types do
> not satisfy their concepts random errors from deep inside the library
> are emitted. The
> verbosity and incomprehensibility of errors from complex C++ code is,
> in my opinion,
> the greatest single failing of the language today. In the face of
> these ridiculous
> messages, some users will simply abandon trying to use the library (or
> the whole
> language, and go back to C) or limit themselves to only what can be
> done by copying
> examples. Fixing this needs effort from the language designers,
> compiler writers, and
> libraries. I am not certain that concept checking can totally cure
> this problem,
> but it can only help.
I believe that I should supply concept checking tests (similar to the examples in the docs) for all concepts so that users who try to map their object types to my concepts can check whether it is correct. I don't know how much I can do to make error messages more friendly as a library author. My intention was to provide a library that demonstrates what a C++ concepts based library would look and feel like. I've been successful in that. I think that the verbose error messages issue is something that is a problem many boost libraries have.
> ** The library spews out enormous quantities of warnings (gcc 4.1.2),
> I
> think mainly
> related to unused parameters. This has to be fixed (and I don't
> believe fixing it is
> hard).
I thought I had fixed it already. I made a few changes, compiled my unit tests without warnings with gcc 4.1.2, and checked those changes in during the review.
> ** The library failed to work with std::pair being used as the
> interval
> type, despite
> this being mentioned as a possibility in the documentation. The
> problem seems to be
> that the std namespace is brought into ADL and std::set is found
> rather
> than the
> library's own set function. I have not investigated how hard this
> would be to fix;
> instead I wrote my own pair template.
I was aware that ADL poses a problem for the functions I gave exceedingly common names to, not least the operators. I can guard useage of set() with (set)() throughout the library and add tests that std::pair can be adapted to both point and interval.
> Having completed the "magic", I started to adapt my marker drawing
> code. My first
> attempt was a minimally-invasive version that would check if each
> marker covered any
> new area and not plot it otherwise:
>
> if (!contains(markers,b)) {
> markers |= b;
> plot(b);
> }
>
> Unfortunately this failed since contains() does not seem to be defined
> for a
> polygon_90_set and a rectangle. This surprised me somewhat. A
> valuable addition to
> the documentation would be a matrix indicating which operations are
> supported between
> which types. Somebody will need every combination of operations and
> types, and it
> would be useful to see quickly which are provided, which are planned
> for a future
> version of the library, and which cannot be implemented due to some
> restriction of the
> library design.
It is possible to make a list of all free functions and all the concepts they accept. It was suggested by other reviewer. I could make an index section to the documentation.
> I could have tried to implement contains(polygon_90_set,rectangle) in
> terms of e.g.
> intersection but I was concerned that that would have much worse
> complexity than an
> optimised contains() algorithm could have. Which raises another
> issue:
>
> ** Algorithms should indicate their complexity guarantees, and (where
> different) their
> expected complexity for common inputs.
I can add this to the documentation.
> So I moved on to a more invasive modification where I accumulate all
> of
> the rectangles
> and use get_rectangles() at the end to extract a minimal set of areas
> to plot:
>
> for (...) {
> markers |= b;
> }
> get_rectangles(rects,markers);
> foreach(rect in rects) {
> plot(rect);
> }
>
> This works, and reduces the number of rectangles that are plotted from
> about 6,000 to
> about 900. Unfortunately get_rectangles() takes about 100 ms to run,
> which is
> slightly longer than plotting the redundant markers would have taken,
> so overall the
> frame rate is not improved.
>
> In that code, I was surprised to see that get_rectangles takes an
> output container by
> reference. In this case, I have no need to allocate memory and store
> these rectangles
> at all. I would have prefered some way to get the rectangles as they
> were generated
> and pass them directly to my plot function, e.g.
>
> for_each_rectangle(markers, &plot);
>
> An output iterator would be a more conventional (but in this case more
> verbose) way to
> achieve this.
>
> ** Unless there is some good reason for using output reference
> parameters, algorithms
> should use output iterators.
I expected this feedback to come up during the review. I can add the output iterator based inerfaces.
> I was also a little confused by the difference - if any - between
> "markers |= b" and
> "markers.insert(b)". I believe that I know what the former does, but
> I
> worry that
> unioning-in each rectangle in turn is inefficient and that it would be
> better to
> construct a set of rectangles and self-union in one go. Perhaps this
> is what insert()
> does - yet there is no self_union function, and in practice I seem to
> get the same
> results. Maybe get_rectangles() has done the self_union. Some
> clarification of this
> in the documentation would be useful.
markers |= b is implemented by a call to insert, get_rectangles does indeed to the self union. I have discussed this optimization during the review and it is described in the documentation as well.
> One issue that I noted while reading in the polygons is that the
> provided polygon_data
> type is immutable: to read from a file, I need either an exotic
> iterator that can be
> passed to its constructor, or a temporary. I'm unsure why
> polygon_data
> can't be more
> like a mutable std::container so that I can simply read points from a
> file and
> push_back() in a loop. Trying to use a std::vector<point_data>
> required more traits
> specialisation that I expected; can't this be pre-defined?
>
> **.
> I also found little mention of winding direction in the documentation.
> I haven't
> checked whether the data I have winds consistently; what does
> unknown_winding actually
> do?
Forces a runtime evaluation of the winding direction when that information is needed.
> As I guessed, contains(polygon,point) is very slow if done naively:
> the library's polygon concept (and the provided default
> implementation) have no way
> to determine
> whether a point lies within a polygon in better than O(N) time.
> Testing first with the
> bounding box makes it O(1) in the common case. So I tried to write a
> polygon type that
> would do this, something like this (but not exactly this!):
>
> struct my_polygon: polygon_data {
> rectangle bbox;
> template <typename ITER>
> my_polygon(ITER begin, ITER end):
> polygon_data(begin,end),
> bbox(extents(*this))
> {}
> };
>
> bool contains(const my_polygon& poly, point_t pt) {
> return contains(poly.bbox,pt) && contains(poly,pt);
> }
>
> Hmm, well that looks OK until the very last "contains"... no doubt
> someone will
> immediately spot the "right" way to do this. I ended up making
> contains() a member of
> my_polygon, and this worked reasonably well. Note that the extents()
> function does not
> work as written above: it takes a reference to a rectangle as an out
> parameter. center() does something similar. This seems wrong to me;
> returning a
> point or
> rectangle would be more conventional I think.
Since it is just as expensive to compute the bounding box of a polygon I left the bounding box optimization to the user.
> ** extents() and center() should return their results, rather than
> using an output
> reference.
Out parameters and equational reasoning have been discussed elsewhere in the review.
> I have a fixed point type that I use for GPS coordinates (32 bits is
> good for lat/lng
> GPS positions, but 24 bits isn't) and using it with this library
> worked
> well. The
> Coordinate Concept page doesn't say much about the type requirements
> ("expected to be
> integral") and spelling out in more detail what is needed would be
> useful. In practice
> I must have already implemented everything that it needed.
Interesting. I provide default traits for coordinate concept, if these are sufficient for you all you need to do is specialize geometry_concept for your coordinate type.
> However, I can't see any way to perform these boolean operations other
> than using the
> operators, and I think this is an ommission. If I were writing code
> that I expected
> someone else unfamiliar with the library to understand I would like
> the important calls to be conspicuous.
>
> ** The library should provide functions to perform the boolean
> operations, as well as
> operators, for the benefit of those who want to make their code more
> verbose.
The polygon_set_data objects have operator member functions that can be used instead, if you manually convert the inputs to polygon_set_data objects in user code.
> I dislike the use of operators with integers for the grow/shrink
> operations. My
> concern is that this meaning is non-obvious, and since these operators
> are also
> defined for boolean operations, there is potential for error:
>
> polygon_set a, b, i;
> ...
> for (int i = 0; i<10; ++i) {
> ...
> a -= b+i; // oops, forgot i is now an int
> }
I agree there is a potential for error. It is a judgement call and preference in this is very subjective.
> Isotropic Style
> ---------------
>
> I recall Luke describing his isotropic style on the list a long time
> ago, and the
> documentation would benefit from an explanation along those lines.
> One "FAQ" that it
> would need to address is the question of the performance of a run-time
> selection of X
> vs. Y compared to a compile-time selection in more conventional code.
I use the isotropic style extensively in the implementation details of algorithms in the library. If the user doesn't like it they generally have alternative APIs available to them that do not require it, and can ignore its existence except when setting up the point and rectangle traits.
> Barend has also raised questions about the worse-case performance of
> Luke's
> line intersection algorithm, and it seems that Luke accepts that it is
> not optimal.
> Achieving the best possible algorithmic complexity is something that I
> would consider
> very important or essential for a Boost library. At the very least,
> Luke needs to
> document the complexity of his current algorithm and explain why he
> cannot do any
> better. The views of experts should be sought if this cannot be
> resolved by the
> review manager.
If Barend, or anyone, implements a fast, robust line intersection algorithm and licenses it under the boost license I can easily replace my own line intersection algorithm with the faster one. Implementing fast, robust line intersection is extremely difficult and time consuming. Our internal performance requirements are met by what I implemented.
> In view of all this, I suggest that this library should be rejected
> for
> now. This
> will tell Barend that he still has an opportunity to present his
> library for review,
> and that it will be considered on a level playing field. If Barend's
> library is
> reviewed and found to be more complete, more performant and at least
> as
> usable as this
> library, then it should be accepted. On the other hand, if Barend's
> library is found
> to be deficient in some way (or is not submitted for review), then
> Luke
> will have an
> opportunity to resubmit an updated version of this library, which I
> anticipate should
> be accepted.
I don't believe it is necessary to position the decision as an either or GGL/Boost.Polygon proposition.
Thanks,
Luke
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk | https://lists.boost.org/Archives/boost/2009/09/156359.php | CC-MAIN-2019-47 | refinedweb | 2,065 | 61.36 |
Logging¶
It’s good practice to log a message using Python logging whenever an error or exception occurs. There are a myriad of tools administrators can then use to send the information where they want it, send email alerts, analyze trends, etc.
If you want to log in your app, just:
import logging logger = logging.getLogger(__name__)
and use:
logger.debug("msg") logger.critical("msg") logger.exception("msg") # etc.
All RapidSMS core logging can now be captured using the
'rapidsms'
root logger. (There’s not a lot of logging from the core yet, but pull
requests are welcome.)
For example, if you wanted messages from the RapidSMS
core to be written to a file “/path/rapidsms.log”, you could define
a new handler in the
LOGGING setting in Django:
LOGGING = { ... 'handlers': { ... 'rapidsms_file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': '/path/rapidsms.log', }, ... }, ... }
Setting
level to
DEBUG means all messages of level DEBUG and
lower will be passed through (that’s all of them). Then this handler
will write those messages to the file
/path/rapidsms.log. They’ll
be formatted by the default formatter.
Then configure the
rapidsms logger to send messages to that handler:
LOGGING = { ... 'loggers': { 'rapidsms': { 'handlers': ['rapidsms_file'], 'propagate': True, 'level': 'DEBUG', }, }, ... }
Setting
level to
DEBUG means all messages of level DEBUG and
lower will be passed through (that’s all of them).
The logger name
rapidsms means any logger to a name that matches
that (
rapidsms,
rapidsms.models, etc) will be passed to this
handler to handle.
Setting
propagate to
True means the same messages will be
passed to other handlers if they also match. (This handler does not
consume the messages.)
If you created your project with the latest Rapidsms project template and haven’t changed the settings, all rapidsms logging will be written to rapidsms.log in your project directory. | http://docs.rapidsms.org/en/develop/topics/logging.html | CC-MAIN-2017-47 | refinedweb | 304 | 66.94 |
Zachdoom 0 Posted February 4, 2011 Hey I am creating a script that log-ins to a website and then do something more... But sometimes, when i am on an unreliable internet the login process wil sometimes fail,and i want it to automatically retry.... here is my script Run('C:\Program Files (x86)\Opera\opera.exe') _WinWaitActivate("Google - Opera","") MouseClick("left",379,55,1) Send("website.com{ENTER}") _WinWaitActivate("BLA BLA BLA- log-in page - Opera","") MouseClick("left",759,111,1) Send("Email@xxxx.xxx") Send("{TAB}") Send("Password") Send("{ENTER}") $input=('C:\Program Files (x86)\Opera\opera.exe') If (" - Opera") Then _________________________________________________________________________________________ And then i can't make my script do something if succes and something else if failure.... In this case, if it goes to the succesful login page do something and if it goes to the unsuccesful do something else... I dont know how to make the endif works... my problem is that the script should continue even if it goes to the unsuccesful site... Hope you understand and can help me. Kind Regards ZachDoom Share this post Link to post Share on other sites | https://www.autoitscript.com/forum/topic/125062-auto-login-website/ | CC-MAIN-2018-47 | refinedweb | 189 | 66.74 |
count
When you use this function in a query, it counts the number of times entries appear in the specified column in the specified dataset.
For more information on using query functions and operators in a REST API request, see Queries. For an end-to-end description of how to create a query, see Creating a Query.
The codeblock example below counts the number of times entries appear in the
Region column of the earthquake dataset, whose
{DATASET_ID} is
90af668484394fa782cc103409cafe39.
{ "version": 0.3, "dataset": "90af668484394fa782cc103409cafe39", "namespace": { "count": { "source": ["Region"], "apply": [{ "fn": "count", "type": "aggregate", }] } }, "metrics": ["count"], }
When you submit the above request, the response includes an HTTP status code and a JSON response body.
For more information on the HTTP status codes, see HTTP Status Codes.
For more information on the elements in the JSON structure in the response body, see Query. | https://developer.here.com/documentation/geovisualization/topics/query-rule-count.html | CC-MAIN-2019-22 | refinedweb | 142 | 59.74 |
+1 for using namespaces.
The Axis C++ API exposed to C services and C clients are a set of static
C style functions. So by adding a prefix (probably a c style prefix) to
all those function names will solve any possible conflict situations.
I suggest the prefixes like Axis_ , AAPI_ or AxisAPI_
---
Susantha
-----Original Message-----
From: Samisa Abeysinghe [mailto:samisa_abeysinghe@yahoo.com]
Sent: Wednesday, April 21, 2004 4:56 PM
To: Apache AXIS C Developers List
Subject: Re: Resolving class name conflicts (for Axis c++ 1.2)
Hi Sanjaya,
If we use namespaces, would it affect services and clients written
in c?
If the answer is no then +1 for namespaces.
Thanks,
Samisa...
--- sanjaya singharage <sanjayas@opensource.lk> wrote:
> What would be the best mechanism to resolve class name conflicts in
> the next Axis c++ release (1.2)?
>
> Two things are possible
>
> 1. Use namespaces for Axis c++ classes
>
> -In this case even if Axis c++ uses some third party libraries that
> has classes with the same class names as Axis c++, that can be
> resolved -When a client application uses Axis c++ and some other
> libraries, class name conflicts between those libraries and axis c++
> can be resolved. -This is a feature that was intended to address such
> conflicts in c++
>
> 2. Use some prefix for class names and hope that will be unique
> enough.
>
> -If by some chance Axis c++ encounters a class with the same class
> name, with prefix and all, all the class names will need to have their
> prefix changed.
>
> What are other plus or minus points for these two items? Is there any
> other approach that we can follow?
>
> sanjaya.
>
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢ | http://mail-archives.apache.org/mod_mbox/axis-c-dev/200404.mbox/%3C001a01c4282d$20adb1b0$0a65a8c0@SusanthaNB%3E | CC-MAIN-2018-30 | refinedweb | 290 | 72.56 |
Parse the .wav audio file
Now that we have discussed the .wav file format, set up the initial audio components, and opened our .wav file in the app, we can process the .wav file based on the structure we discussed earlier in Structure of a .wav file.
Handle chunk tags
In our calling function, first we find the format tag ("fmt ") using find_tag(). Because non-PCM format uses extra parameter space, we must skip over the length of the format chunk, which is the size of wave_hdr from the current position of the file pointer.
To make it easier to read the tags, we can abstract the set of statements into a function. After we locate the tag structure, we must return the length of the memory block that appears before the tag. Because of the byte order that the fields are stored in, we need to convert the 32-bit (4-byte) length variable to little-endian format to read the field as an unsigned byte order. To perform this conversion, we can use the macro ENDIAN_LE32(), which is declared in gulliver.h.
The find_tag() function below accepts the first parameter, FILE *fp, which is an open file pointer to the .wav file. The second parameter, const char *tag, is a character array that represents the tag that we want to search for. The function returns the little-endian version of the length variable.
int find_tag(FILE *fp, const char *tag) { int ret_val = 0; riff_tag tag_bfr = { "", 0 }; /* Keep reading until we find the tag or hit the end of file */ while (fread((unsigned char *) &tag_bfr, sizeof(tag_bfr), 1, fp)) { /* If this is our tag, set the length and break */ if (strncmp(tag, tag_bfr.tag, sizeof tag_bfr.tag) == 0) { ret_val = ENDIAN_LE32(tag_bfr.length); break; } /* Skip ahead the specified number of bytes in the stream */ fseek(fp, tag_bfr.length, SEEK_CUR); } /* Return the result of our operation */ return (ret_val); }
Handle the .riff chunk descriptor
To read the .riff header, you can write a function similar to the check_hdr() function that appears below. This function determines if we have a .riff file and whether it contains .wav data. The function accepts the parameter FILE * fp, which is a pointer to the .wav file. The function returns 0 if it is successful, otherwise it returns a negative value.
int check_hdr(FILE * fp) { riff_hdr riff_header = { "", 0 }; /* Read the header and make sure that this is indeed a Wave file. */ if (fread((unsigned char *) &riff_header, sizeof(riff_hdr), 1, fp) == 0) return 0; if (strncmp(riff_header.Riff, riff_id, strlen(riff_id)) || strncmp(riff_header.Wave, wave_id, strlen(wave_id))) return -1; return 0; }
Last modified: 2015-03-31
Got questions about leaving a comment? Get answers from our Disqus FAQ.comments powered by Disqus | http://developer.blackberry.com/native/documentation/graphics_multimedia/audio_video/tutorial_play_a_wav_parse_the_wav_audio_file.html | CC-MAIN-2018-13 | refinedweb | 454 | 65.52 |
Hey ! You need to learn python . If you are looking a short tutorial which can give a good start in Python . So Please trust me this will be end of your search . Anyways Python is not only a scripting language which is used for data science . There are so many uses of python for example a big community of developer use python in multimedia Software development. In the same way , So many Developer developer use python in Web Application development. That is why we call Python is a multipurpose Language like Java.
Now are You ready For being hard core developer in Python .Of course , You are ! Right ? So you need to first install python . You can Download Python and Install it . There are two basic version of Python 2.x family and 3.x family . 2.x comes with great documentation and community support .In the flip of coin , 3.x is very fast . So It is completely Application dependent what you should choose .
I hope you have installed Python. You have to set the path into environment if you are using Windows based Operating system. Now Lets Learn Python –
Road map to learn Python essentials simple and describe below . After reading this article you will be knowing at least writing basic code in Python .
Now lets start briefing one by one-
1.Learn Python Data Type-
Python support five standard data type . Unlike other Programming language Python is quite flexible in data type . Here we use one root type for every sub data type For example In java for numbers we have to define the sub set Int , Float , double but in python we use Number as a data type . There are five data type respectively Number, String , Tuple , List , Dictionary .
Syntax-
var coin =5 # Number Declaration
var result =8.9 # Number Decleration
Str =’Data Science Learner’ # String Decleration
list_of_python = [1, ‘learn python ‘ , 4.5 ] # List Declaration
Tuple_of_python =(‘Rahul’, 4, 98) 3 #Tuple Declaration
Dictionart_of _Python = { ‘key1 ‘=’value1’ , ‘key2 ‘=’value2’}
Difference between List and Tuple in Python –
List and Tuple in python looks quite similar . In fact , There is quite similarity in List in Python and Tuple in Python . The only difference is that you can not update tuple while you can update a list in python .These two data type are similar as Array in C but unlike C there we can store different data type .
For Example-
Python_List= [ “Data Science Learner “, 3.4 ,3] # Here we are storing different data type in a Python List
2.Conditional Statement in Python –
Conditional Statement in Python is quite similar with conditional Statement in java and other traditional Programming Language .
if <condition is=”” true=””>:
———————————
———————————-
elif <condition2>:
———————————-
———————————-
else:
<do another=”” thing=””>:
———————————
There will not be any closing braces in python .There will be : symbol after every conditional statement in Python .
3. Loop in Python-
If you want to be a expert in python the only way is to learn the basics .
Syntax of for loop-
for var in range(limit source, limit destination):
Statement 1;
Statement 2;
4. Function in Python –
Function is used to modular the code . We have to use ‘def ‘ keyword in defining the function . Functions in python is consist of two parts.
- Defining a Function in Python
- Calling a Function in Python
Defining a Function in Python-
Here we write the behavior of the function . What does it going to perform and what does it going to return like that .
For Example-
def funname (parameters 1, parameters 2, …………… ):
statement 1
statement 2
—————————
return expression
Calling a Function in Python-
For calling a function in python we have just pass the values ( actual arguments ) and Semicolon ‘;’ is also required at end of caller statement .
For Example-
Funname(10 ,20);
5.Python Modules-
If you want to add any functionality . The required functionality is not in current module you have to just import that module in your current script .
Syntax-
import part_you_need from module_name # adding only a part into current namespace
import module_name * # Importing all into the current namespace from module
6. I/O Function in Python-
If you want to input a string using Python there are so many option . I am going to list two function for you guys :
- input
- raw_input
Syntax For input function in Python –
var = input(“Learn python using input function”)
var = raw_input(“Learn python using raw_input function”)
Last Notes –
I have not given a detailed tutorial in this article .This can only give you a start to know the essentials . After reading you can start coding in python . See I am telling you my own experience in coding , You cant learn any programming language by reading at once . You have to read first then write some code . Learn again fill your knowledge gap in that programming language .
Specially If you want to learn Python , You can not be rigid to a particular approach because it is open source language . Developers are contributing some thing everyday . So you should learn python basics only and for advance work in python always look for a better way . How much you write code your experience will help you in writing the similar task in less time next time . Learning a programming language is an on going process . Never Commit this process .
Few words for IDE –
In the continuous series of article our next post will give you a deep approach in learning python . If i discuss about IDE for python there are so many option. In which I selected PyDev with Eclipse. This IDE made my life simpler , I do not have to remember to much syntax .By just knowing few trick in eclipse you can save lot of time . As smart coder you should go for recommendation made by IDE .
For example you want to run a function of a module for this you just have to write the name of module and then ” .” . a=just after it press Ctrl and space together . ide will automatically show you all function inside that module . You have to just choose the function . You need not to remember the complete syntax of the function .
I hope you have enjoyed this short tutorial to Learn Python . There is another article for learning Python for Data Science if you have already good understanding of Python basics. In the Complete Overview of Learning Python for Data Analysis , you will know the complete overview of how to start programming data science in Python Language.
If you have any suggestion or improvement you can comment below . We love to write for you . If you want to get free Ebooks and other materials on python , Do not forget to subscribe us .
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox. | https://www.datasciencelearner.com/learn-python-essentials/ | CC-MAIN-2018-39 | refinedweb | 1,125 | 74.29 |
The objective of this post is to explain how to get the body of a request sent to a HTTP webserver runing on the ESP8266.
Introduction
The objective of this post is to explain how to get the body of a request sent to a HTTP webserver running on the ESP8266. In this example we will be sending to the server a HTTP POST request with some JSON body content.
You can check this previous tutorial where we explain how to configure the ESP8266 to work as a simple HTTP webserver. It will be useful for understanding some of the functions used here.
The code
First of all, we include the ESP8266WiFi library, which will make available the functionality needed for the ESP8266 to connect to a WiFi network. You can check a more detailed explanation on how to connect to a WiFi network from the ESP8266 on this previous post.
Then, we include the ESP8266WebServer library, which will make available the class ESP8266WebServer that we will use during this post.
Next, we declare a global object variable from the previously mentioned class. The constructor of this class receives as argument the port where the server will be listening. We will pass 80, which is the default port for HTTP.
We will also specify the name (SSID) and password of our WiFi network in two global variables.
#include <ESP8266WiFi.h> #include <ESP8266WebServer.h> ESP8266WebServer server(80); const char* ssid = "YourNetworkName"; const char* password = "YourNetworkPassword";
For the setup function, we will start by opening the serial port and then connecting to the WiFi network. One important thing is to print the local IP of the ESP8266 on our WiFi network, so we know where to send the HTTP request. To get this value, we just call the localIP method on the WiFi global variable and then print it to the serial port.
Serial.begin(115200); WiFi.begin(ssid, password); //Connect to the WiFi network while (WiFi.status() != WL_CONNECTED) { //Wait for connection delay(500); Serial.println("Waiting to connect..."); } Serial.print("IP address: "); Serial.println(WiFi.localIP()); //Print the local IP
Then, we need to specify which code to execute when an HTTP request is performed to our websever. To do so, we call the on method on our previously declared server global object.
As the first argument of this method, we pass it the path or route where the server will be listening to. As second argument, we specify an handling function that is executed when a request is received on that path. Naturally, we can specify multiple paths and handling functions, but for our simple example we will only use a path called “/body”.
server.on("/body", handleBody); //Associate the handler function to the path
So, the code mentioned bellow indicates that when an HTTP request is received on the “/body” path, it will trigger the execution of the handleBody function. Note that we don’t specify the IP or port where the ESP8266 is listening, but only the path of the URL from that point onward.
Now, to start our server, we call the begin method on the server object.
server.begin(); //Start the server Serial.println("Server listening");
To handle the actual incoming of HTTP requests, we need to call the handleClient method on the server object, on the main loop function.
void loop() { server.handleClient(); //Handling of incoming requests }
Finally, we need to specify our handling function, called handleBody. But first, we need to take in consideration that there is no specific method or function to access to the body of a request. Thus, in the current implementation, the body of the request is placed on an argument called “plain”.
So, the first thing we will do is checking if an argument called “plain” exists for the received request. If not, we will return a message saying that the body was not received.
To check if a certain argument exists, we need to call the hasArg method on the server object, which receives as input the name of the argument. It will return a Boolean value indicating if it exists or not.
To send a response to a request, we just call the send method, which receives as input the the HTTP response code, the content type and the content.
if (server.hasArg("plain")== false){ //Check if body received server.send(200, "text/plain", "Body not received"); return; }
If the body was received (as the “plain” argument), we just obtain it by calling the arg method on the server object and pass as input the name of the argument.
String message = "Body received:\n"; message += server.arg("plain"); message += "\n";
Finally, we send back the body to the client in a response message. Additionally, for the purpose of illustration, we are also printing this message to the serial port. Note that if your webserver will be receiving a lot of requests in short periods of time, then printing outputs to the serial port may affect performance.
server.send(200, "text/plain", message); Serial.println(message);
Check the full code bellow.
#include <ESP8266WiFi.h> #include <ESP8266WebServer.h> ESP8266WebServer server(80); const char* ssid = "YourNetworkName"; const char* password = "YourNetworkPassword"; void setup() { Serial.begin(115200); WiFi.begin(ssid, password); //Connect to the WiFi network while (WiFi.status() != WL_CONNECTED) { //Wait for connection delay(500); Serial.println("Waiting to connect..."); } Serial.print("IP address: "); Serial.println(WiFi.localIP()); //Print the local IP server.on("/body", handleBody); //Associate the handler function to the path server.begin(); //Start the server Serial.println("Server listening"); } void loop() { server.handleClient(); //Handling of incoming requests } void handleBody() { //Handler for the body path if (server.hasArg("plain")== false){ //Check if body received server.send(200, "text/plain", "Body not received"); return; } String message = "Body received:\n"; message += server.arg("plain"); message += "\n"; server.send(200, "text/plain", message); Serial.println(message); }
Testing the code
To test the code, start by uploading it to the ESP8266 using the Arduino IDE. Then, open the serial port, wait for the connection to the WiFi Network and copy the local IP printed.
Then, to send a post request for the ESP8266 with a body content, the fastest way is by using a tool like Postman. Postman is a HTTP client to test HTTP requests [2], which is particullary usefull when testing REST APIs. You can check here an introdutory video on how to make GET requests with Postman and here how to make POST requests.
So, after opening Postman, choose the POST method from the method dropdown, and put the URL where the request will be sent:
Note that you should change the 192.168.1.73 (the IP of my ESP in my network) by the local IP that was printed on your Arduino console.
Then, go to the body tab of postman, choose the “raw” radio button and on the last dropdown of that row choose JSON(application/json). Finally, on the input text box bellow, put the content of your request. In this example, I’ve sent some dummy JSON content, representing a command to a device:
{ "device": "Relay", "status": "On" }
Then hit send and if everything was correctly configured, you should get an output as shown in figure 1, which also has the main areas to configure mentioned before highlighted.
Figure 1 – HTTP POST Request via Postman.
For the ESP8266 side, you can check the serial console, where the body of the request received should now be printed, as shown in figure 2.
Figure 2 – Output of the program, printed to the Arduino serial console.
As an additional test, you can clear the body content from Postman and re-send the request. In that case, since no body was sent, a “Body not received” message should be returned by the server.
Related Content
Related Posts
- ESP8266: Connecting to a WiFi Network
- ESP8266 Webserver: Controlling a LED through WiFi
- ESP8266: Setting a simple HTTP webserver
- ESP8266 Webserver: Getting query parameters
- ESP8266: uploading code from Arduino IDE
References
[1]
[2]
Technical details
ESP8266 libraries: v2.3.0
your blog is an excellent esp8266 resource. i refer all esp questions i get here
LikeLiked by 1 person
Hi! Thanks for the feedback, I’m very happy you are finding the content useful 🙂 I will try to keep posting regularly.
LikeLiked by 1 person
what if i want to do more with the received request.
for suppose in my browser i’ll send¶meter2=somevalue.
i want to check if the incoming request has the “update” and i’ll store the request in a string and parse it out and do something with the parsed data.
i know how to do it with WiFiServer but i actually want to implement it with ESP8266WebServer Library.
LikeLiked by 1 person
Hello,
From what I understood, you want to get the parameter1 and parameter2 values, right? If so, just follow this tutorial, which explains how to obtain the query parameters:
Once you have accessed them, you can store and parse them according to your needs.
Let me know if this helps.
Best regards,
Nuno Santos | https://techtutorialsx.com/2017/03/26/esp8266-webserver-accessing-the-body-of-a-http-request/ | CC-MAIN-2017-34 | refinedweb | 1,510 | 63.7 |
import java.io.Serializable ;28 import java.util.Iterator ;29 30 /**31 * Markers are named objects used to enrich log statements. Conforming32 * logging system Implementations of SLF4J determine how information33 * conveyed by markers are used, if at all. In particular, many34 * conforming logging systems ignore marker data.35 * 36 * <p>Markers can contain child markers, which in turn can contain children 37 * of their own.38 *39 * @author Ceki Gülcü40 */41 public interface Marker extends Serializable {42 43 /**44 * This constant represents any marker, including a null marker.45 */46 public static final String ANY_MARKER = "*";47 48 /**49 * This constant represents any non-null marker.50 */51 public static final String ANY_NON_NULL_MARKER = "+";52 53 54 /**55 * Get the name of this Marker.56 * @return name of marker57 */ 58 public String getName();59 60 /**61 * Add a child Marker to this Marker.62 * @param child a child marker63 */64 public void add(Marker child);65 66 /**67 * Remove a child Marker.68 * @param child the child Marker to remove69 * @return true if child could be found and removed, false otherwise.70 */71 public boolean remove(Marker child);72 73 /**74 * Does this marker have children?75 * @return true if this marker has children, false otherwise.76 */77 public boolean hasChildren();78 79 /**80 * Returns an Iterator which can be used to iterate over the81 * children of this marker. An empty iterator is returned when this82 * marker has no children.83 * 84 * @return Iterator over the children of this marker85 */86 public Iterator iterator();87 88 /**89 * Does this marker contain the 'other' marker? Marker A is defined to 90 * contain marker B, if A == B or if B is a child of A. 91 * 92 * @param other The marker to test for inclusion.93 * @throws IllegalArgumentException if 'other' is null94 * @return Whether this marker contains the other marker.95 */96 public boolean contains(Marker other);97 98 99 100 /**101 * Does this marker contain the marker named 'name'? 102 * 103 * If 'name' is null the returned value is always false.104 * 105 * @param other The marker to test for inclusion.106 * @return Whether this marker contains the other marker.107 */108 public boolean contains(String name);109 110 // void makeImmutable();111 // public boolean isImmutable();112 }113
Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ | | http://kickjava.com/src/org/slf4j/Marker.java.htm | CC-MAIN-2017-30 | refinedweb | 390 | 57.06 |
Build a Contacts Manager Using Backbone.js: Part 2
This Cyber Monday Tuts+ courses will be reduced to just $3 (usually $15). Don't miss out.
Welcome back to part two of this tutorial; in part one we looked at some of the model, collection and view basics for when working with Backbone and saw how to render individual contact views using a master view bound to a collection.
In this part of the tutorial, we're going to look at how we can filter our view based on user input, and how we can add a router to give our basic application some URL functionality.
We'll need the source files from part one as we'll be building on the existing code for this part. I'd strongly recommend reading part one if you haven't already.
Reacting to User Input
You may have noticed in part one that each of our individual models has an attributed called type which categorises each model based on whether it relates to a friend, family member of colleague. Let's add a select element to our master view that will let the user filter the contacts based on these types.
Now, we can hardcode a select menu into our underlying HTML and manually add options for each of the different types. But, this wouldn’t be very forward thinking; what if we add a new type later on, or delete all of the contacts of a certain type? Our application doesn’t yet have the capability to add or remove contacts (part three spoiler alert!), but it's still best to take these kinds of things into consideration, even at this early stage of our application.
As such, we can easily build a select element dynamically based on the existing types. We will add a tiny bit of HTML to the underlying page first; add the following new elements to the contacts container:
<header> <div id="filter"><label>Show me:</label></div> </header>
That's it, we've an outer
<header> element to act as a general container, within which is another container with an
id attribute, and a
<label> with some explanatory text.
Now let's build the
<select> element. First we'll add two new methods to our
DirectoryView mater view; the first one will extract each unique type and the second will actually build the drop-down. Both methods should be added to the end of the view:
getTypes: function () { return _.uniq(this.collection.pluck("type"), false, function (type) { return type.toLowerCase(); }); }, createSelect: function () { var filter = this.el.find("#filter"), select = $("<select/>", { html: "<option>All</option>" }); _.each(this.getTypes(), function (item) { var option = $("<option/>", { value: item.toLowerCase(), text: item.toLowerCase() }).appendTo(select); }); return select; }
The first of our methods,
getTypes() returns an array created using Underscore's
uniq() method. This method accepts an array as an argument and returns a new array containing only unique items. The array we pass into the
uniq() method is generated using Backbone's
pluck() method, which is a simple way to pull all values of a single attribute out of a collection of models. The attribute we are interested in here is the
type attribute.
In order to prevent case issues later on, we should also normalise the types to lowercase. We can use an iterator function, supplied as the third argument to
uniq(), to transform each value before it is put through the comparator. The function receives the current item as an argument so we just return the item in lowercase format. The second argument passed to
uniq(), which we set to
false here, is a flag used to indicate whether the array that is being compared has been sorted.
The second method,
createSelect() is slightly larger, but not much more complex. Its only purpose is to create and return a new
<select> element, so we can call this method from somewhere else in our code and receive a shiny new drop-down box with an option for each of our types. We start by giving the new
<select element a default
<option> with the text
All.
We then use Underscore's
each() method to iterate over each value in the array returned by our
getTypes() method. For each item in the array we create a new
<option> element, set its text to the value of the current item (in lowercase) and then append it to the
To actually render the
<select> element to the page, we can add some code to our master view's
initialize() method:
this.$el.find("#filter").append(this.createSelect());
The container for our master view is cached in the
$el property that Backbone automatically adds to our view class, so we use this to find the filter container and append the
<select element to it.
If we run the page now, we should see our new
<select> element, with an option for each of the different types of contact:
Filtering the View
So now we have our
<select menu, we can add the functionality to filter the view when an option is selected. To do this, we can make use of the master view's
events attribute to add a UI event handler. Add the following code directly after our
renderSelect() method:
events: { "change #filter select": "setFilter" },
The
events attribute accepts an object of
key:value pairs where each key specifies the type of event and a selector to bind the event handler to. In this case we are interested in the
change event that will be fired by the
<select element within the
#filter container. Each value in the object is the event handler which should be bound; in this case we specify
setFilter as the handler.
Next we can add the new handler:
setFilter: function (e) { this.filterType = e.currentTarget.value; this.trigger("change:filterType"); },
All we need to do in the
setFilter() function is set a property on the master view called
filterType, which we set to the value of the option that was selected, which is available via the
currentTarget property of the event object that is automatically passed to our handler.
Once the property has been added or updated we can also trigger a custom
change event for it using the property name as a namespace. We'll look at how we can use this custom event in just a moment, but before we do, we can add the function that will actually perform the filter; after the
setFilter() method add the following code:
filterByType: function () { if (this.filterType === "all") { this.collection.reset(contacts); } else { this.collection.reset(contacts, { silent: true }); var filterType = this.filterType, filtered = _.filter(this.collection.models, function (item) { return item.get("type").toLowerCase() === filterType; }); this.collection.reset(filtered); } }
We first check whether the master view's
filterType property is set to
all; if it is, we simply repopulate the collection with the complete set of models, the data for which is stored locally on our
contacts array.
If the property does not equal
all, we still reset the collection to get all the contacts back in the collection, which is required in order to switch between the different types of contact, but this time we set the
silent option to
true (you'll see why this is necessary in a moment) so that the
reset event is not fired.
We then store a local version of the view's
filterType property so that we can reference it within a callback function. We use Underscore's
filter() method to filter the collection of models. The
filter() method accepts the array to filter and a callback function to execute for each item in the array being filtered. The callback function is passed the current item as an argument.
The callback function will return
true for each item that has a
type attribute equal to the value that we just stored in the variable. The types are converted to lowercase again, for the same reason as before. Any items that the callback function returns
false for are removed from the array.
Once the array has been filtered, we call the
reset() method once more, passing in the filtered array. Now we're ready to add the code that will wire up the
setType() method, the
filterType property and
filterByType() method.
Binding Events to the Collection
As well as binding UI events to our interface using the
events attribute, we can also bind event handlers to collections. In our
setFilter() method we fired a custom event, we now need to add the code that will bind the
filterByType() method to this event; add the following code to the
initialize() method of our master view:
this.on("change:filterType", this.filterByType, this);
We use Backbone's
on() method in order to listen for our custom event. We specify the
filterByType() method as the handler function for this event using the second argument of
on(), and can also set the context for the callback function by setting
this as the third argument. The
this object here refers to our master view.
In our
filterByType function, we reset the collection in order to repopulate it with either all of the models, or the filtered models. We can also bind to the
reset event in order to repopulate the collection with model instances. We can specify a handler function for this event as well, and the great thing is, we've already got the function. Add the following line of code directly after the
change event binding:
this.collection.on("reset", this.render, this);
In this case we're listening for the
reset event and the function we wish to invoke is the collection's
render() method. We also specify that the callback should use
this (as in the instance of the master view) as its context when it is executed. If we don't supply
this as the third argument, we will not be able to access the collection inside the
render() method when it handles the
reset event.
At this point, we should now find that we can use the select box to display subsets of our contacts. The reason why we set the
silent option to true in our
filterByType() method is so that the view is not re-rendered unnecessarily when we reset the collection at the start of the second branch of the conditional. We need to do this so that we can filter by one type, and then filter by another type without losing any models.
Routing
So, what we've got so far is alright, we can filter our models using the select box. But wouldn’t it be awesome if we could filter the collection using a URL as well? Backbone's router module gives us this ability, let's see how, and because of the nicely decoupled way that we've structured our filtering so far, it's actually really easy to add this functionality. First we need to extend the Router module; add the following code after the master view:
var ContactsRouter = Backbone.Router.extend({ routes: { "filter/:type": "urlFilter" }, urlFilter: function (type) { directory.filterType = type; directory.trigger("change:filterType"); } });
The first property we define in the object passed to the Router's
extend() method is
routes, which should be an object literal where each key is a URL to match and each value is a callback function when the URL is matched. In this case we are looking for URLs that start with
#filter and end with anything else. The part of the URL after the
filter/ part is passed to the function we specify as the callback function.
Within this function we set or update the
filterType property of the master view and then trigger our custom
change event once again. This is all we need to do in order to add filtering functionality using the URL. We still need to create an instance of our router however, which we can do by adding the following line of code directly after the
DirectoryView instantiation:
var contactsRouter = new ContactsRouter();
We should now be able to enter a URL such as
#filter/family and the view will re-render itself to show just the contacts with the type family:
So that's pretty cool right? But there's still one part missing – how will users know to use our nice URLs? We need to update the function that handles UI events on the
<select element so that the URL is updated when the select box is used.
To do this requires two steps; first of all we should enable Backbone's history support by starting the history service after our app is initialised; add the following line of code right at the end of our script file (directly after we initialise our router):
Backbone.history.start();
From this point onwards, Backbone will monitor the URL for hash changes. Now, when we want to update the URL after something happens, we just call the
navigate() method of our router. Change the
filterByType() method so that it appears like this:
filterByType: function () { if (this.filterType === "all") { this.collection.reset(contacts); <b>contactsRouter.navigate("filter/all");</b> } else { this.collection.reset(contacts, { silent: true }); var filterType = this.filterType, filtered = _.filter(this.collection.models, function (item) { return item.get("type") === filterType; }); this.collection.reset(filtered); <b>contactsRouter.navigate("filter/" + filterType);</b> } }
Now when the select box is used to filter the collection, the URL will be updated and the user can then bookmark or share the URL, and the back and forward buttons of the browser will navigate between states. Since version 0.5 Backbone has also supported the pushState API, however, in order for this to work correctly the server must be able to render the pages that are requested, which we have not configured for this example, hence using the standard history module.
Summary
In this part of the tutorial, we looked at a couple more Backbone modules, specifically the Router, History and Events modules. We've now looked at all of the different modules that come with Backbone.
We also looked at some more Underscore methods, including
filter(), which we used to filter down our collection to only those models containing a specific type.
Lastly, we looked at Backbone's Router module, which allowed us to set routes that can be matched by our application in order to trigger methods, and the History module which we can use to remember state and keep the URL updated with hash fragments.
One point to take away is the loosely coupled nature of our filtering functionality; when we added filtering via the select menu, it was done in such a way that it was very quick and easy to come along afterwards and add a completely new method of filtering without having to change our
filter() method. This is one of the keys to successfully building non-trivial, maintainable and scalable JavaScript applications. If we wanted, it would be very easy to add another, completely new method of filtering, which having to change our filtering method.
In the next part of this series, we'll go back to working with models and see how we can remove models from, and add new ones to the collection.
| http://code.tutsplus.com/tutorials/build-a-contacts-manager-using-backbonejs-part-2--net-24315 | CC-MAIN-2014-49 | refinedweb | 2,541 | 58.42 |
Sharing memory is a powerful tool and it can now be done simply....
You have an application, we will call it application "A.exe", and you would like it to pass data to your application "B.exe". How would you do this?
For example, application "A" is a complex user interface that logs users in, reads databases, and adds user form controls for controlling attached hardware.
Application "B" needs to run at the same time within the same PC on another thread/CPU core. It controls hardware in real
time via LAN or USB, yet needs data that would require application "A"’s users database results.
Sharing memory in real time is the best way. However this is not as easy as it sounds......
The memory on a PC is fully managed by the Operating System, in this case Microsoft Windows 7. The Operating System has to balance all the different
running applications over several CPU cores for all of the running "threads". The application's "A" thread will have no knowledge of the application's "B" thread
or its memory use. So how can we set aside some memory to share some data?
In the bad old days of programming, you would have typed "Reserve Memory Address XXX", and in "Basic" would have typed keywords like
PEEK or POKE to place the data in. However, if all your applications did this, you soon would have run out of memory, which did happen!
PEEK
POKE
Until .NET Framework 4, sharing memory was hard to do. But thanks to some new functions, it is really easy and your application don’t
have to know anything about threads or memory as the new function takes care of the memory, thread safety all for you.
This new shared memory function is handled just like files; you open them with a name, add data to them, and share them across different applications.
The data can be a few bytes to Gigabytes. However, I prefer to use a small "buffer file of shared memory". The task of my shared memory file is to pass variables
and data from my different applications.
Another example: You could have a shared memory file called "Commands" which is only a few bytes big, sent from application A. Application
B reads the commands and replies with its shared memory file called "Results" and puts them ready for application A. The combination is limitless and you can have any
number of running applications.
For further reading, please refer to.
The code Imports the System.IO.MemoryMappedFiles namespace
which has all the classes you need for controlling memory mapped files, and waits for the buttons MakeFile or ReadFile mouse click events to fire.
System.IO.MemoryMappedFiles
MakeFile
ReadFile
To write some data to share in memory, you do the following....
Call MakeMemoryMappedFile().
MakeMemoryMappedFile()
First, you declare an object; I used "File" as a memory mapped
file which you can "Open" with the number of bytes you need (e.g., 26), and name it, here I have used "MemoryFile".
File
MemoryFile
Dim File=MemoryMappedFile.CreateOrOpen("MemoryFile",26)
Notice I have used "CreateOrOpen". This is useful if your application could find that another application has already opened it with the same name.
You could just use "Create" for even more simplicity.
CreateOrOpen
Create
Next, I generate an "Array of 26 bytes" called "bytes".
This is going to be my byte memory buffer, which can hold anything I wish to share across the applications.
In this case, I am just going to place a simple count into "Bytes" as 1,2,3,4... This is all done in the "For Next" loop.
bytes
Now we need to make our shared memory called "MemoryFile" viewable to our other applications. This is done by using an object I called "writer"
and calling the method "CreatViewAccessor". This now makes the memory file data "Viewable". You can set the start and size that you wish
your viewing application to see, I used 0 the Start of "bytes Array" and the "bytes Array" length (26).
CreatViewAccessor
Viewable
bytes Array
Using writer = File.CreateViewAccessor(0, bytes.Length)
With the "MemoryFile" open and Viewable all that is left to do is to write our byte array to the shared memory this is done with:
writer.WriteArray(Of Byte)(0, bytes, 0, bytes.Length)
To read the data in shared memory you need to do the following.....
Call ReadMemoryMappedFile().
ReadMemoryMappedFile()
My object "File" here is used to "Open" an "Existing" shared
memory file which we opened in the above method, called "MemoryFile".
Using file = MemoryMappedFile.OpenExisting("MemoryFile")
Here Try and Catch is important to help us, as the shared memory file may not exist, so I catch the exception and simply show a
message box that it does not exist. You could add your own handler here. Note: unlike standard file handling, this class does not support "If.exist".
Try
Catch
If.exist
With the reader open, the class needs to know what you want to access and view. This is done with my object called "reader" and using
the "CreateViewAccessor" method with the start and number of bytes to access. But first I ready a buffer to hold the data bytes to be read, I’ve also called
it "bytes", because I know how many bytes I am sending - I've hard coded this the same size (26).
reader
CreateViewAccessor
Then load the buffer with:
reader.ReadArray(Of Byte)(0, bytes, 0, bytes.Length)
Finally, I display the bytes converted to a string in a text box. Your code could parse the bytes for commands or data for further action
or events. You should close the memory just like you would do with a file. In this example, I left it open so it can be called recursively for demonstration.
The code shown here is just one form; the same code is repeated in a different application I called form 2, with just the data in the write array changed to show that you can change it.
The demo VB.NET application is two projects in the same VS2010 solution. They consist of one form each.
We use the System.IO.MemoryMappedFiles namespace in both and my example uses a few bytes from your system memory.
Application Form1 writes a few bytes when you click the Makefile button. E.g., values 1, 2, 3, 4.. etc. You can read them back on the same form textbox
with the ReadFile button, or more importantly from the other application Form2 Readfile button.
Form1
Form2
Application Form2 Makefile button puts some different data (adds 10) to the same shared memory file so that you can see how easy it is to read the different values.
Once you play with the demo, you should be able to adapt it for your own applications.....
Imports System
Imports System.IO
Imports System.IO.MemoryMappedFiles
''' <summary>
''' Demo Form 1
''' </summary>
''' <remarks>
''' By David Rathbone 18/08/2011
''' Many thanks to Microsoft
''' </remarks>
Public Class Form1
''' <summary>
''' Write Memory
''' </summary>
''' <remarks></remarks>
Private Sub MakeMemoryMappedFile()
Dim File = MemoryMappedFile.CreateOrOpen("MemoryFile", 26)
Dim bytes = New Byte(25) {}
For i As Integer = 0 To bytes.Length - 1
bytes(i) = i + 1
Using writer = File.CreateViewAccessor(0, bytes.Length)
writer.WriteArray(Of Byte)(0, bytes, 0, bytes.Length)
End Using
End Sub
''' <summary>
''' Read Memory
''' </summary>
''' <remarks></remarks>
Private Sub ReadMemoryMappedFile()
Try
Using file = MemoryMappedFile.OpenExisting("MemoryFile")
Using reader = file.CreateViewAccessor(0, 26)
Dim bytes = New Byte(25) {}
reader.ReadArray(Of Byte)(0, bytes, 0, bytes.Length)
TextBox1.Text = ""
For i As Integer = 0 To bytes.Length - 1
TextBox1.AppendText(CStr(bytes(i)) + " ")
End Using
End Using
Catch noFile As FileNotFoundException
TextBox1.Text = "Memory-mapped file does not exist."
Catch Ex As Exception
End Try
End Sub
''' <summary>
''' Button Make File Click event
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub Btn_Make_Click(sender As System.Object, e As System.EventArgs) _
Handles Btn_Make.Click
MakeMemoryMappedFile()
End Sub
''' <summary>
''' Button Read File Click event
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub Btn_Read_Click(sender As System.Object, e As System.EventArgs) _
Handles Btn_Read.Click
ReadMemoryMappedFile()
End Sub
End Class
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.MemoryMappedFiles;
namespace ApplicationA
{
public class Program
{
static void Main(string[] args)
{
string sharingTemp = "Test string";
char[] c = new char[sharingTemp.Length];
byte[] bytes = new byte[sharingTemp.Length + 1];
bytes[0] = (byte)sharingTemp.Length;
for (int i = 0; i < sharingTemp.Length; i++)
{
c[i] = sharingTemp[i];
bytes[i+1] = (byte)c[i];
}
MemoryMappedFile file = MemoryMappedFile.CreateOrOpen("MemoryFile", bytes.Length);
MemoryMappedViewAccessor writer = file.CreateViewAccessor(0, bytes.Length);
writer.WriteArray(0, bytes, 0, bytes.Length);
Console.WriteLine("String to use in memory share: {0}", sharingTemp);
Console.WriteLine("Length: {0}", bytes.Length);
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.MemoryMappedFiles;
namespace ApplicationB
{
class Program
{
static void Main(string[] args)
{
try
{
int size;
MemoryMappedFile file = MemoryMappedFile.OpenExisting("MemoryFile");
MemoryMappedViewAccessor reader = file.CreateViewAccessor(0, 1);
byte[] bytes = new byte[1];
reader.ReadArray(0, bytes, 0, bytes.Length);
size = (int)bytes[0] + 1;
reader = file.CreateViewAccessor(0, size);
bytes = new byte[size];
reader.ReadArray(0, bytes, 0, bytes.Length);
char[] c = new char[size];
for (int i = 0; i < bytes.Length; i++)
{
if(i > 0)
c[i-1] = (char)bytes[i];
}
string temp = new string(c);
Console.WriteLine("Memory sharing success!");
Console.WriteLine("String received: {0}", temp);
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e.Message);
}
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | http://www.codeproject.com/Articles/242386/VB-NET-MEMORY-MAPPING-ACROSS-DIFFERENT-RUNNING-APP?msg=4001866 | CC-MAIN-2014-35 | refinedweb | 1,654 | 59.5 |
12
—
#2 John commented on 2011-01-19:
Thanks for this useful example you provided. I always find seeing simple examples to be the easiest way to learn.
#3 dan commented on 2011-09-18:
Nice example.
Suppose you have a class with class variables, e.g.
class Foo(object): one = 1 letter = "a"
How do you iterate over 'one' and 'letter'?
#4 Z commented on 2012-02-08:
There is a function that exposes the
__dict__ method. It's equivalent, but probably more pythonic.
The vars built-in function
for k, v in vars(a).items(): print k, v myinstatt2 two myinstatt1 one
#5 Dave commented on 2012-03-09:
When I use the vars(a) method illustrated by Z on a generic namespace, I get the data elements, but I also get a "trash" element akin to:
<__main__.Fragment instance at 0x009DE56C>
Is there any simple way to suppress this?
#6 Alvin Mites commented on 2012-06-20:
Find myself referencing this blog quite a bit. Thank you for the shares over the years, like to think I'll get back into the habit of writing to my bog sometime and think the regular examples here will help move that forward.
#7 Eliot commented on 2012-06-25:
Hi Alvin, Thanks! That would be great if you started writing more blog posts. There are a lot of people that have a lot of information that I wish would write blog posts.
#8 Eliot commented on 2012-06-25:
Z: Agree vars() is more pythonic. I just learned about that recently. Thanks for the tip!
#9 hangtwenty commented on 2012-11-03:
I always find myself forgetting this idiom, thanks for making it easy to find again.
#10 Paxwell commented on 2012-12-03:
Hey I really appreciate your blog. I have found no other place that answers so many of my Python questions so quickly. Just want to say thank you and keep it up.
Merry Christmas,
-Paxwell
#11 Brett commented on 2013-03-06:
This article was the last stop on a very long search for me. Thank you so much.
#1 Dave commented on 2010-07-30:
I just tried _ _ dict _ _ (take out spaces) on a Django entity and got an error "'str' object has no attribute '_meta'". Guess I'll keep looking for a way to iterate database fields only for my Django entity?
-- Trindaz/Python on Fedang | http://www.saltycrane.com/blog/2008/09/how-iterate-over-instance-objects-data-attributes-python/ | CC-MAIN-2014-42 | refinedweb | 407 | 74.29 |
Warning: Injector already has a rule for type
I have a bunch of warning messages like this appear when using Robotlegs/Signals. Everytime this command class executes, which is every 2-3 seconds ..this message displays below
If you have overwritten this mapping intentionally you can use "injector.unmap()" prior to your replacement mapping in order to avoid seeing this message. Warning: Injector already has a rule for type "mx.messaging.messages::IMessage", named "".
The command functions fine otherwise but I think I'm doing something wrong anyhow.
public class MessageReceivedCommand extends SignalCommand { [Inject] public var message:IMessage; ...etc.. do something with message.. }
the application context doesnt map IMessage to this command, as I only see an option to mapSignalClass , besides the payload is received fine.
Wonder if anyone knows how I might either fix or suppress this message. I've tried calling this as the warning suggests
injector.unmap(IMessage, "")
but I receive an error - no mapping found for ::IMessage named "".
Thanks
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
Comment Form
You can use
Command ⌘ instead of
Control ^ on Mac
Support Staff 1 Posted by Ondina D.F. on 08 Oct, 2012 08:59 AM
Hello,
Sorry for the late response, I was away over the weekend.
-Could you post the code for the mappings?
-Could it be that you’re using an older version of the SignalCommandMap? I’m not sure, but the warning you’re getting was reported by other users too, and it might be related to a bug in older versions?
Ondina
Ondina D.F. closed this discussion on 15 Oct, 2012 08:39 AM. | http://robotlegs.tenderapp.com/discussions/problems/652-warning-injector-already-has-a-rule-for-type | CC-MAIN-2019-13 | refinedweb | 279 | 67.35 |
Stopping the integration of an ODE at some condition
Posted February 27, 2013 at 02:30 PM | categories: ode | tags: | View Comments
Updated February 27, 2013 at 02:30 PM
Matlab post” function. You setup an event function and tell the ode solver to use it by setting an option..
from pycse import * import numpy as np k = 0.23 Ca0 = 2.3 def dCadt(Ca, t): return -k * Ca**2 def stop(Ca, t): isterminal = True direction = 0 value = 1.0 - Ca return value, isterminal, direction tspan = np.linspace(0.0, 10.0) t, CA, TE, YE, IE = odelay(dCadt, Ca0, tspan, events=[stop], full_output=1) print 'At t = {0:1.2f} seconds the concentration of A is {1:1.2f} mol/L.'.format(t[-1], CA[-1])
At t = 2.46 seconds the concentration of A is 1.00 mol/L.
Copyright (C) 2013 by John Kitchin. See the License for information about copying. | http://kitchingroup.cheme.cmu.edu/blog/2013/02/27/Stopping-the-integration-of-an-ODE-at-some-condition/ | CC-MAIN-2019-26 | refinedweb | 156 | 68.97 |
Generating the skybox textures may require a little more effort because each texture must seamlessly align with the four other textures it shares an edge with. If you are artistically inclined, you may be able to draw or paint these textures, but it is probably easier to use 3D modeling software to render six views of a scene for each face of the skybox. An excellent choice for rendering skyboxes is Terragen (), which creates remarkably realistic-looking images of virtual landscapes. I used Terragen to create the skycube textures in Figure 12-3 that we will be using in the skybox sample code.
Rendering Skyboxes
Rendering the skybox should be the first thing done in a new frame, and negates the need to clear the color buffer (although you will still need to clear the depth buffer).
Since a skybox is just a model of a cube, it can be stored as any other model, but there are a few additional steps required prior to rendering:
1. Set the wrap mode of all the textures in the skybox to GL_CLAMP_TO_EDGE. This is necessary to avoid seams in the skybox, where the cube faces meet. See the previous chapter for more information on wrapping modes. This step needs to be done only once.
2. Set the position of the skybox to be the same as the camera (i.e., the player). This is because the skybox represents very distant scenery that can never be reached by the player.
3. Disable lighting with glDisable(GL_LIGHTING). We don't need to use OpenGL's lighting features because the textures of the skybox have effectively been prelit. With lighting disabled, OpenGL will render the textures with the original brightness levels.
4. Disable the depth buffer with glDepthMask(False). Normally if the player was inside a cube he would not be able to see anything outside of the cube, which is obviously not want we want. Setting the depth mask to False with glDepthMask(False) tells OpenGL to ignore the depth information in the skybox, so that other models will be rendered on top of it.
Once the skybox has been rendered, be sure to reenable lighting and the depth mask, or the other models in the scene may not render correctly. The following two lines should follow the call to render the skybox:
glEnable(GL_LIGHTING) glDepthMask(True)
Let's write code to render a skybox. Listing 12-6 uses the Model3D class from the previous chapter to load a skybox model and its associated textures. When you run it, you will see a scenic view of mountains, and if you adjust the viewpoint with the mouse you will be able to see the landscape from any direction.
Listing 12-6. Rendering a Skybox (skybox.py) SCREEN_SIZE = (800, 600)
from OpenGL.GL import * from OpenGL.GLU import *
import pygame from pygame.locals import *
# Import the Model3D class import model3d def resize(width, height):
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(60.0, float(width)/height, .1, 1000.)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
# Enable the GL features we will be using glEnable(GL_LIGHTING) glEnable(GL_DEPTH_TEST) glEnable(GL_LIGHTING) glEnable(GL_TEXTURE_2D) glShadeModel(GL_SMOOTH)
# Enable light 1 and set position glEnable(GL_LIGHT0)
pygame.init()
screen = pygame.display.set_mode(SCREEN_SIZE, FULLSCREEN | HWSURFACE | ^ OPENGL | DOUBLEBUF)
resize(*SCREEN_SIZE) init()
# Read the skybox model sky_box = model3d.Model3D()
sky_box.read_obj('tanksky/skybox.obj')
# Set the wraping mode of all textures in the skybox to GL_CLAMP_TO_EDGE for material in sky_box.materials.itervalues():
glBindTexture(GL_TEXTURE_2D, material.texture)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
# Used to rotate the world mouse_x = 0.0 mouse_y = 0.0
#Don't display the mouse cursor pygame.mouse.set_visible(False)
while True:
for event in pygame.event.get(): if event.type == QUIT: return if event.type == KEYDOWN: return
# We don't need to clear the color buffer (GL_COLOR_BUFFER_BIT)
# because the skybox covers the entire screen glClear(GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
mouse_rel_x, mouse_rel_y = pygame.mouse.get_rel() mouse_x += float(mouse_rel_x) / 5.0 mouse_y += float(mouse_rel_y) / 5.0
# Rotate around the x and y axes to create a mouse-look camera glRotatef(mouse_y, 1, 0, 0)
# Disable lighting and depth test glDisable(GL_LIGHTING) glDepthMask(False)
# Draw the skybox sky_box.draw_quick()
# Reenable lighting and depth test before we redraw the world glEnable(GL_LIGHTING)
glDepthMask(True)
# Here is where we would draw the rest of the world in a game pygame.display.flip()
Skybox Enhancements
Although a skybox creates a convincing illusion of distance scenery, there are enhancements that can be used to add some more visual flare to the backdrop. One of the downsides of the skybox technique is that it doesn't change over time because the image has been prerendered. Animating parts of the skybox, or adding atmospheric effects on top of it, can add a little extra realism. For example, making the sun shimmer a little or rendering lightning in the distance can enhance a skybox. It is also possible to layer translucent skyboxes and animate one or more of them. For instance, there could be a skybox for distant mountains and another for clouds. Rotating the cloud skybox independently would create realistic-looking weather effects.
Skyboxes aren't the only method of rendering a backdrop in a game; a skydome is a similar technique that uses a sphere, or hemisphere, to display distant scenery. A dome may be a more obvious choice than a cube because the real sky is spherical in nature, but a sphere is not quite as easy to texture as a cube. A cylinder is another alternative, if the player will never look directly up.
Was this article helpful? | https://www.pythonstudio.us/pygame-game-development/note-you-may-have-to-flip-the-normals-on-the-faces-of-the-cube-which-makes-them-point-inward-rather-than-outward-the-reason-for-this-is-that-the-cube-will-be-viewed-from-the-inside-rather-than-the-outside-and-you-want-the-polygons-to-be-facing-the-camera.html | CC-MAIN-2019-51 | refinedweb | 931 | 55.44 |
A PHP7 edition of mongoyii designed for and working with the new MongoDB driver
This is not a complete rewrite of the old documentation, instead it will only detail the new features/ideas behind the PHP7 extension.
Please read the old documentation first if you are new to mongoyii.
There is a new test application for this extension which is a rewrite of the old test appliction.
You can find it over here.
Running the inbuilt tests are the same as before.
Please use the new Github issue tracker for all your questions and bug reports. If you post in the forums please link it in the Github issue tracker.
You can access the Github issue tracker here.
This extension, like the previous, uses semantic versioning 2.0.0.
The licence for this extension remains the same as well, BSD 3 clause. To make it short and to the point: do whatever you want with it.
Before I go into what has changed in this extension it is good to note that many of the changes are not because of my wanting to make them but because the MongoDB driver and PHPLib they have released has changed the workings so dramatically from the old drivers that I was forced to conform to this new standard of working.
There are some parts of the driver and it's PHPLib you will like and others you definitely wont.
All installling is now done through composer. I would NOT recommend installing manually since this extension requires both the driver and the PHPLib MongoDB has released to go with it (which is only on composer as well).
To install simply do (for
dev-master):
composer require sammaye/mongoyii-php7:*
You can find the packagist repository here.
This extension is fully namespaced as:
sammaye\mongoyii
Do not worry! This does not make for too many changes for old applications. It took me about 3 hours to rewrite my test application.
For example, here is how to declare a new model (taken from my test application):
```php use MongoDB\BSON\ObjectID; use MongoDB\BSON\UTCDateTime;
use sammaye\mongoyii\Document;
/** * Represents the article itself, and all of its data */ class Article extends Document { } ```
And that will give you all the same stuff as before.
Now let me show you an example of configuring the
session and
cache component in
your
main.php (again, taken from my test application):
php
'session' => array(
'class' => 'sammaye\mongoyii\util\Session',
),
'cache' => array(
'class' => 'sammaye\mongoyii\util\Cache',
),
So you see use of the namespaces is very easy to get to grips with.
As a final example, let's take a behaviour:
php
public function behaviors()
{
return [
'TimestampBehavior' => [
'class' => 'sammaye\mongoyii\behaviors\TimestampBehavior'
// adds a nice create_time and update_time Mongodate to our docs
]
];
}
So, you see: using namespaces in this extension is very easy. If ever in doubt which namespace to use look up the file in your project and look at the first line where it says something like:
php
namespace sammaye\mongoyii\validators;
Add the class name to that and you have your namespace class.
This is easily the part that has changed the most. To start off, why don't I show an example I use:
php
'mongodb' => [
'class' => 'sammaye\mongoyii\Client',
'uri' => 'mongodb://sam:blah@localhost:27017/admin',
'options' => [],
'driverOptions' => [],
'db' => [
'super_test' => [
'writeConcern' => new WriteConcern(1),
'readPreference' => new ReadPreference(ReadPreference::RP_PRIMARY),
]
],
'enableProfiling' => true
],
Now, let's break this down:
sammaye\mongoyii\Client. This is required and will not be variable.
uriis my server connection string and follows the standard laid out in the PHP documentation
optionsdirectly relate to the
urioptions in the PHP documentation as well, allowing replica set connections etc
enableProfilingallows you to profile your queries as before
dbhas now changed to be an array indexed by the names of the databases you wish to connect to. The value of each index being the options for the PHPLib
Databaseobject
And that is basically it. The write concern, read concern, and other properties are now done per database as you see instead of on client level.
If you have other databases in your configuration and want to set a specific
one as default you can add the
active option as shown:
php
'super_test' => [
'writeConcern' => new WriteConcern(1),
'readPreference' => new ReadPreference(ReadPreference::RP_PRIMARY),
'active' => true
]
__getOnly Gets a Database? ¶
Yes, this is the biggest change between the old driver and the new one.
There is now a clear separation between the client, database, and collection.
So to get the database, ready for fetching a collection you now need to do:
php
Yii::$app->mongodb->selectDatabase()
In the new PHP driver there is no
auth() function. You must athenticate within the
uri of the
mongodb component. You will decide how best to sort out your authentication
database but I decided to put all users into the
admin database. This makes it
incredibly easy to authenticate to one database and then switch as I need.
As you can see, this extension takes multiple databases into account.
If you are using authentication make sure you either layout your users in a way that means you only need one socket connection (like I have above) or make a new component for each time you need to authenticate. You cannot authenticate AFTER connecting anymore.
As for recoding the
Document's
getDbConnection() you now use
getCollection()
like so (due to the separation I mentioned above):
php
public function getCollection()
{
return $this
->getDbConnection()
->selectDatabase('my_other_db_not_default')
->{$this->collectionName()};
}
And you are done...
If you really know what you are doing you can actually set a database as
active making it default for a set of procedures:
php
Yii::$app->mongodb->selectDatabase('my_other_db', ['active' => true]);
But this is for advanced users only!
This is the biggest change away from Yii1. Everything else remains the same and does not require documenting.
Basically, due to how the new driver no longer uses cursors but instead streams I have
recoded the
EMongoDBCriteria object to be
Query (like in Yii2) and it even works similar to
how it does in Yii2.
However, it is good to note that the
Document functions of
find() and
findOne()
return the same as they do in normal Yii1. The return there has not changed.
It is good to note that the way to query has changed though, in accordance with the driver:
php
Article::find(
[
'title' => 'Test'
],
[
'sort' => ['date_created' => -1],
'limit' => 2
// etc
]
)
This is due to how MongoDB uses eager loaded streams. As such the entire query must be defined BEFORE forming the PHP "cursor" object now.
A good place to understand how to query using the new driver is to look at the Github documentation for the MongoDB PHPLib.
Due to the change in the
EMongoCriteria you may need to rewrite model scopes for them to work. A good example would be:
php
[
'condition' => ['deleted' => 0],
'select' => ['_id' => 1],
'sort' => ['date' => -1],
'limit' => 2
'skip' => 1
]
There is not a lot of changes you will see publicly, the biggest one is that
I do not use the
project word anymore for
SELECT in SQL. MongoDB still
does but I don't.
This was a decision put forward by the need to produce clean and workable querying.
I decided, in the end, to make my querying more like Yii2. This actually means you can do this now:
php
$docs = new Query([
'from' => 'colllection',
'condition' => ['what' => 'ever'],
'limit' => 1
])->all()
So, it is a break from Yii1 to Yii2 but it is a good break.
Query logging is now much more extensive. Instead of just logging queries through the models it will now log all queries thanks to a small rewrite which should have been in the original extension.
Now, whenever you get the collection from the MongoDB component in your configuration
it will return my own custom
Collection class which has logging tied into it.
Hopefully, this should take some of the guess work out of building applications.
The MongoDB driver's PHPLib returns subdocuments as
ArrayObjects. This means you need to type cast them via
(array)$subdoc first before you use them in display and forms etc.
Make sure you do not use
ObjectID as your yii session ID. This is because of this issue whereby
you cannot serialise BSON objects yet.
As an exmaple, here is a potential
UserIdentity
authenticate() method you can use (taken from my example application too):
php
public function authenticate()
{
$record=User::model()->findOne(array('username' => $this->username));
if ($record === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else if ($record->password !== crypt($this->password, $record->password)) { // check crypted password against the one provided
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->_id = (String)$record->_id;
$this->errorCode = self::ERROR_NONE;
}
return !$this->errorCode;
}
Notice the line:
$this->_id = (String)$record->_id; it is extremely important or else nothing will work!
DBRefis Deprecated ¶
Yep, it is. If you are using it you will need to get rid of it before using this extension. There is simply no functionality for handling it in the new driver.
Not my fault. It is actually not there yet in the PHPLib!
That should be it. Everything else is pretty much the same, cool, huh?
Please, do let me know if I have left anything out or need to explain something better.
Be the first person to leave a comment
Please login to leave your comment. | http://www.yiiframework.com/extension/mongoyii-php7/ | CC-MAIN-2018-09 | refinedweb | 1,556 | 60.24 |
A really super beginner list of vocab words for code, because sometimes as I’m learning, I just want a brief 10 second synopsis on a term. (When language matters, this list is specific to Ruby.) So here goes:
Variable: a placeholder for a value. This is represented by a “bare word” data type. It allows you to access a value (which could be an extremely long bit of information) via your (typically short) variable name. In addition, as the name implies, a variable’s value can vary, though the specific rules on how it can vary, depend on the language. You can think of a variable as a labeled drawer holding some value.
Constant: this is like a variable, in that it is also a placeholder for a value. However, unlike a variable which can vary, a constant will be set equal to a value once in the course of your program and then it should not be reassigned. (You technically could reassign the constant. The language won’t physically stop you, but you shouldn’t reassign it!) Anytime you call the constant’s name, it will (or should!) always point to the value to which it was originally assigned. In Ruby, a constant starts with a capital letter.
Method: a set of instructions for something you want your code to do. Methods must be “defined” before they can be “called” or “invoked” at one (or many!) points later.
#this is the method definition: def do_something puts "Hello" end #this is the method invocation: do_something => Hello nil
- Parameters: a method can be defined to take information. The parameters are the placeholders in the method definition for that information. For example, we could make our above method take an argument containing some bit of data, and
putsout the value of that data, rather than always
putting “Hello”:
def do_something(data) puts data end
- Arguments: these are very similar to parameters. These are the actual bits of data that are passed into a method’s parameter spot(s) when the method is called. An argument can be raw data (like a “string”) or it can be the name of a variable, where the variable name points to the raw data:
#passing raw data in as an argument: do_something("hi") //=> "hi" nil #assigning a value to a variable and then passing that variable in as the argument: greeting = "hola" do_something(greeting) //=> "hola" nil
- Return Value: In Ruby, a method implicitly (meaning without you having to say so) returns the value of the last line of code - unless you specifically return at some other point. In all of our examples above,
nilis the return value of calling the
do_somethingmethod. (Our
do_somethingmethod is itself invoking the
putsmethod on its last line. The return value of
putsis
nil, so our method
do_somethingreturns
nilor the value of the last evaluated line of code. If we wanted
do_somethingto simply return
hello, we could type hello on the last line inside the function (we would still need to use
putsif we also wanted the method to output hello):
def do_something puts "hello" "hello" end do_something //=> hello #this is the output 'hello' hello #this is the return from the last line inside the method
Terminal: the terminal is where code is “run” and evaluated. This allows you to run a program to “test” it with special tests (written to compare expected code results with actual code results) or see the output, especially in the case of a ‘command line program.’
Text Editor This is the place where you create and edit code projects, similar to using Microsoft Word or Google Docs to write a paper. Text editors are loaded up with code languages; they allow you to format code documents based on the language you are writing, as well as package up multiple files into a larger project. Some examples of text editors include Atom and VS Code. You can choose to run a terminal (where you actually run the code) from within a text editor or separately. Regardless of whether you run your terminal separately or inside your text editor, you generally operate the text editor and the terminal hand in hand while you are designing code. You’ll type in the text editor to write or edit code then run that code in the terminal to see what happens.
Keywords: These are reserved words in a code language that have already been assigned meaning by the writers of the language. Because they are reserved (and already have definitions), they should not be used to name variables or methods. Doing so would cause confusion as you would be over-writing existing definitions with special, temporary definitions. Some examples of Ruby keywords are:
if,
else,
def,
yield,
do,
puts,
Program: this is a collection of code that can be compiled and run together. A program can be as simple as one file, or as complicated as you’d like. Ultimately this is a blanket term for a collection of code that performs some (or many) action(s).
And there you have it! These are some quick definitions to a few of the vocabulary words that I regularly found myself Googling at the beginning of my coding journey. This is by no means comprehensive, even for the vocabulary words above. As with everything in code, you could go much (much) deeper into these words, their meaning, and how they interact with so many other aspects of code.
** Originally published April 30, 2021 via github.io
Discussion (0) | https://dev.to/deliaconstantino/10-basic-coding-terms-for-beginners-24b3 | CC-MAIN-2021-31 | refinedweb | 917 | 59.13 |
vue-list-picker
Just a simple list picker component made with Vue.js.
How to install
npm
$ npm install vue-list-picker --save
yarn
$ yarn add vue-list-picker
Quick start
Vue.js
You can import in your
main.js file
import Vue from 'vue' import VueListPicker from 'vue-list-picker' Vue.use(VueListPicker)
Or locally in any component
import { VueListPicker } from 'vue-list-picker' export default { components: { VueListPicker } }
Nuxt.js
You can import as a Nuxt.js plugin
~/plugins/vue-list-picker.js
import Vue from 'vue' import VueListPicker from 'vue-list-picker' Vue.use(VueListPicker)
and then import it in your
nuxt.config.js file
plugins: [ '~/plugins/vue-list-picker.js' ]
There's a window mouseup event listener so you should use the
<no-ssr> tag
Basic usage
<template> <vue-list-picker : </template> <script> export default { data() { const example1 = { key: 1, content: 'Item 1' } const example2 = { key: 2, content: 'Item 2' } const example3 = { key: 3, content: 'Item 3' } const example4 = { key: 4, content: 'Item 4' } const leftItems = [example1, example2] const rightItems = [example3, example4] return { leftItems, rightItems } } } </script>
Props
Events (optional usage)
Slots (optional usage)
Instructions
Generics
- Right now there's no draggable depency. But if you click and hold your mouse down and drag it into another itens in the same column, all of them it'll selected.
- The title and content background are both blue (#0052c0), but you can change those using the
content-classand
title-classprops.
- By default the height isn't set, but it has an
overflow-yCSS property, so if you use the height prop, you'll have a vertical scroll inside each panel.
- If you pass anything other than
topto
movedItemLocation, the item after moved will go to the bottom.
- The content key should be an unique key inside each array of objects (
left-items/
right-items).
Actions
From top to bottom:
- The first button moves all the left items to the right.
- The second button moves all the selected left items to the right.
- The third button moves all the right items to the left.
- The fourth button moves all the selected right items to the left.
- The fifth button unselect all the selected items from all columns (left and right).
Development
Fork the project and enter this commands in your terminal
git clone cd vue-list-picker yarn
Storybook
For visual testing, this project contains storybook which you can run by doing the next command
$ yarn storybook
Jest
Before making the PR, if you changed something that needs to be tested, please make the tests inside the
tests/unit folder.
To run the tests, you can use the next command
$ yarn test:unit | https://vuejsexamples.com/a-simple-list-picker-component-made-with-vue-js/ | CC-MAIN-2021-21 | refinedweb | 442 | 62.58 |
Readme of my project :-
Machine-Learning-Baseball ⚾.
Hypothesis
We theorized that there is indeed a relationship between the statistics to a game and its outcome. As a result, the group focused on implementing a model that predicted the score of a particular game using the statistics of that game.
Model
As mentioned earlier, the model was built using TFLearn, which is a API to Tensorflow. The model’s input data is the 2020/2021 2020 season, using that data to learn what statistics are import in a game, that trained model could then make a predictions. We applied the model to the 2021.
Code of my project :-
Code is written in Python programming language :Make sure make .py file to execute following code
import numpy as np
class GameStats(object):
def init(self, homeTeamNameIndex, homeTeamScoreIndex, homeTeamStatsIndex, visitorTeamNameIndex, visitorTeamScoreIndex, visitorTeamStatsIndex):
#parse the text file
self.statsFile = open("baseball2016.txt", "r")
self.topArray = []
self.sideArray = []
self.sc = np.zeros((30,30,30), np.int32)
self.sc[:,:,:] = -1
self.am = np.zeros((30,30), np.float32)
self.gameList = []
for line in self.statsFile: homeTeam = "" awayTeam = "" homeScore = 0 awayScore = 0 token = line.split(',') #tokenize the string tokenIndex = [homeTeamNameIndex, homeTeamScoreIndex, visitorTeamNameIndex, visitorTeamScoreIndex] + [i for i in homeTeamStatsIndex] + [i for i in visitorTeamStatsIndex] attributes = dict() for i in xrange(len(token)): if(i in tokenIndex): attributes[i] = removeQuotes(token[i]) self.addScore(attributes[homeTeamNameIndex], attributes[visitorTeamNameIndex], attributes[homeTeamScoreIndex], attributes[visitorTeamScoreIndex]) self.addGame(attributes[homeTeamNameIndex], attributes[homeTeamScoreIndex], [attributes[i] for i in homeTeamStatsIndex], attributes[visitorTeamNameIndex], attributes[visitorTeamScoreIndex], [attributes[i] for i in homeTeamStatsIndex]) self.buildAvgMatrix() self.statsFile.close()
def removeQuotes(string):
if (string.startswith('"') and string.endswith('"')) or (string.startswith("'") and string.endswith("'")):
print("here")
return string[1:-1]
return string
def addGame(self, team1, score1, stats1, team2, score2, stats2):
self.gameList.append([team1, score1, stats1, team2, score2, stats2])
give it two teams, the scores, and it will add it to the matrix
def addScore(self, team1, team2, score1, score2):
'''
for a team in top array, the index in the array corrisponds to the matrix column there located in
for a team in side array, the index in the array corrisponds to the matrix row there located in
'''
#team 1 score entry
try:
row = self.sideArray.index(team2)
except: self.sideArray.append(team2) row = self.sideArray.index(team2) try: col = self.topArray.index(team1) except: self.topArray.append(team1) col = self.topArray.index(team1) temp = self.sc[row, col] counter = 0 for e in temp: if (e == -1): temp[counter] = score1 break counter += 1 self.sc[row, col] = temp #team 2 score entry try: row = self.sideArray.index(team1) except: self.sideArray.append(team1) row = self.sideArray.index(team1) try: col = self.topArray.index(team2) except: self.topArray.append(team2) col = self.topArray.index(team2) temp = self.sc[row, col] counter = 0 for e in temp: if (e == -1): temp[counter] = score2 break counter += 1 self.sc[row, col] = temp
returns the score(s) for match up
def getScore(self, team1, team2, gameSelect = None):
print(team1, team2)
try:
score1 = self.sc[self.sideArray.index(team2), self.topArray.index(team1)]
score2 = self.sc[self.sideArray.index(team1), self.topArray.index(team2)]
if (gameSelect == None):
print(team1, score1)
print(team2, score2)
else:
print(team1, score1[gameSelect])
print(team2, score2[gameSelect])
except:
print('Invalid input of teams')
def getGameList(self):
return self.gameList
constructs a matrix of the avg score in a matchup
def buildAvgMatrix(self):
for col in range(len(self.sc[:,0])): #depth
for row in range(len(self.sc[0, :])): #width
tempScore = self.sc[row, col]
avgScore = 0.0
count = 0.0
for j in tempScore:
if (j != -1):
avgScore += j
count += 1
else:
break
try:
avgScore = avgScore / count
except:
avgScore = -1
self.am[row, col] = avgScore
get the value of the avg score for a match up
def getAvgScore(self, team1, team2):
try:
score1 = self.am[self.sideArray.index(team2), self.topArray.index(team1)]
score2 = self.am[self.sideArray.index(team1), self.topArray.index(team2)]
print(team1, score1)
print(team2, score2)
except:
print('Invalid input of teams')
Baseball Format guide
Field(s) Meaning
1 Date in the form "yyyymmdd"
2 Number of game:
"0" -- a single game
"1" -- the first game of a double (or triple) header
including seperate admission doubleheaders
"2" -- the second game of a double (or triple) header
including seperate admission doubleheaders
"3" -- the third game of a triple-header
"A" -- the first game of a double-header involving 3 teams
"B" -- the second game of a double-header involving 3 teams
3 Day of week ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
4-5 Visiting team and league
6 Visiting team game number
For this and the home team game number, ties are counted as
games and suspended games are counted from the starting
rather than the ending date.
7-8 Home team and league
9 Home team game number
10-11 Visiting and home team score (unquoted)
12 Length of game in outs (unquoted). A full 9-inning game would
have a 54 in this field. If the home team won without batting
in the bottom of the ninth, this field would contain a 51.
13 Day/night indicator ("D" or "N")
14 Completion information. If the game was completed at a
later date (either due to a suspension or an upheld protest)
this field will include:
"yyyymmdd,park,vs,hs,len" Where
yyyymmdd -- the date the game was completed
park -- the park ID where the game was completed
vs -- the visitor score at the time of interruption
hs -- the home score at the time of interruption
len -- the length of the game in outs at time of interruption
All the rest of the information in the record refers to the
entire game.
15 Forfeit information:
"V" -- the game was forfeited to the visiting team
"H" -- the game was forfeited to the home team
"T" -- the game was ruled a no-decision
16 Protest information:
"P" -- the game was protested by an unidentified team
"V" -- a disallowed protest was made by the visiting team
"H" -- a disallowed protest was made by the home team
"X" -- an upheld protest was made by the visiting team
"Y" -- an upheld protest was made by the home team
Note: two of these last four codes can appear in the field
(if both teams protested the game).
17 Park ID
18 Attendance (unquoted)
19 Time of game in minutes (unquoted)
20-21 Visiting and home line scores. For example:
"010000(10)0x"
Would indicate a game where the home team scored a run in
the second inning, ten in the seventh and didn't bat in the
bottom of the ninth.
22-38 Visiting team offensive statistics (unquoted) (in order):
at-bats
hits
doubles
triples
homeruns
RBI
sacrifice hits. This may include sacrifice flies for years
prior to 1954 when sacrifice flies were allowed.
sacrifice flies (since 1954)
hit-by-pitch
walks
intentional walks
strikeouts
stolen bases
caught stealing
grounded into double plays
awarded first on catcher's interference
left on base
39-43 Visiting team pitching statistics (unquoted)(in order):
pitchers used ( 1 means it was a complete game )
individual earned runs
team earned runs
wild pitches
balks
44-49 Visiting team defensive statistics (unquoted) (in order):
putouts. Note: prior to 1931, this may not equal 3 times
the number of innings pitched. Prior to that, no
putout was awarded when a runner was declared out for
being hit by a batted ball.
assists
errors
passed balls
double plays
triple plays
50-66 Home team offensive statistics
67-71 Home team pitching statistics
72-77 Home team defensive statistics
78-79 Home plate umpire ID and name
80-81 1B umpire ID and name
82-83 2B umpire ID and name
84-85 3B umpire ID and name
86-87 LF umpire ID and name
88-89 RF umpire ID and name
If any umpire positions were not filled for a particular game
the fields will be "","(none)".
90-91 Visiting team manager ID and name
92-93 Home team manager ID and name
94-95 Winning pitcher ID and name
96-97 Losing pitcher ID and name
98-99 Saving pitcher ID and name--"","(none)" if none awarded
100-101 Game Winning RBI batter ID and name--"","(none)" if none
awarded
102-103 Visiting starting pitcher ID and name
104-105 Home starting pitcher ID and name
106-132 Visiting starting players ID, name and defensive position,
listed in the order (1-9) they appeared in the batting order.
133-159 Home starting players ID, name and defensive position
listed in the order (1-9) they appeared in the batting order.
160 Additional information. This is a grab-bag of informational
items that might not warrant a field on their own. The field
is alpha-numeric. Some items are represented by tokens such as:
"HTBF" -- home team batted first.
Note: if "HTBF" is specified it would be possible to see
something like "01002000x" in the visitor's line score.
Changes in umpire positions during a game will also appear in
this field. These will be in the form:
umpchange,inning,umpPosition,umpid with the latter three
repeated for each umpire.
These changes occur with umpire injuries, late arrival of
umpires or changes from completion of suspended games. Details
of suspended games are in field 14.
161 Acquisition information:
"Y" -- we have the complete game
"N" -- we don't have any portion of the game
"D" -- the game was derived from box score and game story
"P" -- we have some portion of the game. We may be missing
innings at the beginning, middle and end of the game.
Missing fields will be NULL.
I have used Pycharm IDE and interpreter Python 3.9 (pythonProject) to make this project.
This was my gaming project. I dont know how to upload video. So I am sorry to upload my video here. If I had made any mistake , I am sorry, please excuse me.
Thanks
Mandvi
Discussion (3)
Super cool! Where did you get the baseball data from?
Thank you for submitting your project, Mindvi! Can you please clarify how SashiDo.io was used here?
@sashido.io
My machine learning project | https://practicaldev-herokuapp-com.global.ssl.fastly.net/mandvieng/base-ball-3p0f | CC-MAIN-2021-43 | refinedweb | 1,693 | 63.29 |
This code, somewhat surprisingly, generates Fibonacci numbers.
def fib(n): return (4 << n*(3+n)) // ((4 << 2*n) - (2 << n) - 1) & ((2 << n) - 1)
In this blog post, I’ll explain where it comes from and how it works.
Before getting to explaining, I’ll give a whirlwind background overview of Fibonacci numbers and how to compute them. If you’re already a maths whiz, you can skip most of the introduction, quickly skim the section “Generating functions” and then read “An integer formula”.
Overview
The Fibonacci numbers are a well-known sequence of numbers:
The
th number in the sequence is defined to be the sum of the previous two, or formally by this recurrence relation:
I’ve chosen to start the sequence at index 0 rather than the more usual 1.
Computing Fibonacci numbers
There’s a few different reasonably well-known ways of computing the sequence. The obvious recursive implementation is slow:
def fib_recursive(n): if n < 2: return 1 return fib_recursive(n - 1) + fib_recursive(n - 2)
An iterative implementation works in
operations:
def fib_iter(n): a, b = 1, 1 for _ in xrange(n): a, b = a + b, a return b
And a slightly less well-known matrix power implementation works in
operations.
def fib_matpow(n): m = numpy.matrix('1 1 ; 1 0') ** n return m.item(0)
The last method works by considering the
a and
b in
fib_iter as sequences, and noting that
From which follows
and so if
then
(noting that unlike Python, matrix indexes are usually 1-based).
It’s
based on the assumption that numpy’s matrix power does something like exponentation by squaring.
Another method is to find a closed form for the solution of the recurrence relation. This leads to the real-valued formula:
whereand. The practical flaw in this method is that it requires arbitrary precision real-valued arithmetic, but it works for small
.
def fib_phi(n): phi = (1 + math.sqrt(5)) / 2.0 psi = (1 - math.sqrt(5)) / 2.0 return int((phi ** (n+1) - psi ** (n+1)) / math.sqrt(5))
Generating Functions
A generating function for an arbitrary sequence
is the infinite sum. In the specific case of the Fibonacci numbers, that means. In words, it’s an infinite power series, with the coefficient ofbeing the
th Fibonacci number.
Now,
Multiplying by
and summing over all
, we get:
If we let
to be the generating function of, which is defined to be
then this equation can be simplified:
and simplifying,
We can solve this equation for
to get
It’s surprising that we’ve managed to find a small and simple formula which captures all of the Fibonacci numbers, but it’s not yet obvious how we can use it. We’ll get to that in the next section.
A technical aside is that we’re going to want to evaluate
at some values of, and we’d like the power series to converge. We know the Fibonacci numbers grow likeand that geometric seriesconverge if, so we know that if
then the power series converges.
An integer formula
Now we’re ready to start understanding the Python code.
To get the intuition behind the formula, we’ll evaluate the generating function
at
.
Interestingly, we can see some Fibonacci numbers in this decimal expansion:
. That seems magical and surprising, but it’s because
.
In this example, the Fibonacci numbers are spaced out at multiples of
, which means once they start getting bigger that 1000 they’ll start interfering with their neighbours. We can see that starting at 988 in the computation of
above: the correct Fibonacci number is 987, but there’s a 1 overflowed from the next number in the sequence causing an off-by-one error. This breaks the pattern from then on.
But, for any value of
, we can arrange for the negative power of 10 to be large enough that overflows don’t disturb theth Fibonacci. For now, we’ll just assume that there’s somewhich makes
sufficient, and we’ll come back to picking it later.
Also, since we’d like to use integer maths (because it’s easier to code), let’s multiply by
, which also puts the
th Fibonacci number just to the left of the decimal point, and simplify the equation.
If we take this result modulo
, we’ll get theth Fibonacci number (again, assuming we’ve picked
large enough).
Before proceeding, let’s switch to base 2 rather than base 10, which changes nothing but will make it easier to program.
Now all that’s left is to pick a value of
large enough so that. We know that the Fibonacci numbers grow like, and, so
is safe.
So! Putting that together:
If we use left-shift notation that’s available in python, where
then we can write this as:
Observing that
can be expressed as the bitwise and (
& ) of
, we reconstruct our original Python program:
def fib(n): return (4 << n*(3+n)) // ((4 << 2*n) - (2 << n) - 1) & ((2 << n) - 1)
Although it’s curious to find a non-iterative, closed-form solution, this isn’t a practical method at all. We’re doing integer arithmetic with integers of size
bits, and in fact, before performing the final bit-wise and, we’ve got an integer that is the first
Fibonacci numbers concatenated integer formula for Fibonacci numbers
评论 抢沙发 | http://www.shellsec.com/news/13737.html | CC-MAIN-2018-09 | refinedweb | 894 | 59.23 |
django-newsletter 0.2.6
Django app for managing multiple mass-mailing lists with both plaintext as well as HTML templates (and TinyMCE editor for HTML messages), images and a smart queueing system all right from the admin interface.
What is it?
Django app for managing multiple mass-mailing lists with both plaintext as well as HTML templates (and TinyMCE editor for HTML messages), images and a smart queueing system all right from the admin interface.
Status
We are currently using this package in several production environments, but it should still be considered a work in progress.
Translations
Most of the strings have been translated to Dutch and a German translation should be available soon. Feel free to contribute any translations through Transifex.
Requirements
Please refer to requirements.txt for an updated list of required packes.
Installation
Get it from the Cheese Shop:
pip install django-newsletter
Or get the latest & greatest from Github and link it to your application tree:
pip install -e git://github.com/dokterbob/django-newsletter.git#egg=django-newsletter
(In either case it is recommended that you use VirtualEnv in order to keep your Python environment somewhat clean.)
Add newsletter and to INSTALLED_APPS in settings.py and make sure that the dependencies django-tinymce and django-extensions are there as well:
INSTALLED_APPS = ( ... 'tinymce', 'django_extensions', ... 'newsletter', ... )
Import subscription, unsubscription and archive URL's somewhere in your urls.py:
urlpatterns = patterns('', ... (r'^newsletter/', include('newsletter.urls')), ... )
Make the media dir available as {{ MEDIA_URL }}newsletter/ and do the same for the django-tinymce app.
Preferably use something like django-staticmedia to manage the media files for your installed apps so you won't have to worry about this. You can simply pip install django-staticmedia and add the following to urls.py to make everything accessible in the development server:
import staticmedia urlpatterns += staticmedia.serve()
Configure TinyMCE if you have not already done so. At the very least make sure you set TINYMCE_JS_URL in settings.py to point to wherever tiny_mce.js is located. (Typically /media/tinymce/tiny_mce/tiny_mce.js)
Create required data structure and load default template fixture:
./manage.py syncdb ./manage.py loaddata default_templates
Change the default contact email listed in templates/newsletter/subscription_subscribe.html and templates/newsletter/subscription_update.html.
Run the tests to see if it all works:
./manage.py test
If this fails, please contact me! If it doesn't: that's a good sign, chap. You'll probably have yourself a working configuration!
Add jobs for sending out mail queues to crontab:
@hourly /path/to/my/project/manage.py runjobs hourly @daily /path/to/my/project/manage.py runjobs daily @weekly /path/to/my/project/manage.py runjobs weekly @monthly /path/to/my/project/manage.py runjobs monthly
Usage
- Start the development server: ./manage.py runserver
- Navigate to /admin/ and: behold!
- Put a submission in the queue.
- Submit your message with ./manage.py runjob submit
- For a proper understanding, please take a look at the model graph.
Unit tests
Fairly extensive tests are available for internal frameworks, web (un)subscription and mail sending. One feature currently untested is actually sending mail to very large numbers of recipients (1000+), but feel free to try around. Please to note that the unittests (or actually, Django) currently requires a 404.html in your templates directory in order to be able to test 404 responses.
TODO
- Add a separate submission queue view in the admin instead of the modded edit view, which is confusing to the user.
- Finish front end for article ordering from admin.
- Write tests for: template syntax checking, ordering of articles in a message.
- Extend subscription models to allow for mail deliverability feedback.
- Refactor default contact email out of the templates.
License
This application is released under the GNU Affero General Public License version 3.
- Author: Mathijs de Bruin
- Categories
- Package Index Owner: dokterbob
- DOAP record: django-newsletter-0.2.6.xml | http://pypi.python.org/pypi/django-newsletter | crawl-003 | refinedweb | 648 | 51.14 |
Pytholog (Logic Programming in Python)
Python open source project under MIT License that enables using logic programming in python mimicking Prolog syntax and backtracking. The aim of the project is to explore ways to use symbolic reasoning with machine learning. It also performs probabilistic and logical reasoning.
Github link :
Pytholog gives facts indices (first term) and uses binary search to search for relevant facts instead of looping over all knowledge base. So when defining rules, make sure that the main search terms are in the first position to speed up the search queries.
The project consists of two components; a Python library and a command line tool.
Python Library
The library can be installed easily using the pip command
pip install pytholog
For a quick start, you can have a look at:
While the full documentation can be found here
Pytholog Tool (Command line & API)
Pytholog tool is an executable tool, built in python, that enables logic programming and prolog syntax through interactive shell that mimics prolog language and / or RESTful API that can be called from other applications. The tool can be found at SourceForge here:
The tools in the project work in Linux and Windows and there is also the script to be built on OSX system.
Quick Start
The tool starts normally from the command line. Let’s look at the arguments that can be specified while initiating the tool:
./Pytholog -h usage: Pytholog [-h] [-c CONSULT] -n NAME [-i] [-a] pytholog executable tool: prolog experience at command line and a logic knowledge base with no dependencies optional arguments: -h, --help show this help message and exit -c CONSULT, --consult CONSULT read an existing prolog file/knowledge base -n NAME, --name NAME knowledge base name -i, --interactive start an interactive prolog-like session -a, --api start a flask api
As we can see, we have 4 parameters: -n –name which is the only required parameter that is used to give a name to the session, -c –consult which can be used in case we have a pre-existing knowledge base, -i –interactive to start an interactive prolog-like session and -a –api that starts a RESTful API written in python/flask. By default it starts the API.
Let’s now try the tool with the accompanied dummy knowledge base
First, the interactive shell
./Pytholog -c dummy.txt -n dummy -i facts and rules have been added to dummy.db ?- prin invalid input please type 'print' to print the knowledge base or 'quit' to save and exit ?- print [likes(assel,limonade), likes(dmitry,cookie), likes(melissa,pasta), likes(nikita,sausage), likes(noor,sausage)] [food_type(cookie,dessert), food_type(gouda,cheese), food_type(limonade,juice), food_type(ritz,cracker), food_type(sausage,meat), food_type(steak,meat)] [flavor(savory,meat), flavor(savory,cheese), flavor(sweet,dessert), flavor(sweet,juice)] [food_flavor(X,Y):-food_type(X,Z),flavor(Y,Z)] ?- likes(noor, sausage)? ['Yes'] ?- likes(nikita, cheese)? ['No'] ?- likes(noor, What)? [{'What': 'sausage'}] ?- food_flavor(What, sweet)? [{'What': 'cookie'}, {'What': 'limonade'}] ?- dish_to_like(X, Y) :- likes(X, L), food_type(L, T), flavor(F, T), food_flavor(Y, F). ?- dish_to_like(noor, What)! [{'What': 'gouda'}] ?- quit KnowledgeBase is saved into dummy.pl file
Note the usage of ‘.’ is optional and ‘?’ is required to differentiate between a query and a new fact to be inserted to the knowledge base. And the ‘!’ is used to cut and return the first encountered answer.
Now the API
./Pytholog -c dummy.txt -n dummy -a facts and rules have been added to dummy.db * Serving Flask app "Pytholog" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on * Running on (Press CTRL+C to quit) * Restarting with stat facts and rules have been added to dummy.db * Debugger is active! * Debugger PIN: 222-740-882
Let’s try to call the API from command line, python and R and in the browser
Note that spaces can cause some errors
From R
library(httr) library(jsonlite) GET("") # Response [] # Date: 2020-11-13 19:26 # Status: 200 # Content-Type: application/json # Size: 94 B # [ # { # "What": "gouda" # }, # { # "What": "sausage" # }, # { # "What": "steak" # } # ...
From Command line
curl -s -X POST "" "OK"
From Python
import json import requests url = "!" r = requests.get(url) d = json.loads(r.content) d # [{'What': 'gouda'}]
From browser put this into the browser and it will give you “KnowledgeBase is saved into dummy.pl file” and a dummy.pl file will be created. | https://minimatech.org/pytholog/ | CC-MAIN-2021-31 | refinedweb | 743 | 62.17 |
Details
Description
Yesterday debugging w/ Jack we noticed that with few handlers on a big box, he was seeing stats like this:
2011-04-21 11:54:49,451 DEBUG org.apache.hadoop.ipc.HBaseServer: Server connection from X.X.X.X:60931; # active connections: 11; # queued calls: 2500 2.5.
Activity
- All
- Work Log
- History
- Activity
- Transitions
Todd, you can do anything! (J/K). Yes, that sounds good. We have 'blocking' going on in app already when memstores fill. I'm thinking though that we'd want to just do crass smaller queues for a 0.90.3 and then a sizing fix for 0.92.0 (We were going to run some tests here on our frontend to make sure no side effects taking the queue size down).
Implementing HeapSize might be kinda tough since the Call -> Invocation -> parameters can be more or less arbitrary objects.
I wonder if we could do some estimation, though, by wrapping the input stream during de-serialization and counting the number of bytes read?
I wonder if we could do some estimation, though, by wrapping the input stream during de-serialization and counting the number of bytes read?
Or push the actual deserialization into the handler thread - ie queue the calls as just the byte buffers, and deserialize once they hit the handler?
Or push the actual deserialization into the handler thread - ie queue the calls as just the byte buffers, and deserialize once they hit the handler?
Sure, looking through the code, we're already allocating and reading in to a ByteBuffer in HBaseServer.Connection.readAndProcess(). It's just that we immediately convert to a byte[] when passing to processData() where it does the deserialization. Seems like a good gain to move any deserialization overhead out of the listener thread and into the handlers, with some easy memory accounting for the queue to boot.
Patch for 0.90 branch.
My thinking is this needs a fix for 0.90.3. 100 times the handler count can turn ugly real fast if cells are of any significant size and the RS stalls for a moment and queues backup. This patch makes it configurable at least w/ the default tuned down from 100 to be more like 10 or so.
Todd and Gary, you fellas are talking about a more correct fix. This unaccounted memory usage is going to mess us up over and over again so I think it a critical issue in need of a proper fix but I'm thinking proper fix is over in 0.92.0?
I'm fine w/ this workaround not going into 0.90.3. Just putting it up here in case folks are amenable.
I applied the workaround attached patch for now. Moving this issue to 0.92.0 for better fix.
Integrated in HBase-TRUNK #1909 (See)
BlockingQueue has remainingCapacity() that returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking.
Maybe we should write an implementation of BlockingQueue that is aware of the sizes of the objects it holds. Meaning it would block if the next element to be queued would cause total estimated heap consumed to exceed pre-determined threshold.
I wonder if we should add variant of HbaseObjectWritable.readObject() that records the size of the Object returned.
We need to consider the fact that after Call object is removed from callQueue, it is enqueued to Connection.responseQueue
This means in order to limit the heap consumption of Call objects, callQueue and Connection.responseQueue should be managed jointly.
@Ted Sounds good if you can figure the size of a Call object in a non-intrusive way (as per Gary's comment above).
My proposal doesn't involve moving deserialization overhead into the handlers.
Primary reason is that we should determine the actual size of the parameter object for the Call.
So in processData(), we would have:
HbaseObjectWritable objectWritable = new HbaseObjectWritable(); Writable param = HbaseObjectWritable.readObject(dis, objectWritable, conf);
I have cloned LinkedBlockingQueueBySize off of LinkedBlockingQueue. Its declaration is:
public class LinkedBlockingQueueBySize<E extends WritableWithSize> extends AbstractQueue<E> implements BlockingQueue<E>, java.io.Serializable {
Then we can utilize this method in HbaseObjectWritable:
public static long getWritableSize(Object instance, Class declaredClass, Configuration conf) {
w.r.t. moving deserialization overhead into the handlers, it implies we replace the current call queues with (serialized) parameter queue(s).
Currently we have:
if (priorityCallQueue != null && getQosLevel(param) > highPriorityLevel) { priorityCallQueue.put(call);
getQosLevel() requires deserialized Writable. This means there would be only one parameter queue after this change.
I assume there would be no call queue because we don't want to keep serialized and unserialized forms of the same parameter at the same time.
This issue was closed as part of a bulk closing operation on 2015-11-20. All issues that have been resolved and where all fixVersions have been released have been closed (following discussions on the mailing list).
Can we write our own blocking behavior based on queue memory usage rather than queue count? Not sure how difficult that would be to make Call implement HeapSize | https://issues.apache.org/jira/browse/HBASE-3813 | CC-MAIN-2017-47 | refinedweb | 853 | 56.35 |
Identify the Return Objects from the Built-in Plug-in Tool
Hi,
I'm trying to mirror a joint chain using the built-in Mirror Tool. I want the return for the function to be the mirrored joint. For instance, if I selected the joint chain
thigh_L_jnt, I want the return/result of the function to be
thigh_R_jnt. Currently, it returns nothing.
Is there a way around this?
You can see the code here:
def mirror(objList): for idx, obj in enumerate(objList): if idx == 0: doc.SetActiveObject(obj, mode=c4d.SELECTION_NEW) else: doc.SetActiveObject(obj, mode=c4d.SELECTION_ADD) toolID = 1019953 # Mirror Tool ID c4d.CallCommand(toolID) tool = c4d.plugins.FindPlugin(toolID, c4d.PLUGINTYPE_TOOL) tool[c4d.ID_CA_MIRROR_TOOL_AXIS] = 4 # XZ tool[c4d.ID_CA_MIRROR_TOOL_REPLACE] = '_L_' tool[c4d.ID_CA_MIRROR_TOOL_WITH] = '_R_' result = c4d.CallButton(tool, c4d.ID_CA_MIRROR_TOOL) return result # this returns nothing.
Actually, there is no way to retrieves the created object from the built-in Tool since CallButton is the same as if a user presses the button. So it's return nothing it simply processes the tool and inserts the needed stuff. Of course, you can check what's the behavior of this tool and how new objects are inserted.
However, for most of the tool use SendModelingCommand which is an API around tool available which will give you all need. Setting coordinate system using MCOMMAND_MIRROR provides an example for MCOMMAND_MIRROR.
If you have any questions, let me know.
Cheers,
Maxime.
RE: there is no way to retrieves the created object from the built-in Tool
Thanks for the confirmation
RE: SendModelingCommand/MCOMMAND_MIRROR.
Correct me if I'm wrong but this works only on polygon objects. I'm mirroring a joint chain rather than a polygon object.
Is there a way around this?
Thank you. | https://plugincafe.maxon.net/topic/11595/identify-the-return-objects-from-the-built-in-plug-in-tool | CC-MAIN-2020-24 | refinedweb | 293 | 51.75 |
Secondary camera in QML
This article explains how to use the secondary camera in QML Enter article metadata as described below. Note that this template can be placed anywhere in the article. Do not remove parameters that you do not use
Note: This is an entry in the PureView Imaging Competition 2012Q2
Introduction
This article describes how to use the secondary camera in QML. The article [1] describes how to use the primary camera in various ways. However, access to the secondary camera is not available in QML.
Current solution
The secondary camera (i.e. frontal camera) is available though the C++ API. The registration of the component in QML is possible. However, this component does not provide the methods which are in the QML Camera component [2].
();
}
The multimedia part from qt mobility has to be included in project.
CONFIG += mobility
MOBILITY += multimedia
Also, the FrontCameraApp object has to be registered for QML.
qmlRegisterType<FrontCameraApp>("cz.vutbr.fit.pcmlich", 1, 0, "CameraFront");
The use in QML is as follows:
import com.nokia.meego 1.0
import cz.vutbr.fit.pcmlich 1.0
// import QtMultimediaKit 1.1
Page {
CameraFront {
anchors.fill: parent;
}
/*
// or primary camera
Camera {
anchors.fill: parent;
}
*/
}
Additional features
Since Qt mobility is open source, you can download the source codes from [3]. The implementation of the Camera element is in /plugins/declarative/multimedia/qdeclarativecamera.cpp. In order to use of this class in your own project it is necessary to modify its code to work with secondary camera.
Problems
The image from the secondary camera could be confusing to the user. Therefore it is appropriate to flip it.
transform: Rotation { origin.x: frontcam.width/2; origin.y: frontcam.height/2; axis { x: 0; y: 1; z: 0 } angle: 180 } [FIXME] | http://developer.nokia.com/community/wiki/index.php?title=Secondary_camera_in_QML&oldid=150509 | CC-MAIN-2014-15 | refinedweb | 293 | 51.24 |
06-08-2010 10:58 AM - last edited on 02-06-2011 10:17 PM
Hi Everyone,
I've participated in a bunch of threads around calling web services from widgets. A bunch of these threads have been around ASP.NET. So I figured I would create a post showing how I would go about writing a web service written in ASP.NET that I would then access from my Widget.
To start off with, I figured I would create an example where I had an existing ASP.NET web service that I wanted to extend to mobile. The first rule of thumb is that SOAP web services are INCREDIBLY BLOATED with tons of mark-up and syntax that you typically don't need. It was designed with server to server data transfer via a wired connection in mind.
This becomes especially apparent in the mobile world as you are going to have to process all of that bloat on the client and then transform it into something meaningful. What I like to do is create some small wrapper methods on an existing web service interfaces so that it can continue to be used by those who want to call the pre-existing methods directly via SOAP, but also have an additional much more efficient mobile friendly JSON interface. This allows me the ability to provide a nice end result without ever having to change any logic from my existing web service interfaces.
While my examples below are shown in ASP.NET (because I'm a .NET junkie), the same principals can be applied to all web services written in any language.
Looking at JSON
JSON can be your best friend when it comes to bringing back data. Basically once JSON is parsed it becomes a JavaScript object. You can look at it as built in deserialization from a string.
There are a TON of JSON parsers out there for pretty much any language you can think of. For details on all the available parsers take a look at
For my example I chose the JavaScript JSON toolkit from. In BlackBerry 6, JSON parsing will be built in, but on 5.0 you need a little toolkit. For my server side I just created the JSON syntax myself manually, but there are toolkits for that as well.
web.config
<system.web> <webServices> <protocols> <add name="HttpSoap"/> <add name="HttpGet"/> </protocols> </webServices> ......
If you are wanting to pass down parameters via POST and GET you will need to enable these protocols for your ASP.NET web service. They were turned off by default starting with .NET framework 2.0
My server side code:
using System; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Xml.Serialization; [WebService(Namespace = "")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService { public Service () { } [WebMethod] public Car GetCar(String make, String model) { Car car = new Car(); car.Make = make; car.Model = model; car.Year = 2002; return car; } [WebMethod] public String GetCarJSON(String make, String model) { return GetCar(make, model).toJSON(); } } public class Car : Object { public String Make = String.Empty; public String Model = String.Empty; public int Year = 0; public String toJSON() { String result = "{" + "\"Make\": \"" + this.Make + "\", " + "\"Model\": \"" + this.Model + "\", " + "\"Year\": \"" + this.Year + "\"" + "}"; return result; } }
You will see that I created a GetCarJSON() companion method that acts as a quick wrapper around the main GetCar() method that was previously exposed. This gives my mobile a nice alternative method to call that will then return JSON instead of SOAP XML. You can entirely re-use your existing methods without change.
To complete this simplification, I added a toJSON() method on my Car object. This will then serialize the object into its JSON representation.
NOTE: Please forgive my code "casing" between C# and JavaScript... I have too many languages running around in my head
Now let's look at the Client side code:
<html> <head> <meta name="viewport" id="viewport" content="initial-scale=1.0,user-scalable=no" /> <script type="text/javascript" src="json_sans_eval.js"></script> <script type="text/javascript"> var xmlHttp = new XMLHttpRequest(); function doClick() { var url = ">
Here I make a simple XMLHttpRequest to the URL for the GetCarJSON() function. Since the results being returned are well formed XML I can then retrieve the contents of the results from the responseXML property of the XHR object. From there I grab the contents of my JSON string from the first child node.
Here is where the JSON parser comes in.. simply call jsonParse() and my string is now a Car JavaScript object that I can interact with. JSON allows for all kinds of data structures so that you can replicate pretty much any object you wish to return.
Passing down objects to your web service from the client is simply the same process in reverse.
What if you don't have access to the web service source?
My recommendation is that if you have an existing SOAP web service that you wish to call and you do not have access to changing its source code, that you should create a small server side wrapper around this web service and provide your JSON data back out of your own web service.
This allows for two main benefits:
1) Light weight JSON data going to-and-from your mobile application
2) A layer of abstraction between a Web Service interface that you do not control and your mobile application. Should this 3rd party interface change, you can abstract those changes away from your mobile client.
Even More Optimized!
You can even take this further by returning <div> statements from your web service instead of JSON. This is particularly good if you are returning data that is simply for display and does not need to be manipulated in code. You can then simply dump in the <div> using the innerHTML of an element and not have to do any client side processing. Since it is returned as a <div> with no formatting, you can then apply a client side CSS to layout the data as you see fit.
Summary
Web services can be really easy to access via a Widget. There's no need for complicated Java extensions or other heavy options. Hopefully you will find this information useful and possibly help you out of a bind
08-04-2010 02:31 PM
I am curious if you have tested this with a live web service, rather than just local?
08-05-2010 02:44 AM
Hi TNEIL,
The below approach works fine only with webservices on LOCALHOST alone. Let us know the \
approach for the webservice hosted on an server/Remote machine.
Tried with several approaches
1) webservice behaviour : webservice.HTC. BB doesnot support this it seems as initial callservice
method gives error stating UNDEFINED function.
2) vth JQUERY : doesnot run even with localhost
Let us know the way ahead .....
Quite frustrating and cant help out saying BB not dat much convenient for DOTNET developers
Regards
GIRI
08-05-2010 07:56 AM
Hi Ekey, GIRI
Yes this method works fine both on localhost and on a remote machine.
JQUERY is an entirely different story, it has both UI capabilities and other convenience methods. I'm not sure what its webservice toolkit is doing on top of .NET or how you may be using it.
What I have personally found is that the "extra bits" that .NET and JQuery place on top of calling a web service as shown above create a level of abstraction but there are lots of places where things can go wrong.
You should litterally be able to copy and paste my code from above and it will work. I have tried it several times without fail on both local and remote resources. I've always favored going direct and simple where I know exactly what I am calling instead of an abstract toolkit. Especially when a user's data fees are involved. I don't want to be doing excessive data requests where it could cost my customer real out of pocket money.
Accessing localhost with the BB simulators can sometimes have issues depending on your PC's environment. This is due to using MDS that serves as the connection proxy. We are working on ways to eliminate MDS out of the picture for developers for exactly these reasons.
08-05-2010 10:48 AM
As you may see in my "Utterly baffled" post, I have been able to successfully create JSON using the ideas from your example (with a little research on how to embed multiple "objects" within the JSON, some nice examples on building the array here:
08-05-2010 11:18 AM
In the hope that someone may see something obscure that is wrong with my code, here is how my web service class is setup. You'll notice that this differs slightly from your web service.
Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Data.SqlClient Imports System.IO Imports System.Xml <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:= <System.Web.Services.WebServiceBinding(ConformsTo:
=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem("")> _False)> _ Public Class Service1Inherits System.Web.Services.WebService ....=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem("")> _False)> _ Public Class Service1Inherits System.Web.Services.WebService ....
08-05-2010 01:03 PM
I now have the jSON web method working correctly. The params being passed had whitespace. There are a few tidbits I learned along the way however:
1. When building the jSON object, do not forget to add the "," after each row;
2. the json_sans_eval.js file DOES contain an eval() method (go figure) but does NOT contain the method reference in the original post (jsonParse);
3. You'll want to use the responseXML.documentElement instead of the responseText because you'll need to get the json from childNode[0].nodeValue
4. Once you can successfully parse your jSON, it's pretty cool being able to use those as objects instead of just "nodes"!
10-14-2010 02:38 PM
Hi Tim I new in black berry widgets development , i have made a little application that connects with a webserver made in .Net 2008 and it works fine. But i haven seen any example about how can I POST data from a widget to process that data in the webservice and finally to send back a response to the widget.
So if you could provide me an example about how could i POST data to a webservice from a widget made in VisualStudio.net 2008 That would help me a lot.
Thanks in advance!
Hello form Saltillo (City),Coahuila (state) Mexico (country)
OS: Windows XP SP3
10-31-2010 09:17 AM
When I try the example and change the web service to return an HTML, it doesn't work as expected
what I get in the screen is the HTML itself (including the tags).
Any ideas?
11-01-2010 08:23 AM
Sharshabel,
try running the following on your client side when you receive the HTML back from the web service.
... xmlHTTP.onreadystatechange = function() { if (xmlHTTP.readyState == 4) { var temp = xmlHTTP.responseText; temp = temp.replace(/</g,"<").replace(/>/g,">"); document.getElementById('contentDiv').innerHTML = temp; } } ... | http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-quot-I-quot-would-call-a-web-service-from-a-WebWorks-App/td-p/519745 | crawl-003 | refinedweb | 1,871 | 65.32 |
import java.io.* fun main(args: Array<String>) { val stream = ByteArrayInputStream("Hello there!".toByteArray()) val sb = StringBuilder() var line: String? val br = BufferedReader(InputStreamReader(stream)) line = br.readLine() while (line != null) { sb.append(line) line = br.readLine() } br.close() println(sb) }
When you run the program the output will be:
Hello there!
In the above program, the input stream is created from a String and stored in a variable stream. We also require a string builder sb to create the string from the stream.
Then, we created a buffered reader br from the
InputStreamReader to read the lines from the stream. Using a while loop, we read each line and append it to the string builder. Finally, we closed the bufferedReader.
Since, the reader can throw
IOException, we have the throws IOException in the main function as:
public static void main(String[] args) throws IOException
Here's the equivalent Java code: Java program to convert InputStream to String. | https://cdn.programiz.com/kotlin-programming/examples/convert-inputstream-string | CC-MAIN-2019-47 | refinedweb | 158 | 67.86 |
Scraping for houses
Having moved back to Romania, I decided I would need a place to live in, ideally to buy. So we started looking online for various places, we went to see a lot of them. Lots of work, especially footwork. But, being the data nerd that I am, I wanted to get smart about it and analyze the market.
For that, I needed data. For data, I turned to scraping. For scraping, I turned to Scrapy. While I did write a scraper 5 years ago, I didn't want to reinvent the wheel yet again, so I turned to Scrapy because it's a well-known, much used scraping framework in Python. And I was super impressed with it. I even started scraping things more often, just because it's so easy to do in Scrapy :D
In this post I am going to show you how to use it to scrape the olx website for housing posts in a given city, in 30 lines of Python. Later, we are going to analyze the data too.
First, you have to generate a new Scrapy project and a Scrapy spider. Run the following commands in your preferred Python environment (I currently prefer pipenv).
pip install scrapy scrapy startproject olx_houses scrapy genspider olx olx.ro
This will generate a file for you inside
olx_houses/spiders, with some
boilerplate already written, and you just have to extend it a bit.
import scrapy import datetime today = datetime.date.today().strftime('%Y-%m-%d')
These are just imports and I am precomputing today's date, because I want each entry to contain when it was scraped.
class OlxHousesSpider(scrapy.Spider): name = 'olx_houses' allowed_domains = ['olx.ro'] start_urls = ['', '']
Then we define our class, with the allowed domains. If we encounter a link that is not from these domains, it is not followed. We are interested only in olx stuff, so we allow only that. The start URLs are the inital pages, from where we should start the scraping. In our case, these are the listing pages for house and flats.
def parse(self, response): for href in response.css('a.detailsLink::attr(href)'): yield response.follow(href, self.parse_details) for href in response.css('a.pageNextPrev::attr(href)')[-1:]: yield response.follow(href, self.parse)
parse is a special function, which is called by default for every URL. So
the start URLs will be parsed using this. It is called with a response object,
containing the HTML received from the website. This response object contains
both all the HTML text, but it also has a DOM parse and it allows direct
querying with CSS and XPath selectors. If you return or yield a Request object
from this function, Scrapy will add it to the queue of pages to be visited. A
convenience method for doing this is to use the
follow method on the response
object. You pass it the URL to visit and what callback method to use for parsing (by default
it's the
parse method).
We are looking for two things on this page:
1) For anchor links that have a
detailsLink CSS class. These we want to parse
with the
parse_details method.
2) Anchor links that have a
pageNextPrev CSS class. We look only at the last
one of these links (that's what the [-1:] indexing does), because that one
always points forward. We could look at all links and it wouldn't cause
duplicate requests, because Scrapy is keeping track of what links it already
visited and it doesn't visit them again. These links we will parse with the default method.
And now comes the fun part, getting the actual data.
def parse_details(self, response): attrs = { 'url': response.url, 'text': response.css('#textContent>p::text').extract_first().strip(), 'title': response.css('h1::text').extract_first().strip(), 'price': response.css('.price-label > strong::text').extract_first().replace(" ", ""), 'date': today, 'nr_anunt': response.css('.offer-titlebox em small::text').re('\d+'), 'adaugat_la': response.css('.offer-titlebox em::text').re('Adaugat (de pe telefon) +La (.*),') }
We extract various attributes from the listing pages. Some things are straightforward, like the URL, or the text and title, which are obtained by taking the text of some elements chosen with CSS selectors. For price the selector is a bit more complicated and we have to prepare the text a bit (by removing spaces). For the ID of the listing and the date added field, we have to apply some regular expressions to obtain only the data that we want, without anything else.
for tr in response.css('.details').xpath('tr/td//tr'): title = tr.css('th::text').extract_first() value = " ".join(x.strip() for x in tr.xpath('td/strong//text()').extract() if x.strip()!="") attrs[title]=value yield attrs
There is one last thing: some crucial information is displayed in a "structured" way, but it's marked up in a completely unstructured way. Things like the size of the house or the age. These values are in a table, with rows containing a table header? cell with the name of the attribute, followed by table data cells containg values. We take all the values, join them with a space, and put them in the dictionary we used above, with the key being the value we got from the table header cell. We do this for all the rows in the table.
And that's it. Easy peasy. Now all we have to do is run the scraper with the following command:
scrapy run olx -o houses.csv
We wait a little bit and then in that file we have all the listings. And if we repeat this process (almost) daily for several months, we can get trends and see how long are houses on the market on average. But that's a topic for another post. | https://rolisz.ro/2018/05/07/scraping-for-houses/ | CC-MAIN-2019-26 | refinedweb | 968 | 75.3 |
> I've tried 2.2.12pre1 and 2.2.12pre3 today. Output from ifconfig looks> normal. Interface eth0 works fine. Interface eth1 doesn't: if pinged> from another box, it may or may not (mostly not) wake up and ping back,> and if it does, and I ping from the local host, that may work for a bit;> but very soon (under 20 seconds) the interface seems to revert to> inactivity. All this time eth0 is quite normal. Taking eth1 down and> bringing it back up manually with ifconfig doesn't help. Rebooting> 2.2.11 causes the problem to go away.Do you have any of the IP virtual server stuff built in ?Can you see if backing out this helpsdiff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv4/arp.c linux.12p2/net/ipv4/arp.c--- linux.vanilla/net/ipv4/arp.c Tue Aug 10 21:45:41 1999+++ linux.12p2/net/ipv4/arp.c Wed Aug 11 22:54:16 1999@@ -65,6 +65,8 @@ * clean up the APFDDI & gen. FDDI bits. * Alexey Kuznetsov: new arp state machine; * now it is in net/core/neighbour.c.+ * Wensong Zhang : NOARP device (such as tunl) arp fix.+ * Peter Kese : arp_solicit: saddr opt disabled for vs. */ /* RFC1122 Status:@@ -306,9 +308,15 @@ u32 target = *(u32*)neigh->primary_key; int probes = neigh->probes; +#if !defined(CONFIG_IP_MASQUERADE_VS) /* Virtual server */ + /* use default interface address as source address in virtual+ * server environment. Otherways the saddr might be the virtual+ * address and gateway's arp cache might start routing packets+ * to the real server */ if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL) saddr = skb->nh.iph->saddr; else+#endif saddr = inet_select_addr(dev, target, RT_SCOPE_LINK); if ((probes -= neigh->parms->ucast_probes) < 0) {@@ -534,6 +542,7 @@ struct rtable *rt; unsigned char *sha, *tha; u32 sip, tip;+ struct device *tdev; u16 dev_type = dev->type; int addr_type; struct in_device *in_dev = dev->ip_ptr;@@ -627,6 +636,13 @@ * addresses. If this is one such, delete it. */ if (LOOPBACK(tip) || MULTICAST(tip))+ goto out;++/* + * Check for the device flags for the target IP. If the IFF_NOARP+ * is set, just delete it. No arp reply is sent. -- WZ+ */ + if ((tdev = ip_dev_find(tip)) && (tdev->flags & IFF_NOARP)) goto out; /*-To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to majordomo@vger.rutgers.eduPlease read the FAQ at | http://lkml.org/lkml/1999/8/15/141 | CC-MAIN-2014-41 | refinedweb | 391 | 59.09 |
I'm write one code to my rasp+neo6m gps. I wanna get gps lat and long and compare with others points of lat and long. Is like this, when the car cross some point off lat and long one audio saying he was passed for the specified point. My code was like this:
The problem was when i cross the point with car, do not play the audio.
Code: Select all
from gps3 import agps3 import sys import os import pygame.mixer import pygame, time import json import math pygame.mixer.init(44100) gps_socket = agps3.GPSDSocket() data_stream = agps3.DataStream() gps_socket.connect() gps_socket.watch() lat1 = -12.924511667 lon1 = -38.465796667 lat2 = -12.962735 lon2 = -38.46010 for new_data in gps_socket: if new_data: data_stream.unpack(new_data) print("Longitude =" , data_stream.lon) print("Latitude =" , data_stream.lat) if "lat1" < "Latitude" < "lat2"" lon1" < "Longitude" < "lon2": music = pygame.mixer.music music.load('/home/pi/Documents/beep.mp3') music.play() print('Aloalo!') while pygame.mixer.music.get_busy(): time.sleep(1) | https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=218184 | CC-MAIN-2018-34 | refinedweb | 163 | 54.9 |
Lightweight, modular DOM library.
Browser targets are relatively modern browsers from IE9+, Chrome, Firefox, Safari and modern versions of Opera (post blink integration).
This library is not designed to be a drop-in replacement for jquery, it is designed to provide a modular library that is jqueryesque therefore it is best suited to new projects.
Work in progress: not yet ready for production.
npm i air --save
Whilst the API is similar to jquery some notable design decisions:
To get a feel for how lightweight
air is see air.js, the core of the system is less than 100 lines of code (with comments). All other files in lib are plugins that should be loaded depending upon your application requirements.
Designed to work with browserify by default, assuming you have configured the browserify
paths option correctly for
node_modules/air/lib:
var $ = ;$
Note that the plugins are namespaced to prevent potential collisions when an application is using multiple plugin-enabled components.
The main function
air wraps a set of elements in a class that may be decorated by plugins.
Core functionality is the main method, the class function and the pre-defined properties and methods on the class, see air.js.
Returns an
Air instance.
Reference to the
Air constructor.
Class constructor.
Accepts a selector
String,
Element,
NodeList,
Air instance or array of elements.
The
context argument is only applicable when a selector
String argument is used and should reference the parent
Element context for
querySelectorAll.
When an existing
Air instance is passed the underlying array is copied but the elements are not cloned.
var $ = ;; // String (selector); // Element; // Element; // NodeList; // Array; // Air
The underlying array of elements.
The number of encapsulated elements.
Get the element at the specified index, if no arguments are passed the
dom array is returned.
Iterate the underlying elements, alias for
dom.forEach.
Alias to the main
air function, allows instance methods to wrap elements using
this.air().
Alias to the
plugin function, allows instance methods to load plugins via
this.plugin().
Plugin functionality is provided by zephyr see the zephyr plugins documentation.
Default plugins that may be loaded on demand, syntax examples assume that
air has been aliased to
$.
Everything except the core methods are implemented as plugins so there are many examples in lib.
Insert content, specified by the parameter, to the end of each element in the set of matched elements.
;
Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
;;;
Get the children of each element in the set of matched elements.
;
Plugin groups provide a convenient way to load related plugins.
Element attribute plugins.
Some features available in jquery that there are no plans to implement.
Accessing the underlying DOM elements using array bracket notation
[] is not available, if you wish to access the encapsulated elements use the core methods.
Whilst jquery allows HTML parsing (eg:
$('<p></p>')) this library does not support it and there are no plans to implement this functionality, the rationale is:
$.
Note that recent jquery versions now recommend
$.parseHTML rather than passing markup to
$.
This is deemed to be irrelevant to DOM manipulation and is best left to one of the many capable libraries available.
The
data plugin allows manipulating the
data- attributes of an element but does not store any data on the element itself. If you wish to maintain data as part of your application it would be best resolved using another pattern (eg: storage).
If you really need to assign arbitrary data to an element you can always do so by directly setting properties on the element.
Designed to work with
HTML documents the behaviour when modifying
XML documents is undefined.
The jquery library extends CSS selectors with pseudo-selectors such as
:checked, we believe this is unnecessary as all selector extension functionality can be achieved using other means.
We aim to provide a single way to perform a task, the jquery library often provides multiple ways to achieve the same thing, for example:
$.get()and
$.toArray().
$.append()and
$.appendTo().
$.prepend()and
$.prependTo().
The
air library will usually prefer the shorter and most common variant and not supply the alternatives; using the above examples the equivalent functions are
$.get(),
$.append() and
$.prepend().
Whilst the jquery dimension methods (
width(),
innerWidth() etc.) allow setting element dimensions we prefer (for the sake of simplicity) to make these read-only as you can already set element dimensions using the
css plugin. It is possible that this may change in the future.
Developer workflow is via gulp but should be executed as
npm scripts to enable shell execution where necessary.
Run the headless test suite using phantomjs:
npm test
To run the tests in a browser context open test/index.html.
Run the test suite and generate code coverage:
npm run cover
Run the source tree through jshint and jscs:
npm run lint
Remove generated files:
npm run clean
Create distribution builds in dist:
npm run dist
Compile the test specifications:
npm run spec
Generate instrumented code from
lib in
instrument:
npm run instrument
Generate the project readme file (requires mdp):
npm run readme
Everything is MIT. Read the license if you feel inclined. | https://www.npmjs.com/package/air | CC-MAIN-2017-13 | refinedweb | 871 | 53.81 |
Okay, here's the scerario: You've got a bunch of constants in your code in a static class that you want to reference in your XAML files. How do you do it? {x:Static} to the rescue! Simple and very handy, although not particularly intuitive or well documented. Below is the syntax for both the code and XAML. Note that the constant class has its own XML Namespace and corresponding mapping PI in XAML, thus the double QName in the XAML(x:Static c:Constants).
Code:using System.Windows;
namespace ConstantSample{ public static class Constants { public const double X = 100; public const double Y = 50; }}
XAML:
<?Mapping XmlNamespace="CodeMapNS" ClrNamespace="ConstantSample" ?><Window x: <Grid > <StackPanel> <Button Width="{x:Static c:Constants.X}" Height="{x:Static c:Constants.Y}"> Button </Button> </StackPanel> </Grid></Window> | http://blogs.msdn.com/b/karstenj/archive/2005/07/15/439167.aspx | CC-MAIN-2014-23 | refinedweb | 134 | 60.82 |
Android NDK Beginner’s Guide — Save 50%
Discover the native side of Android and inject the power of C/C++ in your applications with this book and ebook
A man with the most powerful tools in hand is unarmed without the knowledge of their usage. Eclipse, GCC, Ant, Bash, Shell, Linux—any new Android programmer needs to deal with this technologic ecosystem. Depending on your background, some of these names may sound familiar to your ears. Indeed, that is a real strength; Android is based on open source bricks which have matured for years. Theses bricks are cemented by the Android Development Kits (SDK and NDK) and their set of new tools: Android Debug Bridge (ADB), Android Asset Packaging Tool (AAPT), Activity Manager (AM), ndk-build, and so on. So, since our development environment is set up, we can now get our hands dirty and start manipulating all these utilities to create, compile, and deploy projects which include native code.
In this article by Sylvain Ratabouil, author of Android NDK Beginner’s Guide we are going to do the following:
- Compile and deploy official sample applications from the Android NDK with Ant build tool and native code compiler ndk-build
- Learn in more detail about ADB, the Android Debug Bridge, to control a development device
- Discover additional tools like AM to manage activities and AAPT to package applications
- Create our first own hybrid multi-language project using Eclipse
- Interface Java to C/C++ through Java Native Interfaces (in short JNI)
By the end of this article, you should know how to start up a new Android native project on your own.
(For more resources on Android, see here.)
Compiling and deploying NDK sample applications
I guess you cannot wait anymore to test your new development environment. So why not compile and deploy elementary samples provided by the Android NDK first to see it in action? To get started, I propose to run HelloJni, a sample application which retrieves a character string defined inside a native C library into a Java activity (an activity in Android being more or less equivalent to an application screen).
Time for action – compiling and deploying hellojni sample
Let's compile and deploy HelloJni project from command line using Ant:
- Open a command-line prompt (or Cygwin prompt on Windows).
- Go to hello-jni sample directory inside the Android NDK. All the following steps have to performed from this directory:
$ cd $ANDROID_NDK/samples/hello-jni
- Create Ant build file and all related configuration files automatically using android command (android.bat on Windows). These files describe how to compile and package an Android application:
android update project –p .
- Build libhello-jni native library with ndk-build, which is a wrapper Bash script around Make. Command ndk-build sets up the compilation toolchain for native C/ C++ code and calls automatically GCC version featured with the NDK.
$ ndk-build
- Make sure your Android development device or emulator is connected and running.
- Compile, package, and install the final HelloJni APK (an Android application package). All these steps can be performed in one command, thanks to Ant build automation tool. Among other things, Ant runs javac to compile Java code, AAPT to package the application with its resources, and finally ADB to deploy it on the development device. Following is only a partial extract of the output:
$ ant install
- Launch a shell session using adb (or adb.exe on Windows). ADB shell is similar to shells that can be found on the Linux systems:
$ adb shell
- From this shell, launch HelloJni application on your device or emulator. To do so, use am, the Android Activity Manager. Command am allows to start Android activities, services or sending intents (that is, inter-activity messages) from command line. Command parameters come from the Android manifest:
# am start -a android.intent.action.MAIN -n com.example.hellojni/com.example.hellojni.HelloJni
- Finally, look at your development device. HelloJni appears on the screen!
(Move the mouse over the image to enlarge.)
The result should look like the following extract:
What just happened?
We have compiled, packaged, and deployed an official NDK sample application with Ant and SDK command-line tools. We will explore them more in later part. We have also compiled our first native C library (also called module) using the ndk-build command. This library simply returns a character string to the Java part of the application on request. Both sides of the application, the native and the Java one, communicate through Java Native Interface. JNI is a standard framework that allows Java code to explicitly call native C/C++ code with a dedicated API.
Finally, we have launched HelloJni on our device from an Android shell (adb shell) with the am Activity Manager command. Command parameters passed in step 8 come from the Android manifest: com.example.hellojni is the package name and com.example.hellojni. HelloJni is the main Activity class name concatenated to the main package.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
package="com.example.hellojni" HIGHLIGHT
android:versionCode="1"
android:
...
<activity android:name=".HelloJni" HIGHLIGHT
android:
...
Automated build
Because Android SDK, NDK, and their open source bricks are not bound to Eclipse or any specific IDE, creating an automated build chain or setting up a continuous integration server becomes possible. A simple bash script with Ant is enough to make it work!
HelloJni sample is a little bit... let's say rustic! So what about trying something fancier? Android NDK provides a sample named San Angeles. San Angeles is a coding demo created in 2004 for the Assembly 2004 competition. It has been later ported to OpenGL ES and reused as a sample demonstration in several languages and systems, including Android. You can find more information by visiting one of the author's page:.
Have a go hero – compiling san angeles OpenGL demo
To test this demo, you need to follow the same steps:
- Go to the San Angeles sample directory.
- Generate project files.
- Compile and install the final San Angeles application.
- Finally run it.
As this application uses OpenGL ES 1, AVD emulation will work, but may be somewhat slow!
You may encounter some errors while compiling the application with Ant:
The reason is simple: in res/layout/ directory, main.xml file is defined. This file usually defines the main screen layout in Java application—displayed components and how they are organized. However, when Android 2.2 (API Level 8) was released, the layout_width and layout_height enumerations, which describe the way UI components should be sized, were modified: FILL_PARENT became MATCH_PARENT. But San Angeles uses API Level 4.
There are basically two ways to overcome this problem. The first one is selecting the right Android version as the target. To do so, specify the target when creating Ant project files:
$ android update project –p . -–target android-8
This way, build target is set to API Level 8 and MATCH_PARENT is recognized. You can also change the build target manually by editing default.properties at the project root and replacing:
target=android-4
with the following line:
target=android-8
The second way is more straightforward: erase the main.xml file! Indeed, this file is in fact not used by San Angeles demo, as only an OpenGL screen created programmatically is displayed, without any UI components.
Target right!
When compiling an Android application, always check carefully if you are using the right target platform, as some features are added or updated between Android versions. A target can also dramatically change your audience wideness because of the multiple versions of Android in the wild... Indeed, targets are moving a lot and fast on Android!.
All these efforts are not in vain: it is just a pleasure to see this old-school 3D environment full of flat-shaded polygons running for the first time. So just stop reading and run it!
Exploring android SDK tools
Android SDK includes tools which are quite useful for developers and integrators. We have already overlooked some of them including the Android Debug Bridge and android command. Let's explore them deeper.
Android debug bridge
You may have not noticed it specifically since the beginning but it has always been there, over your shoulder. The Android Debug Bridge is a multifaceted tool used as an intermediary between development environment and emulators/devices. More specifically, ADB is:
- A background process running on emulators and devices to receive orders or requests from an external computer.
- A background server on your development computer communicating with connected devices and emulators. When listing devices, ADB server is involved. When debugging, ADB server is involved. When any communication with a device happens, ADB server is involved!
- A client running on your development computer and communicating with devices through ADB server. That is what we have done to launch HelloJni: we got connected to our device using adb shell before issuing the required commands.
ADB shell is a real Linux shell embedded in ADB client. Although not all standard commands are available, classical commands, such as ls, cd, pwd, cat, chmod, ps, and so on are executable. A few specific commands are also provided such as:
ADB shell is a real Swiss Army knife. It also allows manipulating your device in a flexible way, especially with root access. For example, it becomes possible to observe applications deployed in their "sandbox" (see directory /data/data) or to a list and kill currently running processes.
ADB also offers other interesting options; some of them are as follows:
To ease the writing of issued command, ADB provides facultative flags to specify before options:
ADB client and its shell can be used for advanced manipulation on the system, but most of the time, it will not be necessary. ADB itself is generally used transparently. In addition, without root access to your phone, possible actions are limited. For more information, see.
Root or not root.
If you know the Android ecosystem a bit, you may have heard about rooted phones and non-rooted phones. Rooting a phone means getting root access to it, either "officially" while using development phones or using hacks with an end user phone. The main interest is to upgrade your system before the manufacturer provides updates (if any!) or to use a custom version (optimized or modified, for example, CyanogenMod). You can also do any possible (especially dangerous) manipulations that an Administrator can do (for example, deploying a custom kernel). Rooting is not an illegal operation, as you are modifying YOUR device. But not all manufacturers appreciate this practice and usually void the warranty.
Have a go hero – transferring a file to SD card from command line
Using the information provided, you should be able to connect to your phone like in the good old days of computers (I mean a few years ago!) and execute some basic manipulation using a shell prompt. I propose you to transfer a resource file by hand, like a music clip or a resource that you will be reading from a future program of yours.
To do so, you need to open a command-line prompt and perform the following steps:
- Check if your device is available using adb from command line.
- Connect to your device using the Android Debug Bridge shell prompt.
- Check the content of your SD card using standard Unix ls command. Please note that ls on Android has a specific behavior as it differentiates ls mydir from ls mydir/, when mydir is a symbolic link.
- Create a new directory on your SD card using the classic command mkdir
- Finally, transfer your file by issuing the appropriate adb command.
.
Project configuration tool
The command named android is the main entry point when manipulating not only projects but also AVDs and SDK updates. There are few options available, which are as follows:
- create project: This option is used to create a new Android project through command line. A few additional options must be specified to allow proper generation:
For example:
$ android create project –p ./MyProjectDir –n MyProject –t
android-8 –k com.mypackage –a MyActivity
- update project: This is what we use to create Ant project files from an existing source. It can also be used to upgrade an existing project to a new version. Main parameters are as follows:
There are also options to create library projects (create lib-project, update lib- project) and test projects (create test-project, update test-project). I will not go into details here as this is more related to the Java world.
As for ADB, android command is your friend and can give you some help:
$ android create project –help
Command android is a crucial tool to implement a continuous integration toolchain in order to compile, package, deploy, and test a project automatically entirely from command line.
Have a go hero – towards continuous integration
With adb, android, and ant commands, you have enough knowledge to build a minimal automatic compilation and deployment script to perform some continuous integration. I assume here that you have a versioning software available and you know how to use it. Subversion (also known as SVN) is a good candidate and can work in local (without a server).
Perform the following operations:
- Create a new project by hand using android command.
- Then, create a Unix or Cygwin shell script and assign it the necessary execution rights (chmod command). All the following steps have to be scribbled in it.
- In the script, check out sources from your versioning system (for example, using a svn checkout command) on disk. If you do not have a versioning system, you can still copy your own project directory using Unix commands.
- Build the application using ant.
- If needed, you can deploy resources files using adb
- Install it on your device or on the emulator (which you can launch from the script) using ant as shown previously.
- You can even try to launch your application automatically and check Android logs (see logcat option in adb). Of course, your application needs to make use of logs!
Do not forget to check command results using $?. If the returned value is different from 0, it means an error occurred. Additionally, you can use grep or some custom tools to check potential error messages.
A free monkey to test your App!
In order to automate UI testing on an Android application, an interesting utility that is provided with the Android SDK is MonkeyRunner, which can simulate user actions on a device to perform some automated UI testing. Have a look at .
To favor automation, a single Android shell statement can be executed from command-line as follows:
adb shell ls /sdcard/
To execute a command on an Android device and retrieve its result back on your host shell, execute the following command: adb shell "ls / notexistingdir/ 1> /dev/null 2> &1; echo \$?" Redirection is necessary to avoid polluting the standard output. The escape character before $? is required to avoid early interpretation by the host shell.
Now you are fully prepared to automate your own build toolchain!
(For more resources on Android, see here.)
Creating your first android project using eclipse
In the first part of the article, we have seen how to use Android command-line tools. But developing with Notepad or VI is not really attractive. Coding should be fun! And to make it so, we need our preferred IDE to perform boring or unpractical tasks. So let's see now how to create an Android project using Eclipse.
Eclipse views and perspectives
Several times in this book, I have asked you to look at an Eclipse View like the Package Explorer View, the Debug View, and so on. Usually, most of them are already visible, but sometimes they are not. In that case, open them through main menu: Window | Show View | Other…. Views in Eclipse are grouped in perspectives, which basically store your workspace layout. They can be opened through main menu: Window | Open Perspective | Other…. Note that some contextual menus are available only in some perspectives.
Time for action – initiating a Java project
- Launch Eclipse.
- In the main menu, select File | New | Project…
- In the project wizard, select Android | Android Project and then Next.
- In the next screen, enter project properties:
- In Project name, enter MyProject.
- Select Create a new project in workspace.
- Specify a new location if you want to, or keep the default location (that is, your eclipse workspace location).
- Set Build Target to Android 2.3.3.
- In Application name, enter (which can contain spaces): MyProject.
- In Package name, enter com.myproject.
- Create a new activity with the name MyActivity.
- Set Min SDK Version to 10.
- Click on Finish. The project is created. Select it in Package Explorer view.
- In the main menu, select Run | Debug As | Android Application or click on the Debug button in the toolbar.
- Select application type Android Application and click OK:
- Your application is launched, as shown in the following screenshot:
What just happened?
We have created our first Android project using Eclipse. In a few screens and clicks, we have been able to launch the application instead of writing long and verbose commands. Working with an IDE like Eclipse really gives a huge productivity boost and makes programming much more comfortable!
ADT plugin has an annoying bug that you may have already encountered: Eclipse complains that your Android project is missing the required source folder gen whereas this folder is clearly present. Most of the time, just recompiling the project makes this error disappear. But sometimes, Eclipse is recalcitrant and refuses to recompile projects. In that case, a little-known trick, which can be applied in many other cases, is to simply open the Problems view, select these irritating messages, delete them without mercy (Delete key or right-click and Delete) and finally recompile the incriminated project.
Android projects created with ADT are always Java projects. But thanks to Eclipse flexibility, we can turn them into C/C++ projects too; we are going to see this at the end of this article.
Avoiding space in file paths
When creating a new project, avoid leaving a space in the path where your project is located. Although Android SDK can handle that without any problem, Android NDK and more specifically GNU Make may not really like it.
Introducing Dalvik
It is not possible to talk about Android without touching a word about Dalvik. Dalvik, which is also the name of an Icelandic village, is a Virtual Machine on which Android bytecode is interpreted (not native code!). It is at the core of any applications running on Android. Dalvik is conceived to fit the constrained requirements of mobile devices. It is specifically optimized to use less memory and CPU. It sits on top of the Android kernel which provides the first layer of abstraction over hardware (process management, memory management, and so on).
Android has been designed with speed in mind. Because most users do not want to wait for their application to be loaded while others are still running, the system is able to instantiate multple Dalvik VMs quickly, thanks to the Zygote process. Zygote, whose name comes from the very first biologic cell of an organism from which daughter cells are reproduced, starts when the system boots up. It preloads (or "warms up") all core libraries shared among applications as well as a Dalvik instance. To launch a new application, Zygote is simply forked and the initial Dalvik instance is copied. Memory consumption is lowered by sharing as many libraries as possible between processes.
Dalvik operates on Android bytecode, which is different from Java bytecode. Bytecode is stored in an optimized format called Dex generated by an Android SDK tool named dx. Dex files are archived in the final APK with the application manifest and any native libraries or additional resources needed. Note that applications can get further optimized during installation on end user's device.
Interfacing Java with C/C++
Keep your Eclipse IDE opened as we are not done with it yet. We have a working project indeed. But wait, that is just a Java project, whereas we want to unleash the power of Android with native code! In this part, we are going to create C/C++ source files, compile them into a native library named mylib and let Java run this code.
Time for action – calling C code from Java
The native library mylib that we are going to create will contain one simple native method getMyData() that returns a basic character string. First, let's write the Java code to declare and run this method.
- Open MyActivity.java. Inside main class, declare the native method with the native keyword and no method body:
public class MyActivity extends Activity {
public native String getMyData();
...
- Then, load the native library that contains this method within a static initialization block. This block will be called before Activity instance gets initialized:
...
static {
System.loadLibrary("mylib");
}
- Finally, when Activity instance is created, call the native method and update the screen content with its return value. You can refer to the source code provided with this book for the final listing:
...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setTitle(getMyData());
}
}
Now, let's prepare the project files required to build the native code.
- In Eclipse, create a new directory named jni at the project's root using menu File | New | Folder.
- Inside the jni directory, create a new file named Android.mk using menu File | New | File. If CDT is properly installed, the file should have the following specific icon in the Package Explorer view:
- Write the following content into this file. Basically, this describes how to compile our native library named mylib which is composed of one source file the com_ myproject_MyActivity.c:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib
LOCAL_SRC_FILES := com_myproject_MyActivity.c
include $(BUILD_SHARED_LIBRARY)
As project files for native compilation are ready, we can write the expected native source code. Although the C implementation file must be written by hand, the corresponding header file can be generated with a helper tool provided by the JDK: javah.
- In Eclipse, open Run | External Tools | External Tools Configurations….
- Create a new program configuration with the following parameters:
- Name: MyProject javah.
- Location refers to javah absolute path, which is OS-specific. In Windows, you can enter ${env_var:JAVA_HOME}\bin\javah.exe. In Mac OS X and Linux, it is is usually /usr/bin/javah.
- Working directory: ${workspace_loc:/MyProject/bin}.
- Arguments: –d ${workspace_loc:/MyProject/jni} com.myproject. MyActivity}.
In Mac OS X, Linux, and Cygwin, you can easily find the location of an executable available in $PATH, by using the which command.
For example,
$ which javah
- On the Refresh tab, check Refresh resources upon completion and select Specific resources. Using the Specify Resources… button, select the jni folder.
- Finally, click on Run to save and execute javah. A new file com_myproject_ MyActivity.h is generated in the jni folder. It contains a prototype for the method getMyData() expected on the Java side:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
...
JNIEXPORT jstring JNICALL Java_com_myproject_MyActivity_getMyData
(JNIEnv *, jobject);
...
- We can now create com_myproject_MyActivity.c implementation inside the jni directory to return a raw character string. Method signature originates from the generated header file:
#include "com_myproject_MyActivity.h"
JNIEXPORT jstring Java_com_myproject_MyActivity_getMyData
(JNIEnv* pEnv, jobject pThis)
{
return (*pEnv)->NewStringUTF(pEnv,
"My native project talks C++");
}
Eclipse is not yet configured to compile native code, only Java code. Until we do that in the last part of this article, we can try to build native code by hand.
- Open a terminal prompt and go inside the MyProject directory. Launch compilation of the native library with the command ndk-build:
$ cd <your project directory>/MyProject
$ ndk-build
The native library is compiled in the libs/armeabi directory and is named libmylib.so. Temporary files generated during compilation are located in the obj/local directory.
- From Eclipse, launch MyProject again. You should obtain following result:
What just happened?
In the previous part, we created an Android Java project. In this second part, we have interfaced Java code to a native library compiled with the Android NDK from a C file. This binding from Java to C allows retrieving through Java Native Interfaces a simple Java string allocated in the native code. The example application shows how Java and C/C++ can cooperate together:
- By creating UI components and code on the Java side and defining native calls.
- Using javah to generate header file with corresponding C/C++ prototypes.
- Writing native code to perform the expected operation.
Native methods are declared on the Java side with the native keyword. These methods have no body (like an abstract method) as they are implemented on the native side. Only their prototype needs to be defined. Native methods can have parameters, a return value, any visibility (private, protected, package protected or public) and can be static, like classic Java methods. Of course, they require the native library with method implementations to be loaded before they are called. A way to do that is to invoke System.loadLibrary() in a static initialization block, which is initialized when the containing class is loaded. Failure to do so results in an exception of type java.lang.UnsatisfiedLinkError, which is raised when the native method is invoked for the first time.
Although it is not compulsory, javah tool provided by the JDK is extremely useful to generate native prototypes. Indeed, JNI convention is tedious and error-prone. With generated headers, you immediately know if a native method expected by the Java side is missing or has an incorrect signature. I encourage you to use javah systematically in your projects, more specifically, each time native method's signature is changed. JNI code is generated from .class files, which means that your Java code must be first compiled before going through javah conversion. Implementation needs to be provided in a separate C/C++ source file.
Remember that a very specific naming convention, which is summarized by the following pattern, must be followed by native side methods:
<returnType> Java_<com_mypackage>_<class>_<methodName> (JNIEnv* pEnv,
<parameters>...)
Native method name is prefixed with Java_ and the packages/class name (separated by _) containing it separated. First argument is always of type JNIEnv and the preceding arguments are the actual parameters given to the Java method.
More on makefiles
Native library building process is orchestrated by a Makefile named Android.mk. By convention, Android.mk is in folder jni, which is located inside the project's root. That way, ndk-build command can find this file automatically when the command is invoked. Therefore, C/C++ code is by convention also located in jni directory (but this can be changed by configuration).
Android Makefiles are an essential piece of the NDK building process. Thus, it is important to understand the way they work to manage a project properly. An Android.mk file is basically a "baking" file, which defines what to compile and how to compile. Configuration is performed using predefined variables, among which are: LOCAL_PATH, LOCAL_MODULE and LOCAL_SRC_FILES.
The Android.mk file presented in MyProject is a very simple Makefile example. Each instruction serves a specific purpose:
LOCAL_PATH := $(call my-dir)
The preceding code indicates native source files location. Instruction $(call < function> ) allows evaluating a function and function my-dir returns the directory path of the last executed Makefile. Thus, as Makefiles usually share their directory with source files, this line is systematically written at the beginning of each Android.mk file to find their location.
include $(CLEAR_VARS)
Makes sure no "parasite" configuration disrupts compilation. When compiling an application, a few LOCAL_XXX variables need to be defined. The problem is that one module may define additional configuration settings (like a compilation MACRO or a flag) through these variables, which may not be needed by another module.
Keep your modules clean
To avoid any disruption, all necessary LOCAL_XXX variables should be cleared before any module is configured and compiled. Note that LOCAL_PATH is an exception to that rule and is never cleared out.
LOCAL_MODULE := mylib
The preceding line of code defines your module name. After compilation, the output library is named according to the LOCAL_MODULE variable flanked by a lib prefix and a .so suffix. This LOCAL_MODULE name is also used when a module depends on another module.
LOCAL_SRC_FILES := com_myproject_MyActivity.c
The preceding line of code indicates which source files to compile. File path is expressed relative to the LOCAL_PATH directory.
nclude $(BUILD_SHARED_LIBRARY)
This last instruction finally launches the compilation process and indicates which type of library to generate.
With Android NDK, it is possible to produce shared libraries (also called dynamic libraries, like DLL on Windows) as well as static libraries:
- Shared libraries are a piece of executable loaded on demand. These are stored on disk and loaded to memory as a whole. Only shared libraries can be loaded directly from Java code.
- Static libraries are embedded in a shared library during compilation. Binary code is copied into a final library, without regards to code duplication (if embedded by several different modules).
In contrast with shared libraries, static libraries can be stripped, which means that unnecessary symbols (like a function which is never called from the embedding library) are removed from the final binary. They make shared libraries bigger but "all-inclusive", without dependencies. This avoids the "DLL not found" syndrome well known on Window.
Shared vs. Static modules
Whether you should use a static or shared library depends on the context:
- If a library is embedded in several other libraries
- If almost all pieces of code are required to run
- If a library needs to be selected dynamically at runtime
- If it is used in one or only a few places
- If only part of its code is necessary to run
- If loading it at the beginning of your application is not a concern
then consider turning it into a static library instead. It can be reduced in size at compilation-time at the price of some possible duplication.
then consider turning it into a shared library because they avoid memory duplication (which is a very sensible issue on mobile devices). On the other hand:
Compiling native code from eclipse
You probably agree with me, writing code in Eclipse but compiling it by hand is not very satisfying. Although the ADT plugin does not provide any C/C++ support, Eclipse does this through CDT. Let's use it to turn our Android project into a hybrid Java-C/C++ project.
Time for action – creating a hybrid Java/C/C++ project
To check whether Eclipse compilation works fine, let's introduce surreptitiously an error inside the com_myproject_MyActivity.c file. For example:
#include "com_myproject_MyActivity.h"
private static final String = "An error here!";
JNIEXPORT jstring Java_com_myproject_MyActivity_getMyData
...
Now, let's compile MyProject with Eclipse:
- Open menu File | New | Other....
- Under C/C++, select Convert to a C/C++ Project and click on Next.
- Check MyProject, choose MakeFile project and Other Toolchain and finally click on Finish.
- Open C/C++ perspective when requested.
- Right-click on MyProject in Project explorer view and select Properties.
- In the C/C++ Build section, uncheck Use default build command and enter ndk- build as a Build command. Validate by clicking on OK:
And... oops! An error got insidiously inside the code. An error? No we are not dreaming! Our Android project is compiling C/C++ code and parsing errors:
- Let's fix it by removing the incriminated line (underlined in red) and saving the file.
- Sadly, the error is not gone. This is because auto-build mode does not work. Go back to project properties, inside C/C++ Settings and then the Behaviour tab. Check Build on resource save and leave the value to all.
- Go to the Builders section and place CDT Builder right above Android Package Builder. Validate.
- Great! Error is gone. If you go to the Console view, you will see the result of ndk- build execution like if it was in command line. But now, we notice that the include statement of jni.h file is underlined in yellow. This is because it was not found by the CDT Indexer for code completion. Note that the compiler itself resolves them since there is no compilation error. Indeed, the indexer is not aware of NDK include paths, contrary to the NDK compiler.
- Let's go back to project properties one last time. Go to section C/C++ General/Paths and Symbols and then in Includes tab.
- Click on Add... and enter the path to the directory containing this include file which is located inside NDK's platforms directory. In our case, we use Android 2.3.3 (API level 9), so the path is ${env_var:ANDROID_NDK}/platforms/android-9/ arch-arm/usr/include. Environment variables are authorized and encouraged! Check Add to all languages and validate:
- Because jni.h includes some "core" include files (for example, stdarg.h), also add ${env_var:ANDROID_NDK}/toolchains/arm-linux- androideabi-4.4.3/prebuilt/
/lib/gcc/arm-linux- androideabi/4.4.3/includepath and close the Properties window. When Eclipse proposes to rebuild its index, say Yes.
- Yellow lines are now gone. If you press Ctrl and click simultaneously on string.h, the file gets automatically opened. Your project is now fully integrated in Eclipse.
If warnings about the include file which the CDT Indexer could not find do not appear, go to C/C++ perspective, then right-click on the project name in the Project Explorer view and select Index/Search for Unresolved Includes item. The Search view appears with all unresolved inclusions.
What just happened?
We managed to integrate Eclipse CDT plugin with an Android project using CDT conversion wizard. In a few clicks, we have turned a Java project into a hybrid Java/C/C++ project! By tweaking CDT project properties, we managed to launch ndk-build command to produce the library mylib defined in Android.mk. After getting compiled, this native library is packaged automatically into the final Android application by ADT.
Running javah automatically while building
If you do not want to bother executing manually javah each time native methods changes, you can create an Eclipse builder:
- Open your project Properties window and go to the Builder section.
- Click on New… and create a new builder of type Program.
- Enter configuration like done at step 8 with the External tool configuration.
- Validate and position it after Java Builder in the list (because JNI files are generated from Java .class files).
- Finally, move CDT Builder right after this new builder (and before Android Package Builder).
JNI header files will now be generated automatically each a time project is compiled.
In step 8 and 9, we enabled Building on resource save option. This allows automatic compilation to occur without human intervention, for example, when a save operation is triggered. This feature is really nice but can sometimes cause a build cycle: Eclipse keeps compiling code so we moved CDT Builder just before Android Package Builder, in step 9, to avoid Android Pre Compiler and Java Builder to triggering CDT uselessly. But this is not always enough and you should be prepared to deactivate it temporarily or definitely as soon as you are fed up!>
Automatic building
Build command invocation is performed automatically when a file is saved. This is practical but can be resource and time consuming and can cause some build cycle. That is why it is sometimes appropriate to deactivate the Build automatically option from main menu through Project. A new button: appears in the toolbar to trigger a build manually. You can then re-enable automatic building.
Summary
Although setting up, packaging, and deploying an application project are not the most exciting tasks, but they cannot be avoided. Mastering them will allow being productive and focused on the real objective: producing code.
In this artilce, we have seen how to use NDK command tools to compile and deploy Android projects manually. This experience will be useful to make use of continuous integration in your project. We have also seen how to make both Java and C/C++ talk together in a single application using JNI. Finally we have created a hybrid Java/C/C++ project using Eclipse to develop more efficiently.
With this first experiment in mind, you got a good overview of how the NDK works.
Further resources on this subject:
- Android Application Testing: Getting Started [Article]
- Android 3.0 Application Development: Managing Menus [Article]
- Manifest Assurance: Security and Android Permissions for Flash [Article]
- Android User Interface Development: Animating Widgets and Layouts [Article]
Post new comment | http://www.packtpub.com/article/creating-compiling-deploying-native-projects-android-ndk | CC-MAIN-2014-15 | refinedweb | 6,099 | 55.95 |
20732/init-and-self-in-python
When we define a method such as :
def method(self, blah):
def __init__(?):
What is the use of self and __init__ ? are they mandatory?
The self variable represents an instance of the object itself. while most object oriented languages pass this as a hidden parameter, it is declared explicitly in python.
The __init__ method is basically a constructor in Python. it creates an object and passes as the first parameter to the __init__ method.
Ruby and Python are actually very different languages (although ...READ MORE
Hi,
The basic difference between these two are
_init_ ...READ MORE
You probably want to use np.ravel_multi_index:
[code]
import numpy ...READ MORE
AND - True if both the operands ...READ MORE
A module is a file containing a ...READ MORE
suppose you have a string with a ...READ MORE
You can also use the random library's ...READ MORE
Syntax :
list. count(value)
Code:
colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
The keywords is and is not are ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in. | https://www.edureka.co/community/20732/init-and-self-in-python | CC-MAIN-2022-40 | refinedweb | 202 | 70.19 |
A label control is displayed as a single line. So a long text will not be shown if it goes out of screen.
So to show a label which has a long text length, one should just provide the screenwidth or rect wherein the label is to be shown to the following function
Header files :
#include <eiklabel.h> #include <AknUtils.h>
Link against:
LIBRARY avkon.lib eikcore.lib gdi.lib
Source:
AknTextUtils::WrapToArrayL(*iLabelText, iScreenWidth, *iFont, *iTextArray);
where iFont can be
iFont=CCoeEnv::Static()->NormalFont();
iTextArray is the array in which the long text will be split depending on the iScreenWidth.
Once this is done just add a "\n" to all the array elements and make a single text of all the elements.
Then
SetTextL(iWrappedText->Des()); SetExtent(iXY, (*this).MinimumSize());
Where iWrappedText is the HBufC in which the iTextArray elements are appended to make a single line of text with the "\n"'s .
Following the above steps gives a multiline custom CEikLabel. | http://wiki.forum.nokia.com/index.php/Multiline_CEikLabel | crawl-002 | refinedweb | 163 | 64.91 |
I don't count the number of weeks I've spent during the last months fixing
pure OSGi code for concurrency and thread safety issues. And that includes
Karaf, Pax-Web, Blueprint, Fabric and even SCR. Service trackers are nice
tools, but not sufficient at all when it comes to handle multiple service
dependencies along with configuration changes.
Of course, registering commands is quite easy whatever method we use (pure
OSGi, DS, blueprint or any other tool).
Let's consider a simple use case: a bundle which expose an OSGi service
which has 2 service dependencies and a configuration. Can you show me a
pure OSGi code that does it in a safe way ?
Guillaume
2013/12/7 Łukasz Dywicki <luke@code-house.org>
> All pax libraries we have deployed in Karaf are written without any piece
> of injection frameworks. Starting from pax logging over pax web, to pax
> wicket even (it supports blueprint namespaces but does not use it for
> service tracking).
>
> On other hand, does registration of commands is so hard that could not be
> done from Activator code? I don't think so. Most critical place which will
> be affected is actually a tracker, which will need to be registered by us.
> Indeed we'll get more code to maintain, but that's just matter of good
> modularization to keep it clean. Honestly, most of complications we have is
> hiden in service implementations. That's why I do consider dropping of
> dependency injection framework. It is something which can be done, it's
> just matter of balance between cons and pros.
>
> Best regards,
> Łukasz Dywicki
> --
> luke@code-house.org
> Twitter: ldywicki
> Code-House -
>
> Wiadomość napisana przez Christian Schneider <chris@die-schneider.net> w
> dniu 7 gru 2013, o godz. 13:14:
>
> > I went the pure OSGi way for CXF DOSGi. It works but is quite error
> prone as you have to handle the dynamics of services and config yourself.
> As DOSGi is a pretty small project I think it was worth the effort for
> getting rid of DI dependencies.
> >
> > For karaf I would not like to have to do this for every service and
> command bundle. DS might work quite well there.
> > I have looked into the source from Ioannis. He uses SCR annotations for
> the wiring and the felix scr plugin to generate the xml. So it looks like
> not to much effort. The learning curve is of course there but I think with
> some good example projects it should be relatively easy.
> >
> > I have not yet seen how the SCR annotations handle config injection. I
> hope it works equally well.
> >
> > Christian
> >
> >
> > Am 06.12.2013 23:05, schrieb Łukasz Dywicki:
> >> Yes Joed,
> >> You got the point I wanted to reflect. DS and SCR is still dependency
> which, for sure, may be optional. Switching to poorer replacement from
> feature rich blueprint will bring bigger cost than moving to plain osgi.
> For me it will look like stopping in half of the way.
> >> Most of us knows well core spec plus something about blueprint. Very
> few from us knows anything more about SCR, except the fact, that it's
> exists. This kind of change may decrese number of maintaners to these who
> already know SCR. From drawbacks of another DI I may throw that it
> requires, if I'm not wrong, additional bundle header which lists all
> components. Also integration with maven bundle plugin seems missing. Ie for
> blueprint we get imports for free and validation, because when this plugin
> fails to read XML prevents build from passing.
> >>
> >> The idea of extender, shared earlier in this topic, which install
> necessary features is very good. It might be used in similar way as
> deployers or feature resolvers to preprocess bundles before installation to
> automatically enable certain features.
> >>
> >> Łukasz Dywicki
> >> --
> >> Code-House
> >>
> >>
> >
> > --
> > Christian Schneider
> >
> >
> > Open Source Architect
> > Talend Application Integration Division
> >
>
> | http://mail-archives.apache.org/mod_mbox/karaf-dev/201312.mbox/%3CCAA66Tpo4OUi80j5c2w8xjA1tK9dEkX1cck_Lp2Eg3GVupdps3w@mail.gmail.com%3E | CC-MAIN-2018-47 | refinedweb | 642 | 65.73 |
After installing Python v2.7 and registering a key for the New York Times Article Search API i was good to go and writing code.
The first thing we have to do, is to find out, how we can request data from the NYT API, this means reading the documentation and looking for tutorials on the net:
There is also a tool for generating url-request strings:
These url string can simply be typed into the url bar of your browser, and it will show you the results. These results will only be a line of text and symbols and are not very human-readable. The format i used was JSON, XML is also available in some of the API’s.
Our weapon of choice, to sort through these data-formats will be python. Python 2.7 has support for reading websites and decoding JSON/XML.
First off, we want to request the data from the API, we use the urllib2 module for this:
request_string = ''+str(offset)+'&api-key=####'
response = urllib2.urlopen(request_string)
content = response.read()
Here, we build our request url, in this case i’m searching for german finances with an offset of 2, which will deliver the 20th to the 30th article. The urllib2.urlopen method will send an HTTP request to the url and store the resulting website in the “response” variable.
We know that the result is a string in JSON format. This means that we can use the json module to decode and traverse the data sent to us
import urllib2
import json
....
decoded = json.loads(content)
date_of_first_article = decoded['results'][0]['date']
This will decode the JSON string into objects and lists in python, which are much easier to work with. You can visualise this data as a tree, which starts with the ‘results’ node at the top, which has the articles as children:
To understand the structure of JSON strings, you can simple look at the JSON string and read the API. In this case, the results-node contains a list of articles( accessed by [0] to [9] ), and every article node has data, like its text, date, title and url to the original story.
In this example, we will make multiple queries via a for-loop and extraxt the date, title and url.
Here is how a for-loop could look like:
for offset in xrange(10):
request_string = ''+str(offset)+'&api-key=bcbdffbec58353edaf892db8b2e4d3fb:5:67631538'
response = urllib2.urlopen(request_string)
content = response.read()
this for-loop will will assign the values 0 to 10 to the “offset” variable and run the indented code every time. For now, this only makes queries with different offsets, but we do not do anything with the data yet. We can now use the JSON objects to extract data and write it to a file
import urllib2 import json def year(d): return d[0:4] def month(d): return d[4:6] def day(d): return d[6:8] f = open('newfile','w') for offset in xrange(2): print "-" request_string = ''+str(offset)+'&api-key=####' response = urllib2.urlopen(request_string) content = response.read() #decoded = json.loads(response_string) decoded = json.loads(content) for x in decoded['results']: string = x['date'] f.write(year(string) + " " + month(string) + " " + day(string)+"\t") f.write((x['title'].encode('utf-8') ).replace("’","'").replace("'","'")+"\t") f.write(x['url']+"\n") raw_input("Press enter to quit")
I’ll walk you through this code bit by bit.
The first two lines import modules, so we can use them in our program. We need urllib2 to make http requests and json to decode the json string we get from the NYT API.
Then there are three definitions, these will make it a little bit easier to work with dates. In the JSON objects, dates are just string like 20130523, which is the 23th day of the 5th month in 2013. The syntax d[0:4] takes the string stored in variable d and returns the first to the fourth character as a new string. In this example 2013.
The next line creates a new file, which we can ‘w’rite to.
The forloop then assigns offset the values 0,1 and 2.
We request data for every offset and decode the answer. The next forloop is a little more complicated. We basically assign every article that we currently have in our result to the variable x. This reads: for each value in the list of results, assign the value to x.
We then read the articles date, title and url and write it to the file we created earlier. We have to encode the title-string to UTF-8, and replace certain special characters, because python does not like the ‘-character ( apostrophe ) in unicode format ( which the json string currently is in)
Notice that we use “\t” to seperate data, url and title. This is so we can later use the resulting text-file as a table and for example load it into google fusion tables.
Also notice that the last line is NOT inside the for-loops anymore. It basically waits for the user to press enter, when the program runs. This way, we can print text on the screen, without having the window disappear instantly ( on windows )
After saving this code as a .py file, i ran it, and got the following output:
2013 05 08 Backing Grows for European Bank Plan 2013 05 04 Euro Area Recession Is Expected to Deepen 2013 05 01 In Continuing Sign of Weakness, Unemployment Hits New High in the Euro Zone 2013 04 30 Italy's New Premier Puts Stimulus First 2013 04 30 Italy's New Premier Puts Stimulus First 2013 04 28 Germans' Dominance Is Peak of a Long Climb 2013 04 23 German Soccer Hero Faces Prison Amid Record Run and Scandal 2013 04 23 MEMO FROM EUROPE; Shrinking Europe Military Spending Stirs Concern 2013 04 19 Plan for Cyprus Bailout Wins Easy Approval in Germany 2013 04 16 Path to Growth Splits Europe, With Austerity A Central Issue 2013 04 13 Bailout Terms Are Eased for Ireland and Portugal 2013 04 12 OP-ED CONTRIBUTOR; Cybersecurity: A View From the Front 2013 04 11 Economies of France and Italy Are Risks to the Euro Zone, a Report Says 2013 04 11 Hollande Creates a Prosecutor for Fraud and Vows to End Tax Havens 2013 04 11 Hollande Creates a Prosecutor for Fraud and Vows to End Tax Havens 2013 04 10 Europe's Data on Wealth Needs a Grain of Salt 2013 04 07 FUNDAMENTALLY; Europe's Markets, No Longer in Lock Step 2013 04 07 FUNDAMENTALLY; Europe's Markets, No Longer in Lock Step 2013 04 06 WEALTH MATTERS; Overseas Finances Can Trip Up Americans Abroad 2013 04 02 INSIDE EUROPE; Germany Appoints Itself Parent to Restive Euro Children | https://csitkursus.wordpress.com/2013/05/10/python-and-the-nytimes-api/ | CC-MAIN-2017-39 | refinedweb | 1,134 | 65.86 |
Comment on Tutorial - How to Send SMS using Java Program (full code sample included) By Emiley J.
Comment Added by : Milind
Comment Added at : 2011-12-15 06:20:33
Comment on Tutorial : How to Send SMS using Java Program (full code sample included) By Emiley J.
It work fine with message below 160 chars. How can we modify to send message with more than 200 chars? Please suggest where we need to customize.
View Tutorial By: ankit at 2011-07-15 06:48:21
2. nice///
View Tutorial By: MHARLON ALADEN at 2009-08-14 01:00:09
3. I tried ....so this is best solution for understa
View Tutorial By: rehnuma at 2015-03-30 12:29:38
4. Try this
import java.net.*;
View Tutorial By: Asad at 2014-02-13 05:55:26
5. nice article... got th topic clearly
View Tutorial By: praba at 2011-05-09 23:29:26
6. thanku verymuch. very helpfull
View Tutorial By: praveen at 2010-08-05 06:04:35
7. Hi,
I can run this program.But after
View Tutorial By: jayaraj at 2009-06-05 01:28:18
8. method overloading possible across classes????
View Tutorial By: Rohit at 2011-01-26 20:23:02
9. hi the code is working fine till step5 and am gett
View Tutorial By: raj at 2008-09-16 22:55:40
10. I need one help how to update particular column da
View Tutorial By: santhosh.s at 2015-01-22 15:09:33 | https://java-samples.com/showcomment.php?commentid=37214 | CC-MAIN-2022-21 | refinedweb | 254 | 68.87 |
I’m not going to dive into much details about the pattern because there’s already tons of posts and books that explain it in fine detail. Instead, I’m going to tell you why and when you should consider using it. However, it is worth mentioning that this pattern is a bit different to the one presented in the Gang of Four book. While the original pattern focuses on abstracting the steps of construction so that by varying the builder implementation used we can get a different result, the pattern explained in this post deals with removing the unnecessary complexity that stems from multiple constructors, multiple optional parameters and overuse of setters.
Imagine you have a class with a substantial amount of attributes like the User class below. Let’s assume that you want to make the class immutable (which, by the way,
unless there’s a really good reason not to you should always strive to do. But we’ll get to that in a different post).
public class User { private final String firstName; //required private final String lastName; //required private final int age; //optional private final String phone; //optional private final String address; //optional ... }
Now, imagine that some of the attributes in your class are required while others are optional. How would you go about building an object of this class? All attributes are declared final so you have to set them all in the constructor, but you also want to give the clients of this class the chance of ignoring the optional attributes.
A first and valid option would be to have a constructor that only takes the required attributes as parameters, one that takes all the required attributes plus the first optional one, another one that takes two optional attributes and so on. What does that look like? Something like this:
public User(String firstName, String lastName) { this(firstName, lastName, 0); } public User(String firstName, String lastName, int age) { this(firstName, lastName, age, ''); } public User(String firstName, String lastName, int age, String phone) { this(firstName, lastName, age, phone, ''); } public User(String firstName, String lastName, int age, String phone, String address) { this.firstName = firstName; this.lastName = lastName; this.age = age; this.phone = phone; this.address = address; }
The good thing about this way of building objects of the class is that it works. However, the problem with this approach should be pretty obvious. When you only have a couple of attributes is not such a big deal, but as that number increases the code becomes harder to read and maintain. More importantly, the code becomes increasingly harder for clients. Which constructor should I invoke as a client? The one with 2 parameters? The one with 3? What is the default value for those parameters where I don’t pass an explicit value? What if I want to set a value for address but not for age and phone? In that case I would have to call the constructor that takes all the parameters and pass default values for those that I don’t care about. Additionally, several parameters with the same type can be confusing. Was the first String the phone number or the address?
So what other choice do we have for these cases? We can always follow the JavaBeans convention, where we have a default no-arg constructor and have setters and getters for every attribute. Something like:
public class User { private String firstName; // required private String lastName; // required private int age; // optional private String phone; // optional private String address; //optionalPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
This approach seems easier to read and maintain. As a client I can just create an empty object and then set only the attributes that I’m interested in. So what’s wrong with it? There are two main problems with this solution. The first issue has to do with having an instance of this class in an inconsistent state. If you want to create an User object with values for all its 5 attributes then the object will not have a complete state until all the setX methods have been invoked. This means that some part of the client application might see this object and assume that is already constructed while that’s actually not the case. The second disadvantage of this approach is that now the User class is mutable. You’re loosing all the benefits of immutable objects.
Fortunately there is a third choice for these cases, the builder pattern. The solution will look something like the following.
public class User {; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public int getAge() { return age; } public String getPhone() { return phone; } public String getAddress() { return; } public User build() { return new User(this); } } }
A couple of important points worth noting:
- The User constructor is private, which means that this class can not be directly instantiated from the client code.
- The class is once again immutable. All attributes are final and they’re set on the constructor. Additionally, we only provide getters for them.
- The builder uses the Fluent Interface idiom to make the client code more readable (we’ll see an example of this in a moment).
- The builder constructor only receives the required attributes and this attributes are the only ones that are defined “final” on the builder to ensure that their values are set on the constructor.
The use of the builder pattern has all the advantages of the first two approaches I mentioned at the beginning and none of their shortcomings. The client code is easier to write and, more importantly, to read. The only critique that I’ve heard about the pattern is the fact that you have to duplicate the class’ attributes on the builder. However, given the fact that the builder class is usually a static member class of the class it builds, they can evolve together fairly easy.
Now, how does the client code trying to create a new User object looks like? Let’s see:
public User getUser() { return new User.UserBuilder('Jhon', 'Doe') .age(30) .phone('1234567') .address('Fake address 1234') .build(); }
Pretty neat, isn’t it? You can build a User object in 1 line of code and, most importantly, is very easy to read. Moreover, you’re making sure that whenever you get an object of this class is not going to be on an incomplete state.
This pattern is really flexible. A single builder can be used to create multiple objects by varying the builder attributes between calls to the “build” method. The builder could even auto-complete some generated field between each invocation, such as an id or serial number.
An important point is that, like a constructor, a builder can impose invariants on its parameters. The build method can check these invariants and throw an IllegalStateException if they are not valid.
It is critical that they be checked after copying the parameters from the builder to the object, and that they be checked on the object fields rather than the builder fields. The reason for this is that, since the builder is not thread-safe, if we check the parameters before actually creating the object their values can be changed by another thread between the time the parameters are checked and the time they are copied. This period of time is known as the “window of vulnerability”. In our User example this could look like the following:
public User build() { User user = new user(this); if (user.getAge() 120) { throw new IllegalStateException(“Age out of range”); // thread-safe } return user; }
The previous version is thread-safe because we first create the user and then we check the invariants on the immutable object. The following code looks functionally identical but it’s not thread-safe and you should avoid doing things like this:
public User build() { if (age 120) { throw new IllegalStateException(“Age out of range”); // bad, not thread-safe } // This is the window of opportunity for a second thread to modify the value of age return new User(this); }
A final advantage of this pattern is that a builder could be passed to a method to enable this method to create one or more objects for the client, without the method needing to know any kind of details about how the objects are created. In order to do this you would usually have a simple interface like:
public interface Builder { T build(); }
In the previous User example, the UserBuilder class could implement Builder<User>. Then, we could have something like:
UserCollection buildUserCollection(Builder<? extends User> userBuilder){...}
Well, that was a pretty long first post. To sum it up, the Builder pattern is an excellent choice for classes with more than a few parameters (is not an exact science but I usually take 4 attributes to be a good indicator for using the pattern), especially if most of those parameters are optional. You get client code that is easier to read, write and maintain. Additionally, your classes can remain immutable which makes your code safer.
UPDATE: if you use Eclipse as your IDE, it turns out that you have quite a few plugins to avoid most of the boiler plate code that comes with the pattern. The three I’ve seen are:
-
-
-
I haven’t tried any of them personally so I can’t really give an informed decision on which one is better. I reckon that similar plugins should exist for other IDEs.? | http://www.javacodegeeks.com/2013/01/the-builder-pattern-in-practice.html/comment-page-1/ | CC-MAIN-2014-52 | refinedweb | 1,588 | 60.95 |
Creates Candlesticks chart based on WPFToolkit.
I spent a lot of time trying to get candle sticks to work and looking for samples on the web. Finally the solution in this article is what I came up with. The idea is to apply a style on the BubbleSeries to make a candle. If you have a better way of doing it, please let me know and I will update the article.
The color of the candlestick, red or green by default, is determined by where the current candlestick closed in relation to the previous candlestick.
The candlestick will be red if it closes lower that the previous candle's close.
The candlestick will be green if it closes higher that the previous candle's close.
Some candlesticks will be filled (solid), and some will be unfilled (hollow) based on where the current candle closes relative to its open price.
If the candlestick closes lower than it opened, the candle will be filled.
If the candlestick closes higher than it opened, the candle will be unfilled.
Add the files under the CandleStick folder to your project.
In the .xaml where you need the chart, add the namespace:
xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;
assembly=System.Windows.Controls.DataVisualization.Toolkit"
xmlns:local="clr-namespace:CandleStickChart"
Now you can get the cart as:
<charting:Chart >
<local:CandleStickSeries
</local:CandleStickSeries>
</charting:Chart>
ResourceDictionary contains the style to model the Bubble as a Candle. Make sure you update your App.xaml to merge the dictionary as:
ResourceDictionary
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CandleStickDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Let's look at the data structures.
StockData is self explanatory.
StockData
public class StockData
{
public DateTime Date { get; set; }
public double Open { get; set; }
public double High { get; set; }
public double Low { get; set; }
public double Close { get; set; }
public int Volume { get; set; }
}
CandleStickViewModel contains the mathematics needed by the view to display the candle, like the Wick Height, Body Height, adjusting the origin of the body.
CandleStickViewModel
CandleStickViewModelCollection contains all the candles. Since the color of the candle depends on the previous candle, it will not display the first candle.
CandleStickViewModelCollection
The following method gets the Origin of the Body almost correct relative to the Wick and hopefully someone can give me the perfect math for it. I have noticed the body is not perfectly in place.
public Point Origin
{
get
{
Point origin = new Point() { X = 0 };
var top = Open > Close ? Open : Close;
origin.Y = (High - top + (BodyHeight/2)) / WickHeight ;
return origin;
}
}
CandleStickSeries contains the code to convert the Candle data points to canvas coordinates.
CandleStickSeries
To create a hollow candle, I tried to use the polygon instead of the two rectangles but I could not get it to scale correctly. If I did not fill the Body rectangle with light gray, we will be able to see the rectangle used to draw the w. | http://www.codeproject.com/Articles/294704/Candlestick-based-off-WPF-Toolkit?fid=1669863&df=90&mpp=10&sort=Position&spc=None&tid=4310197 | CC-MAIN-2016-26 | refinedweb | 487 | 56.66 |
It's been two years and seven months since StarCraft II: Wings of Liberty was released. That's 959 days since we saw the release of the first new StarCraft game in a decade. Now, just over two and a half years later, we're celebrating the launch of the second title in the StarCraft II trilogy.
Dubbed StarCraft II: Heart of the Swarm, the game is an expansion pack for Wings of Liberty and is hitting shelves today. With 20 missions, Heart of the Swarm includes seven new multiplayer units from Wings of Liberty, as well as a continuing campaign focusing on the Zerg.
As an expansion pack, the price for Heart of the Swarm is slightly lower than the price of Wings when it was announced. The Wings of Liberty collectors edition was priced at $99 at time of launch whereas the Heart of the Swarm Collector's Edition price is set at $79.99. The regular, non-Collector's Edition price is $39.99. The Collector's Edition includes a behind-the-scenes Blu-ray and DVD two disc making-of, the soundtrack, and a 144-page art book.
Just in case it wasn't clear, Heart of the Swarm does require Wings of Liberty to play. GameStop currently has WoL on sale for twenty bucks. Blizzard has not yet discussed a release schedule for Legacy of the Void, the second StarCraft II expansion.
It's not a DLC... It's an expansion.
using either wine or something else
They really did put enough content into Wings of Liberty to justify being called a full game, it is just a very disappointing design concept to not include campaigns for two of your three races in the first game; to expect your gamers to wait to play a story experience for the other other two in 'expansions.' I disagree with that route.
I loved the starcraft series. However to play devil's advocate, most of the original members of blizzard have gone away. Although this is a normal experience that the gaming industry will see, you also see that blizzard has been shifting its resources to provide the least amount of work with the highest return (IE: "Copy/Paste" game creation). I'd highly urge others in order to stop allowing themselves be duped into thinking their money is going to quality products when most indie titles have far more re playability. | https://www.tomshardware.com/uk/news/StarCraft-II-Heart-of-the-Swarm-Release-Launch-Legacy-of-the-Void,21483.html | CC-MAIN-2021-39 | refinedweb | 404 | 68.91 |
>>> On 26.02.19 at 17:46, <ian.jackson@xxxxxxxxxx> wrote:
> Stefano Stabellini writes ("[PATCH v10 2/6] xen: introduce DEFINE_SYMBOL"):
>> +/*
>> + * Declare start and end array variables in C corresponding to existing
>> + * linker symbols.
>> + *
>> + * Two static inline functions are declared to do comparisons and
>> + * subtractions between these variables.
>> + *
>> + * The end variable is declared with a different type to make sure that
>> + * the static inline functions cannot be misused.
>> + */
>> +#define DEFINE_SYMBOL(type, name, start_name, end_name) \
>> + \
>> +struct abstract_ ## name { \
>> + type _; \
>> +}; \
>> + \
>> +extern const type start_name[]; \
>> +extern const struct abstract_ ## name end_name[]; \
>
> I have thought of a problem with this approach.
>
> This goes wrong unless `type' is a struct type. Because the compiler
> is allowed to assume that end_name has the correct alignment for its
> type. And in some ABIs, the alignment of a struct containing (say) a
> char is bigger than that of a char. AIUI in some of the actual use
> cases the linker-generated symbols may not be struct aligned.
>
> I am not aware of a standard C type which could be used instead of
> this struct. But I think you can use the `packed' attribute to get
> the right behaviour. The GCC manual says:
>
> | Alignment can be decreased by specifying the 'packed' attribute.
> | See below.
>
> Bizarrely, this seems only to be stated, slightly elliptically like
> this, in the section on the `aligned' attribute; it's not mentioned in
> `packed'. I suggest we couple this with a compile-time assertion that
> alignof is the struct is the same as alignof the type.
Until I've looked at this (again) now, I wasn't even aware that
one can combine packed and aligned attributes in a sensible
way. May I suggest that, because of this being a theoretical
issue only at this point, we limit ourselves to the build time
assertion you suggest?
>> +static inline bool name ## _lt(const type s1[], \
>> + const struct abstract_ ## name s2[])
> \
>> +{ \
>> + return (uintptr_t)s1 < (uintptr_t)s2; \
>> +} \
>
> This seems right to me.
>
>> +static inline ptrdiff_t name ## _diff(const type s1[], \
>> + const struct abstract_ ## name s2[])\
>> +{ \
>> + return ((uintptr_t)s2 - (uintptr_t)s1) / sizeof(*s1); \
>
> This is wrong. The conversion to ptrdiff_t (currently done implicitly
> by return) must come before the division. Otherwise it will give the
> wrong answer when s1 > s2.
>
> Suppose 32-bit, s1=0x00000040 s2=0x00000020 sizeof=0x10, Then
> s2-s1=0xffffffe0, and unsigned division gives
> (s2-s1)/sizeof=0x0ffffffe. Converstion to ptrdiff_t does not change
> the bit pattern. But we wanted 0xffffffe.
>
> Signed integer division by a positive divisor is always defined (and
> always fits) so doing the conversion first is fine.
Well, this would come as a side effect if there first was a function
producing the byte delta, and then the function here would call
that other function, doing the division on the result.
There's another caveat here though: Even by doing the cast first,
the division will still be unsigned as long as the sizeof() doesn't also
get cast to ptrdiff_t.
One question though is whether we actually care about the case
when s1 > s2 in the first place. But perhaps it's better to consider
it right away than getting bitten later. | https://old-list-archives.xen.org/archives/html/xen-devel/2019-02/msg01911.html | CC-MAIN-2021-49 | refinedweb | 522 | 62.17 |
HandWiki:Help/SourceCode
HandWiki uses [[1]] extension to highlights source code.
Showing source code
To show programming code, use the "source" tag (and specify the language). Here is an example for a Java code:
Java="OK"; File F = new File();
which is programmed as:
<source lang="java"> Java="OK"; File F = new File(); </source>
Another option is to use "syntaxhighlight" instead of the "source" code.
Instead of "java", you can use "python" (Python), "php" (PHP), "cpp" (C++), "js" (JavaScript) etc. tags that define the programming language. HaneWiki is bundled with highlight.js version 9.12 and the following languages (the keyword is given in brackets):
Common languages in HandWiki:
- Object-C ("objectivec")
- C ("c-like")
- C# ("csharp")
- C++ ("cpp")
- PHP ("php")
- Bash ("bash")
- CSS ("css")
- Go ("go")
- Groovy ("groovy")
- Python ("python")
- Shell ("shell")
- Java ("java")
- JavaScript ("javascript")
- Fortran ("fortran")
- Matlab ("matlab")
- HTML,XML ("xml")
- R ("r")
- Plaintext ("plaintext)
As in the case of HTML, pre-formatted text can be shown with the tag "pre". This is a good way to show the output of the program:
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks
Showing code inline
The attribute indicates that the source code should be inline as part of a paragraph (as opposed to being its own block). For example,
let us show a programming code with a syntax highlighting in the same line where the text is.
This is PHP code
<?php echo "Done!"; ?> on one line. It is programmed as:
<source lang="php" inline><?php echo "Done!"; ?></source>
This code above assumes syntax highlighting. However, you can use the tag "code" that does not apply syntax highlighting and cane used inline. Here is an example of a class name
java.lang.String which is programmed as:
<code>java.lang.String</code>
Note that the code is inside the white box.
Another option is to use the "tt" tag which does not apply the white background (and it looks more organic with the main text). Here is an example of the "tt" tag: java.lang.String. It is programmed as:
<tt>java.lang.String</tt>
Examples from DataMelt
For showing source code examples from DataMelt project, use the "jcode" statement. The first word should be "dmelt", the second - id of the example.
from jhplot import * f1 = F1D("2*exp(-x*x/50)+sin(pi*x)/x", 1.0, 10.0) c1 = HPlot("Example of function") c1.visible() c1.setAutoRange() c1.draw(f1)
which is programmed as:
<jcode lang="python"> dmelt 27777667.py </jcode>
If the example is protected, you will see a yellow box instead. You can also type code inside "jcode", but this will be less efficient than using the "source" statement assuming the Java syntax.
You can also show code using the "pycode" tag (Python syntax). This is a more protected approach since it shows a yellow box if not a member:
This code is equivalent to <source lang="python">:
def quickSort(arr): less = [] pivotList = [] more = [] if len(arr) <= 1: return arr else: pass
codded as:
<source lang="python"> def quickSort(arr): less = [] pivotList = [] more = [] if len(arr) <= 1: return arr else: pass </source>
Here when one uses "js" (JavaScript) tag:
console.log('Some JavaScript code');
Here when one uses "java" (Java) tag:
console.log('Some Java code');
Here when one uses "python" (Python) tag:
console.log('Some Python code');
If you do not need syntax highlighting, the best way to show outputs is to use "pre" tag.
Showing documentation
Javadoc API
Native Java classes can be identified automatically as "Java documentation" links. For example,
is programmed as:
<javadoc>jhplot.H1D</javadoc>
Here is another example:
java.lang.String which is programmed as:
<javadoc>java.lang.String</javadoc>
One can reference up to 50,000 Java classes (restrictions for some proprietary documentation may apply).
Python API
Python classes and libraries classes can be identified automatically as "Python documentation" links. For example,
is programmed as:
<pydoc>string</pydoc>
By default, Python3 is assumed. | https://handwiki.org/wiki/HandWiki:Help/SourceCode | CC-MAIN-2021-43 | refinedweb | 668 | 65.42 |
Show Table of Contents
The token can be deleted only after all the encrypted PVCs using the
4.2. Creating a storage class for persistent volume encryption
Use the following procedure to create an encryption enabled storage class using an external key management system (KMS) for persistent volume encryption. Persistent volume encryption is only available for RBD PVs.
Prerequisites
- The OpenShift Container Storage cluster is in
Readystate.
On the external key management system (KMS),
- Ensure that a policy with a token exists and the key value backend path in Vault is enabled. See Enabling key value and policy in Vault.
- Ensure that you are using signed certificates on your Vault servers.
Create a secret in the tenant’s namespace as follows:
- On the OpenShift Container Platform web console, navigate to Workloads → Secrets.
- Click Create → Key/value secret.
- Enter Secret Name as
ceph-csi-kms-token.
- Enter Key as
token.
- Enter Value. It is the token from Vault. You can either click Browse to select and upload the file containing the token or enter the token directly in the text box.
- Click Create.
注記
The token can be deleted only after all the encrypted PVCs using the
ceph-csi-kms-token have been deleted.
Procedure
- Navigate to Storage → Storage Classes.
- Click Create Storage Class.
- Enter the storage class Name and Description.
- Select either Delete or Retain for the Reclaim Policy. By default, Delete is selected.
- Select RBD Provisioner
openshift-storage.rbd.csi.ceph.comwhich is the plugin used for provisioning the persistent volumes.
- Select Storage Pool where the volume data will be stored from the list or create a new pool.
Select Enable Encryption checkbox.
- Key Management Service Provider is set to Vault by default.
- Enter Vault Service Name, host Address of Vault server ('https://<hostname or ip>'), and Port number.
Expand Advanced Settings to enter additional settings and certificate details based on your Vault configuration.
- Enter the key value secret path in Backend Path that is dedicated and unique to OpenShift Container Storage.
- (Optional) Enter TLS Server Name and Vault Enterprise Namespace.
- Provide CA Certificate, Client Certificate and Client Private Key by uploading the respective PEM encoded certificate file.
- Click Save.
- Click Connect.
- Review external key management service Connection details. To modify the information, click Change connection details and edit the fields.
Click Create.
Next steps
- The storage class can be used to create encrypted persistent volumes. For more information, see managing persistent volume claims. | https://access.redhat.com/documentation/ja-jp/red_hat_openshift_container_storage/4.8/html/deploying_and_managing_openshift_container_storage_using_red_hat_openstack_platform/creating-a-storage-class-for-persistent-volume-encryption_osp | CC-MAIN-2022-05 | refinedweb | 405 | 51.04 |
#include <cafe/os.h> int OSSwitchFiberEx(u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 pc, u32 newsp);
The result of the function pointed by pc.
Executes a function pointed to by pc using the new stack pointed to by newsp. When the function returns, the old stack pointer is restored.
Unlike
OSSwitchFiber, four arguments can be passed to a function specified by pc. The argument of the specified function does not need to be
u32 type as long as it is a register passable type (such as pointers), and the number of arguments may be less than four.
None.
2013/05/08 Automated cleanup pass.
2012/07/31 Cleanup Pass
2006/08/23 Initial version.
CONFIDENTIAL | http://anus.trade/wiiu/personalshit/wiiusdkdocs/fuckyoudontguessmylinks/actuallykillyourself/AA3395599559ASDLG/os/Stack/OSSwitchFiberEx.html | CC-MAIN-2018-05 | refinedweb | 117 | 72.76 |
I have to make a code that checks to see whether the Student 1's first name was blank and if it was then ask the user to input a name. However, when I use this code it doesn't display that message. When I press enter the cursor just goes to the next line until I actually type something in. I've tried this with strcmp too and nothing works.
#include <stdio.h>
#include <string.h>
{
char charStudent1FirstName[50] = "";
printf("Please enter Student 1's First name: ");
scanf("%s", &charStudent1FirstName);
if (charStudent1FirstName[0] == '\0')
{
printf("Please input Student 1's first name again: ");
scanf("%s", &charStudent1FirstName);
}
}
Here's what I changed:
fgetsinstead of
scanf. This means you will actually see the blank line if that's all that's entered.
fgetsresult.
charStudent1FirstNameinstead of
&charStudent1FirstName. You want to pass a
char*, not a
char**. If your compiler doesn't warn you about this, consider using a different compiler or changing your compilation settings.
Complete working code:
#include <stdio.h> #include <string.h> int main() { char charStudent1FirstName[50] = ""; while (charStudent1FirstName[0] == 0) { printf("Please input Student 1's first name: "); fgets(charStudent1FirstName, 50, stdin); charStudent1FirstName[strcspn(charStudent1FirstName, "\n")] = 0; } printf("First name: %s\n", charStudent1FirstName); } | https://codedump.io/share/9HAdnjPixxg1/1/how-to-check-if-a-string-is-empty-in-c-nothing-has-worked-so-far | CC-MAIN-2017-51 | refinedweb | 204 | 57.77 |
This preview shows
pages
1–2. Sign up to
view the full content.
// An applet that says "Hello World" in a big bold font, // with a button to change the color of the message. import java.awt.*; // Defines basic classes for GUI programming. import java.awt.event.*; // Defines classes for working with events. import java.applet.*; // Defines the applet class. public class ColoredHelloWorldApplet extends Applet implements ActionListener { // Defines a subclass of Applet. The "implements ActionListener" // part says that objects of type ColoredHelloApplet are // capable of listening for ActionEvents. This is necessary // if the applet is to respond to events from the button. int colorNum; // Keeps track of which color is displayed; // 1 for red, 2 for blue, 3 for green. Font textFont; // The font in which the message is displayed. // A font object represent a certain size and // style of text drawn on the screen. public void init() { // This routine is called by the system to initialize the applet. // It sets up the font and initial color for the message and
View Full
Document
This preview
has intentionally blurred sections.
- Spring '09
- jackson
Click to edit the document details | https://www.coursehero.com/file/5696631/ColoredHelloWorldApplet/ | CC-MAIN-2016-50 | refinedweb | 189 | 67.45 |
Calts can be found at:
The following help is available, click on a part of the image or one of the links
Here you can login and select the object type. From top to bottom :
Here you specify the query parameters. The parameters control which object(s) will be shown in either a graphical or tabular presentation. The selected parameters are persistent, so you can set the parameters and select different object types from the left. The header of a parameter will be greyed out if the current object type does not depend on that parameter.
The graphical output plots the timestamp ranges of all queried objects. Horizontal (left to right)
the timestamp ranges go from low to high, vertical (top to bottom) the creation_date.
The timestamp range is plotted as a colored bar from timestamp_start to timestamp_end. To edit timestamp
ranges and the is_valid flag click on the textual timestamps. When an object is eclipsed by another
object the eclipsed timestamp range will be shown in black.
In the tabular output screen the query results are plotted in tabular form. The columns vary from object type to object type. The columns can be clicked to sort them, the '-' indicates the column is sorted descending and the '+' for ascending sorting. Click on the filename to open the window for editing the timestamps and is_valid flag. The + or x sign in the second column indicates the presence of Comment(s) for this object. Click to add or view the comments. The is_valid flag of multiple objects can be set or unset by selecting the checkboxes in front of the objects and click the 'Make Valid' or 'Make Invalid' button at the bottom. A comment should always be provided when (in)validating objects.
In the edit window the timestamps can be changed and the is_valid flag set/unset, also comments can be added to the altered objects. This can be done for one or multiple objects.
This section covers setting the timestamps and the is_valid flag from the command line.
On the AWE prompt timestamps and the is_valid flag can be changed. After changing these attributes the object can be commited to the database using the recommit method. Notice that only the timestamp_start, timestamp_end and the is_valid flag can be (re)commited to the database in this manner, any other attribute that is changed will not be updated in the database.
Python example adjusting timestamps and is_valid:
# WARNING : the recommit(s) have been commented out in this example,
# these will change the timestamps and is_valid of the BiasFrame in the database !!
# query for a BiasFrame
import datetime
from astro.main.BiasFrame import BiasFrame
qry = BiasFrame.instrument.name == 'WFI'
bias = qry[0]
# substract one day from the timestamps start
bias.timestamp_start -= datetime.timedelta(1)
# and set timestamp_end to far future
bias.timestamp_end = datetime.datetime(2010, 1, 1)
# and commit changes to the database
# bias.recommit()
# make the BiasFrame invalid
bias.is_valid = 0
# bias.recommit()
# make the BiasFrame valid again
bias.is_valid = 1
# bias.recommit()
Python example adding a comment:
# WARNING : the commit has been commented out in this example
# query for a BiasFrame
from astro.main.BiasFrame import BiasFrame
qry = BiasFrame.instrument.name == 'WFI'
bias = qry[0]
# make a comment
from common.log.Comment import Comment
c = Comment()
c.make('A comment text', bias)
# c.commit() | http://calts.astro-wise.org/local/astro-users/astro-oper/awehome/master/astro/services/calts/static/Calts_Help.html | CC-MAIN-2019-39 | refinedweb | 553 | 57.87 |
Code written in C can be used inside swift directly by using clang’s module maps. Module map allows to define C code as a module and import it into swift code using import statements. Swift package manager has a documentation on how to use and link system libraries using SPM.
How it works?
C shared libraries (.so or .dylib) should be present at correct positions (for eg /usr/local/lib on OSX and /usr/lib on ubuntu)
A swift package should be created containing a module.modulemap file
module.modulemap file defines the name of the package which will be used in swift code, header file which will be exposed, which c library has to be linked, etc
SPM recommends prepending C in name of the library when making its swift package. for eg if a c library is called Foo, its swift name should be CFoo
A small example
In this example we’ll create a C Library to compute factorial of the number supplied and display its result using swift.
C Library
Create Factorial.h and Factorial.c
$ mkdir CGetFactorial && cd CGetFactorial && mkdir CSources && touch CSources/Factorial.h && touch CSources/Factorial.c
Factorial.h
long factorial(long n);
Factorial.c
long factorial(long n) { long result = 1; for(int i = 1;i <= n;i++) { result = result * i; } return result; }
- Create Package.swift, module.modulemap and makefile
Package.swift This contains name and dependencies of our package. This can be left empty but the file has to be present.
import PackageDescription let package = Package( name: "CGetFactorial" )
module.modulemap This file will help clang to define the c library as module for swift.
module CGetFactorial { header "CSources/Factorial.h" link "Factorial" export * }
the module name used here will be the name of the package that can be imported into swift
makefile We will use make to install our c library into the system
SRCDIR = CSources SHAREDLIB = libFactorial.so UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) SHAREDLIBPATH = /usr/lib endif ifeq ($(UNAME_S),Darwin) SHAREDLIBPATH = /usr/local/lib endif Factorial: $(SRCDIR)/Factorial.c clang -shared $(SRCDIR)/Factorial.c -o $(SHAREDLIB) cp libFactorial.so $(SHAREDLIBPATH) clean: -rm -f $(SHAREDLIB) -rm -f $(SHAREDLIBPATH)/$(SHAREDLIB)
This a simple makefile which will compile our Factorial.c into a shared library and copy it into /usr/lib for ubuntu and /usr/local/lib for OSX.
And we’re done with our C package ready to be used with swift.
Github :
Swift Package
Lets create a swift package called SwiftyFactorial
mkdir SwiftyFactorial && cd SwiftyFactorial && touch Package.swift && touch main.swift
Package.swift define the dependency to the C Package we created above
import PackageDescription let package = Package( name: "SwiftyFactorial", dependencies: [ .Package(url: "", majorVersion: 1) ] )
main.swift import the C Package and use the method we wrote.
import CGetFactorial let result = factorial(20) print("factorial of 20 = \(result)")
Okay! Lets try building this package.
$ swift build Cloning Packages/CGetFactorial Using version 1.0.0 of package CGetFactorial Compiling Swift Module 'SwiftyFactorial' (1 sources) Linking Executable: .build/debug/SwiftyFactorial ld: library not found for -lFactorial for architecture x86_64 <unknown>:0: error: link command failed with exit code 1 (use -v to see invocation) <unknown>:0: error: build had 1 command failures
This failed because the C factorial library is not yet installed in our system. Go to the cloned package
$ cd Packages/CGetFactorial-1.0.0/
run make to install it. (You’ll need to run
sudo make for ubuntu)
$ make clang -shared CSources/Factorial.c -o libFactorial.so cp libFactorial.so /usr/local/lib
That should do it. Go back and try to run swift build again.
$ cd ../../ $ swift build Compiling Swift Module 'SwiftyFactorial' (1 sources) Linking Executable: .build/debug/SwiftyFactorial
Great, try to run the executable
$ .build/debug/SwiftyFactorial factorial of 20 = 2432902008176640000
Done. Swift is correctly importing the
CGetFactorial package and is able to call the method.
To remove the installed library from your system just run the
make clean inside the CGetFactorial package dir.
$ cd Packages/CGetFactorial-1.0.0 && make clean rm -f libFactorial.so rm -f /usr/local/lib/libFactorial.so
It is fairly simple to import and use C inside swift code but SPM can’t yet build C code for you which will simplify this process if we need to ship C code which has to be linked to our swift packages.
The above code can be downloaded from github: | http://ankit.im/swift/2015/12/27/ship-c-code-with-swift-packages-using-swift-package-manager/ | CC-MAIN-2021-10 | refinedweb | 729 | 50.84 |
Building a Vue SPA with Laravel Part 3
We will continue building our Vue SPA with Laravel by showing you how to load asynchronous data before the
vue-router enters a route.
We left off in Building a Vue SPA With Laravel Part 2 finishing a
UsersIndex Vue component which loads users from an API asynchronously. We skimped on building a real API backed by the database and opted for fake data in the API response from Laravel’s
factory() method.
If you haven’t read Part 1 and Part 2 of building a Vue SPA with Laravel, I suggest you start with those posts first and then come back. I’ll be waiting for you!
In this tutorial we are also going to swap out our fake
/users endpoint with a real one powered by a database. I prefer to use MySQL, but you can use whatever database driver you want!
Our
UsersIndex.vue router component is loading the data from the API during the
created() lifecycle hook. Here’s what our
fetchData() method looks like at the conclusion of Part 2:
created() { this.fetchData(); }, methods: { fetchData() { this.error = this.users = null; this.loading = true; axios .get('/api/users') .then(response => { this.loading = false; this.users = response.data; }).catch(error => { this.loading = false; this.error = error.response.data.message || error.message; }); } }
I promised that I’d show you how to retrieve data from the API before navigating to a component, but before we do that we need to swap our API out for some real data.
Creating a Real Users Endpoint
We are going to create a
UsersController from which we return JSON data using Laravel’s new API resources introduced in Laravel 5.5.
Before we create the controller and API resource, let’s first set up a database and seeder to provide some test data for our SPA.
The User Database Seeder
We can create a new users seeder with the
make:seeder command:
php artisan make:seeder UsersTableSeeder
The
UsersTableSeeder is pretty simple right now—we just create 50 users with a model factory:
<?php use Illuminate\Database\Seeder; class UsersTableSeeder extends Seeder { public function run() { factory(App\User::class, 50)->create(); } }
Next, let’s add the
UsersTableSeeder to our
database/seeds/DatabaseSeeder.php file:
<?php use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $this->call([ UsersTableSeeder::class, ]); } }
We can’t apply this seeder without first creating and configuring a database.
Configuring a Database
It’s time to hook our Vue SPA Laravel application up to a real database. You can use SQLite with a GUI like TablePlus or MySQL. If you’re new to Laravel, you can go through the extensive documentation on getting started with a database.
If you have a local MySQL instance running on your machine, you can create a new database rather quickly from the command line with the following (assuming you don’t have a password for local development):
mysql -u root -e"create database vue_spa;" # or you could prompt for the password with the -p flag mysql -u root -e"create database vue_spa;" -p
Once you have the database, in the
.env file configure the
DB_DATABASE=vue_spa. If you get stuck, follow the documentation which should make it easy to get your database working.
Once you have the database connection configured, you can migrate your database tables and add seed data. Laravel ships with a Users table migration that we are using to seed data:
# Ensure the database seeders get auto-loaded composer dump-autoload php artisan migrate:fresh --seed
You can also use the separate
artisan db:seed command if you wish! That’s it; you should have a database with 50 users that we can query and return via the API.
The Users Controller
If you recall from Part 2, the fake
/users endpoint found in the
routes/api.php file looks like this:
Route::get('/users', function () { return factory('App\User', 10)->make(); });
Let’s create a controller class, which also gives us the added benefit of being able to use
php artisan route:cache in production, which is not possible with closures. We’ll create both the controller and a User API resource class from the command line:
php artisan make:controller Api/UsersController php artisan make:resource UserResource
The first command is adding the User controller in an
Api folder at
app/Http/Controllers/Api, and the second command adds UserResource to the
app/Http/Resources folder.
Here’s the new
routes/api.php code for our controller and
Api namespace:
Route::namespace('Api')->group(function () { Route::get('/users', 'UsersController@index'); });
The controller is pretty straightforward; we are returning an Eloquent API resource with pagination:
<?php namespace App\Http\Controllers\Api; use App\User; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Http\Resources\UserResource; class UsersController extends Controller { public function index() { return UserResource::collection(User::paginate(10)); } }
Here’s an example of what the JSON response will look like once we wire up the
UserResource with API format:
{ "data":[ { "name":"Francis Marquardt", "email":"schamberger.adrian@example.net" }, { "name":"Dr. Florine Beatty", "email":"fcummerata@example.org" }, ... ], "links":{ "first":"http:\/\/vue-router.test\/api\/users?page=1", "last":"http:\/\/vue-router.test\/api\/users?page=5", "prev":null, "next":"http:\/\/vue-router.test\/api\/users?page=2" }, "meta":{ "current_page":1, "from":1, "last_page":5, "path":"http:\/\/vue-router.test\/api\/users", "per_page":10, "to":10, "total":50 } }
It’s fantastic that Laravel provides us with the pagination data and adds the users to a
data key automatically!
Here’s the
UserResource class:
<?php namespace App\Http\Resources; use Illuminate\Http\Resources\Json\Resource; class UserResource extends Resource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array */ public function toArray($request) { return [ 'name' => $this->name, 'email' => $this->email, ]; } }
The
UserResource transforms each
User model in the collection to an array and provides the
UserResource::collection() method to transform a collection of users into a JSON format.
At this point, you should have a working
/api/users endpoint that we can use with our SPA, but if you are following along, you will notice that our new response format breaks the component.
Fixing the UsersIndex Component
We can quickly get our
UsersIndex.vue Component working again by adjusting the
then() call to reference the
data key where our user data now lives. It might look at little funky at first, but
response.data is the response object, so the user data can be set like the following:
this.users = response.data.data;
Here’s the adjusted
fetchData() method that works with our new API:
fetchData() { this.error = this.users = null; this.loading = true; axios .get('/api/users') .then(response => { this.loading = false; this.users = response.data.data; }).catch(error => { this.loading = false; this.error = error.response.data.message || error.message; }); }
Fetching Data Before Navigation
Our component is working with our new API, and it’s an excellent time to demonstrate how you might fetch users before navigation to the component occurs.
With this approach, we fetch the data and then navigate to the new route. We can accomplish this by using the
beforeRouteEnter guard on the incoming component. An example from the vue-router documentation looks like this:
beforeRouteEnter (to, from, next) { getPost(to.params.id, (err, post) => { next(vm => vm.setData(err, post)) }) },
Check the documentation for the complete example, but suffice it to say that we will asynchronously get the user data, once complete, and only after completion, we trigger
next() and set the data on our component (the
vm variable).
Here’s what a
getUsers function might look like to asynchronously get users from the API and then trigger a callback into the component:
const getUsers = (page, callback) => { const params = { page }; axios .get('/api/users', { params }) .then(response => { callback(null, response.data); }).catch(error => { callback(error, error.response.data); }); };
Note that the method doesn’t return a Promise, but instead triggers a callback on completion or failure. The callback passes to arguments, an error, and the response from the API call.
Our
getUsers() method accepts a
page variable which ends up in the request as a query string param. If it’s null (no page passed in the route), then the API will automatically assume
page=1.
The last thing I’ll point out is the
const params value. It will effectively look like this:
{ params: { page: 1 } }
And here’s how our
beforeRouteEnter guard uses the
getUsers function to get async data and then set it on the component while calling
beforeRouteEnter (to, from, next) { const params = { page: to.query.page }; getUsers(to.query.page, (err, data) => { next(vm => vm.setData(err, data)); }); },
This piece is the
callback argument in the
getUsers() call after the data is returned from the API:
(err, data) => { next(vm => vm.setData(err, data)); }
Which is then called like this in
getUsers() on a successful response from the API:
callback(null, response.data);
The beforeRouteUpdate
When the component is in a rendered state already, and the route changes, the
beforeRouteUpdate gets called, and Vue reuses the component in the new route. For example, when our users navigate from
/users?page=2 to
/users?page=3.
The
beforeRouteUpdate call is similar to
beforeRouteEnter. However, the former has access to
this on the component, so the style is slightly different:
// when route changes and this component is already rendered, // the logic will be slightly different. beforeRouteUpdate (to, from, next) { this.users = this.links = this.meta = null getUsers(to.query.page, (err, data) => { this.setData(err, data); next(); }); },
Since the component is in a rendered state, we need to reset a few data properties before getting the next set of users from the API. We have access to the component. Therefore, we can call
this.setData() (which I have yet to show you) first, and then call
next() without a callback.
Finally, here’s the
setData method on the
UsersIndex component:
setData(err, { data: users, links, meta }) { if (err) { this.error = err.toString(); } else { this.users = users; this.links = links; this.meta = meta; } },
The
setData() method uses object destructuring to get the
data,
links and
meta keys coming from the API response. We use the
data: users to assign
data to the new variable name
users for clarity.
Tying the UsersIndex All Together
I’ve shown you pieces of the
UsersIndex component, and we are ready to tie it all together, and sprinkle on some very basic pagination. This tutorial isn’t showing you how to build pagination, so you can find (or create) fancy pagination of your own!
Pagination is an excellent way to show you how to navigate around an SPA with
vue-router programmatically.
Here’s the full component with our new hooks and methods to get async data using router hooks:
<template> <div class="users"> <div v- <p>{{ error }}</p> </div> <ul v- <li v- <strong>Name:</strong> {{ name }}, <strong>Email:</strong> {{ email }} </li> </ul> <div class="pagination"> <button :Previous</button> {{ paginatonCount }} <button :Next</button> </div> </div> </template> <script> import axios from 'axios'; const getUsers = (page, callback) => { const params = { page }; axios .get('/api/users', { params }) .then(response => { callback(null, response.data); }).catch(error => { callback(error, error.response.data); }); }; export default { data() { return { users: null, meta: null, links: { first: null, last: null, next: null, prev: null, }, error: null, }; }, computed: { nextPage() { if (! this.meta || this.meta.current_page === this.meta.last_page) { return; } return this.meta.current_page + 1; }, prevPage() { if (! this.meta || this.meta.current_page === 1) { return; } return this.meta.current_page - 1; }, paginatonCount() { if (! this.meta) { return; } const { current_page, last_page } = this.meta; return `${current_page} of ${last_page}`; }, }, beforeRouteEnter (to, from, next) { getUsers(to.query.page, (err, data) => { next(vm => vm.setData(err, data)); }); }, // when route changes and this component is already rendered, // the logic will be slightly different. beforeRouteUpdate (to, from, next) { this.users = this.links = this.meta = null getUsers(to.query.page, (err, data) => { this.setData(err, data); next(); }); }, methods: { goToNext() { this.$router.push({ query: { page: this.nextPage, }, }); }, goToPrev() { this.$router.push({ name: 'users.index', query: { page: this.prevPage, } }); }, setData(err, { data: users, links, meta }) { if (err) { this.error = err.toString(); } else { this.users = users; this.links = links; this.meta = meta; } }, } } </script>
If it’s easier to digest, here’s the UsersIndex.vue as a GitHub Gist.
There are quite a few new things here, so I’ll point out some of the more important points. The
goToNext() and
goToPrev() methods demonstrate how you navigate with
vue-router using
this.$router.push:
this.$router.push({ query: { page: `${this.nextPage}`, }, });
We are pushing a new page to the query string which triggers
beforeRouteUpdate. I also want to point out that I’m showing you a
<button> element for the previous and next actions, primarily to demonstrate programmatically navigating with
vue-router, and you would likely use
<router-link /> to automatically navigate between paginated routes.
I have introduced three computed properties (
nextPage,
prevPage, and
paginatonCount) to determine the next and previous page numbers, and a
paginatonCount to show a visual count of the current page number and the total page count.
The next and previous buttons use the computed properties to determine if they should be disabled, and the “goTo” methods use these computed properties to push the
page query string param to the next or previous page. The buttons are disabled when a next or previous page is null at the boundaries of the first and last pages.
There’s probably a bit of redundancy in the code, but this component illustrates using
vue-router for fetching data before entering a route!
Don’t forget to make sure you build the latest version of your JavaScript by running Laravel Mix:
# NPM npm run dev # Watch to update automatically while developing npm run watch # Yarn yarn dev # Watch to update automatically while developing yarn watch
Finally, here’s what our SPA looks like after we update the complete
UsersIndex.vue component:
What’s Next
We now have a working API with real data from a database, and a simple paginated component which uses Laravel’s API model resources on the backend for simple pagination links and wrapping the data in a
data key.
Next, we will work on creating, editing, and deleting users. A
/users resource would be locked down in a real application, but for now, we are just building CRUD functionality to learn how to work with
vue-router to navigate and pull in data asynchronously.
We could also work on abstracting the axios client code out of the component, but for now, it’s simple, so we’ll leave it in the component until Part 4. Once we add additional API features, we’ll want to create a dedicated module for our HTTP client.
Newsletter
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
Github Deprecates Anonymous Gist Creation
Github announced that in 30 days they will no longer allow anonymous Gist creation any longer. The reason they stated…
Laravel 5.6.3 Released and GitHub Stargazing
A few releases have gone out at the end of last week since the big release of Laravel 5.6 at Laracon Online 2018. You… | https://laravel-news.com/building-vue-spa-laravel-part-3 | CC-MAIN-2019-04 | refinedweb | 2,533 | 55.24 |
The curious case of Module Federation and how do we write tests for federated applications.
If you haven't heard by now — Module Federation is a way to simply
import() other modules/files between independently compiled and deployed bundles at runtime.
Possibilities are endless, especially after working with it for over a year. Before there was even an npm release, it was in production, installing directly from a branch on GitHub. It’s immensely more powerful then most think
With this new at-runtime orchestration and code sharing, a big question loomed.
How on earth will I test this?
Over a year later….
There’s two Passions I have. Architecture and performance
I refused to accept that It could not be improved by engineering, without getting…
There’s lots of advice, but it seems to taper off when it comes to advanced performance tactics. I’ve read the articles, but it’s either too vague, too broad, or just basic stuff I have already done. Where are the more advanced articles on performance, most importantly — why are we not combining tech and talking about a stacked implementation?
This has been my real-world experience, tools, or tactics I've used. I like web performance and am a little obsessed. These ideas can be a little quirky or abstract, there are probably better ways to handle perf.
With that said…
… demonstrating a manual method that uses the startup code pattern. I’ll develop some better examples soon which demonstrate complex integrations.
In the context of…
Module Federation was already powerful. So we doubled its power by introducing an advanced API. This technology is clearly a game-changer in javascript architecture
Beta 17 has been out for a week or so. It packs a powerful punch. Despite the power that’s been introduced in the latest release. We are far from completion.
Module Federation is just getting started.
Some Major work went into this release. Rewritten Externals Plugin, Changes to how webpack runtime works, Changes to the webpack graph, changes to chunking systems, and the startup sequence of webpack. …
Stitching two independent bundles into one single page application, at runtime
A short and sweet guide to using Module Federation on two independently deployed web apps, so that they can work like a monolith. Sharing code between themselves at runtime.
We’re going to federate two independent, very basic little react apps.
What we have started out is a bare-bones React app, hosted on port
3001
// app1 - running on localhost:3001
import React from "react";
const App = () => (
<div>
<h1>Basic Host-Remote</h1>
<h2>App 1</h2>
</div>
);
export default App;
On port
3002 we have another single page application….
It’s a type of JavaScript architecture I invented and prototyped. Then with the help of my co-creator and the founder of Webpack — it was turned into one…
Update: This project is being rewritten and will be incorporated into Webpack 5!
medium.com
This article describes how I wrote a Webpack plugin that imports chunks from other Webpack bundles at runtime. It is part of a larger series on micro-frontend applications and techniques for managing them.
The article is low level in some places, and it’s intended to document the journey of developing tools for interleaving. I will write higher level articles focused around using the tool, providing code samples and use cases.
Building modern distributed JavaScript applications is complex. Managing multiple repositories, builds, and code sharing is a challenging…
High Performance Configuration for JetBrains IDEs [IntelliJ, WebStorm, etc..]
Once you step into the realm of multi-project development, large scale dev, or just have to have like 6 IDE’s open. You really start to feel a performance hit on JetBrains IDEs.
This configuration aims to give at least 10x performance increases across the board.
The recommended way of changing the JVM options in the recent product versions is from the Help | Edit Custom VM Options menu. …
This article is part of a series on micro-frontend applications and techniques for managing them.
We are making some big changes to frontend architecture. Check out our progress on Webpack Module Federation:
medium.com
github.com
This tutorial will discuss how to decouple your frontend from a monolith and begin migrating to micro frontend architecture immediately. This was one of my past projects
Let us assume there’s a Monolithic codebase. This monolith uses one of the backend templating engines or systems (ex. EJS or ERB), jQuery, and it has no real considerations for frontend — or worse, it comes…
Principal Engineer of Web @ Lululemon. Specializing in Webpack and Javascript Orchestration at scale. Creator of Module Federation | https://scriptedalchemy.medium.com/?source=post_internal_links---------4---------------------------- | CC-MAIN-2021-31 | refinedweb | 776 | 56.35 |
Table of Contents
To create a table use the
CREATE TABLE command. You must at least specify a
name for the table and names and types of the columns.
See Data Types for information about the supported data types.
Let’s create a simple table with two columns of type
integer and
string:
cr> create table my_table ( ... first_column integer, ... second_column string ... ); CREATE OK, 1 row affected (... sec)
A table can be removed by using the
DROP TABLE command:
cr> drop table my_table; DROP OK, 1 row affected (... sec)
The
DROP TABLE command takes the optional clause
IF EXISTS which
prevents the generation of an error if the specified table does not exist:
cr> drop table if exists my_table; DROP OK, 0 rows affected (... sec) string, ...
Note
Schemas are primarily namespaces for tables.
In the standard edition of CrateDB, there is no notion of access control and everybody can see and manipulate tables in every schema.
In the Enterprise Edition of CrateDB, byte, ... another_one geo_point ... ); CREATE OK, 1 row affected (... sec)
cr> select table_schema, table_name from information_schema.tables ... where table_name='my_doc_table'; +--------------+--------------+ | table_schema | table_name | +--------------+--------------+ | doc | my_doc_table | +--------------+--------------+ SELECT 1 row in set (... sec). | https://crate.io/docs/crate/reference/en/latest/general/ddl/create-table.html | CC-MAIN-2018-09 | refinedweb | 190 | 56.86 |
The const member functions are the functions which are declared as constant in the program. The object called by these functions cannot be modified. It is recommended to use const keyword so that accidental changes to object are avoided.
A const member function can be called by any type of object. Non-const functions can be called by non-const objects only.
Here is the syntax of const member function in C++ language,
datatype function_name const();
Here is an example of const member function in C++,
#include<iostream> using namespace std; class Demo { int val; public: Demo(int x = 0) { val = x; } int getValue() const { return val; } }; int main() { const Demo d(28); Demo d1(8); cout << "The value using object d : " << d.getValue(); cout << "\nThe value using object d1 : " << d1.getValue(); return 0; }
The value using object d : 28 The value using object d1 : 8 | https://www.tutorialspoint.com/const-member-functions-in-cplusplus | CC-MAIN-2021-04 | refinedweb | 146 | 62.38 |
mezzanine-slides 1.0.3
Easily plug a slideshow into your mezzanine website on all pages.
# mezzanine-slides Add simple slide functionality to your Mezzanine based website allowing for beautiful banners at the tops of pages. ## Setup 1. Run `pip install mezzanine-slides` 2. In `settings.py` add `mezzanine_slides` to your `INSTALLED_APPS` above mezzanine apps. 3. Run createdb or syncdb, if running syncdb run migrate if you are using South. 4. If you haven't modified your `base.html` or `pages/page.html` templates then you can just `manage.py collectemplates mezzanine_slides` and use the ones I provide. If you've already modified these templates see the Templates section for continued instruction. ## Templates Add this to your `pages/page.html` anywhere as long as it's not inside another block: {% block slides %}{% if page.slide_set.all %} <div class="row"> <div class="span12"> <ul class="rslides">{% for image in page.slide_set.all %} <li><img src="{{ MEDIA_URL }}{% thumbnail image.file 940 300 %}" alt="{{ image.description }}"/></li> {% endfor %}</ul> </div> </div> {% endif %}{% endblock %} Add this to `base.html` where you would like the slides to appear, which is usually between your main content and the navigation: {% block slides %}{% endblock %} Notice that I include the `row` and `span12` classes on the `pages/page.html` template so that if you don't have any slides then nothing is added to the page. Now you'll need to include the CSS and JS in your compress areas of your `base.html` template: {% compress css %} ... <link rel="stylesheet" href="{{ STATIC_URL }}css/responsiveslides.css"> {% endcompress %} {% compress js %} ... <script src="{{ STATIC_URL }}js/responsiveslides.min.js"></script> {% endcompress %} Lastly you'll need to invoke the slides JavaScript by putting `$('.rslides').responsiveSlides();` on in your JavaScript somewhere. In the `base.html` template I put this in the header around line 34 where I found some other JavaScript functions to just make it easy and try to conform to the original Mezzanine as much as possible, here is an excerpt of the area: <script> $(function() { ... $('.rslides').responsiveSlides(); }); </script> ## Credits Thanks to [Viljami Salminen][0] for his great [ResponsiveSlides.js][1] plugin. ## License (Simplified BSD) Copyright (c) Isaac Bythe]: [1]:
- Downloads (All Versions):
- 31 downloads in the last day
- 194 downloads in the last week
- 566 downloads in the last month
- Author: Isaac Bythewood
- Download URL:
- License: Simplified BSD
- Categories
- Package Index Owner: overshard
- DOAP record: mezzanine-slides-1.0.3.xml | https://pypi.python.org/pypi/mezzanine-slides/1.0.3 | CC-MAIN-2014-10 | refinedweb | 399 | 59.3 |
Smith10,172 Points
Im not sure why this is incorrect
I'm supposed to put the name variable in the h1 tag form. I used the double curly braces like the previous video showed but it won't work
from flask import Flask from flask import render_template app = Flask(__name__) @app.route('/hello/<name>') def hello(name="Treehouse"): name = name return render_template('hello.html')
<!doctype html> <html> <head><title>Hello!</title></head> <body> <h1>Howdy {{name}}!</h1> </body> </html>
1 Answer
Steven Parker210,422 Points
The HTML change is OK. But the rest of the instructions said to "Pass the name argument to the template."
Putting "
name=name" on a line by itself doesn't do anything, but putting it as the 2nd argument to
render_template would be a way to pass the name to the template. | https://teamtreehouse.com/community/im-not-sure-why-this-is-incorrect | CC-MAIN-2021-43 | refinedweb | 137 | 73.58 |
User Tag List
Results 1 to 2 of 2
Thread: Ajax with layout templates
- Join Date
- Dec 2004
- Location
- Syria
- 12
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ajax with layout templates
Hello,
Here is the situation:
I have a List action that lists items for me (scaffold generated), now I need to the destroy method to be ajaxed, I wrote the following:
Code:
<%=link_to_remote ('Destroy', :update => "main", :url => {:action => 'destroy', :id => @category}, :confirm => 'Are you sure?', :post => true, :loading => "document.getElementById('loading').style.display='inline'", :loaded => "document.getElementById('loading').style.display='none'")%>
Code:
def destroy Category.find(params[:id]).destroy redirect_to :action => 'list'
I have searched the rails documentation and found this:
render :action => "list", :layout => false
But this didn't work, it caused an error.
Do you suggest some other solution?
- Join Date
- Aug 2005
- 986
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Don't use Ajax for this. It has no advantage if you redirect anyway.
Bookmarks | http://www.sitepoint.com/forums/showthread.php?440587-Ajax-with-layout-templates&p=3178455&viewfull=1 | CC-MAIN-2014-41 | refinedweb | 162 | 53.41 |
Gradient..
A standard approach to solving this type of problem is to define an error function (also called a cost function) that measures how “good” a given line is. This function will take in a
(m,b) pair and return an error value based on how well the line fits our data. To compute this error for a given line, we’ll iterate through each
(x,y) point in our data set and sum the square distances between each point’s
y value and the candidate line’s
y value (computed at
mx + b). It’s conventional to square this distance to ensure that it is positive and to make our error function differentiable.:
Lines that fit our data better (where better is defined by our error function) will result in lower error values. If we minimize this function, we will get the best line for our data. Since our error function consists of two parameters (
m and
b) we can visualize it as a two-dimensional surface. This is what it looks like for our data set:
Each point in this two-dimensional space represents a line. The height of the function at each point is the error value for that line. You can see that some lines yield smaller error values than others (i.e., fit our data better).. To compute it, we will need to differentiate our error function. Since our function is defined by two parameters (
m and
b), we will need to compute a partial derivative for each. These derivatives work out to be:
We now have all the tools needed to run gradient descent. We can initialize our search to start at any pair of
m and
b values (i.e., any line) and let the gradient descent algorithm march downhill on our error function towards the best line. Each iteration will update
m and
b to a line that yields slightly lower error than the previous iteration.. Each iteration
m and
b are updated to values that yield slightly lower error than the previous iteration. The left plot displays the current location of the gradient descent search (blue dot) and the path taken to get there (black line). The right plot displays the corresponding line for the current search location. Eventually we ended up with a pretty accurate fit..
108?
Hi Matt,
about Chris’s comment:
Look at the fift image: The y-intercept in the left graph (about 2.2) doesn’t correspond with the y-intercept in the right graph (about -8).
Best,
jalil
the y-intercept in the right graph is not -8. For the y-intercept, you need to find the position where x=0.
hie sir, where should i run this project, i mean in centos.
I did check on the internet so many times to find a way of applying the gradient descent and optimizing the coefficient on logistic regression the way u did explain it here. I’d like to see another work for you explaining this or if you have any other link
Dear Matt:
I ran your simulation (m=-1, b=0, with 2000 iterations), but the final slope and intercept were not the same as the ones you listed. Also, I ran my own best fit and it matches what you have graphically. Anyway, I am just trying to get the best fit line from your gradient algorithm. Maybe I am missing something??
Dave Paper
I think I have got it now. I was able to create a ‘best fit’ line with the final slope and intercept (from your gradient descent algorithm) that matched the ‘best line’ fit from running numpy ‘polyfit’. Thx for the great example!
dave
Hello, what improvements did you do to the code to match a solution from let’s say, Excel with slope = 1.3224 and interceptio = 7.991? I had to make the code do a lot of iterations to achieve that. Did you managed to do it in 2000 iterations?.
sometime we do gradient descent and optimization based on each single vector like the case in NN. how would you explain this..
In OLS cost function (J(theta)) you don’t have to worry about local minimum issues. That is exactly the reason we use convex function to derive it.
Also want to understand how the differentiation is always arriving at a descent.
Vinsent, gradient descent is able to always move downhill because it uses calculus to compute the slope of the error surface at each iteration.
It is my understanding that the gradient of a function at a point A evaluated at that point points in the direction of greatest increase. If you take the negative of that gradient you get the direction of greatest decrease. The gradient vector is derived from the several partial derivatives of the function with respect to its variables. This is why differentiation leads to the direction of greatest descent.
Keeping this in mind, if you are given an error function; by finding the gradient of that function and taking its negative you get the direction in which you have to “move” to decrease your error.
Hope this makes sense.:
How do i use this code to find value of Y for a new value of x?
Nicely explained!! Enjoyed the post.Thanks
That was such an awesome explanation !! Can you also explain logistic regression and gradient descent
Thanks Praveen, glad you liked it. Also, thanks for the logistic regression suggestion, I may consider writing a post on that in the future.
Matt, this is a boss-level post. Really helped me understand the concept. Gold stars and back-pats all round.
I really liked the post and the work that you’ve put in. I suggest you add a like button to your posts.
Hi Matt,
Overall your article is very clear, but I want to clarify one important moment. The real m and b are 1.28 and 9.9 respectively for the data you ran on your code (e.g. data.csv). But your code gives us totally different results, why is that?
I know we can get that true result above by giving different random m and b, but shouldn’t our code work for any random m and b?
Would be kind clarifying that moment please, it is very important for me.
Thank you in advance.
Hi Altay, how are you computing 1.28 and 9.9 for the real m and b?
Hi,
I’ve just simply used excel to compute that linear regression. Also vusualized that line graphically to check.
It’s important to understand that there is no “true” or “correct” answer (e.g., m and b values). We are trying to model data using a line, and scoring how well the model does by defining an objective function (error function) to minimize. It’s very possible that Excel is using a different objective function than I used. It’s also possible that I did not run gradient descent for enough iterations, and the error difference between my answer and the excel answer is very small. Ideally, you would have some test data that you could score different models against to determine which approach produces the best result.
Hi Matt,
Sorry for my late reply.
But I thought that Gradient Descent should give us the exact and most optimal fitting m and b for training data, at least because we have only one independent variable X in the example you gave us.
If I miss smth, correct me please.
If you compare the error for the (m,b) result I got above after 2000 iterations, it is slightly larger than the (m,b) example you reported from excel (call the compute_error_for_line_given_points function in my code with the two lines and compare the result). Had I ran it for more than 2000 iterations it would have eventually converged at the line you posted above.
What I was trying to say above is that gradient descent will in theory give us the most optimal fitting for m and b for a defined objective function. Of course, this comes with all sorts of caveats (e.g., how searchable is the space, are there local minima, etc.).
I am terribly sorry Matt, but there was a slight error with data selection when I was creating my regression formula in excel, so I corrected it and results are m = 1.32 and b = 7.9. And this result is achieved using your python code when I gave m = 2 and b = 8 as initial parameters.
And I played with some other different values as an initial m and b and number of iterations, after which I realized that the best starting values were m = 2 and b = 8.
And I made conclusion that the main point is to give right starting m and b which I do not know how to do.
So I want to thank you for your your article and your replies to my comments which was a sort of short discussion.
Assuming it is the true minimum, it should eventually converge to (1.32, 7.9) regardless of what initial (m,b) value you use. It may take a very long time to do so however.
In the error surface above you can see a long blue ridge (near the bottom of the function). My guess is that the search moves into this ridge pretty quickly but then moves slowly after that. My guess is that you just aren’t running it long enough if you are getting different results for different starting values.
Hi Matt,
Thank you once again. I got correct results just by increasing number of iterations to 1000000 and more.
Hi Matt.
Thanks for efforts. I’m trying to refresh my knowledge with your article.
Can you please explain what do you mean by “Each point in this two-dimensional space represents a line. The height of the function at each point is the error value for that line.” Does that mean each point IS line or what? I cant understand.
Thanks
I am also confused by this point / line vocabulary here. Too bad you did not get any answer.
I believe the 2 dimensions in this 2-dimensional space are m (slope of the line) and b (the y-intercept of the line). Therefore any point in the m,b space will map into a line in the x-y space. I suppose Matt added the 3rd dimension to the m,b space by showing the error associated with the line associated with the m,b pair.
Matt,
Thanks for your blog, especially using PDE and converting into function is quite useful. BTW, this is quite useful for people who is taking CS.190.x on EDX.
Cheers
Hey Matt, just wanted to say a huge “THANK YOU!!” this is the best simple explanation of linear regression + gradient on the Web so far.
Hi, Matt
can you please give an example or an explanation og how gradient descent helps or works in text classification problems.
Hi, this is really interesting, could you also make an article about stochastic gradient descent, please. Thanks.
Matthew,
What is the license for your code examples?
@Michael – great question, I’ve added an MIT license.
Is gradient descent algorithm applied in hadoop….if so how ??
can you explain more about defferentiating the error function specifically?
hi
is there any body who knows some information about shape topology optimization by phase field method ?
best regards
thanks for your web and reply
I’m beginning to study data science and this blog is very helpful. Thanks Matt. Just one question, could you explain how you derive the partial derivative for m and b? thanks a lot.
Can only say: fantastic !!!
Thankyou. I’ve never seen a better explanation in any of my class (I’m a UG Bioinformatics student struggling to understand such concepts) and now I understand this concept thoroughly.
Excellent explanation.
Are you using this to spot a trend in a stock? I have coded something in easy language for Trade Station and what I have found is that there is no correct chart size for the day.
In other words no matter what chart size I use I will know if I should be a buyer or a seller based on the trend for the day.
I then take a measurement and can make a logical decision about what the big boys are doing and then I do what they do.
For instance……I was 100 percent sure that buying EMINI’s above 2060 was a terrible decision and I had calculated that the stall out was going to be 2063.50 …
I also was a seller of oil futures above 42.76 and then I hit it again on the retrace above 42.40.
Are you interested in this type of thing or is this outside the realm of what you are doing?
Great post! I’m trying to understand the type of math behind neural networks through examples and this helped a whole bunch! I did my own implementation of your code in Google Spreadsheets/Google Script (7.5MB GIF)
Hello,
Thanks for the explanation. Does the error function remain same for exponential curve i.e (y – w * e^(lambda * x))^2? If not how does it change when I try to fit a curve using exponential curve and similarly for a hypo exponential – convolution of exponential’s. I am trying to fit curve which is a probability density function using exponential PDF.
To start with I am trying single exponential curve.
I tried implementing the same algorithm for exponential curve but it doesn’t work. The matlab code for the same can be found here –
Thanks for writing this! I’m actually taking Andrew Ng’s MOOC, and I was looking for an explanation of gradient descent that would go into a little more detail than he gave (at least initially…I haven’t finished the course) and show me visually what gradient descent looked like and what the graph for the error function looked like. Your explanation was really helpful and helped me picture what was going on. Thanks!
Me too. I studied regression analysis once a long time ago but I could not recall the details. I searched a lot of other websites and I could not find the explanation that I needed there either. Oddly, conventional presentations of elementary machine learning methods seem to have a meta-language that is half way between mathematics and programming that are riddled with little but significant explanatory gaps.Some details are so important that they should be pointed out in order to make a consistent presentation.
Awesome! Thank you.
At my current job we are using this algorithm specifically. without your example, I would not have been able to figure it out so easily.
What I am trying to figure out is what would be a good way to generate example data for a multi-point(x, y, z) approach using a quadratic in three dimensions?
Matt, This is the best and the most practical explanation of this algorithm. Kudos!! Thanks a lot.
Awesome article………. I was trying to get my head around Neural Networks and came through Gradient Descent……of all article I searched this is the most well explained Article. Thanks a ton.
On a lighter note there is a saying “You do not really understand something unless you can explain it to your grandmother.”…….Well now I can explain my grandmother this stuff :D
Thank you for this valuable article.
I have a problem with my code, I’m using (Simple Regression Problem//
F(a)= a^4+ a^3+ a^2+ a)
but there is no convergence
its about Cartesian genetic programming
my question is
should i use the gradient with it to solve the problem or?????
thanks
Thank you. All i every well detailed but one “line” has no explanation, and this is ( to me the core of the algorithm):
Why on each iteration do you determine that
new_b = b_current – (learningRate * b_gradient)
( same for m : why is the new value = the old value minus the new calculated one )
or, to use your wording: why is this meaning going downhill ?
Thanks for such an fantastic article.
I am attending online course of Prof. Andrew Ng from Coursera.
Your article has contributed to remove many confusions.
In your example I could not find where you are using “learning rate”?
Where you use 0.0001 ?
Thanks in advance for reply.
Bharat.
hello sir, i want to know that if i am training one robot that identify handwitten alphabet character and if i am giving training of character ‘A’ , 50 different training latter A given to robot. then here gradient descent is used or any other?
Can you share the code to generate the gif? Did you just call the matplot lib everytime you compute the values of intercept and slope? I don’t seem to find it on the GitHub
Hello,
In statistics, we use the “Centroid” point to fix at least a point of the line ” Y=m X + b.
very useful, after with only one other point we have the full equation.
(see linear regression in statistics)
But I see in machine learning that you jump to Cost Fonction type of problem to minimize.
and yes, it has to search for both m, and B, the slope and the “Bias” in same time.
Would you please help, explain why they don’t use CENTROID methode ?
thanks
does it work for multi linear regression? if it does, can you please show me how it works? thanks
I am confused in one thing. We have to take the partial derivative of the cost function continuously again and again until we get the local minimum or the derivative will be taken only once?
Is it that once we get the equations
b_gradient += -(2/N) * (points[i].y – ((m_current*points[i].x) + b_current))
m_gradient += -(2/N) * points[i].x * (points[i].y – ((m_current * points[i].x) + b_current))
by taking the partial derivative once and then it will calculate the parameters by itself each time in a loop?
I hope you understand my question..
thanks
Hi Matt:
When I run your code with initial m = -1 and b = 2 for 2000 iterations, I get the following:
b = 0.0607
m = 1.478
When I use polyfit and lineregress functions, I get the following:
b = 7.99
m = 1.322
I believe that I am running your code correctly. Maybe I am doing something wrong??
dave
awesome explanation.
thanks so much
Thanks for the post Matt.. very well explained.
Amazing post. Exactly what I needed to get started. This beautiful explanation of yours give a feel of the mathematics and logic behind the machine learning concept.
Thanks,
Khalid
Hello,
Very Nicely written.
Thank You for this.
Just Curious–Do you have a similar example for a logistic regression model?
If not- Then Can you please share a similar example for logistic regression.
Thank You Again.
hello
can anyone help me
how can i run this in eclipse
Hi Matt, Thanks for this tutorial. I have been searching for clear and consice explanation to machine learning for a while until I read your article. The animation is great and the explanation is excellent. After reading through it I have managed to replicate it with your data set using T-SQL.I am.over the moon.and so grateful to you for making me understand the concepts of gradient descent. If you do have any other machine learning tutorials kindly send me the links in your response.Thanks
Michael
Hey Matt,
Sorry if I am repeating a question. I havent read all the comments but how do you come up with the value learningRate? is it Hit and trial?
Yes, it’s largely trial and error. Plotting the error after each iteration can help you visualize how the search is converging – check out this SO post
Great explanation! Thanks a lot.
Awesome .
Please include an article for stochastic gradient too .
A very good introduction. Covers the essential basics and gives just about enough explantion to understand the concepts well.
One quick question. Apologies if this is a repeat!
You did mention that there can be situations in which we might be stuck in a “Local Minima” & to resolve this we can use “Stochastic Gradient Descent”. But, how do we realize OR understand in the first place, that we are stuck at a local minima and have not already reached the best fitting line?
why do u increment the gradient?
is there someone to let me know what this X is for… in 2nd equation????
why is not it in other equation:
b_gradient += -(2/N) * (y – (m*x) + b))
m_gradient += -(2/N) * x * (y – ((m*x) + b)
i am talking about the x over this dotted place
-(2/N)*……………*(y – ((m * x) + b))
Thanks for the very clear example of linear regression. I’d like to do the surface plot shown just below the error function using matplotlib. I’m having a lot of trouble. I wonder if anyone else has tried this or if Matt is still reading comments.
-2/N should be put out of the for loop right ?
Exactly my thought, but you havent got response, I the -2/N part should go outside the loop too
I am facing problem with a particular data-set even with your python example:
2104,400
1600,330
2400,369
1416,232
3000,540
def computeErrorForLineGivenPoints(b, m, points):
totalError = 0
for i in range(0, len(points)):
totalError += (points[i].y – (m * points[i].x + b)) ** 2
return totalError / float(len(points))
in the above code, for the function “computeErrorForLineGivenPoints(b, m, points)”, what are the parameter values you give for b(y-intercept) and m(slope) parameters. How do you choose b and m ?
I can see from the gradient descent plot that you take only the values between -2 and 4 for both y and m. Why cant it take any other values outside that range ?
The “computeErrorForLineGivenPoints” function is just used to compute an error value for any (m, b) value (i.e., line). I’m using it to show that the error decreases during each iteration of the gradient descent search.
Great page!!! I have one question. How do you put the code in your html? Looks really cool. I want to do the same thing.
Very well written and explained. You inspired me to read and explore more on ML algorithms . Thanks a lot!!!
Clear and well written, however, this is not an introduction to Gradient Descent as the title suggests, it is an introduction tot the USE of gradient descent in linear regression. Gradient descent is not explained, even not what it is. It just states in using gradient descent we take the partial derivatives. The links to Wikipedia are of little use, because these pages are not at all introductory, that’s why I came here. Again, the content is good, but not what it is supposed to be.
Great Explanation!
The only Thing I don’t understand:
Where did you get those Derivatives from?
“These derivatives work out to be:” is not that helpful :(
Thank you very much for fluent and great explanations !!!
At last, I got the Gradient Descent for you.
After a couple of months of studying missing puzzle on Gradient Descent, I got very clear idea from you.
Thanks!! | https://spin.atomicobject.com/2014/06/24/gradient-descent-linear-regression/ | CC-MAIN-2018-13 | refinedweb | 3,926 | 73.58 |
Question :
I have a long sequence, and I would like to know how often some sub-sequences occur in this sequence.
I know string.count(s, sub), but it only counts non-overlapping sequences.
Does a similar function which also counts overlapping sequences exist?
Answer #1:
As an alternative to writing your own search function, you could use the
re module:
In [22]: import re In [23]: haystack = 'abababa baba alibababa' In [24]: needle = 'baba' In [25]: matches = re.finditer(r'(?=(%s))' % re.escape(needle), haystack) In [26]: print [m.start(1) for m in matches] [1, 3, 8, 16, 18]
The above prints out the starting positions of all (potentially overlapping) matches.
If all you need is the count, the following should do the trick:
In [27]: len(re.findall(r'(?=(%s))' % re.escape(needle), haystack)) Out[27]: 5
Answer #2:
A simple to understand way to do it is:
def count(sub, string): count = 0 for i in xrange(len(string)): if string[i:].startswith(sub): count += 1 return count count('baba', 'abababa baba alibababa') #output: 5
If you like short snippets, you can make it less readable but smarter:
def count(subs, s): return sum((s[i:].startswith(subs) for i in xrange(len(s))))
This uses the fact that Python can treat boolean like integers.
Answer #3:
This should help you :
matches =[] st = 'abababa baba alibababa' needle = 'baba' for i in xrange(len(st)-len(needle)+1): i = st.find(needle,i,i+len(needle)) if(i >= 0): matches.append(st.find(needle,i,i+len(needle))) print(str(matches))
see it here :
Did not benchmark it for long strings, see if its efficient enough for your use.
Answer #4:
I learnt today that you could use a running index to fetch the next occurrence of your substring:
string = 'bobobobobobobob' # long string or variable here count = 0 start = 0 while True: index = string.find('bob', start) if index >= 0: count += 1 start += 1 else: break print(count)
Returns
7 | https://discuss.dizzycoding.com/how-can-i-find-the-number-of-overlapping-sequences-in-a-string-with-python-duplicate/ | CC-MAIN-2022-33 | refinedweb | 333 | 70.84 |
Expose C++ value to QML's shared JavaScript library
How can I get a value from C++ in QML's stateless JavaScript (ie .pragma library) ? I use the following method to access C++ value from QML and non-stateless JavaScript file:
@
#define APP_NAME "myApp"
int main(int argc, char *argv[]){
QApplication app(argc, argv);
...
QDeclarativeView view;
view.rootContext()->setContextProperty("APP_NAME", APP_NAME); // expose to QML root context
...
}@
Then I can access the value from QML/JS using APP_NAME but I can't access in stateless JavaScript file. How to expose C++ value to stateless JavaScript file?
Hi,
Firstly, despite what the old documentation said, .pragma library js resources are not stateless; they're definitely stateful. They are shared context libraries, however, which means that importing them multiple times does not result in each imported version having its own context.
In practice, this means that the .pragma library doesn't ever inherit context from the importing scope, because it might be imported multiple times. Thus, the root context of a .pragma library js resource is a top-level (or orphan) context - not the root context of the application.
To get things from the application's root context into the shared JS context, you can pass them as parameters:
@
.pragma library
var app_name
var isInitialized = false
function initialize(appName) {
isInitialized = true;
app_name = appName;
}
// whatever other code, below...
@
This can then be called from your top-level QML application context:
@
import "shared.js" as MyShared
Item {
Component.onCompleted: if (!MyShared.isInitialized) MyShared.initialize(APP_NAME);
}
@
I hope this helps!
Thanks for your suggestion.
But I have lot of constant value that I need to pass to JavaScript library from C++, using the above method will definitely make the code looks poor (need to expose every value to QML then pass to JavaScript). Do you have any better suggestion? :)
You can create one single QObject in C++, with a whole bunch of properties.
EG:
@
class MyConstantsContainer : public QObject
{
Q_OBJECT
Q_PROPERTY(int someConstant READ someConstant WRITE setSomeConstant NOTIFY someConstantChanged)
Q_PROPERTY(QString otherConstant READ otherConstant WRITE setOtherConstant NOTIFY otherConstantChanged)
// ... etc
public:
MyConstantsContainer(QObject *parent) : QObject(parent) {}
~MyConstantsContainer() {}
int someConstant() const { return m_someConstant; } void setSomeConstant(int c) { m_someConstant = c; emit someConstantChanged(); } // etc...
private:
int m_someConstant;
};
@
Then, in your main.cpp or other entrypoint, instantiate the object, set the constant properties, and set it as a root context property (eg, "constants").
Then in your main QML file, call the init function, passing the "constants" object to the pragma library. Store a reference to the object (eg, var constantsObj; function init(constants) { constantsObj = constants; }
From then on, you'll be able to access the constants via: constantsObj.someConstant; etc.
Cheers,
Chris.
Thanks Chris, but I have a question:
If I pass a QObject to a shared JavaScript library, is the pointer of the QObject being pass or copy of the QObject? If I change the value in the QObject will the object that I keep in the shared JavaScript library will change as well?
Also, in a shared JavaScript library, I can access to the Qt namespace and function (eg. Qt.formatDateTime()). Is it possible for me to achieve that?
A pointer to the QObject is what will be passed, internally. So, yes. And yes - the orphan context spawned for the library import is a clean copy of the global context which includes the Qt object, if I recall correctly, so you will have access to the Qt object and its functions.
Remember: if in doubt, try it! QML is great in that it's simple to iteratively try things and see what happens. You'll learn a lot about how QML works from exploring and trying different things.
Cheers,
Chris.
Thanks Chris, I will try :) | https://forum.qt.io/topic/21782/expose-c-value-to-qml-s-shared-javascript-library | CC-MAIN-2017-39 | refinedweb | 615 | 55.95 |
Compiler Implementation
Table of Contents
- 1. Linker
- 2. AddressSanitizer
- 3. C Preprocessor (CPP)
- 4. Special Notations
- 5. GCC options
- 6. Misc
1 Linker
ldd
- show the dynamic library used by an executable
2 AddressSanitizer
- wiki:
- flags:
To use it:
cc -fsanitize=address a.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char buf[10]; // strcpy(buf, "hhhhhiiiiiooooo"); char *hbuf = (char*)malloc(10*sizeof(char)); strcpy(hbuf, "hhhhhddddd"); }
Note the heap buffer overflow, it will not crash by normal compilation. However, it will crash and print out report after using address sanitizer.
On mac, the default behavior is just hang, does not finish. To make it terminates the program:
ASAN_OPTIONS=halt_on_error=1 ./a.out
3 C Preprocessor (CPP)
The CPP Manual :
3.1 The processing
The following textural transformation is done before everything:
- The input file is read into memory and broken into lines.
- Continued lines (line ends with a backslash and newline) are merged into one long line. There's NO way to prevent a backslash at the end of a line from being interpreted as a backslash-newline.
- All comments are replaced with single spaces. Block comments (
/* */) does not nest. Line comments (
//) can nest because it doesn't matter. It is safe to put line comments inside block comments, or vice versa.
After these steps, the tokenization is performed. Then the true "preprocessing" is performed.
Preprocessing directives are lines in your program that start with
#.
Whitespace is allowed before and after the
#.
The ‘#’ is followed by an identifier, the directive name.
The ‘#’ which begins a directive cannot come from a macro expansion.
Also, the directive name is not macro expanded.
The primary directives do:
- Inclusion of header files.
- Macro expansion.
- Conditional compilation.
- Line control.
- Diagnostics.
Macro has two kinds, object like (e.g.
BUFFER) and function like (i.e. takes parameters).
For function-like macros,
all arguments to a macro are completely macro-expanded before they are substituted into the macro body.
3.1.1 Compiler option to separate them
Generally the compiler will do preprocessing, compilation, assembling, and linking in order.
cc -c a.c # do not do link ==> a.o cc -S a.c # do not do assembling => a.s cc -E a.c # only do preprocessing, output to stdout > a.i
3.1.2 self-referential macro
A self-referential macro is one whose name appears in its definition
The self-references that do not expand in the first scan are marked so that they will not expand in the second scan either.
e.g.
#define foo (4 + foo).
In most cases, it is a bad idea to take advantage of this feature.
3.2 Predefined macros
3.2.1 Standard (in language specification)
__FILE__
- expands to the name of the current input file, in the form of a C string constant This is the path by which the preprocessor opened the file, not the short name.
__LINE__
- expands to the current input line number
One typical use of these two macros are in log message.
fprintf (stderr, "Internal error: " "negative string length " "%d at %s, line %d.", length, __FILE__, __LINE__);
An ‘#include’ directive changes the expansions of FILE and LINE to correspond to the included file. Revert back when coming back. A ‘#line’ directive changes LINE, and may change FILE as well.
Note, for debugging purpose, it is nice to have the current function name.
However, the preprocessor does not know about what the function name is.
There does exist a
__func__ and
__FUNCTION__, but they're not macros.
They are strings.
__DATE__
- expand to string constant, describing the date on which the preprocessor is being run. The string constant contains eleven characters and looks like "Feb 12 1996". If the day of the month is less than 10, it is padded with a space on the left.
__TIME__
- The string constant contains eight characters and looks like "23:59:01".
__STDC__
- most of the time equal to 1. I think just assume this.
__STDC_VERSION__
- something like
199409L
__STDC_HOSTED__
- should also be assumed to be 1
__cplusplus
- defined when c++ compiler is used.
__OBJC__
- defined when OBJ-C compiler is used.
__ASSEMBLER__
- defined when running on assembly.
3.2.2 Common GNU C extension
I only list some interesting ones. For the full list see the page in gcc manual.
__COUNTER__
- expands to sequential integral values starting from 0.
__GNUC__
- int, major version
__GNUC_MINOR__
- int, minor version
3.2.3 system specific
To find the macros that are defined in current system:
cpp -dM - # use standard input C-d # EOF, see result
3.2.3.1 MAC
#define OBJC_NEW_PROPERTIES 1 #define _LP64 1 #define __APPLE_CC__ 6000 #define __APPLE__ 1 #define __LP64__ 1 #define __MACH__ 1 #define __MMX__ 1 #define __clang__ 1 #define __clang_major__ 7 #define __clang_minor__ 3 #define __llvm__ 1 #define __x86_64 1 #define __x86_64__ 1
3.2.3.2 Ubuntu
#define __unix__ 1 #define __linux 1 #define __unix 1 #define __linux__ 1 #define unix 1 #define __x86_64__ 1
3.3 Stringification
Parameters are not replaced inside string constants.
When a macro parameter is used with a leading ‘#’, the preprocessor replaces it with the literal text of the actual argument, converted to a string constant. Unlike normal parameter replacement, the argument is not macro-expanded first. This is called stringification..
3.4 token-pasting
token pasting or
token concatenation
When a macro is expanded,
the two tokens on either side of each
## operator are combined into a single token,
which then replaces the
## and the two original tokens in the macro expansion.
Two tokens that don't together form a valid token cannot be pasted together. CPP will give warning.
struct command { char *name; void (*function) (void); }; struct command commands[] = { { "quit", quit_command }, { "help", help_command }, ... };
can be wrote as:
#define COMMAND(NAME) { #NAME, NAME ## _command } struct command commands[] = { COMMAND (quit), COMMAND (help), ... };
Another example:
#define paster( n ) printf_s( "token" #n " = %d", token##n ) int token9 = 9;
becomes
printf_s( "token" "9" " = %d", token9 ); // => printf_s( "token9 = %d", token9 );
3.5 Line Markers
# linenum filename flags
They mean that the following line originated in file filename at line linenum.
After the file name comes zero or more flags, which are ‘1’, ‘2’, ‘3’, or ‘4’. If there are multiple flags, spaces separate them, and must be in ascending order.
1
- This indicates the start of a new file.
2
- This indicates returning to a file (after having included another file).
3
- This indicates that the following text comes from a system header file, so certain warnings should be suppressed.
4
- This indicates that the following text should be treated as being wrapped in an implicit extern "C" block.
They are treated like the corresponding
#line directive,
except that trailing flags are permitted.
4 Special Notations
4.1 Line Control
It can have three formats:
#line linum
- a non-negative integer
#line linum filename
- a string constant
#line anything else
- This is just a dummy, anything else must be a macro, and expands to the above two format.
The only things that changed are
__FILE__ and
__LINE__.
5 GCC options
-includeinclude file before parsing
-include-pchinclude precompiled header file (often names as
header.h.gch) Note that generally the include directive will look for the
.h.gchversion right before looking for
.hfile in each directory.
6 Misc
nm a.olist symbols from object files | http://wiki.lihebi.com/compiler-impl.html | CC-MAIN-2017-22 | refinedweb | 1,218 | 59.19 |
If you are using the standard installation of Python from python.org which comes with the IDLE editor, there are some exciting demonstrations of the power of the turtle module available at the click of a mouse.
The turtle module is hugely useful for learning about and teaching programming, and also great fun. It provides a way to express computational concepts in a visual form and provides easy-to-interpret feedback on what is happening in a program.
To get an idea of what is possible with Python and the Turtle module, select the help menu in IDLE and click on
Turtle Demo. Then choose one of the examples from the menu and off you go!
Many of the examples use straightforward procedural code so should be fairly eady to understand – for example
peace and
yinyang. Others make use object oriented programming (
Nim for example), which is great if you are learning or teaching A Level Computer Science.
One great thing about the demos is that you can copy the code and adapt it to your own needs.
Here is the code for
tdemo_yinyang.py:
from turtle import * def yin(radius, color1, color2): width(3) color("black", color1) begin_fill() circle(radius/2., 180) circle(radius, 180) left(180) circle(-radius/2., 180) end_fill() left(90) up() forward(radius*0.35) right(90) down() color(color1, color2) begin_fill() circle(radius*0.15) end_fill() left(90) up() backward(radius*0.35) down() left(90) def main(): reset() yin(200, "black", "white") yin(200, "white", "black") ht() return "Done!" if __name__ == '__main__': main() mainloop()
Plenty of bits in there you can make use of I expect.
The Turtle module in Python is awesome. I hope you have fun with it. | https://compucademy.net/python-turtle-graphics-demos/ | CC-MAIN-2022-27 | refinedweb | 287 | 66.13 |
Example
We have a main form. The user clicks "New Order", where the order form pops up. But how does it pop up?
Instance and Static
This is how C# differs to VB. In VB, you have one copy of each form. You can hide and show this form any time you like, but there is one form. You can toggle visibility by using Show() or Hide().
C#, on the other hand, is very different. Here we can only use instance members. What this means is that there is no single copy of the form - if you want to open a form, you must create a new "version" of the form, and display this to the user.
Classes and Objects
In VB, a form name in the code would refer to the actual form object. By typing a period (.), we could access the properties of the form. In C#, the form name is a class. Therefore, we cannot access any properties directly from it. We must create a new object variable, and use the form class to fashion it to the shape of the form we want to show.
The Code
To open the order form, we would do something like this:
frmOrder form = new frmOrder();
form.ShowDialog();
Notice how the frmOrder form (the name of our order form) is being used as a class - the actual form object is called "form". Therefore, to access its properties we refer to this, and not the form class.
Suppose we wanted to know the result of the order form:
frmOrder form = new frmOrder();
if (form.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("You selected the " + form.txtOrder.Text + " item!");
}
else
{
MessageBox.Show("Oh well, maybe next time!");
}
First, we check the DialogResult enumeration that ShowDialog() returns. If it is DialogResult.OK (under a couple of namespaces, of course) then we grab the contents of the txtOrder textbox on the form. If not, we display a cancellation note (you don't have to do this, of course).
Conclusion
I hope this will be helpful - especially for those migrating from VB to C#. Bear this in mind, and creating new forms will be a doddle.
Xav | http://forum.codecall.net/topic/44081-c-tutorial-how-to-open-new-forms/ | CC-MAIN-2018-39 | refinedweb | 360 | 84.17 |
The Apache Directory team proudly announces the Apache Directory project graduated incubation under the Apache Software Foundation (ASF) according to the ASF Board Summary for February 23, 2005.
Our primary vision is to build an enterprise directory server platform (Apache Directory Server)ache Directory Server:
* Designed as an LDAP and X.500 experimentation platform.
* The server exposes all aspects of administration via a special system backend.
* Both the backend subsystem and the frontend are separable and independently embeddable.
* Provides a server side JNDI LDAP provider which directly interacts with the backend storage.
* Powered by MINA, a powerful framework for building Internet protocol servers.
* Remote management via JMX.
* Java-based triggers and stored procedures.
The Apache Directory team is looking for developers and users to work
with the server and give feedback. Mailing list information is at:
Check the Apache Directory project at: Apache Directory Project Exits Incubator (17 messages)
- Posted by: Trustin Heuiseung Lee
- Posted on: March 04 2005 00:19 EST
Threaded Messages (17)
- The Apache Directory Project Exits Incubator by Mileta Cekovic on March 08 2005 18:13 EST
- What is difference between the frameworks by Daniel Fellars on March 08 2005 19:46 EST
- What is difference between the frameworks by Trustin Heuiseung Lee on March 08 2005 20:17 EST
- Why MINA by Sugra Moin on April 10 2005 04:20 EDT
- Why MINA by Trustin Heuiseung Lee on May 11 2005 09:45 EDT
- DB as backend? by Rickard Oberg on March 09 2005 04:25 EST
- DB as backend? by Trustin Heuiseung Lee on March 09 2005 07:51 EST
- RE: DB as backend? by Marc Boorshtein on March 09 2005 07:58 EST
- DirXML/LDIF by Rickard Oberg on March 09 2005 08:16 EST
- RE: DB as backend? by alex karasulu on March 09 2005 10:44 EST
- RE: DB as backend? by Marc Boorshtein on March 10 2005 09:55 EST
- Virtual Directory by Adison Wongkar on March 11 2005 06:18 EST
- RE: DB as backend? by alex karasulu on March 12 2005 04:17 EST
- RE: DB as backend? by Marc Boorshtein on March 12 2005 07:02 EST
- DB as backend? by alex karasulu on March 09 2005 10:26 EST
- Quality by Pavel Tavoda on March 09 2005 07:06 EST
- Quality by Trustin Heuiseung Lee on March 09 2005 07:56 EST
The Apache Directory Project Exits Incubator[ Go to top ]
Wow, Apapche is steadily rounding its family of servers.
- Posted by: Mileta Cekovic
- Posted on: March 08 2005 18:13 EST
- in response to Trustin Heuiseung Lee
What is difference between the frameworks[ Go to top ]
Hi Trustin,
- Posted by: Daniel Fellars
- Posted on: March 08 2005 19:46 EST
- in response to Trustin Heuiseung Lee
I am wondering if any insight can be given as to the differences between the 4 frameworks listed: apseda,protocol,MINA,sedang?
they all look like they accomplish the same thing. does the directory project use all of them together, or is it configurable to use just one?
If I want to use one of these for a network server socket layer without using directory, what are the pros/cons of each?
thanks
What is difference between the frameworks[ Go to top ]
Hi Daniel,
- Posted by: Trustin Heuiseung Lee
- Posted on: March 08 2005 20:17 EST
- in response to Daniel Fellars MINA[ Go to top ]
- Posted by: Sugra Moin
- Posted on: April 10 2005 04:20 EDT
- in response to Trustin Heuiseung Lee
Hi Daniel do you say APSEDA is Dead, How is MINA stronger then seda or Sedang.
Is Mina same as Netty.
Where can I get more Info on MINA and its merits.
Moin
Why MINA[ Go to top ]
I'm sorry for this late reply.
- Posted by: Trustin Heuiseung Lee
- Posted on: May 11 2005 21:45 EDT
- in response to Sugra Moin
APSEDA was immature in its API design, so that users couldn't develop network applications easily. MINA provides comprehensive API that boosts development speed. And of course you can implement SEDA on top of MINA. SedaNG didn't evolve as fast as MINA, so it went back to sandbox. That's why we're using MINA.
Thanks,
Trustin
DB as backend?[ Go to top ]
We have a number of customers that are stuck with application account info in relational databases. They would like to expose them through LDAP, but I have been unable to find a good way to do so thus far. Would it be possible to plug in such a user database as a *limited* backend for the ADS? It would be read-only mostly.
- Posted by: Rickard Oberg
- Posted on: March 09 2005 04:25 EST
- in response to Trustin Heuiseung Lee
DB as backend?[ Go to top ]
Yes, you can. ApacheDS provides a user-implementable interface for backend storages.
- Posted by: Trustin Heuiseung Lee
- Posted on: March 09 2005 07:51 EST
- in response to Rickard Oberg
RE: DB as backend?[ Go to top ]
Use a virtual directory. Virtual directories act as a proxy layer between your application and your data, allowing your application to communicate via LDAPv3 to what it thinks is an LDAP directory while the virtual directory communicates with backend repositories (such as LDAP, DB & webservices). There are primarily two leaders in the space:
- Posted by: Marc Boorshtein
- Posted on: March 09 2005 07:58 EST
- in response to Rickard Oberg
Octet String
Radiant Logic
Marc Boorshtein
DirXML/LDIF[ Go to top ]
Well, we've been discussing this (just now) with one of our customers, and it seems much easier to simply populate a standard directory (such as eDirectory) with application account data (i.e. use a meta-directory approach) using something like DirXML, or just plain LDIF files. It's definitely a very simple and robust solution anyway, and should be easier than hacking a custom DB backend.
- Posted by: Rickard Oberg
- Posted on: March 09 2005 08:16 EST
- in response to Marc Boorshtein
But using a virtual directory, like the ones you describe, should also be a very good solution. I think it all comes down to customer requirements (e.g. is it required to be always up to date, or is a daily update ok), and pricing.
RE: DB as backend?[ Go to top ]
We hope to have virtual directory capabilities soon. It's just not that hard to do once you got the baseline protocols grok'd. Expect to see these capabilties emerging within a matter of weeks, perhaps as early as 0.9 or 0.10 are released.
- Posted by: alex karasulu
- Posted on: March 09 2005 10:44 EST
- in response to Marc Boorshtein
BTW I'm totally shocked at how much Octet String and Radiant Logic can charge: ~50K and up for their products. Companies like Boeing seem to pay without a peep. Hopefully we'll have a free alternative soon and people can save a few thousand bucks. A virtual directory for us is just a mapping tool on top of a configurable dynamic backend. We are already working on one.
RE: DB as backend?[ Go to top ]
Actually, a virtual directory is NOT simply a "mapping" tool. What you are describing is more of a "simple proxy". Virtual directories offer far more functionality including:
- Posted by: Marc Boorshtein
- Posted on: March 10 2005 09:55 EST
- in response to alex karasulu
Multiple namespace arbitration
Multiple directory integration
Logical joining of directory entries
Extended access controls
Seperate "views" per application
Numerouse proxt features such as load ballancing and directory routing
If a virtual directory were just a "mapping" tool, then everyone would just use openldap's proxy.
And as for why people pay 50k for such products: You have just spent a million or two deploying a portal, spent over a year in the deployment with a week to go until going production and just realized your portal software can't get access to your company's users because they are spread across several data stores. Re-architecting corporate data structures can take over a year while a virtual directory can be deployed in a matter of days. What's 50k compared to a failed multi-million dollar deployment?
Virtual Directory[ Go to top ]
In recent article at: the guys at Burton Group are suggesting that LDAP is now moving from isolated to consolidated and now to distributed. The article give lots of good reason that I won't repeat here.
- Posted by: Adison Wongkar
- Posted on: March 11 2005 18:18 EST
- in response to Marc Boorshtein
Distributed here means that while we can have multiple instances of LDAP, the underlying data are practically the same (or "integrated"). It's more like saying "ln -s" (linking a file in UNIX) rather than "cp" (copying a file). I agree with you that Virtual Directory is not simply a mapping tool per se but it must be able to combine entries from heterogeneous data sources (such as DB and LDAP).
There are also more reasons for people to use Virtual Directory aside from integrating heterogeneous data sources. It may also be used to shield main directory from attacks that would disrupt the enterprise operation. This feature is what OpenLDAP Proxy is for ().
RE: DB as backend?[ Go to top ]
Marc I'm not suggesting that a VD is *just* a mapping tool. If I do not mention all the aspects of a VD in a 5 line TSS post forgive me. It also does not mean that I think a VD is only a mapping tool. Nice try.
- Posted by: alex karasulu
- Posted on: March 12 2005 16:17 EST
- in response to Marc Boorshtein
Regardless you have an interesting stance on the cost to the customer. I suspect the reason why a 50K cost to a user is ok with you is because you are at the receiving end: an Octet String employee. Perhaps you should come out and say this. I don't blame you for your stance. I just think there's subterfuge in recommending the companies you work for as if you're not an employee but just another commentator. Your approach is so typically commercial.
Is Radiant Logic a reseller of Octet String's VDE?
RE: DB as backend?[ Go to top ]
Alex,
- Posted by: Marc Boorshtein
- Posted on: March 12 2005 19:02 EST
- in response to alex karasulu
First I'd like to say that the tone of your argument is not necessary. People may talk and disagree without being rude to each other.
Second I'd like to point out several facts about Octet String and myself (Marc Boorshtein):
1. I am no longer an employee at Octet String
2. Octet String has been very active in the open source community.
3. Radiant Logic is not a reseller, but a competitor to Octet String.
Now, as I have stated in point #2, Octet String has been a VERY active member in the open source community. Octet String's co-founder and CTO wrote a 100% java ldap server almost 5 years ago and released it under the GPL (). He recently granted the rights to CodeHause to re-license it under the academic free license. Previously he wrote the PerlLDAP and co wrote the Net::LDAP libraries, both under the same license as Perl.
In addition to his own Open Source work, Clayton continued his dedication to the community while at the head of Octet String. In 2002 he hired me, as an Open Source developer, to write the JDBC-LDAP bridge. The bridge is a tool that allows JDBC based applications to communicate with LDAPv3 based directories. Once the tool was completed, Octet String donated it to OpenLDAP and it is still the only jdbc-to-ldap driver that is both free as in speech and as in beer. Once the jdbc-ldap project was completed, I was hired on as a fulltime employee. While at Octet String I continued to develop and improve the bridge as well as fix several bugs in the JLDAP ldap library (mostly around web services) and have continued to improve and develop the bridge and the SQL Directory Browser with the full support of Octet String.
Finally the cost is not "OK" with me because I use to work at Octet String; that is what the market has deemed its worth. It's a simple matter of supply & demand as well as the economy of scale. The demand is derived from very large companies where certain identity management problems and scale require the supply of software to fix those problems. As a case in point, look at the example I gave in my previous posting. Who would be spending 1-2 million on a portal deployment? It would not be a small business that has a few hundred users where such a price tag is cost prohibitive. It would instead be a company like Boeing that has 100k+ employees plus partners where a massive heterogeneous environment exists that spans several continents.
As for being "so typically commercial", we live in a society where it is commerce that allows us to put food on the table and take care of our families. As I have no intention to get into a discussion about the merits of capitalism in this forum (though I am always quite happy to in other arenas), I would simply like to state that the over whelming amount of interaction and donations to the open source community from Octet String should show that while it is in fact a business it is very active in endeavors that they will not be profiting from directly. I'd like to close with a comment from one of Octet String's customers "You saved us millions and saved my job".
Marc Boorshtein
p.s.: If you re-read your posting you do in fact say it is *just* a mapping tool :-)
DB as backend?[ Go to top ]
Richard you can definately do this using a custom partition (backend) implementation. Yes you can plug it in. Actually in a few (maybe couple weeks) we'll release 0.9 which will make it much easier to do so.
- Posted by: alex karasulu
- Posted on: March 09 2005 10:26 EST
- in response to Rickard Oberg
Eventually though we should be able to introduce some virtual directory capabilities. Once this is in place you won't have to devise a new custom backend. Rather you would use mapping tools to map an RDBM schema to a DIT subtree. The VD engine of the server would do the rest.
Cheers,
Alex Karasulu
Quality[ Go to top ]
They would like to use it as X.500 experimentation platform? What about real value of directory service like reliability, performance, security, ... .
- Posted by: Pavel Tavoda
- Posted on: March 09 2005 07:06 EST
- in response to Trustin Heuiseung Lee
Is it just another project for fun or something real?
Quality[ Go to top ]
We're developing Apache Directory Server for real enterprise environment. Its current version is 0.8 yet, and therefore we're striving to make it more suitable for production use. Currently, you can run ApacheDS with LDAP protocol.
- Posted by: Trustin Heuiseung Lee
- Posted on: March 09 2005 07:56 EST
- in response to Pavel Tavoda | http://www.theserverside.com/discussions/thread/32324.html | CC-MAIN-2017-26 | refinedweb | 2,558 | 61.06 |
Content-type: text/html
#include <sys/cred.h>
int priv_policy(const cred_t *cr, int priv, int err, const char *msg);
int priv_policy_only(const cred_t *cr, int priv);
int priv_policy_choice(const cred_t *cr, int priv);
Solaris DDI specific (Solaris DDI).
cr
The credential to be checked.
priv
The integer value of the privilege to test.
err
The error code to return.
msg.
EINVAL
This might be caused by any of the following:
• The flags parameter is invalid.
• The specified privilege does not exist.
• The priv parameter contains invalid characters.
ENOMEM
There is no room to allocate another privilege.
ENAMETOOLONG
An attempt was made to allocate a privilege that was longer than {PRIVNAME_MAX} characters.
This functions can be called from user, interrupt, or kernel context.
See attributes(5) for a description of the following attributes:
acct(3HEAD), attributes(5), privileges(5)
Writing Device Drivers | https://backdrift.org/man/SunOS-5.10/man9f/priv_policy.9f.html | CC-MAIN-2017-39 | refinedweb | 142 | 51.95 |
Before we started discussing the actual syntax, let’s discuss how Java handles its code.
When someone runs a Java file, the first thing it does is to set up a JRE (Java Runtime Environment). As the name implies, it’s an environment that allows the Java code to run in it.
Furthermore, it also provides a layer of security for the user, as the Java code is not allowed to make changes to the PC outside the JRE. This prevents any malicious hackers gaining control of your system.
Now moving onto how Java creates portable code that runs on any platform. Java does this by using it’s compiler to generate bytecode from the actual code. Bytecode is a highly optimized set of instructions designed to be executed by the JVM (Java Virtual Machine).
The result of all this is that to run Java on a platform, all you require is a JRE. Since all JRE’s understand the same bytecode, there are no portability issues.
If haven’t read our introductory article Getting started with Java, you won’t be able to build the same level of understanding!
Java files names
For most programming languages, the name of the file that holds the source code to a program is arbitrary. However, this is not the case with Java. In Java, the name of the main class should match that of the source file. Even the capitalization of the names must match.
Furthermore, all the Java files must be saved with the .java extension.
Case sensitivity in Java Syntax
Like many programming languages Java is also case sensitive. This effects everything down to the name of files (as pointed out above) and the names of variables used in the program.
For instance,
Dog and
dog are treated as two different variables. To keep things easy while coding, it’s recommended to code only in lowercase.
Java Comments
Comments are useful pieces of explanatory text added alongside the code. It can serve as a useful reminder regarding the use of several variables, or the purpose of a specific block of code.
Using double slash characters can be used to declare a single line comment.
//This is a comment
You can write whole paragraphs using the multi line comments characters. Any text you may want to include comes between the
/* and
*/ characters.
/* This is a multi line comment in Java */
Java main() method
After you’ve declared a main class, you’ll have to declare the following line in your code. This is the line at which the program will begin executing.
The entire program is contained within the curly brackets.
public static void main (String args[]) { // Program }
The keyword void tells the compiler that main( ) is not meant to return a value. The keyword public declares it’s access level. Keeping it private for instance would not allow anything outside the class to access it, which would cause issues. Hence we keep it public, so it can be accessed by anyone.
The exact meaning of this line cannot be explained without further knowledge of Java’s concepts. Hence this is where we stop.
Java Output
Since output is Java is not large enough of a topic to be given a separate page, it will be discussed here. Every programming has it’s own output statement. Most commonly you’ll see the
System.out.println("Output in Java");
Remember to include the semi colon. All Java statements must end with a semi colon, else a syntax error is raised.
Java Example
To top it all off, we’re including a small example code from one of our Java articles.
You can see clearly the main() wrapper around the code like we mentioned earlier. There’s also the first line, which is
public class example, a line compulsory in all Java programs. For now just remember to write this every time you begin (assuming your IDE doesn’t do it for you). Only difference is that
example will be swapped out for the name of your file. The name of the file and class must be the same.
public class example { public static void main(String[] args) { int x = 0; int y = 0; do { x = x + 1; y = y + 2; System.out.println("X: " + x + " " + "Y: " + y); } while (x < 5 && y < 6); } }
Other than that, you can see that we’ve kept all the variables in lower case and that certain lines end with a semi colon (you’ll get the hang of it pretty quick) and we’ve kept everything properly indented to increase readability.
This marks the end of the Java syntax Article. If you have suggestions or contributions for CodersLegacy, please don’t hesitate. Any questions about the article can be asked in the comments below. | https://coderslegacy.com/java/java-syntax/ | CC-MAIN-2021-21 | refinedweb | 797 | 64.3 |
Kevin Biesbrock wrote:My approach to this would be to make an AJAX call to an action mapped behind a JSON namespace (e.g., myApp/json/getObject.action) passing the value of the select field (e.g., ?mySelect=1). Use the response to populate the multi-select and/or text box using JavaScript.
I've never used it, myself, but you might look into the dojo plug-in. Of course, you don't need to use dojo. If you're used to another js library, use it. I use prototype (js framework lib) and scriptaculous (effects engine lib). I would also use the json plug-in for your responses. It's very simple to set up and use. It basically just maps your action as json.
Hope that helps get you started.
Resources:
json exampledojo & ajax exampleprototype & ajaxscript.aculo.us
Bear Bibeault wrote:At this point, Prototype and Scriptaculous are dinosaurs. You might want to investigate jQuery. | http://www.coderanch.com/t/516772/Struts/Struts-Ajax | CC-MAIN-2015-40 | refinedweb | 157 | 61.43 |
public class hallo1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Hello world");
}
}
it shows "hello world" in the console inside eclipse, so everything is fine there. im just wondering, how do i take it out of eclipse? (for future scripts) i have tried open it in java. but it closes really fast tryed to print screen to see what it said, and it said it couldnt find my file. i think i have heard i should save it as a jar file to see it? mby im wrong. please help if you can
| http://www.gamedev.net/user/197935-nico1991/?tab=topics | CC-MAIN-2016-18 | refinedweb | 102 | 84.57 |
Created on 2019-10-08 22:55 by gregory.p.smith, last changed 2019-10-12 20:26 by gregory.p.smith. This issue is now closed.
Another use of the deprecated unsafe preexec_fn was to call os.umask in the child prior to exec.
As seen in (see the code in there).
We should add an explicit feature for this to avoid people's desire for preexec_fn or for the heavyweight workaround of an intermediate shell calling umask before doing another exec.
Any common preexec_fn uses that we can encode into supported parameters will help our ability to remove the ill fated preexec_fn misfeature in the future.
> We should add an explicit feature for this
If we need to write a wrapper program for that, I would say that no, we don't "have to" provide something in the stdlib.
In OpenStack, I wrote prlimit.py which is a preexec-like wrapper program to apply resource limits when calling a program. It's just a pure Python implementation of the Unix prlimit program. The Python implementation is used when the prlimit progrma is not available.
IMHO it's perfectly fine to explain that a wrapper program is needed to implement preexec-like features.
We don't have to for all possible things, doing this just reduced friction for existing uses. In this case, calling umask in our child ourselves would be easy to support. (easier than the more important setuid/sid/gid/groups-ish stuff that recently went in)
I'm trying to make sure we track what is blocking people from getting rid of preexec_fn in their existing code so that we can actually deprecate and get rid of the API entirely.
> I'm trying to make sure we track what is blocking people from getting rid of preexec_fn in their existing code so that we can actually deprecate and get rid of the API entirely.
If you consider posix_spawn(), I think that a convenient replacement for preexec_fn function would be a wrapper process which would execute *arbitrary Python code* before spawning the program.
It would not only cover umask case, but also prlimit, and another other custom code.
Pseudo-code of the wrapper:
import sys
code = sys.argv[1]
argv = sys.argv[2:]
eval(code)
os.execv(argv[0], argv)
The main risk is that the arbitrary code could create an inheritable file descriptor (not all C extensions respect the PEP 446) which would survive after replacing the process memory with the new program.
Such design would allow to implement it in a third party package (on PyPI) for older Python versions as well.
--
Currently, preexec_fn is a direct reference to a callable Python object in the current process. preexec_fn calls it just after fork().
Here I'm talking about running arbitrary Python code in a freshly spawned Python process. It's different.
--
The new problems are:
* How to ensure that Python is configured as expected? Use -I command line option? Use -S to not import the site module?
* How to report a Python exception from the child to the parent process? Build a pipe between the two processes and serialize the exception, as we are already doing for preexec_fn?
* How to report os.execv() failure to the parent? Just something like sys.exit(OSErrno.errno)?
* Should close_fds be implemented in the wrapper as well? If yes, can the parent avoid closing file descriptors?
>
This wrapper uses os.execv().
We should not provide such an "run arbitrary python code before execing the ultimate child" feature in the standard library.
It is complicated, and assumes you have an ability to execute a new interpreter with its own slow startup time as an intermediate in the child in the first place. (embedded pythons do not have that ability)
Leave that to someone to implement on top of subprocess as a thing on PyPI.
> Another use of the deprecated unsafe preexec_fn was to call os.umask in the child prior to exec.
What do you mean by "deprecated"? The parameter doesn't seem to be deprecated in the documentation:
And when I use it, it doesn't emit any warning:
---
import os, subprocess, sys
def func(): print(f"func called in {os.getpid()}")
argv = [sys.executable, "-c", "pass"]
print(f"parent: {os.getpid()}")
subprocess.run(argv, preexec_fn=func)
---
Output:
---
$ ./python -Werror x.py
parent: 22264
func called in 22265
---
If you want to deprecate it, it should be documented as deprecated and emit a DeprecatedWarning, no?
pylint emits a warning on subprocess.Popen(preexec_fn=func):
W1509: Using preexec_fn keyword which may be unsafe in
the presence of threads (subprocess-popen-preexec-fn)
But not when using subprocess.run(preexec_fn=func). Maybe a check is missing in pylint.
Note: pyflakes doesn't complain about preexec_fn.
> We should not provide such an "run arbitrary python code before execing the ultimate child" feature in the standard library.
Do you want to modify _posixsubprocess to call umask() between fork() and exec()? As it has been done for uid, gid and groups: call setreuid(), setregid() and setgroups()?
If so, it means that posix_spawn() couldn't be used when the new umask parameter would be used, right?
preexec_fn does not work in subinterpreters, which (amongst others) affects mod_wsgi and similar WSGI implementations. Therefore portable software must not use preexec_fn at all..
preexec_fn has been mentally and advisability deprecated for years. :)
I'll mark it officially with pending deprecation in 3.9 destined to be removed in 3.11. tracking that in its own rollup issue
As far as posix_spawn goes, I expect these kinds of between fork+exec features to be something that prevents posix_spawn from being usable. As are many other things. People who want to use posix_spawn will need to know that and seek to avoid those. That's a documentation issue first and foremost. Our existing POpen API is very old and wasn't designed to make that nice.
A new API could be made that *only* supports posix_spawn available features if you want an entrypoint that encourages the generally lower latency posix_spawn path. (A subprocess.spawn function similar to subprocess.run perhaps?) That should be taken up within its own enhancement issue.
New changeset f3751efb5c8b53b37efbbf75d9422c1d11c01646 by Gregory P. Smith in branch 'master':
bpo-38417: Add umask support to subprocess (GH-16726)
Now to see if the more esoteric config buildbots find any platform issues to address... | https://bugs.python.org/issue38417 | CC-MAIN-2021-21 | refinedweb | 1,064 | 57.87 |
Introduction to PySpark foreach
PYSPARK FOR EACH is an action operation in the spark that is available with DataFrame, RDD, and Datasets in pyspark to iterate over each and every element in the dataset. The For Each function loops in through each and every element of the data and persists the result regarding that. The PySpark ForEach Function returns only those elements which meet up the condition provided in the function of the For Each Loop. A simple function that applies to each and every element in a data frame is applied to every element in a For Each Loop. ForEach partition is also used to apply to each and every partition in RDD. We can create a function and pass it with for each loop in pyspark to apply it over all the functions in Spark. This is an action operation in Spark used for Data processing in Spark. In this topic, we are going to learn about PySpark foreach.
Syntax for PySpark foreach
The syntax for the PYSPARK WHEN function is:-
def function(x): //function definition
Dataframe.foreach(function)
code:
def f(x): print(x)
b=a.foreach(f)
ScreenShot:
Working of PySpark foreach
Let us see somehow the ForEach function works in PySpark:-
The ForEach function in Pyspark works with each and every element in the Spark Application. We have a function that is applied to each and every element in a Spark Application.
The loop is iterated for each and every element in Spark. The function is executed on each and every element in an RDD and the result is evaluated.
Every Element in the loop is iterated and the given function is executed the result is then returned back to the driver and the action is performed.
The ForEach loop works on different stages for each stage performing a separate action in Spark. The loop in for Each iterate over items that is an iterable item, One Item is selected from the loop and the function is applied to it, if the functions satisfy the predicate for the loop it is returned back as the action.
The number of times the loop will iterate is equal to the length of the elements in the data.
If the data is not there or the list or data frame is empty the loop will not iterate.
The same can be applied with RDD, DataFrame, and Dataset in PySpark.
Example of PySpark foreach
Let us see some Example of how PYSPARK ForEach function works:
Create a DataFrame in PYSPARK:
Let’s first create a DataFrame in Python.
CreateDataFrame is used to create a DF in Python
a= spark.createDataFrame(["SAM","JOHN","AND","ROBIN","ANAND"], "string").toDF("Name")
a.show()
Now let’s create a simple function first that will print all the elements in and will pass it in a For Each Loop.
Def f(x) : print(x)
This is a simple Print function that prints all the data in a DataFrame.
def f(x): print(x)
Code SnapShot:
Let’s iterate over all the elements using for Each loop.
b = a.foreach(f)
This is simple for Each Statement that iterates and prints through all the elements of a Data Frame.
b = a.foreach(f)
Stages are defined and the action is performed.
[Stage 3:> (0 + 8) / 8]
Row(Name='ROBIN')
Row(Name='ANAND')
Row(Name='AND')
Row(Name='JOHN')
Row(Name='SAM')
Code Snapshot:
a= spark.createDataFrame(["SAM","JOHN","AND","ROBIN","ANAND"], "string").toDF("Name")
b=a.foreach(print)
Example #2
Let us check the type of element inside a Data Frame. For This, we will proceed with the same DataFrame as created above and will try to pass a function that defines the type of variable inside.
Create a DataFrame in PYSPARK:-
Let’s first create a DataFrame in Python.
CreateDataFrame is used to create a DF in Python
a= spark.createDataFrame(["SAM","JOHN","AND","ROBIN","ANAND"], "string").toDF("Name").show()
Code SnapShot:
Let’s create a function that defines the type of the variable, this is a generic UDF that a user can create based on the requirements.
This function defines the type of the variable inside.
def f(x): print(type(x))
Let’s use ForEach Statement and print the type in the DataFrame.
b = a.foreach(f)
Output:
This will print the Type of every element it iterates.
Code SnapShot:
We can also build complex UDF and pass it with For Each loop in PySpark.
From the above example, we saw the use of the ForEach function with PySpark
Note:
- For Each is used to iterate each and every element in a PySpark
- We can pass a UDF that operates on each and every element of a DataFrame.
- ForEach is an Action in Spark.
- It doesn’t have any return value.
Conclusion
From the above article, we saw the use of FOR Each in PySpark. From various examples and classification, we tried to understand how the FOREach method works in PySpark and what are is used at the programming level.
We also saw the internal working and the advantages of having PySpark in Spark Data Frame and its usage for various programming purpose. Also, the syntax and examples helped us to understand much precisely the function.
Recommended Articles
This is a guide to PySpark foreach. Here we discuss the internal working and the advantages of having PySpark in Spark Data Frame and its usage for various programming purpose. You may also have a look at the following articles to learn more – | https://www.educba.com/pyspark-foreach/?source=leftnav | CC-MAIN-2021-43 | refinedweb | 919 | 61.56 |
See also:
@@which release?
see 11 Aug announcement
Used for Sets
Cwm can now run as a SPARQL server. This includes:
A few strange bugs in rdf:xml serialization, many related to the rdf: prefix or xml: prefix, have been fixed
delta now returns with similar exit statuses as the diff utility for
plaintext files. An exit status of 0 means no differences between the
from and
to graphs were found. An exit status of 1 means some
differences were found. An exit status of 2 means differences were not
computed for some reason.
Fixes in decimal support
A bug introduced into 0.8.0 where cwm crashed if no input files were specified has been fixed.
Performance work has resulted in some tasks taking 1/10 the time that they used to. Much more work is planned in this regard.
Cwm now uses python's distutils for distribution. This allows for installation of cwm. As an added bonus, there are now rpm's, windows installers.
--flatten and --unflatten have been rewritten, replacing the old --flat. Flatten minimally reifies an n3 file to make it an rdf graph. Note that the graph may still fail to serialize as rdf, due to literals as subjects.
This release has some bugfixes, as well as some changed and new functionality.
Cwm will now do the expected thing on log:uri if given an invalid URI string.
An integer over the platforms native integer size will no longer crash Cwm.
Cwm now understands most xsd datatyped notwithstanding
BNodes given names using the _: notation now have formula scope, not document scope.. Initial support for N3QL query language handling in
cwm. command line looks like:
cwm myKB.n3
--query=myquery.n3ql. Initial test case in swap/test/ql/detailed.tests, after being broken for almost a year, has been rewritten and is better than ever. See reify/detailed.testsT.
2004/6/23:.
Cwm now correctly identifies HTTP 404 errors, throwing an exception, and does not try to parse the returned (HTML) file.
An n3 statement which references the same universal quantifier twice now does the right thing.
Ooops - nodeID was misspelled nodeid on RDF/XML output.
The
--patch=patchfile command line argument allows a
patch file to be applied to the knowledge base (current working formula). See
the Diff, Patch, Update and Sync
note in the Design Issues series on the motivation for exchanging
difference files, and how they work. Diff files can in certain specific
circumstances (a well-labeled graph) be produced by the diff.py program
included with this distribution. The new tests are in
$SWAP/test/delta/detailed.tests
The i18n/detailed.tests have been removed from the test harness. They were not right, and URI/ IRI issues are not clear yet. It is not clear whether cwm should URI-canonicalize, or IRI-canonicalize. (My instinct is that it should - Tim).
Cwm does not canonicalize numerical (xsd:double and xsd:integer) values on N3 output. It uses python's str(float(s)) and str(int(s)). The effect is to reduce some over-precision in the output.
The cwm regresssion test now incorporates the RDF Core Positive Parser Tests except for those which deal with reification or with XML literals. In the process, xml:base supposrt was added in the parser.
A new test found in the updated core tests requires RDF to be parsed even when there is no enveloping <rdf:RDF> tag, even if the outermost element is a typed node production, and so not something in the RDF namespace at all. This makes rdf much less self-describing, and makes it more dangerous that one might parse say an HTML file as RDF by accident. Use with care. If need this feature, use the --rdf=R flag.
The RDF core tests are done with --rdf=RT to make the parser parse naked RDF or RDF buried in foreign XML..
This has been a missing feature of the RDF generator for a while. The nodeid feature allows bnodes to be output in RDF/XML. I may not have got this right, as I don't have RDF generation tests, only RDF parse tests.
The ordering of Terms has been changed. Automatically generated terms with no URIs sort after anything which has a URI.
This will change the order of N3 and RDF/XML output but does not change its semantics.s
Cwm now does output in a two-pass process. This makes its counting of the number of occurrences of namespaces more acurate, which determines the default namespace it choses. This does take more time, though not as long as the previous method of working out which was going to be most common. To skip this process, use the "d" flag on output (N3 or RDF/XML) to suppress the use of a default namespace.
Because this counting is now accurate, it now suppresses namespace prefix declarations which are not actually needed in the output.
Cwm will also make up prefixes when it needs them for a namespace, and none of the input data uses one. It peeks into the the namespace URI, and looks around for a short string after the last "/", adding numbers if necessary to make the prefix unique.
Cwm when writing N3 not normally use namespace names for URIs which do not have a "#". Including a "/" in the flags overrides this.
cwm mydcdata.n3 --n3="/"
Namespaces which end in "/" lead (in my opinion) to an unfortunate confusion between the RDF propoerties and the HTTP document they identify. This is related to W3C TAG Issue httpRange-14.
The "this" syntax in a formula refers to the formula itself. It was used for thr pseudo-statements this log:forSome x, and this log;forAll y.
In a few rare cases it actually was used to refer logically to the formula itself. A classic is of course { this a log:falseHood }. I decided that this was going to make more problems than it would solve. The psudostatements have gone anway (in response to popular request), they became just syntax. And the @forAll syntax has been introduced as the way to go. So with this release, while you can still like many N3 files use this to qualify variables, you can't use it for anything else.
Release 0.7. 2004-02-04: This is a first numbered release. After much discussion we picked 0.7 as the number. Added a CVS tag rel-0-7, so that if you have the source through CVS, you up- or down-grade to this by
cvs update -r rel-0-7
The idea is that this release has a well-defined set of bugs, and that we work toward a more community-supported platform with time.
(code is formula.compareTerm())
At this point cwm made a number of changes at once, so we document them here.
@prefix test:
<>.
The namespaces used for lists changed from DAML to RDF. The namespace used for "=" switched to OWL. DAML and DAML+OIL are used no more, though we remember them fondly. This change actually shouldn't change much in many applications, where files use the collection syntax in RDF or the () and = syntaxes in N3. It does affect the order of statements cwm uses to pretty-print files.
test:t1018b2) with that - and wrapping my head round that caused me to decide it was time for the change. It is nowsimpler in that regard.
CWM_RUN_NSto something like "#", which will create the original behaviour, or a specific namespace you know you won't reuse in related work.
More changes 2003-08-25
You can get the old version before these 2.0 changes using CVS, by checking out with the tag oldLists .
cvs update -r oldLists
Done ==== - sucking in the schema (http library?)
--schemas ; - to know about r1 see r2;
- split Query engine out as subclass of RDFStore? (DWC) SQL-equivalent client
- split out separate modules: CGI interface, command-line stuff, built-ins (DWC 30Aug2001)
- (test/retest.sh is another/better list of completed functionality --DWC)
- BUG: a [ b c ] d. gets improperly output. See anon-pred
- Separate the store hash table from the parser.
- DONE - regeneration of genids on output.
- DONE - repreentation of genids and foralls in model - regression test
- DONE (once!) Manipulation: { } as notation for bag of statements - DONE - filter -DONE - graph match
-DONE - recursive dump of nested bags
- DONE - semi-reification - reifying only subexpressions
- DONE - Bug :x :y :z as data should match [ :y :z ] as query. Fixed by stripping forSomes from top of query.
- BUG: {} is a context but that is lost on output!!! statements not enough. See foo2.n3 - change existential representation :-( to make context a real conjunction again? (the forSome triple is special in that you can't remove it and reduce info) - filter out duplicate conclusions
- BUG! - DONE - Validation: validate domain and range constraints against closure of classes and mutually disjoint classes.
- Use unambiguous property to infer synomnyms (see sameDan.n3 test case in test/retest.sh)
- schema validation - done partly but no "no schema for xx predicate". ULTILS WE HAVE DONE
- includes(expr1, expr2) (cf >= , dixitInterAlia )
- indirectlyImplies(expr1, expr2)
- startsWith(x,y)
- uri(x, str)
- usesNamespace(x,y) # find transitive closure for validation - awful function in reality | http://www.w3.org/2000/10/swap/doc/changes.html | CC-MAIN-2016-07 | refinedweb | 1,539 | 66.23 |
Print the kth row of a Pascal Triangle
Pascal Triangle is an arrangement of numbers in rows resembling a triangle. Here, our task is to print the kth row for which the integer k is provided.
Remember that in a Pascal Triangle the indexing of rows starts from 0. Let's see how the output should look like:
Input: 3
Output: 1 3 3 1
Input: 4
Output: 1 4 6 4 1
Input: 2
Output: 1 2 1
Input: 0
Output: 1
Here, we are going to see two methods for this algorithm:
- Recursion Method
- Using the
nCkformula but in a modified way(Time Complexity: O(n) and Auxiliary Space: O(1))
It is recommended to have a page and pen ready to understand the working of the algorithm.
Approach 1: Recursion Method
Pascal Triangle has a property that elements of a current row can be found with the help of the elements of the previous row. The value at each position of the Pascal Triangle is the direct sum of the above two values. Still didn't get it? Look at the image below:
The formula to find the value of the current row from the previous row is:
curr_row = prev_row[i - 1] + prev_row[I]
Example:
prev_row = [1, 2, 1]
curr_row[1] --------- initially storing 1
Using a
for loop from
1 to len(prev_row)
curr_row = prev_row[1 - 1] + prev_row[1] = [1, 3]
curr_row = prev_row[2 - 1] + prev_row[2] = [1, 3, 3]
curr_row = [1, 3, 3, 1]--------------manually appending 1 at end of for loop
Now, we can use this property to find elements of any row, If we are given the value of
k that is the row number, we will find the elements of its previous row that
(k-1)th row using the recursion method. Once we get the values of the previous row, we can use the above property and find the values of the
kth row. Let's see how we can achieve this using recursion. It is suggested to learn how recursion works before moving ahead here.
Suppose k = 3, values of row 3 are to be printed(remember that row number starts from 0). Recursion will happen
k number of times. Let's see how:
We will stop the recursion when we reach the value of
k == 0. Now, at each stage, we will return the value of each row calculated with the formula discussed above. For your understanding the pictorial representation will look like this:
Now let's see the actual implementation of the Recursion approach in Python:
- Python
def find_row(k): my_row = [] my_row.append(1) # since every row has its first value as 1 if k == 0: return my_row prev_row = find_row(k - 1) # recursively calling the previous row for i in range(1, len(prev_row)): curr_row = prev_row[i - 1] + prev_row[i] # formula to calculate the value of current row from previous row my_row.append(curr_row) my_row.append(1) # since every row has its last value as 1 return my_row k = 6 arr = find_row(k) for i in arr: print(i, end=" ")<br/>
1 3 3 1
1. We can see in the above code, the function
find_row() is recursively called until
k == 0 which is our base condition to stop the recursion.
2. We are storing the list in the array
my_row[] and every time we need to do
my_row.append(1) since the first and the last value of each row is 1.
3. Note that after every recursion step, we are storing the array in prev_row for calculating the values in the further steps.
Approach 2: Using nCk formula in a modified way (Time Complexity: O(n) and Auxiliary Space: O(1))
We should know in a Pascal Triangle, every single element of each row is calculated by a formula of Combinations which is commonly known as "n choose k" or the number of combinations of k elements from n elements. The formula is:
Note: "n choose k" can also be written
C(n,k),
nCk or even
nCk.
The value at each position of Pascal Triangle using the
nCk formula is shown below where
n = current row number
k = current column number
We can use this formula in our algorithm and find the values of the given row. But calculating
nCk each time increases the time complexity. Also,
n! may overflow for larger values of n. So, we can modify the
nCk formula and come up with an efficient solution. Let's see how:
For a detailed explanation of this formula please click here.
So basically for this approach, we are going to generate the values only for the particular row and not for the previous rows as we did in the earlier approach. Let's see how to achieve it:
def find_row(n): prev_val = 1 # first value is always 1 print(prev_val, end = ' ') for k in range(1, n + 1): curr_val = (prev_val * (n - k + 1)) // k # using the formula nCk = (nCk-1 * (n - k + 1))/k print(curr_val, end=' ') prev_val = curr_val # Driver code n = 0 find_row(n)
So, we have a function
find_row() to generate the values of the given row.
1.
prev_value is initialized to
1 as every row has its first value as
1.
2. Note that the
prev_value will always store the preceding value of the same row which will be helpful to calculate the current value. That is
prev_value stores
C(n, k-1)
3. We will use the
for loop to generate each value of the row. So it ranges from
1 to n+1.
4. In the
for loop, we use the formula discussed above to generate the values.
For better understanding, first, use the original
nCk formula and try to get the values, and then go for the modified formula. | https://www.codesdope.com/blog/article/find-the-kth-row-pascal-triangle/ | CC-MAIN-2021-49 | refinedweb | 961 | 55.68 |
Introduction
A recurring issue when using the automatic master-detail synchronization feature in ADF Business Components is the moment the detail view object is queried. If you have a "deep" or "wide" hierarchy of view object instances in your application module, then the performance cost of those detail queries might add up significantly. This article describes a technique to prevent premature execution of detail queries.
Main Article
In ADF 10, by default all details where queried immediately together with the master during the ADF-JSF prepareModel phase. Steve Muench has provided sample 74. Automatically Disabling Eager Coordination of Details Not Visible on Current Page on his undocumented samples page to delay detail queries when that data is only needed on subsequent pages. This samples works fine in 10.1.3 but is not easy to implement, and the implementation is page specific, not generic.
Fortunately, in ADF 11 the default query behavior has been changed. For a start, the initial query of a view object is triggered during JSF render response phase while traversing the UI tree. This ensures that only queries that provide data that are actually used on the current page are fired. When a master view object is queried the first time during this JSF render response phase, none of its detail view objects are queried, unless this data is also needed on the same page. This default behavior is already a big improvement over ADF 10, as queries are fired "on-demand" when constructing the page. However, the caviat is that once a detail view object has been queried once, for example because the user navigated from the master page to a detail page that displays this detail information, then on subsequent queries of the master view object, or changes in the current row of the master, the detail view object is queried immediately.
Lets clarify the impact using an example: we have one master view object instance with 5 sibling detail view object instances, all having their own JSF page to display the data. The end user enters the master page, and the master VO is queried, marking the first row as the current row. Then he visits the 5 detail pages for this first master row, causing 5 detail queries, one at the time for each detail page he visits. Now, when the end user returns to the master page and clicks on the second row to make it current, 5 detail queries will fire immediately. If the end user plans to visit the 5 detail pages for this second master row then that's OK, the queries have to be fired anyway. However, when he will not be visiting the detail pages for this master row, 5 queries have been executed in vain.
From the above description you will understand that ADF BC keeps track of the detail VO's (detail row sets to be precise) that have been queried before, so it knows whether detail view objects should be queried immediately as a result of a row currency change in the master. If we somehow can "undo" the housekeeping of these detail row sets, we will constantly keep the nice on-demand querying of detail view objects that we get for free for the initial queries. Well, it turns out to be quite simple to implement this "undo" by adding a custom RowSetListener to the master view object. Here is the RowSetListener class:
package oracle.adf.model.adfbc.fwk; import oracle.jbo.DeleteEvent; import oracle.jbo.InsertEvent; import oracle.jbo.NavigationEvent; import oracle.jbo.RangeRefreshEvent; import oracle.jbo.RowSet; import oracle.jbo.RowSetListener; import oracle.jbo.ScrollEvent; import oracle.jbo.UpdateEvent; import oracle.jbo.ViewObject; public class ClearDetailRowSetsListener implements RowSetListener { /** * This method fires when the current row changes. * We clean up all detail row sets to avoid querying of these detail row sets * when navigating to another master row, or requerying the master */ public void navigated(NavigationEvent event) { ViewObject vo = (ViewObject) event.getSource(); RowSet[] rowsets = vo.getDetailRowSets(); if (rowsets != null) { for (int i = 0; i < rowsets.length; i++) { rowsets[i].getViewObject().clearCache(); rowsets[i].getViewObject().resetExecuted(); rowsets[i].closeRowSet(); } } } public void rangeRefreshed(RangeRefreshEvent event) { } public void rangeScrolled(ScrollEvent event) { } public void rowInserted(InsertEvent event) { } public void rowDeleted(DeleteEvent event) { } public void rowUpdated(UpdateEvent event) { } }
And here is the view object create method that registers the listener:
protected void create() { super.create(); addListener(new ClearDetailRowSetsListener()); }
That's all. You can add this code to your base class view object, and you will get lazy on-demand querying everywhere in your application. | http://www.ateam-oracle.com/lazy-on-demand-querying-of-detail-view-objects | CC-MAIN-2019-35 | refinedweb | 758 | 54.42 |
Many functional programming languages like Haskell or Elm have a structural type system. This perfectly lines in with the direction in which majority of JavaScript’ish community is heading. Nevertheless, every feature comes with a certain set of trade-offs. Choosing structural type system allows for a greater flexibility but leaves a room for a certain class of bugs. What I find interesting is that the answer to the question whether TypeScript, Flow or any other type system adopts structural or nominal type system does not have to be binary. So, is it possible to have the best of both worlds writing in TypeScript?
Nominal types allow for expressing problem semantics in a way that correctness of the program, up to some point, can be assured by a type checker. Both TypeScript and Flow type systems are mostly structural. Flow also adopts a few attributes of nominal type system but let’s leave it for now. In structural type system, two different types but of the same shape are compatible. In TypeScript, there are a few exceptions like in case of private properties. Later I present how to make a practical use of this feature.
Ryan Cavanaugh gathered a compelling list of use cases where nominal typing excels.
Before we dive into TypeScript, it is worth mentioning that Flow addresses this very problem with opaque types. When an opaque type is imported it hides its underlying type. Opaque type resembles a nominal type.
Table of contents
- Approach #1: Class with a private property
- Approach #2: Brands
- Approach #3: Intersection types
- Approach #4: Intersection types and brands
Use case
I would like to show you a few approaches of nominal typing wannabe implementations. Each is slightly different but I would recommend sticking to only one across your code base. To make things simpler, a goal of each implementation is to disallow to sum two numbers if both are not in USD.
Approach #1: Class with a private property
class USD { private __nominal: void; constructor(public value: number) {}; } class EUR { private __nominal: void; constructor(public value: number) {}; } const usd = new USD(10); const eur = new EUR(10); function gross(net: USD, tax: USD) { return { value: net.value + tax.value } as USD; } gross(usd, usd); // ok gross(eur, usd); // Error: Types have separate declarations of a private property '__nominal'.
The main difference of this approach from any following is that it does not require to perform a type assertion (or casting if you wish). Types of
usd and
eur variables can be correctly inferred as we only create an instance of a new class. They are not compatible due to separate declarations of a private property. On the other hand, the main disadvantage is that class is a redundant construct from a purely logical standpoint.
Approach #2: Brands
interface USD { _usdBrand: void; value: number; } interface EUR { _eurBrand: void; value: number; } let usd: USD = { value: 10 } as USD; let eur: EUR = { value: 10 } as EUR; function gross(net: USD, tax: USD) { return { value: net.value + tax.value } as USD; } gross(usd, usd); // ok gross(eur, usd); // Error: Property '_usdBrand' is missing in type 'EUR'.
As long as interfaces have different properties they are incompatible. TypeScript team follows this convention. We never assign values to a brand property so there is no runtime cost. There are cases in which interface can be an overkill but its the simplest way to have a taste of nominal typing in TypeScript I am aware of.
Approach #3: Intersection types
class Currency<T extends string> { private as: T; } type USD = number & Currency<"USD"> type EUR = number & Currency<"EUR"> const usd = 10 as USD; const eur = 10 as EUR; function gross(net: USD, tax: USD) { return (net + tax) as USD; } gross(usd, usd); // ok gross(eur, usd); // Error: Type '"EUR"' is not assignable to type '"USD"'.
Here we take an advantage of intersection types. Both USD and EUR types have features of both
number and
Currency<T>. We never actually assign a value to the
as property, it does not exist in runtime and class Currency itself will be defined as an empty class.
Although
Currency could have a more abstract and generic name I would avoid generalization. It can easily go out of control in a real life project if being followed as mantra.
function ofUSD(value: number) { return value as USD; } function ofEUR(value: number) { return value as EUR; } const usd = ofUSD(10); const eur = ofEUR(10); function gross(net: USD, tax: USD) { return ofUSD(net + tax); }
It is convenient to create a separate function to avoid a fuss with explicit type assertion.
Approach #4: Intersection types and brands
type Brand<K, T> = K & { __brand: T } type USD = Brand<number, "USD"> type EUR = Brand<number, "EUR"> const usd = 10 as USD; const eur = 10 as EUR; function gross(net: USD, tax: USD): USD { return (net + tax) as USD; } gross(usd, usd); // ok gross(eur, usd); // Type '"EUR"' is not assignable to type '"USD"'.
This approach is a mix of two previous one. Despite being a little hacky I find it the most elegant and clean solution. An error message is still descriptive. Moreover, type Brand is only a type and will not be present in the output code.
More reading
- Aforementioned discussion on nominal typing in TypeScript
- Nominative And Structural Typing
- Opaque types in Flow
- Stronger JavaScript with Opaque Types
Photo by Thao Le Hoang on Unsplash. | https://michalzalecki.com/nominal-typing-in-typescript/ | CC-MAIN-2019-04 | refinedweb | 899 | 60.04 |
Flex 4.1 Do custom components export in Application or Module if used in the Module only?FM_Flame Jun 13, 2011 7:53 AM
I think I am missing something here:
."
I thought that if I use a component only in a module then I won't be able to use it in the application or sibling modules and I would be able to use it only in submodule of that module since the component definitions are in the module application domain which is a child of the application's application domain.
So I've just made a simple example: application with 2 moduleLoaders and 2 modules both using the same 3 components:
1) ButtonBar
2) DataGrid
3) CustomSkinnableComponent (empty, just extends SkinnableComponent) with custom skin (with a Rect 200x200 px, extends Skin).
I start the application -> both modules load without problem. Wasn't this supposed to cause error with loading the second module because the first module has the components definitions? Or it doesn't cause an error because the component definitions match, and they match because my component is in the same flex project and in this case there is no problem. Problem will be if I have 2 or more RSLs with same package and class definitions but different functionality?
I don't really understand how to cause mismatch of component definitions so I can watch out to avoid it.. can someone please explain ?
I'm confused and I thought I knew this stuff. What am I missing ?
Also one more thing:
I thought that if a module holds the component definitions that means it's swf will grow in size -> reason for using modules. If the application holds the components definitions wouldn't this mean the application swf will grow in size and then -> why would I use a module? To save memory from instances and embeded images/fonts in module?
Also having in mind that the skin to a component is also a class definition and I embed some large images in it, and I use that skin in 2 modules, wouldn't that require the skin to be put in the application -> large size of application swf and not module swf as it should be?
Please someone spread some light in my foggy mind
Message was edited by: FM_Flame
1. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?Flex harUI
Jun 13, 2011 8:21 AM (in response to FM_Flame)
First in wins, but sibling definitions are fine. See the modules
presentation on my blog
--
Alex Harui
Flex SDK Team
Adobe System, Inc.
2. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?FM_Flame Jun 13, 2011 10:41 AM (in response to FM_Flame)
Ok I read it (maybe for 5th time) to recall things a bit. So let me summarize after reading testing etc what I still don't understand:
1) In my application I have 1 custom skin extending Skin.
import custom.CSCSkin;
public var testSkinnn:CSCSkin;
and on creation complete I have:
var testSkin:Class = loaderInfo.applicationDomain.getDefinition("custom.CSCSkin") as Class;
trace(testSkin);
This returns [class CSCSkin].
But the same thing doesn't work in the module because the loaderInfo is null.
So how do you access the applicationDomain of a module ?
2) Looks like I can use almost any component as you say in the siblings and there is no problem, except for the managers classes and Alert. I guess that's because they are singletons with static vars and functions and they register their reference only once - for one application domain and get restrained by it.
I just tried to use Alert only in a module. Application is empty, just a moduleLoader.
import mx.managers.PopUpManager;
private var popUpManager:PopUpManager;
import mx.controls.Alert;
private var alert:Alert;
On creation complete I have:
Alert.show("TESTING","bla");
In the docs it says that registering the singletons/managers in module will make it throw error when you try to use it in a sibling module. But the fact is that the Alert doesn't work at all even in the module I registered them first - it throws error with the PopUpManager. To make the Alert work I had to move the Alert and PopUpManager declarations to the main application. Then they started working everywhere.
Why the Alert is not working if used only in one module?
3. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?FM_Flame Jun 13, 2011 10:47 AM (in response to Flex harUI)
Oh and I forgot the most important questions I wanted to ask you:
1) How can I cause mismatch of component definitions? Is that even possible within one flex project?
2) I just even tried to have the same component package and name in a merged RSL as in the Flex Project and this didn't cause anything because I was unable to select the component from the RSL, it was like Flex Project one won over the one from the RSL. Is that correct ?
4. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?FM_Flame Jun 15, 2011 3:15 PM (in response to FM_Flame)
Anyone?
5. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?Flex harUI
Jun 15, 2011 9:41 PM (in response to FM_Flame)1 person found this helpful
Sorry, must have missed your earlier response.
Use the factory.create("custom.CSCSkin") to create instances of classes in
the module. Then you don't need applicationDomain references.
Hopefully the release notes for Flex 4 say that you have to put singleton
managers in the main app. It wasn't true for Flex 3.
You can cause a mismatch by passing references from one module to another
module via shared singletons or some other mechanism.
First-in-wins. I'm not sure how you set up your RSL test.
6. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?FM_Flame Jun 16, 2011 1:57 AM (in response to Flex harUI)
Hi, that's for the reply.
Great, I got it for the module part and for the managers.
Could you give me a simple example how to cause that mismatch? I didn't really get it, but if it's hard to do it you can skip that.
I set up my RSL by creating a Flex Library project and a Flex Project. The Flex Library project has package custom with component CustomComponent. Then I add the compiled Library project's swc to the Flex project's library path with merged option. In my Flex project I also had package custom with component named CustomComponent. So I have the same component with the same package in my flex library and in my flex project and I could see only the one in my flex project. When I tested this both CustomComponent were 100% the same. Not sure what would have happened if they had different functions...
7. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?Flex harUI
Jun 16, 2011 10:23 AM (in response to FM_Flame)
Roughly:
<!-- main app -->
<mx:Application>
<mx:Script>
public var foo:Object;
</mx:Script>
<mx:Button
<mx:Button
<mx:ModuleLoader
<mx:ModuleLoader
</mx:Application>
<!-- module -->
<mx:Module
<mx:Script>
public function runTest():void
{
if (Application.application.foo == null)
Application.application.foo = new SomeClass();
else
trace(SomeClass(Application.application.foo));
}
If you click the first button then the second, you should see a type
mismatch.
8. Re: Flex 4.1 Do custom components export in Application or Module if used in the Module only?FM_Flame Jun 16, 2011 12:42 PM (in response to Flex harUI)
Thanks a lot, I've got the idea No more questions here I think | https://forums.adobe.com/thread/864141 | CC-MAIN-2017-51 | refinedweb | 1,344 | 64.71 |
This section demonstrates the ease with which a program that embeds Derby can be modified for a client/server implementation using the Derby Network Server. A Derby client program, WwdClient.java, is created by changing a few lines of the WwdEmbedded.java program. The client program can be run in multiple command shells allowing simultaneous update from two or more sources.
copy WwdEmbedded.java WwdClient.java
cp WwdEmbedded.java WwdClient.java
Original declaration public class WwdEmbedded New declaration public class WwdClient
Original definitions String driver = "org.apache.derby.jdbc.EmbeddedDriver"; String dbName="jdbcDemoDB"; String connectionURL = "jdbc:derby:" + dbName + ";create=true"; New definitions String driver = "org.apache.derby.jdbc.ClientDriver"; ... String connectionURL = "jdbc:derby://localhost:1527/" + dbName + ";create=true";
javac WwdClient.java
That's all there is to it.
Before you run the WwdClient program, the Network Server needs to be started.
java -jar %DERBY_HOME%\lib\derbynet.jar start Apache Derby Network Server - 10.2.1.6 - (452058) started and ready to accept connections on port 1527 at 2006-09-22 00:56:33.091 GMT
java -jar $DERBY_HOME/lib/derbynet.jar start Apache Derby Network Server - 10.2.1.6 - (452058) started and ready to accept connections on port 1527 at 2006-09-22 00:56:33.091 GMT
set CLASSPATH=%DERBY_HOME%\lib\derbyclient.jar;.
export CLASSPATH=$DERBY_HOME/lib/derbyclient.jar:.
java WwdClient org.apache.derby.jdbc.ClientDriver loaded. Connected to database jdbcDemoDB Enter wish-list item (enter exit to end): a sunny day _________________________________________________________ On 2006-09-21 15:11:50.412 I wished for a peppermint stick On 2006-09-21 15:12:47.024 I wished for an all expenses paid vacation On 2006-09-22 10:08:21.167 I wished for a sunny day ________________________________________________________ Enter wish-list item (enter exit to end): a new car ________________________________________________________ On 2006-09-21 15:11:50.412 I wished for a peppermint stick On 2006-09-21 15:12:47.024 I wished for an all expenses paid vacation On 2006-09-22 10:08:21.167 I wished for a sunny day On 2006-09-22 10:08:33.665 I wished for a new car ________________________________________________________ Enter wish-list item (enter exit to end): exit Closed connection Working With Derby JDBC program ending.
java -jar %DERBY_HOME%\lib\derbynet.jar shutdown Apache Derby Network Server - 10.2.1.6 - (452058) shutdown at 2006-09-22 19:13:51.445 GMT
java -jar $DERBY_HOME/lib/derbynet.jar shutdown Apache Derby Network Server - 10.2.1.6 - (452058) shutdown at 2006-09-22 19:13:51.445 GMT
In a client/server environment, the client program is often used from other computers on the network. Whenever a system accepts connections from other computers, there is a chance of abuse. To maintain security, the Derby Network Server defaults to accepting connections only from clients running on the local machine (localhost). Before this or any other Derby client program can access Network Server from another machine, additional steps should be taken to secure the Network Server environment. Once secured, the Network Server can be safely configured to accept connections from other machines. Refer to the Network Server security and Running the Network Server under the security manager sections of the Derby Server and Administration Guide for important information on securing the Network Server and enabling network connections.
With Network Server started, you can run the client program simultaneously in multiple windows. To demonstrate this, open two command windows and perform the substeps of the Run the client program step in each window. Both clients will operate without a problem. In contrast, it would not be possible for a program that uses the embedded driver (e.g. WwdEmbedded) to access the database until the database or the Network Server is shut down.
You may have noticed that the client program does not shut down the database. This is because the database is a shared resource in a client/server environment and, in most cases, should only be shut down when the Server is shut down. If multiple clients are accessing the database and one shuts down the database, the remaining clients will encounter a failure the next time they attempt an SQL command.
Derby's two architectures have caused confusion for some new Derby users. They mistakenly think that embedded is a single user configuration. This is not true. The embedded driver supports multiple simultaneous connections, performs locking, and provides performance, integrity and recoverability. Any application using the embedded driver can open multiple Derby connections and then provide a means for multiple users to interact with the database on each connection. The Derby Network Server is an example of such an application. | http://db.apache.org/derby/docs/10.2/workingwithderby/twwdactivity4.html | CC-MAIN-2016-07 | refinedweb | 781 | 50.12 |
zhengda wrote:
address@hidden wrote:Hi, Well, I must remind you that you were supposed to provide a schedule in your application... I accepted your not doing so, because the task description was very unspecific, and you were not really in a position to provide a schedule without discussing things first; but now that you have an idea what you will be actually working on, you should be able to come up with a rough schedule... I suggest you start with the server overriding mechanism, as it's the easier part, and there is less to discuss... -antrik-Hi,I think maybe I can set up multiple pfinets and modify glibc as the exercise and try to finish it next week. After that, I can go back and work on the mechanism for communication among different pfinet servers.Afterwards, I implement other mechanisms for the server overriding. So the rough schedule could be:today~June 13rd: the exercise. discuss the mechanism for communication among different pfinet servers. June 14th~July 14: implement the mechanism for communication among different pfinet servers and discuss the server overriding mechanism.July 15th~August 18: implement the server overriding mechanism.I hope I leave enough time for the second work (pfinet server communication).I have a question:antrik, you said someone had already implemented the BPF translator, but where is the code?I cannot find it in the CVS. Best, Zheng Da
Hi, I have already been able to run mutiple pfinet in my hurd.and I modified the glibc which now allows the user to override the default path for pfinet server.
The environment variable for the path of socket servers is "SOCK_SERV_PATH". It works.Another interesting thing is that when I ping from one pfinet server to another, I get the reply. Does it mean the two pfinets are already able to communicate with each other?
Back to my real work and I need to change the schedule.I will implement the server overriding mechanism. and I can make a choice between options, mainly from option 4 and 5. (4) Either all filesystem servers could provide a mechanism to modify the namespace they export to certain clients (5) proxies could be used that mirror the default namespace but override certain locations.
Here is my rough schedule:June 06~June 13: make a choice among all different options for server overriding mechanism. June 14~July 07: implement the server overriding mechanism and discuss about the mechanism for the communication among pfinet servers.
July 08~July 14: test the implementationJuly 14~August 11: implement the mechanism for pfinet server communication. continue testing the first part of work.
August 12~August 18: final test. Best, Zheng Da | http://lists.gnu.org/archive/html/bug-hurd/2008-06/msg00023.html | CC-MAIN-2014-52 | refinedweb | 451 | 55.95 |
this article will demonstate how to install django in ubuntu..
Installing django:
Django is available open-source under the BSD license. It requires Python version 2.4 or higher, but it has no dependencies on other Python libraries.
Django can be downloaded from the following web page:
installation:
if you dont have python, install it. Django is a python framework and it needs python to work. So if you dont have it, lets download it from
if successfully installed, go to the command prompt (or terminal for linux) and type python. You will get the python interactive window.
It is better you get python 2.5 or later. Cause I will work on python 2.6 . but dont try on 3.0 . it will not work well.
Now I am using django 1.3 . so I hope you got that from the web site.
Extract the package downloaded from the django site. Then open the command prompt and go to the directory you extract the package. Now type the following-
python setup.py install
(for linux user, use sudo python setup.py install )
after that, open python interactive shell (type python in the command prompt) and then type-
import django
if it return no error, type
print django.get_version()
it will show the django version.
Now if any point fails above, you may have not installed django correctly, try again from the beginning. | https://faysalahmed.wordpress.com/2011/05/14/installing-django/ | CC-MAIN-2017-51 | refinedweb | 233 | 78.04 |
C++ Quiz
You've answered 0 of 76 questions correctly. (Clear)
Question #1 Difficulty:
According to the C++11 standard, what is the output of this program?
#include <iostream> template <class T> void f(T &i) { std::cout << 1; } template <> void f(const int &i) { std::cout << 2; } int main() { int i = 42; f(i); }
Problems? View a hint or try another question.
I give up, show me the answer (make 3 more attempts first).
Mode : Training
You are currently in training mode, answering random questions. Why not Start a new quiz? Then you can boast about your score, and invite your friends. | http://cppquiz.org/quiz/question/1 | CC-MAIN-2017-51 | refinedweb | 103 | 76.22 |
in reply to Re^4: Writing Modules/namespace polutionin thread Writing Modules/namespace polution
Is there a way of privatizing variables/member functions of a package
The only way I know of is through lexical variables. You can use them to create closures that only the enclosed blocks have access to. There are ways to get around this protection, but they're not pretty or for the faint of heart. Here's the basic example:
package Example::Module;
use strict;
{
# this variable is not accessible outside of the block
# that it's in. thus, any access to it must go through
# the subroutines defined in this block.
my $variable;
sub accumulate { $variable += $_ for @_ }
sub printvalue { print $variable, $/ }
}
1;
[download]
You could use that package like so:
use Example::Module;
Example::Module::accumulate(5,6,7);
Example::Module::printvalue;
[download]
Using anonymous coderefs, you can get the same protection for subroutines:
package Example::Module;
use strict;
{
my $value;
# this lexical variable stores a subroutine that is only
# accessible from within this block.
my $add = sub { $value += $_[0] };
sub accumulate { $add->($_) for @_ }
sub printvalue { print $value, $/ }
}
1;
[download]
Now, a problem comes in when you want to use these techniques with objects. Converted to an object interface, these lexical variables would be persistent across all instances of the object. Trying to use them for instance data would obviously be a problem. Thus, you have to keep track of the instances yourself.
One way to do this is to make each data member a hash that is keyed on the object instance's reference ID. You have to be careful to remove these instance variables when the object is destroyed, though, because the hash is persistent throughout the program's lifetime. Note, this is an approach that Abigail-II developed, called inside-out objects. Here's a very minimal example:
package Example::Module;
use strict;
# note, we don't actually have to use the reference that we
# bless. we just need it for its unique reference id.
sub new { bless {}, shift }
{
my %value;
my %counter;
sub accumulate {
my $self = shift;
for (@_) {
$value{ $self } += $_;
$counter{ $self }++;
}
}
sub printvalue {
my $self = shift;
printf "%s has value %2d from %2d iterations.\n",
$self, $value{$self}, $counter{$self};
}
# prevent memory leaks.
DESTROY {
my $self = shift;
delete $value{$self};
delete $counter{$self};
}
}
1;
[download]
Of course, it's neat that you can get this protection if you really need it. But most of the time, my experience shows that you don't really need it. Most of the community simply relies on politeness and common conventions, such as using _ in the beginning of private method names.
Strict
Warnings
Results (154 votes). Check out past polls. | https://www.perlmonks.org/index.pl/?node_id=440135 | CC-MAIN-2019-51 | refinedweb | 455 | 60.45 |
The objective of this post is to explain how to use a 4×4 matrix keypad with the ESP8266. For simplicity, we will assume the use of the ESP8266 integrated in a NodeMCU board.
Introduction
The objective of this post is to explain how to use a 4×4 matrix keypad with the ESP8266. For simplicity, we will assume the use of the ESP8266 integrated in a NodeMCU board.
For this tutorial, I’ve used a membrane keypad similar to the one shown in figure 1. This is a very simple keypad that can be bought at eBay for less than 1 euro.
Figure 1 – Membrane 4×4 matrix keypad. Adapted from [1]
We will be using the Arduino Keypad library that can be found here. If you prefer, you can also find it at GitHub here. The easiest way to install the library is via Arduino IDE library manager, as shown bellow in figure 2.
Figure 2 – Installation of the library via library manager.
Although there is no explicit mention for the support in the ESP8266, it works fine with it as we will see bellow.
The hardware
As we can see from figure 1, a 4×4 matrix only has 8 interface pins, which correspond to the columns and rows of the matrix. Explaining how we can use only 8 pins to check which of the 16 keys is pressed is outside the scope of this post, but I strongly recommend you to read this article which explains the working principle.
Although the library we are going to use hides the implementation details from us, if you want to check how it works the mentioned article provides a useful help.
So, to interface with the matrix keypad, we simply need to connect both its columns and rows to the pins of the NodeMCU. This is shown in figure 3.
Figure 3 – Connection diagram for the NodeMCU and keypad matrix.
Note that we don’t need to connect any power supply to the keypad because half of the digital pins will work as outputs and the other half as inputs, as can be seen in this private method of the library, which is responsible for scanning for pressed keys. Again, this is just an implementation detail that we don’t need to worry about when using the library.
The code
This code is very similar to the one in the “CustomKeypad” example of the library. The examples are very simple and easy to use, so I encourage you to check them.
We will start by including the previously installed library, so we can access all the functionality needed to interact with the keypad.
#include <Keypad.h>
Next, we will declare some global variables. Since we are using a 4×4 keypad, we will declare a variable to store the number of lines and another for the number of columns. Note that this library works with keypads with sizes different from 4×4.
const byte n_rows = 4; const byte n_cols = 4;
Then, we will declare a char matrix with the same size of our keyboard (4 lines and 4 columns). We will initialize this matrix with the same values as the keys of our keypad. So, when a key is pressed, we will receive a value that matches the one in our keypad, which is simpler to interpret than having to convert, for example, integers in our keys.
For our keypad, shown in figure 1, we have the following mappings:
char keys[n_rows][n_cols] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} };
Then, we declare two byte arrays, which will contain the pins of the NodeMCU that are connected to the rows and the columns of our keypad.
byte colPins[n_rows] = {D3, D2, D1, D0}; byte rowPins[n_cols] = {D7, D6, D5, D4};
Note that we are using the constants defined here so we don’t need to worry about mapping the pins of the NodeMCU board to the pins of the ESP8266.
Finally, we instantiate an object of class Keypad and pass to the constructor our matrix of keys, the arrays containing the numbers of the digital pins of the NodeMCU connected to the rows and columns of the matrix, and the number of rows and columns.
Note that the matrix of keys needs to be passed to a macro that will cast it to a char array. But this is just a detail, we can just think of it as passing the matrix to a regular function.
Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, n_rows, n_cols);
In the setup function, we simply initialize a serial connection, so we can output the result of our code.
void setup(){ Serial.begin(115200); }
Now, in the main loop, we can call the getKey method of the class Keypad to get a char corresponding to the key pressed. This char will correspond to the one defined in the previously mentioned matrix, for the button pressed.
If there’s no key being pressed, the function will return NULL.
char myKey = myKeypad.getKey();
The full code is shown bellow, already including the printing of the pressed key to the serial port.
#include <Keypad.h> const byte n_rows = 4; const byte n_cols = 4; char keys[n_rows][n_cols] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte colPins[n_rows] = {D3, D2, D1, D0}; byte rowPins[n_cols] = {D7, D6, D5, D4}; Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, n_rows, n_cols); void setup(){ Serial.begin(115200); } void loop(){ char myKey = myKeypad.getKey(); if (myKey != NULL){ Serial.print("Key pressed: "); Serial.println(myKey); } }
To test the program, just upload the code to the ESP8266, open the Arduino IDE serial monitor and press some keys. You can check the expected output in figure 4.
Figure 4 – Output of the program.
References
[1]
Technical details
- ESP8266 libraries: v2.3.0
- Keypad library: v3.1.1
Can it be done using lua and nodemcu
LikeLiked by 1 person
Hello,
As for the NodeMCU, that’s precisely the board I’ve used for this tutorial, so it works fine.
I haven’t played with lua yet, so I don’t know the libraries / functions available. Although this library will most likely not be available for lua, there may be an equivalent module/library.
If not, the implementation of the scanning of a keypad matrix is relatively simple, as you can check in this article:×4-matrix-keypad-with-microcontroller/
So, if you can do digital writes and digital reads, in principle you will be able to get the pressed key from the keypad.
Just as a curiosity, there are other more complex approaches to reading keys pressed on a keyboard, from a microcontroller:
Hope it helps | https://techtutorialsx.com/2017/03/18/esp8266-interfacing-with-a-4x4-matrix-keypad/ | CC-MAIN-2017-34 | refinedweb | 1,124 | 68.91 |
#include <CGAL/Profile_counter.h>
The class
Profile_counter provides a way to count the number of times a given line of code is executed during the execution of a program, and print this number at the end of the execution of the program.
Such counters can be added at critical places in the code, and at the end of the execution of a program, the count is printed on
std::cerr, together with an identification string passed to the constructor. The macro CGAL_PROFILER can be used to conveniently place these counters anywhere. They are disabled by default and activated by the global macro CGAL_PROFILE.
Operations
If
CGAL_PROFILE is not defined, then
CGAL_PROFILER is defined to an empty statement. Otherwise, it is defined to
File Profiling_tools/Profile_counter.cpp
will print at exit: | https://doc.cgal.org/4.12.1/Miscellany/structCGAL_1_1Profile__counter.html | CC-MAIN-2022-05 | refinedweb | 130 | 53.31 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.