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
|
|---|---|---|---|---|---|
I've used jQuery version 2.2.4 and tried to capture event - no luck. Is there any way to fix issue?
This code works:
window.addEventListener('test.namespace', e => console.log('CustomEvent with namespace captured by vanilla'));
$(window).on('test.namespace', e => console.log('CustomEvent with namespace captured by jQuery'));
const event = new CustomEvent('test.namespace', {
bubbles: true,
detail: 123
});
window.dispatchEvent(event);
The "normal" DOM event system doesn't have a concept of namespaces.
window.addEventListener('test.namespace', ...) will literally be listening for an event with the name
test.namespace, which is what you are creating with
new CustomEvent('test.namespace', ...).
Event namespaces is a concept in jQuery:.
What's important here is that the namespace is not part of the event name. That's why
new CustomEvent('test.namespace', ...) doesn't work, but
new CustomEvent('test', ...) would.
If you want to trigger an event for a specific namespace, you have to use jQuery for that:
$(window).trigger('test.namespace', {detail: 123});
$(window).on('test.namespace', e => console.log('CustomEvent with namespace captured by jQuery')); $(window).trigger('test.namespace', {detail: 123});
<script src=""></script>
|
https://codedump.io/share/mv3ijFRDVCkc/1/dispatching-customevent-with-dot-in-name-do-not-trigger-jqueryon-event-listener
|
CC-MAIN-2018-09
|
refinedweb
| 186
| 56.01
|
.
What version of XHTML does IE9 support?.
How do I use XHTML in IE9?:
How does versioning impact XHTML?".
How does XHTML differ from HTML?.
Next Steps
Are there any advantages in IE9 of using XHTML over HTML, in addition the fact that XHTML is more extensible and cleaner?
I am thinking of e.g. speed and features only available in XHTML mode.
Thanks,
Alexandre
Will IE9 support XML rendering like the IE6-8 did? The Beta currently does not.
Will/does IE9 not advertise support for application/xhtml+xml when a page load is triggered by an iframe in a document that isn't loaded in IE9 Standards mode? Seems important for preserving backwards compatibility with sites that iframe arbitrary other sites that might be in XHTML. If the framed site can't tell whether the browser will be able to handle an XHTML response (can't tell if it's being iframed by a non-Standards mode document or not), sometimes it'll serve an XHTML MIME type and won't be able to be displayed.
Wow. IE supports 13 year old technology that everyone else supported 13 years ago. Wow.
Rob, XHTML only became a recommendation ten years and nine months ago. Even if we take the first working draft as the metric for age, it's still less than twelve years old. I'm not sure when the first browser implementation came about (I don't care enough to check), but they're certainly younger than the first draft, I'd imagine. You might want to get your facts straight before you go raking mud. Just a thought.
Does IE9 behave correctly if you serve an XHTML1.1 page as application/xhtml+xml. What about the differences in the object model, CSS rule interpretation (particularly regarding the HTML element itself), and inline CSS and script parsing rules? Does IE9 behave the same as other browsers for those?
Hahaha……yeah ROB. 10 year-old technology is MUCH better than 13 year-old technology.
Just got new that IE9 PP6 is top in the Official HTML5 Test Suite Conformance Results
test.w3.org/…/report.htm
Congrats!
"Local files with ".xht" or ".xhtml" extensions will also be opened as XHTML."
You forgot the .xhtm extension. It should be supported as it's more common than .xht.
Will document.body be available in xhtml documents?
What about the xml-stylehseet PI in xhtml documents? Will IE9 load stylesheets specified there?
Also, what if you have a plain XML file with a script element somewhere in the middle with xmlns="" on it? Will it execute JS in it like other browsers do?
(I'd check myself, but I have WinXP)
I meant
Developers IE9 work in Redmond?
Your detection code isn't standards-compliant. It will send XHTML to browsers that explicitly refuse it:
Accept: text/html, application/xhtml+xml;q=0
And which browsers would those be, klkl?
@Michael A. Puls II:
1. *.xhtml is not an official extension. See RFC3236. You can configure your server to support that if you want, of course, but I don't see any good reason to encourage the proliferation of unofficial extensions when official ones already exist.
2. |document.body| returns |null| in IE9PP6. However, |document.getElementsByTagName("body").length| returns |0| while |document.getElementsByTagName("head").length| returns |1| in an ordinary XHTML document, so clearly there are bugs. (Per DOM3 Core, both should return |0| and, per Web DOM Core, both should return |1|.)
3. IE9PP6 seems to support CSS via |xml-stylesheet| PIs. It doesn't not seem to support XSLT via such PIs though despite trying two file extensions (*.xsl and *.xslt) and three MIME types (text/xsl, application/xml, and application/xslt+xml) in the |href| pseudo-attribute.
4. IE9PP6 seems to load scripts called from an XHTML |script| element placed in a generic XML document based on a simple |window.alert| test.
Sorry, "*.xhtml is not…" should be "*.xhtm is not…"
Hm, what is a purpose of sending XHTML as text/html? Isn't better just to use HTML 4.x or 5?
@Sven:
No browser implements XHTML 1.1 because it was incompatible to XHTML 1.0 for most of its life span. Today it is almost the same as XHTML 1.0 Strict, except that you can't use the lang attribute.
XHTML 1.1 is a dead end. The succesor of XHTML 1.0 is XHTML5.
@piotr:
Code that looks like XHTML but uses text/html is simple HTML, nothing else. In former times, that meant sending invalid HTML (as <br/> is actually <br>>), but these issues are fixed in most browsers (and standarized in the HTML5 parser, which Gecko and WebKit will implement in their upcoming releases).
I personally don't see any advantage in XHTML compared to HTML at least on the client side.
Thanks Patrick!
@Patrick
Yes, RFC3236 doesn't list .xhtm. But, .xhtm is to .xhtml like .htm is to .html. It's an intuitive thing. (Opera supports .xht, .xhtm and .xhtml for local file association and for triggering xhtml mode for local files. I've used both .xhtm and .xhtml, but never .xht)
the_dees:
"No browser implements XHTML 1.1".
Test here: "". If you use Firefox or some other modern browser, you'll get XHTML 1.1.
So what about MSIE 9? Will XHTML 1.0 and XHTML 1.1 – served as "application/xhtml+xml" – work or not?
"XHTML 1.1 is a dead end."
That is most probably true.
Dear IE team, I am having extreme heartburn using the IE9 beta due to a lack of the green progress bar and how it used to say "Done" when loading a page. The spinning Aero cursor doesn't cut it.
@Michael A. Puls II:
".htm" was made up to fit the extension into 3 letters, so ".xhtm" doesn't make much sense as it becomes 4 letters. 2 different extensions for one file type already adds enough confusion as is, no need to add a 3rd one. What if Super XHTML comes up, should 4 different extensions be supported?
The iframe element should follow the css border:none and overflow:hidden to hide the border and scrollbar.
frameborder and scrolling are no longer allowed in the HTML 5 spec.
Hi,
"CSS3 Grid Align" will be supported on IE9?!
blogs.msdn.com/…/new-direction-for-me-and-the-blog.aspx
Where can i find IE9 roadmap? Will be more public betas ?
.wdp File and .jxr File…. !!!SUPPORT(.wdp, .hdp, jxr etc Support…)
I'm can not Speak English ^^;;
Thank you
Hello,
I downloaded The Newest platform preview and I saw that the buttons on sites like the tweet button on twitter is not round it should be round but it is a square on ie please fix this!
Hello, you should Make it so that the status bar a.k.a the loading bar that tells you when a webpage is done loading still there but you just see it if you hover the mouse over the area where it is. but just make it do this when a webpage is loading 😛
@Bertil Wennergren
."
Long story.
As you say, a browser can state it accepts the application/xhtml+xml media type. Note that there is no version indicator.
It's probably important to note that todays XHTML 1.1 is almost the same as XHTML 1.0, however that was a long fight.
When XHTML 1.1 came out (became a REC) it contained several contradictions to XHTML 1.0 (no lang attribute allowed, no text/html allowed, a bug in the handling of client side image maps, different CSS handling).
That wouldn't have been a problem, but unfortunately the W3C decided that XHTML 1.1 "lives" in the same namespace as XHTML 1.0 does. So if a browser receives a document labled application/xhtml+xml and namespace it can not decide what version of the language the document is written in.
To solve this problem on the browser side there are three solutions: a) Implement doctype switching in XML, b) do not implement XHTML 1.1 or c) do not implement XHTML 1.0 anymore.
For a while, browsers tried a) which led to several bug reports and critic on the bad influence on the XML ecosystem.
It's not like browser vendors didn't want to implement XHTML 1.1 – they even tried for years to fix the issues in XHTML 1.1, but their tries were in vain.
Then, the WHATWG and HTML5 appeared. HTML5 defines its vocabulary to be backwards compatible to HTML 4.01 and XHTML 1.0, so in the end, browser vendors decided to not implement XHTML 1.1 because a XHTML 1.0 is a perfectly fine subset of XHTML5.
Most XHTML 1.1 issues are resolved as of today, the only real issue in my opinion is that it still doesn't allow the lang attribute.
You probaly got it by now, your XHTML 1.1 code simply works because the browser can't tell it's XHTML 1.1 – and even if it could, you probably wouldn't notice a difference anymore.
However, keeping in mind that HTML5 introduced the widely used ruby elements for HTML and XHTML, there is no real advantage in using XHTML 1.1 anymore.
So in short, XHTML (without version number) sill simply work in IE9 and all other browsers.
Your support of HTML5 is a bunch of BS! You only selectively support some elements of Canvas in order to protect Silverlight. I don't see any need for IE in my enterprise. Because I have Firefox, Chrome, Opera and Safari.
the_dees:
"Most XHTML 1.1 issues are resolved as of today, the only real issue in my opinion is that it still doesn't allow the lang attribute."
I use "xml:lang" as the XHTML 1.1 rules say I should. It seems to work, at least in Firefox. What actual breakage or problems do you see happening? I see none.
Firefox's RSS feed reader doesn't update regularly for MSDN for some reason…hm…
Well I applaud finally supporting XHTML as application/xhtml+xml however instead of rendering up to an error it would make more sense to not display the page and display an error message instead like Gecko and Presto do. Presto handles it best by allowing the user to render the page as text/html. This has a VERY large bearing on why I test with Gecko first and Presto secondly. WebKit doesn't break the page and I think KHTML doesn't either so I test with WebKit third and up to this point with IE last. Since IE9 isn't available on XP I will continue to test with it last because it's the least convenient requiring tons of RAM for virtualization.
Handling the mime with PHP…
——————
<?php
if (isset($_SERVER['HTTP_ACCEPT']))
{
$mime_ua = stristr($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml');
if ($mime_ua) {$mime = 'application/xhtml+xml';}
else {$mime = 'text/html';}
}
else {$mime = 'text/html';}
header('content-type: '.$header->mime.'; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>'."n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "…/xhtml11.dtd">
——————
It should be noted that AJAX content loaded via importNode (innerHTML should NOT be used EVER) should be served as text/xml.
I like the idea of NOT implementing quirks mode for XHTML, that's a good move.
But limiting IE9 to Vista/7 is NOT a smart move. Want us to "upgrade"? Tell the Windows team to stop removing all the ACTUALLY useful things and shortcuts from Windows. Heck there isn't even an "Explore" option in the context menu on the My Documents or My Computer icon in 7 and I couldn't effectively move the ENTIRE My Documents folder to the D: for a client last week as IE was still saved files to the C:. This isn't guess work or trying to figure out how to one-up Apple, it's listening to users who actually use their machines for production and as power users. Oh and fix IE9's totally borked GUI, less isn't more, it's less. Having you guys actually listen to CRITICAL input besides standards compliance is like trying to tell Linux fan boys to just make the start key with with their version of the start menu. End users and ESPECIALLY people like myself who do production are having to put up with worse and worse software GUI while hardware is getting more and more awesome.
@the_dees: XHTML 1.1 supports complex ruby markup whereas HTML5 does not. That, rather than |lang| attribute differences, is probably the most major difference between XHTML 1.1 and HTML5. That problem is more with Ruby Annotations and CSS3 Ruby specs being too vague and poorly thought through than with XHTML 1.1 though, so we may yet see more complete de facto XHTML 1.1 support in the future when those specs have been scrapped or rewritten.
There was another difference: modularity (hence the spec title: "Module-based XHTML"). But, given that implementors apparently don't plan to ever support validation against DTDs, that feature is optional per XML, and people can write their own XML schema, that feature has been pretty much invisible and will probably remain that way.
@Bertil Wennergren:
There is no problem with xml:lang (nowadays). But the xml:lang attribute has had the problem of being unrecognized by browsers or assistive technology. It's not a problem anymore.
However, note that in XHTML 1.0 you can use the lang attribute to define the language of an element, and in XHTML 1.1 you can not. Thus both are incompatible. A browser that implemented XHTML 1.1 wouldn't be allowed to look for lang attributes in XHTML documents. It would've to be treated like any other attribute xyz.
It works in modern browsers (and even older ones) because XHTML 1.1 documents are simply treated like XHTML 1.0 documents.
@Patrick Garies:
Let's assue a browser implemented XHTML 1.1 completly (including CSS Ruby and the Ruby Annotations Spec). In this scenario, HTML5 would automatically have Ruby support as well. That is not a thing of specifications but of implementations. And that is the crux of the matter. Something implemented in abrowser will work in any document. But if that meant either one document mode or another (which do not really exist) had a bug, a spec is not implementable.
Module-based XHTML sounds nice in theory but it is just a nice concept that wasn't ever needed. Technology evolved way too fast to make this concept needed. You see HTML parsers in mobile browsers. Something no one thought would be possible.
|
https://blogs.msdn.microsoft.com/ie/2010/11/01/xhtml-in-ie9/
|
CC-MAIN-2019-09
|
refinedweb
| 2,474
| 75.81
|
24 November 2013
Set up a federated identity provider on Azure using Active Directory and ADFS 2.0
Federated identity is easy enough to set up using Azure. The Access Control Service provides a federation broker that is free to use while adding an identity provider based on Azure’s Active Directory service is very straightforward. The problem is that you have very limited control over the interface and branding. You are left with a thoroughly Microsoft-flavoured experience which feels rather disjointed as you are handed off to a completely different site to login.
This hand-off may be something users are getting more used to in a federated world, but many would at least prefer the option of a fully integrated experience. Jumping over to an external identity provider should be a user choice, not something that is asserted on them without explanation.
The recently released Premium version of Azure Active Directory now allows you to re-brand aspects of the login experience but this only provides for fairly superficial changes. Features such as password reset and the access panel have Microsoft’s stamp on them and you cannot change their appearance or behaviour. The service seems very much geared towards facilitating internal corporate SSO where an obvious hand-off to Microsoft is less of a issue.
The only way to fully control the user experience is to run your own identity server. There are numerous open source options for identity management (Thinktecture’s Identity Server is worth a look) but the simplest solution may be to set up your own Active Directory domain in Azure and use ADFS 2.0 for federation. This is not as daunting as it may sound – this walkthrough explains how it’s done.
Pre-requisites
To complete this guide you will need the following:
- An active Windows Azure account – a 90 day trial account will be sufficient
- Visual Studio 2012 to create a claims-aware website.
- The Identity and Access Tool extension for Visual Studio 2012 should be installed. This is available here:
- Firewall access to manipulate external VMs via remote desktop (out-going connections via TCP port 3389 must be enabled).
Part one: Set up the Azure infrastructure
Create an Azure affinity group
An affinity group in Azure is mechanism for grouping resources that have to collaborate closely. It will, among other things, guarantee a degree of regional proximity for services. Everything we set up here will use the same affinity group.
In the Windows Azure Management Portal select Settings from the side bar
- On the Settings page, select the Affinity Groups tab on the top navigation bar.
- Click the +ADD button on the bottom navigation bar.
- On the Create Affinity Group form, enter the following details:
- Name: adtestaffinity
- Region: Select the Azure data centre where you want to this infrastructure to be based.
Create a new Azure Storage Account
We will leverage Azure’s storage service to will ensure that the Active Directory database is on a highly-available drive.
- To create a new storage account click the +NEW button on the bottom toolbar in the Azure Management Portal and select Data Services > Storage > Quick Create.
- Enter the following details:
- URL: adteststorage
- Region/Affinity Group: Select the affinity group created above, i.e. adtestaffinity.
- Enable Geo-Replication: Leave the default option, i.e. selected.
- Click the CREATE STORAGE ACCOUNT button to create the account.
Register a DNS server
The VM will act as a domain controller so will need to register the internal IP address that it will be using for Active Directory-integrated Dynamic DNS services.
- Click the +NEW button on the bottom toolbar in the Azure Management Portal and select Network Services > Virtual Network > Register DNS Server.
- Complete the fields as shown:
- Name: adtestdns
- DNS Server IP Address: 10.0.0.4
- Click the REGISTER DNS SERVER button.
Define a virtual network
The Active Directory will need to run under a virtual network created in Azure.
- Click the +NEW button on the bottom toolbar in the Azure Management Portal and select Networks > Virtual Network > Quick Create.
- Complete the fields as follows:
- Name: adtestnetwork
- Address Space: 10.—.—.—
- Maximum VM Count: 4096 [CIDR: /20]
- Affinity Group: Select the Affinity Group defined above, i.e. adtestaffinity.
- DNS Server: Select the DNS Server registered above, i.e. adtestdns.
- Click the Create a virtual network button.
Part two: Set up an Azure VM with Active Directory
Provision the VM in Azure
Now we are ready to create the virtual machine in Azure that will act as our identity store.
- Click the +NEW button on the bottom toolbar in the Azure Management Portal and select Compute > Virtual Machines > From Gallery. The VM wizard will open.
- In the operating system list, select Windows Server 2012 Datacenter and click the Next arrow button.
- On the Virtual Machine Configuration page, complete the fields as follows:
- Version Release Date: Select the most recent release date
- Virtual Machine Name: adtestadvm01
- Size: Small (1 core, 1.75GB Memory)
- New User Name: This is the local administrator account – choose a unique name (i.e. not “Administrator”)
- New Password and Confirm Password fields: Choose a very strong password as this is your local administrator password.
- Click the Next button to continue.
- On the Virtual Machine Mode page, complete the fields as follows:
- Cloud service: keep the default “Create a new cloud service” option.
- DNS Name: adtestadvm01.cloudapp.net
- Region/Affinity Group/Virtual Network: Select the virtual network defined above, i.e. adtestnetwork.
- Virtual Network Subnets: Keep the default option, i.e. Subnet-1 (10.0.0.0/23)
- Storage Account: Select the Storage Account defined above, i.e. adteststorage
- Availability set: Leave this option at “(none)”.
- Click the Next button to continue.
- On the Virtual machine configuration page, you will want to add another end point to enable HTTPS connectivity to and from the server.
- In the drop down list select HTTPS – it should create a new row in the table where the “public port” and “private port” fields both read 443.
- Create another row by selecting HTTP from the drop-down list. This row should have 80 in both the “public port” and “private port” columns
Click the Next button to start provisioning the VM. This will take a while to complete – up to 10 minutes.
Connect to the VM for the first time
Once provisioning is complete, open the details page for the VM in the Azure Management Portal by clicking on the name displayed on the Virtual Machines page.
On the virtual machine details page for adtestadvm01, click the Connect button located on the bottom toolbar and click the Open button to launch a Remote Desktop Connection to the VM. You will need to local administrator credentials entered while setting up the VM.
Attach the VM to an empty disc drive
The Active Directory database will be held on a disc drive based on the Azure Storage account that we created earlier.
In the Azure Management Portal, go to the virtual machine details page for adtestadvm01 and click the Attach button found on the bottom toolbar.
Select Attach Empty Disk and complete the following fields on the form that appears:
- File name: adtestadvm01-data01
- Size: 10 GB
- Host Cache Preference: None
Click the Tick button to create and the new virtual hard disk and attach it to the VM.
This may take a few minutes to provision and be visible to the VM.
Format the empty disc drive on the VM
Once the disc has been attached you can format it directly on the server using Computer Manager.
- Connect to the VM adtestadvm01 using a remote desktop connection.
- In the Server Manager window, click on the Tools menu on the top navigation bar and select Computer Management.
- In the Computer Management window, click on Disk Management in the left navigation pane.
- When prompted with the Initialize Disk dialog box, click the OK button to continue leaving the default options in place.
- Right-click on the unallocated disk space on Disk 2 and select New Simple Volume… from the pop-up menu.
- In the New Simple Volume Wizard, click the Next button on each page to accept all default values.
- Click the Finish button on the last page of the wizard to create a new F: drive.
- When the new volume has finished the formatting process, close the Computer Management window.
Configure a Windows Server Active Directory Forest in the VM
The VM is ready to configure as a domain controller running Active Directory. This involves adding the Active Directory Domain Services role to the server.
- Active Directory Domain Services role. A dialog box will open – just click the Add Features button.
- Click the Next button accepting the default settings until you advance to the Confirm installation selections page of the wizard.
- Click the Install button to begin the installation process.
When the installation of Active Directory Domain Services has completed, do not click the Close button. Instead, click the link titled Promote this server to a domain controller as highlighted below.
This will launch the Active Directory Domain Services Configuration Wizard.
- In the Deployment Configuration page of the wizard, select the deployment operation for Add a new forest.
- In the Root domain name field, enter adtestsso.com. Click the Next button.
- On the Domain Controller Options page of the wizard, enter and confirm a recovery password in the Directory Services Restore Mode (DSRM) password fields. Click the Next button.
- On the DNS Options page of the wizard, ignore the warning message about not being able to find the “authoritative parent zone” point to the Azure storage disc – i.e. they should begin with F: instead of C:. Click the Next button.
-. It will take some time and re-boot the server automatically as part of the installation process.
Add a test user
The first logins you create for the identity server have to be created directly through the VM. Create a new user account now to use in testing later on.
- In Server Manager on the VM adtestadvm01 right-click on Tools and select Active Directory Users and Computers.
- When the dialog opens, expand the domain node (adtestsso.com) in the left-hand pane and right-click on the Users option. Click on New > User.
- Add in details for the First Lame, Last name and a User login name fields. Click on Next.
- Enter and confirm a password. Ensure that the “User must change password at next logon” option is unchecked. Click on Finish.
Part three: Configure the VM as an identity server
Install and configure IIS
ADFS 2.0 needs IIS to deliver features such as the login page.
- Web Server (IIS).
Create an SSL certificate
ADFS uses HTTPS and we will be using a self-signed certificate for this exercise. This will give rise to some SSL warnings when accessing the services but it will be sufficient to prove the functionality.
- In the Server Manager window, click on the Tools menu on the top navigation bar and select Internet Information Services (IIS) Manager.
- Click on the server node in the left-hand pane. A dialog will open asking about Web Platform Installer – just click on No to close it.
- Double-click on the Server Certificates icon in the main screen area.
- In the right-hand Actions pane click on the Create Self-Signed Certificate option.
- Enter “adtestadvm01.cloudapp.net” in the friendly name field and select “Web Hosting” in the certificate store drop-down.
- Click on OK to create the certificate. This certificate will be used when you configure ADFS.
- In Server Manger s elect the Add roles or features link in the Quick Start section.
- In the dialog box click the Next button three times to advance to the list of Roles that you can install.
- In the list of roles, select the checkbox for the Active Directory Federation Services.
- In the Server Manager window, click on the Tools menu on the top navigation bar and select AD FS Management.
- Click on the AD FS Federation Server Configuration Wizard link – this will open a new dialog.
- On the Welcome page keep the “Create a new Federation Service” option selected and click on Next.
- On the Select Deployment Type page keep the “New Federation Server” option selected and click on Next.
- The SSL certificate created above should be selected on the Federation Service Name page. Click on Next.
- Select the local administration account as the Service account and enter the password. Click on Next.
- Click on Next to start the configuration process – this will take a few minutes.
Install ADFS 2.0
Configure ADFS 2.0 for the first time
Adjusting the service properties
The default ADFS service properties will not send the correct federation data to Azure ACS. They will pass the Active Directory namespace (i.e. adtestsso.com) as the identity store URL rather than the ADFS service URL. This can be adjusted through the ADFS settings that are used in writing the federation metadata.
- In the Server Manager window, click on the Tools menu on the top navigation bar and select AD FS Management.
- When the ADFS snap-in opens, click on Edit Federation Service Properties… from the right-hand Actions pane.
- Ensure that the Federation Service name field is the same as the server URL, i.e. adtestadvm01.cloudapp.net.
- Click on OK.
Part four: Configure Azure ACS to act as a federation broker
Set up a new instance of Azure ACS
Firstly, create a new ACS namespace that will act as the federation broker for the application.
- Click the +NEW button on the bottom toolbar in the Azure Management Portal and select App Services > Active Directory > Access Control > Quick Create.
- Enter adtestacs as the namespace.
- Select a region that is consistent with the affinity group you created above.
- Click on the Create button.
- To configure the ACS service select Active Directory from the left-hand toolbar and Access Control Namespaces from the top-level menu. Select the instance created above and click on the Manage button on the bottom tool-bar.
- This will open the Access Control Service portal from the old Azure Management Portal where ACS is configured.
Note that there may be a lengthy delay before the management portal is available for your new namespace, even if Azure if reporting the namespace as fully provisioned.
You will need to make a note of the WS-Federation metadata endpoint for the service so you can establish a trust relationship with the ADFS service. In the left-hand menu click on the Application Integration menu item. The main area will display a series of entries in the Endpoint Reference section, including the WS-Federation Metadata endpoint which will be of the form:
https://[namespace].accesscontrol.windows.net/FederationMetadata/2007-06/FederationMetadata.xml
Configure a trust relationship between Azure ACS and ADFS
Now that we have an identity server and a federation broker we have to establish a two-way trust relationship between them.
The first step will be to configure the relationship on the ADFS server.
- Connect to the VM adtestadvm01 using remote desktop and start Server Manager.
- In the Server Manager window, click on the Tools menu on the top navigation bar and select AD FS Management.
- Click on the Add a trusted relying party link in the main pane. This can also be done via a link on the right-hand Actions pane.
- When the Add Relying Party Trust Wizard opens click on the Start button.
- In the Federation metadata address text box you will need to add the WS-Federation metadata endpoint for the Azure ACS service. This will be in the following format:
https://[namespace].accesscontrol.windows.net/FederationMetadata/2007-06/FederationMetadata.xml
- Click on Next.
- Accept all the remaining default options by clicking on Next several times.
- At the end of the wizard there will be a checkbox labelled “Open the Edit Claims Riles dialog…” – you can uncheck this before clicking on Close.
- A similar trust relationship also has to be established in the ACS management portal.
- Download the federation metadata from the ADFS server – the URL will be in the following format:
https://[server name].cloudapp.net/FederationMetadata/2007-06/FederationMetadata.xml
- Accessing this file will give rise to an SLL error that you can ignore.
- Open the management console for the ACS namespace via the Azure Management Portal.
- Select Identity Providers from the left-hand menu.
- Click on the Add link towards the top of the page.
- Select the “WS-Federation identity provider” option and click on Next.
- In the Display name field enter the URL of the ADFS server, i.e. adtestadvm01.cloudapp.net.
- In the WE-Federation metadata section click on the Choose File button and select the meta data file downloaded from the ADFS server.
- Enter “ADFS Identity Store” into the Login link text field – this is what will be displayed to users.
- Click on Save.
Setting up the name identifier claim
Different identity providers tend to return different sets of claims. If you are planning to use more than one identity provider in the long term you can only really rely on the Name Identifier claim to uniquely identify users. To make sure the ADFS identity store conforms to this it has to be configured to return a unique username for the following claim:
This can be done by adding a claim rule in the ADFS server.
- Connect to the VM adtestadvm01 using remote desktop and start Server Manager.
- In the Server Manager window, click on the Tools menu on the top navigation bar and select AD FS Management.
- In the left-hand pane, expand the nodes and select Relying Party Trusts from the Trust Relationships node. The address of the Azure ACS instance will appear in the main panel.
- Right-click on the name of the Azure ACS instance and click on Edit Claim Rules…
- Click on Add Rule…
- Select “Send LDAP Attributes as Claims” and click on Next.
- Enter “Map User-Principal-Name to User ID” in the Claim rule name field.
- Select Active Directory in the Attribute store drop-down list.
- In the mappings grid, enter User-Principal-Name into the “LDAP Attribute” column and Name ID into the “Outgoing Claim Type” column.
- Click on Finish.
- Click on OK to leave the Claim Rules dialog.
Allowing claims to be passed through Azure ACS
Now that we have configured the ADFS server to send the correct claims we have to ensure that Azure ACS passes them through to any application. This is done by creating a rule group in Azure ACS.
- Open the management console for the ACS namespace via the Azure Management Portal.
- Select Identity Providers from the left-hand menu.
- Click on the Add link towards the top of the page.
- Enter “adtestadvm01.cloudapp.net” into the Name field. Click on Save.
- Click on Add to create a new rule for the group.
- Accept all the default values as these will allow any claims to pass through. Click on Save.
Part five: Set up a website to log in using federated identity
Create the MVC website in Visual Studio
The Windows Identity Federation is written into version 4.5 of the .Net framework, so integration a website with Azure ACS is very straightforward. It just requires the application to be registered as a relying party application in Azure.
The application we create will just display a single page that logs a user in and shows the claims associated with their identity.
- In Visual Studio 2012 create a new ASP.NET MVC 4 web application. Choose Internet Application as the project type.
- Run the application to check that it works and displays the home page – take a note of the application URL.
To link the application up to Azure ACS you will need the management key from your ACS instance. This can be collected from the Azure ACS Management Portal.
- Click on Management service in the left-hand menu.
- Click on the Management client link
- In the Edit Management Service Account screen click on the Symmetric Key link towards the bottom of the screen.
- Click on Show Key and copy the content – it should be a long security key.
The next step is to link the web application to Azure using the management key you have just collected.
- In Visual Studio Solution Explorer, right-click on the project and select Identity and Access…. (Note that this requires the Identity and Access Tool extension listed as a pre-requisite at the start of this guide).
- In the dialog that opens select the “Use the Windows Azure Access Control Service” option.
- Click on the Configure… link in the middle of the screen.
- Enter the ACS namespace – i.e. adtestacs (not the fully qualified domain name)
- Enter the management key and ensure that the “Save management key” option is checked.
- Click on OK to register the application with Azure.
- The available identity providers for the Azure ACS instance will be displayed in a list. Select qasadvm01.cloudapp.net and click on OK.
The wizard will now write the required configuration into the site’s web.config file and register it as a relying application in Azure ACS. You can check the configuration in the Azure ACS management portal by selecting the Relying party applications left-hand menu option.
Run the application to test the connection. You will see an error caused by the self-signed SSL certificate but this should be ignored at this stage.
Once past the certificate error you should be challenged to enter a username and password – use the fully qualified Active Directory username here – i.e. username@adtestsso.com.
Configuring the login experience
By default ADFS 2.0 will just cause the browser to show a system login dialog. You can configure it to display a set of web pages that are installed as part of ADFS 2.0 and hosted in IIS.
- Connect to the VM adtestadvm01 and open the web.config file found in the following location:
C:\inetpub\adfs\ls
- Look for the localAuthenticationTypes element and move the Forms element to be first in the list, i.e.
<localAuthenticationTypes> < < < < </localAuthenticationTypes>
- You can now adjust the login experience by changing the website files in the same location.
Filed under Architecture, ASP.NET, Azure.
|
http://www.ben-morris.com/set-up-a-federated-identity-provider-on-azure-using-active-directory-and-adfs-2-0/
|
CC-MAIN-2017-22
|
refinedweb
| 3,708
| 64.51
|
Railway Flow-Based Programming with Flowex
Flow-Based Programming
Having been a software developer many years, I’ve tried lots of programming languages with different paradigms: procedural, object oriented and functional. Last year I took a look at a completely different approach to program design — Flow-Based Programming (FBP) — a paradigm that defines an application as a network of independent processes exchanging data via message passing. FBP is a data-centered approach — when an application is viewed as a system of data streams being transformed by processes. It differs a lot from “conventional programming” (both OO and FP) where a program is a sequential modification of data which are at rest.
In FBP each process (called “component”) is independent “black box” with one or several inputs and outputs. In general, these components can be implemented using any programming language. The data (called “information packets” or IP) are being sent from output of one process to input of another via externally predefined connections. It can be said there are 2 logic layers in FBP application. The bottom layer is a set of components implementing parts of business-logic. And the top layer is a “communication logic” — an organization of data flows from one component to another.
Elixir GenStage
One may have noticed that of Elixir/Erlang actors completely fit the FBP process description. So an implementation of components is not a big deal. A more complex problem is setting up connections between them for passing IPs. As mentioned before these connections should be defined externally (components are not supposed to know about their neighbors).
José Valim announced GenStage package on July 14, 2016. GenStage is an Elixir behavior for exchanging events with back-pressure between Elixir processes. José defined GenStage as “better abstractions for working with collections” and the main scope of its application is parallel data processing (Flow package).
But I’ve found GenStage feature as a solution for FBP components communication problem. What one need to do is just place a component logic inside “stage” process and subscribe them in right order. GenStage will guarantee not only correct message passing but also ensure that stage will not be overflowed with data.
Railway FBP
There is a “Railway Oriented Programming” pattern in functional programming which presents a program (or its part) as a pipeline of functions (output of one function is an input for another). As an example let’s consider a simple program which receives a number as an input, then adds one, then multiplies the result by two and finally subtracts three:
defmodule Functions do
def add_one(number), do: number + 1
def mult_by_two(number), do: number * 2
def minus_three(number), do: number - 3
enddefmodule MainModule do
def run(number) do
number
|> Functions.add_one
|> Functions.mult_by_two
|> Functions.minus_three
end
end
MainModule.run/1 function defines a pipeline of functions with the same interface. The program can be easy redesigned using FBP approach. All we need is to “place” each of the functions into separate “stage” process.
This is what I call “Railway FBP” — the special case of FBP when a component graph is just a simple chain.
Flowex
Flowex is a set of abstractions built on top Elixir GenStage which allows to easily create chains of communicating processes.
The main abstraction is “pipeline”. In order to create it, one should
use Flowex.Pipeline in the module and define functions which will be placed into separate GenStage using
pipe macro:
defmodule FunPipeline do
use Flowex.Pipeline
pipe :add_one
pipe :mult_by_two
pipe :minus_three # functions` definitions are skipped
end
After compilation of
FunPipeline module, one can “start” pipeline:
FunPipeline.start. A lot of things happen after that:
- three GenStages start — one for each of the function in the pipeline;
- one additional GenStage starts for error processing is started;
- ‘producer’ and ‘consumer’ GenStages start to handle input and output;
- all the components are placed under Supervisor.
In order to run calculations one can use
FunPipeline.cast or
FunPipeline.call function. According to Elixir/Erlang conventions
call will perform a synchronous operation, so the function will returns result only after IP has been sent through all “pipes”. The
cast function sends IP into the pipeline and returns
:ok immediately. One should use
cast if the returned result doesn’t matter.
Another way to run calculations is using
Flowex.Client. The client is just GenServer initialized with a specific pipeline. One need clients to effectively utilize the pipeline (see details)
What if something went wrong? The pipeline has a mechanism of error handling. If an error happens, for example, in the first pipe, the
:mult_by_two and
:minus_three functions will not be called. IP will bypass to the “error_pipe”. Even if you don’t specify “error_pipe” flowex will add the default one. One can use
error_pipe macro to define a function which will be called when an error happens:
defmodule FunPipeline do
use Flowex.Pipeline
# ...
error_pipe :if_error
def if_error(error, struct, opts)
#...
end
What should you do if you need to share some functionality between pipelines? It is not a good idea to duplicate function if you want to use the same component in other pipeline modules. There is a better solution — one can pass module name to the
pipe macro:
defmodule ModulePipeline do
use Flowex.Pipeline
pipe AddOne
pipe MultByTwo
pipe MinusThree
end
Each module must implement only
init and
call functions (like in Plug modules). In this way, one can create reusable components for pipelines.
Each component of pipeline takes a some time to finish IP processing. One component does simple work, another can process data for a long time. So if client or clients continuously push IPs they will stack before the slowest component. And data processing speed will be limited by that component.
Flowex has a solution. One can define a number of executing processes for each component:
defmodule FunPipeline do
use Flowex.Pipeline
pipe :add_one, 1
pipe :mult_by_two, 3
pipe :minus_three, 2
error_pipe :if_error, 2
# ...
end
And the pipeline will look like on the figure below:
I called that feature “controlled parallelism” — one can adjust and control a number of executing components before the program starts. It is an opposite approach to what we used to see in Elixir/Erlang applications where a number of processes may change on demand — for example “cowboy” server creates a new process for each request.
Conclusion
Flow-Based Programming is an absolutely different approach to program design as compared with “conventional programming”. While in general, it seems difficult and weird some special cases are very easy to implement.
I’m sure lots of your programs or at least their parts may be designed to be a chain of sequentially called functions. If so, there is only one step to evaluate them in separate processes — use Flowex.
|
https://anton-mishchuk.medium.com/railway-flow-based-programming-with-flowex-ef04fd338e41
|
CC-MAIN-2021-25
|
refinedweb
| 1,121
| 54.52
|
1 year, 11 months ago.
uVision 5 - Serial "unknown type name 'Serial'"
Hey guys,
i tried to make my work trough the online compiler but its very strange after a few hours :D I installed mbed cli on my computer, imported my project and exported it for uVision. After starting it there are already 5 errors ... in my main program :D
- error in include chain (SDFileSystem.h): unknown type name 'SPI'
- error in include chain (ESP8266.h): unknown type name 'Serial'
- error: unknown type name 'Serial'
- same
- use of undeclared identifier 'Serial'
Online Compiler compiled it without errors.
On my "surface pro" there are no errors. i have got a fresh uVision.
Maybe someone knows a workaround
Ng Thomas
3 Answers
1 year, 11 months ago.
Those errors make me feel like the Mbed library is not in your project. Though, I don't think you would've been able to run export without it. Ccould you please send the latest commit hash inside your Mbed library? Please run "git log" inside Mbed and post the results. If you are using a public code repository, it would be helpful to know what it is. Then, I will try to replicate your issue.
I dont know how to use "git log" but i think you mean this -> 154:fb8e0ae1cceb?
I also tried to export just the blinky test program and insert Serial hmm(p9, p10, 115200); Same error.
Maybe my Keil has a wrong configuration?posted by 01 Nov 2017
It looks like the export might be incomplete. I was not able to reproduce exporting mbed_blinky to uvision for k64f.posted by 01 Nov 2017
1 year, 10 months ago.
I am having same problem with this code Im using Nucleo-F401RE So I have tried to export standard UART example from mbed to keilv5. And even on this simplest sample keilv5 complains "unknown type name 'Serial'"
Serial pc(SERIAL_TX, SERIAL_RX);
It does compile but serial does not work...
1 year, 10 months ago.
Hello,
Provided that an
mbed_config.h file was created by mbed when exporting the project from the online compiler, one solution/workaround is to add a new line
#include "mbed_config.h" into the respective
device.h file of your target board. It worked for me with the NUCLEO-F103RB board for Offline compilation and debugging with CooCox CoIDE.
For the LPC1768 board, when using MBED OS 2, the
device.h file is located in the
mbed-dev\targets\TARGET_NXP\TARGET_LPC176X\TARGET_MBED_LPC1768 folder.
You need to log in to post a question
|
https://os.mbed.com/questions/79418/uVision-5-Serial-unknown-type-name-Seria/
|
CC-MAIN-2019-43
|
refinedweb
| 424
| 75.61
|
Code. Collaborate. Organize.
No Limits. Try it Today.
The Shunting yard algorithm takes an expression, e.g., 3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3 and evaluates it in RPN.
I was looking for a Shunting yard algorithm in C# for a web development project to lexical analyse XHTML code.
As I was unable to find anything
I spent some time writing code to solve my problem. I think others can use it as well.
An good article on the Shunting yard algorithm can be found
at Wikipedia .
To use the code we have to make a new class inheriting from my class ShuntingYardBase<Result,Input>, where Result is the type returned from the code,
and Input is the type of source, normally String, but can be any type including your own list of classes.
ShuntingYardBase<Result,Input>
Result
Input
String
Then we have to implement some virtual functions:
This is from my demo code - a simple math evaluator.
public override double Evaluate(double result1, char opr, double result2)
{
if (!Oprs.ContainsKey(opr))
throw new Exception("Wrong operator!!");
switch (opr)
{
case '+':
return (double)result1 + result2;
case '-':
return (double)result1 - result2;
case '*':
return (double)result1 * result2;
case '/':
return (double)result1 / result2;
case '^':
return Math.Pow(result1, result2);
}
return base.Evaluate(result1, opr, result2);
}
After implementing all the virtual functions (see the code example), use the object:
ShuntingYardSimpleMath SY = new ShuntingYardSimpleMath();
String s = "3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3";
Console.WriteLine("input: {0}", s); Console.WriteLine();
List<String> ss = s.Split(' ').ToList();
SY.DebugRPNSteps += new ShuntingYardBase<double, string>.DebugRPNDelegate(SY_DebugRPNSteps);
SY.DebugResSteps += new ShuntingYardBase<double, string>.DebugResDelegate(SY_DebugResSteps);
Double res = SY.Execute(ss, null);
bool ok = res == 3.0001220703125;
Console.WriteLine("input: {0} = {1} {2}", s, res, (ok ? "Ok" : "Error"));
Console.ReadKey();
It is interesting that this code also can be used to lexical analyze source code, C# , HTML,.
|
http://www.codeproject.com/Tips/351059/Shunting-Yard-in-Csharp?msg=4450321
|
CC-MAIN-2014-23
|
refinedweb
| 307
| 51.04
|
#000 How to access and edit pixel values in OpenCV with Python?
Highlight: Welcome to another datahacker.rs post series! We are going to talk about digital image processing using OpenCV in Python. In this series, you will be introduced to the basic concepts of OpenCV and you will be able to start writing your first scripts in Python. Our first post will provide you with an introduction to the OpenCV library and some basic concepts that are necessary for building your computer vision applications. You will learn what images and pixels are and how we can access and manipulate them using OpenCV. So, without further ado, let’s begin with our lecture.
What is OpenCV?
OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library that was built to provide a common infrastructure for computer vision, not to mention that the library has more than 2500 optimized algorithms! With this in mind, you can use it to detect and recognize faces, identify objects, classify human actions in videos, track movement with camera and many others.
Tutorial overview:
- Introduction to the image basics
- File extensions supported by OpenCV
- What is a coordinate system?
- Accessing and manipulating pixels in images with OpenCV
- BGR color order in OpenCV
- Funny hacking with OpenCV
1. Introduction to the image basics
What is a pixel?
The definition of an image is very simple: it is a two-dimensional view of a 3D world. Furthermore, a digital image is a numeric representation of a 2D image as a finite set of digital values. We call these values pixels and they collectively represent an image. Basically, a pixel is the smallest unit of a digital image (if we zoom in a picture, we can detect them as miniature rectangles close to each other) that can be displayed on a computer screen.
A digital image is presented in your computer by a matrix of pixels. Each pixel of the image is stored an integer number. If we are dealing with a grayscale image, we are using numeric values from 0 (black pixels) up to 255 (white pixels). Any number in between these two is a shade of gray. On the other hand, color images are represented with three matrices. Each of those matrices represent one primary color which is also called a channel. The most common color model is the Red, Green, Blue (RGB). These three colors are mixed together to generate a broad range of colors. Note that OpenCV loads the color images in reverse order so that the blue channel is the first one, the green channel is the second, and the red channel is the third (BGR).
To represent a single channel intensity values in an RGB image, we also use values from 0 to 255. Each channel produces a total of 256 discrete values, which corresponds to the total number of bits that you use to represent the color channel value \(2^{8}= 256 \). Since there are three different channels with 8 bits per channel, we call this a 24-bit color depth.
2. File extensions supported by OpenCV
So far, we have explained that the images in OpenCV are stored as matrices. However, one very important thing to note is that they are not necessarily stored, or transmitted in the same file format. Some file formats use different forms of compression to represent images more efficiently and they may not be supported by OpenCV.
In the following section, we will go over which of those file formats are supported by OpenCV.
1. Windows bitmap (bmp, dib)
The BMP file format, also known as bitmap image file or device independent bitmap (DIB), is a raster graphics image file format used to store bitmap digital images, independently of the display device. It is capable of storing two-dimensional digital images both monochrome and color, in various color depths, and optionally with data compression, alpha channels, and color profiles.
2. Netpbm – Portable image formats (pbm, pgm, ppm)
Netpbm is an open-source package of graphics programs and a programming library. Several graphics formats are used and defined by the Netpbm project. The portable pixmap format (PPM), the portable graymap format (PGM) and the portable bitmap format (PBM) are image file formats designed to be easily exchanged between platforms.
3. Sun Raster (sr, ras)
Sun Raster was a raster graphics file format used on SunOS by Sun Microsystems. The format was mainly used in research papers.
4. JPEG (jpeg, jpg, jpe)
JPEG is a raster image file format that’s used to store images that have been compressed to store a lot of information into a small file.
5. JPEG 2000 (jp2)
JPEG 2000 (JP2) is an image compression standard and coding system. It is a discrete wavelet transform (DWT) based compression standard that could be adapted for motion imaging video compression with the Motion JPEG 2000 extension. A standard uses wavelet based compression techniques, offering a high level of scalability and accessibility. In other words JPEG 2000 compresses images with fewer artifacts than a regular JPEG.
6. TIFF files (tiff, tif)
It is an adaptable file format for handling images and data within a single file.
7. Portable network graphics (png)
It is a raster-graphics file-format that supports lossless data compression. A PNG was developed as an improved, non-patented replacement for Graphics Interchange Format (GIF).
3. What is a coordinate system?
In the following example we see an image that is shown as a collection of pixels. If we want to asses a single pixel in the image, we will use a coordinate system.
Pixels are accessed with two \((x, y) \) coordinates. The \(x \) value represents the columns and the \(y \) value represents the rows. As you can see in our example, the upper left corner of the image has the coordinates of the origin \((0, 0) \). Moreover, values for \(x \) coordinates increase as they go right and values for \(y \) coordinates increase as they go down.
It is important to note that NumPy always reads first the vertical values from the \(y \) axis, and then, the horizontal values from the \(x \) axis. Then, we will actually reverse the coordinates when we want to work with them as matrices both in OpenCV and NumPy.
We can assess and manipulate each pixel in an image in a similar way: as an individual element of an array referenced in Python. Now, let’s see how we can do this with code.
4. Accessing and manipulating pixels in images with OpenCV
It is good to note that we are mainly going to use grayscale images as a default choice. Due to only one channel, it makes image processing more convenient. Usually, we convert an image into the grayscale one, because we are dealing with one color and it is a lot easier and faster. In OpenCV we can perform image and video analysis in full color as well, which we will also demonstrate.
Now, we are going to see how we can work with BGR images in OpenCV.
First, we need to read the image we want to work with using the
cv2.imread() function. If the image is not in the working directory, make sure to know the exact file path. If we are working in Google Colab we need to upload our image from our computer. With this in mind, in the following examples we are going to read the image of the Tesla truck.
# Necessary imports import cv2 import numpy as np import matplotlib.pyplot as plt # For Google Colab we use the cv2_imshow() function from google.colab.patches import cv2_imshow
If we want to load a color image, we just need to add a second parameter. The value that’s needed for loading a color image is
cv2.IMREAD_COLOR. There’s also another option for loading a color image: we can just put the number 1 instead
cv2.IMREAD_COLOR and we will obtain the same output.
# Loading our image with a cv2.imread() function img=cv2.imread("Cybertruck.jpg",cv2.IMREAD_COLOR) # img=cv2.imread("Cybertruck.jpg",1)
The value that’s needed for loading a grayscale image is
cv2.IMREAD_GRAYSCALE, or we can just put the number 0 instead as an argument.
# Loading our image with a cv2.imread() function gray=cv2.imread("Cybertruck.jpg",cv2.IMREAD_GRAYSCALE) # gray=cv2.imread("Cybertruck.jpg",0)
To display an image, we will use the
cv2.imshow() function.
# For Google Colab we use the cv2_imshow() function # but we can use cv2.imshow() if we are programming on our computer cv2_imshow(img) cv2_imshow(gray)
Output:
Our output for the grayscale image is the following:
Output:
Moreover, it is also possible to show images using the matplotlib library and the
plt.imshow() function. Note, that here, we need to pay attention to the order of color channels. Let’s see!
# We can show the image using the matplotlib library. # OpenCV loads the color images in reverse order: # so it reads (R,G,B) like (B,G,R) # So, we need to flip color order back to (R,G,B) plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) # We can use comand plt.axis("off") to delete axis # from our image plt.title('Original')
Output:
After we load the image, some descriptors can be extracted from it:
# If we want to get the dimensions of the image we use img.shape # It will tell us the number of rows, columns, and channels dimensions = img.shape print(dimensions)
Output:
(550, 995, 3)
# If an image is a grayscale, img.shape returns #the number of rows and columns dimensions = gray.shape print(dimensions)
Output:
(550, 995)
# We can obtain a total number of elements by using img.size total_number_of_elements= img.size print(total_number_of_elements)
Output:
1641750
# Image data type is obtained by img.dtype image_dtype = img.dtype print(image_dtype)
Output:
uint8
Furthermore, we can access a pixel value by putting a row and a column coordinates and also store the color channels in a tuple.
# To get the value of the pixel (x=50, y=50), we would use the following code (b, g, r) = img[50, 50] print("Pixel at (50, 50) - Red: {}, Green: {}, Blue: {}".format(r,g,b))
Output:
Pixel at (50, 50) – Red: 210, Green: 228, Blue: 238
We can manipulate a pixel in the image, by updating the values into a new set of values
# We changed the pixel color to red img[50, 50] = (0, 0, 255)
# Displaying updated image plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) plt.title('Updated')
Output:
# Using indexing we modified a whole region rather than one pixel # For the top-left corner of the image, we can rewrite # the color channels in folowing way: img[0:150, 0:300] = [0,255,0]
cv2_imshow(img)
Output:
5. BGR color order is why it is very important to know how to convert an image from one format into another. Here is one way how it can be done in a fancy way.
# We load the image using the cv2.imread() function # Function loads the image in BGR order img3=cv2.imread("Pamela.jpg",1) cv2_imshow(img3)
Output:
But when we are plot our image with matplotlib due to the fact that it uses RGB color order, colors in our displayed image will be reversed. See below.
plt.imshow(img3)
Output:
# We can split the our image into 3 three channels (b, g, r) b, g, r = cv2.split(img3)
# Next, we merge the channels in order to build a new image img4 = cv2.merge([r, g, b])
Now, we have two images. The first one is our original image. In addition, we also created the second one (img2) where we split the original image into 3 channels and then merged them back together in RGB order. Next, we are going to plot both images, first with OpenCV and then with matplotlib.
OpenCV:
cv2_imshow(img4)
Output:
Matplotlib:
plt.imshow(img4)
Output:
So, now, for img2, matplotlib works properly, but for the OpenCV we got a reversed colors. Luckily, it is easy for us visually to inspect whether the colors are displayed correctly. Using this trick, you can always
6. Funny hacking with OpenCV
For fun, let’s try and create our own images!
import numpy as np gray = np.zeros( (256,256), dtype="uint8" )
for i in range(256): gray[i,:] = i gray=gray.astype("uint8") cv2_imshow(gray)
Output:
We created this grayscale transition along the \(x \) axis. As an experiment, we can print our image in \(8\times 8 \) resolution to show you the pixel values. You would get this output if in the previous code you replace 256 with 8.
print(gray)
Output:
We can do the same trick, and create this transition along the \(y \) axis.
for i in range((255)): gray[:,i] = i gray=gray.astype("uint8") cv2_imshow(gray)
Output:
Let’s now create the grayscale transitioning along diagonal of our image. We use int casting, as we need to convert it to an integer values, due to multiplication with 0.5.
for i in range(255): for j in range(255): gray[i,j]= (i*0.5 + j*0.5)
gray=gray.astype("uint8") cv2_imshow(gray)
Output:
Okay, now let’s add some color:
r = np.zeros((256,256),dtype="uint8") g = np.zeros((256,256),dtype="uint8") b = np.zeros((256,256),dtype="uint8") for i in range(255): for j in range(255): r[i,j]= i g[i,j]= 0 b[i,j]= 0 r=r.astype("uint8") g=g.astype("uint8") b=b.astype("uint8") img = cv2.merge( (r,g,b) ) cv2_imshow(img)
Output:
Or how about adding two colors?
r = np.zeros((256,256),dtype="uint8") g = np.zeros((256,256),dtype="uint8") b = np.zeros((256,256),dtype="uint8") for i in range(255): for j in range(255): r[i,j]= (i*0.5 + j*0.5) g[i,j]= j b[i,j]= 0 r=r.astype("uint8") g=g.astype("uint8") b=b.astype("uint8") img = cv2.merge( (r,g,b) ) cv2_imshow(img)
Output:
This should be enough 🙂 You get an idea how creative you can be with pixels and for loops!
Summary
In this post we covered some key concepts related to images. To sum it up, we learn that OpenCV uses the BGR color format instead of RGB. We learn what pixels are and how to access and manipulate them in Python. Also, we explained how to create new images and how to index them. In the next post we will see how to work with videos using OpenCV.
|
http://datahacker.rs/how-to-access-and-edit-pixel-values-in-opencv-with-python/
|
CC-MAIN-2020-24
|
refinedweb
| 2,436
| 64.41
|
How to get first AND last element of tuple at the same time
python tuple
last item of tuple python
get second element of tuple in list
python get nth element of list of lists
what is the syntax to obtain the first element of the tuple:
remove element from tuple python
how to get value from list of tuples
I need to get the first and last dimension of an numpy.ndarray of arbitrary size.
If I have
shape(A) = (3,4,4,4,4,4,4,3)
my first Idea would be to do
result = shape(A)[0,-1] but that doesn't seem to work with tuples, why not ??
Is there a neater way of doing this than
s=shape(A) result=(s[0], s[-1])
Thanks for any help
I don't know what's wrong about
(s[0], s[-1])
A different option is to use
operator.itemgetter():
from operator import itemgetter itemgetter(0, -1)(s)
I don't think this is any better, though. (It might be slightly faster if you don't count the time needed to instantiate the
itemgetter instance, which can be reused if this operation is needed often.)
Introduction to the Art of Programming. Accessing the first element and the last element of the tuple requires index operator([]). You can find the first element and last element of tuple using Python. Get your single element of tuple with the methods given here. In addition to this, you can also get elements from first to the end of given tuple using Python.
s = (3,4,4,4,4,4,4,3) result = s[0], s[-1]
Introduction to Programming and Problem-Solving. Modify / Replace the element at specific index in tuple. To replace the element at index n in tuple we will use the same slicing logic as above, but we will slice the tuple from from (0 to n-1) and (n+1 to end) i.e. # Sliced copy containing elements from 0 to n-1 tupleObj[ : n] # Sliced copy containing elements from n to end tupleObj[n + 1 : ]
If you are using numpy array, then you may do that
s = numpy.array([3,4,4,4,4,4,4,3]) result = s[[0,-1]]
where
[0,-1] is the index of the first and last element. It also allow more complex extraction such as
s[2:4]
Python program to interchange first and last elements in a list , Approach #3: Swap the first and last element is using tuple variable. Store the first and last element as a pair in a tuple variable, say get, and unpack those.
Came across this late; however, just to add a non indexed approach as previously mentioned.
Tuple unpacking can be easily be applied to acquire the first and last elements. Note: The below code is utilizing the special asterisk '*' syntax which returns a list of the middle section, having a and c storing the first and last values.
Ex.
A= (3,4,4,4,4,4,4,3) a, *b, c = A print((a, c))
Output (3, 3)
Python, Recommended Posts: Python | Find the tuples containing the given element from a list of tuples · Python | Get first element with maximum value in list of tuples I'm trying to obtain the n-th elements from a list of tuples. I have something like: elements = [(1,1,1),(2,3,7),(3,5,10)] I wish to extract only the second elements of each tuple into a list: seconds = [1, 3, 5] I know that it could be done with a for loop but I wanted to know if there's another way since I have thousands of tuples.
get the last element from a tuple in Python, Building starts with Ground (0) floor followed by 1st, 2nd floor and so on. Similar is the concept of indexing. Indexing is accessing elements from sequence..
Mathematical Methods in Interdisciplinary Sciences, (fff;..so), , (zi,z, ,x)| then the elements of i-tuple of A, are added at the end of i-tuple of Al if the elements of these tuples belong to the same set; otherwise, the rule for u) It means that if we go through elements of ā' = (a,a), aft) from its first element as to its last element as and At the same time, a; = 3 as well as a;, = 3. Python 3 only answer (that doesn't use slicing or throw away the rest of the list, but might be good enough anyway) is use unpacking generalizations to get first and last separate from the middle: first, *_, last = some_list
Python: Get an item of a tuple, Python Exercises, Practice and Solution: Write a Python program to get the 4th element and 4th element from last of a tuple. A little Linq will do the trick: var myStringList = myTupleList.Select(t=>t.Item1).ToList(); As an explanation, since Tim posted pretty much the same answer, Select() creates a 1:1 "projection"; it takes each input element of the Enumerable, and for each of them it evaluates the lambda expression and returns the result as an element of a new Enumerable having the same number of elements.
- I was just wondering, because I haven't worked with tuples that much so far. Thanks, I'm going to accept your answer as soon as I can (~8 minutes :))
- yes, but shape does not return a np.array. The strange thing is, that the
s[2:4]access even is possible for a tuple, but
s[0, -1]is not
|
https://thetopsites.net/article/54063034.shtml
|
CC-MAIN-2021-25
|
refinedweb
| 927
| 63.53
|
Em Fri, Feb 06, 2009 at 03:39:45AM +0100, Frederic Weisbecker escreveu:> On Thu, Feb 05, 2009 at 11:54:16PM -0200, Arnaldo Carvalho de Melo wrote:> > Em Thu, Feb 05, 2009 at 11:58:37PM +0100, Frederic Weisbecker escreveu:> > > > +void trace_buffer_unlock_commit(struct trace_array *tr,> > > > + struct ring_buffer_event *event,> > > > + unsigned long flags, int pc)> > > > +{> > > > + ring_buffer_unlock_commit(tr->buffer, event);> > > > +> > > > + ftrace_trace_stack(tr, flags, 6, pc);> > > > + ftrace_trace_userstack(tr, flags, pc);> > > > + trace_wake_up();> > > > +}> > > > > > > > > I have mitigate feelings about this part. The name of this function could> > > have some sense if _most_ of the tracers were using the stack traces. But that's> > > not the case.> > > > > > We have now this couple:> > > > > > _ trace_buffer_lock_reserve() -> handles the ring-buffer reservation, the context info, and the type> > > _ trace_buffer_unlock_commit() -> unlock, commit, wake and... stacktraces?> > > > > > In my opinion, the latter doesn't follow the logic meaning of the first.> > > And the result is a mixup of (trace_buffer | ring_buffer)(lock/unlock/reserve/commit).> > > > > > You are sometimes using trace_buffer_lock_reserve followed by ring_buffer_unlock_commit.> > > That looks a bit weird: we are using a high level function followed by its conclusion> > > on the form of the low lovel function.> > > > > > I think the primary role of this new couple should be to simplify the low level ring buffer> > > bits as it does. But the stack things should stay separated.> > > > Well, the whole reason for this cset was to provide a way to check for> > things like stacktrace while reducing the number of explicit calls the> > poor driver, oops, ftrace plugin writers had to keep in mind.> > > I agree, but that forces those who don't need stacktraces to use> a paired trace_buffer_lock_reserve() / ring_buffer_unlock_commit()> The poor newcomers will become dizzy with these different namespaces...> And it's like managing a file with fopen() and then close() ... :-)> > > > So it may well be the case for a better name, but frankly I think that> > this is something better left _hidden_, a magic that the plugin writers> > doesn't have to deal with.> > I agree with you, the stacktraces are used by several tracers, and then> it deserves some code factoring.> What I would suggest is to have two different trace_buffer_unlock_commit()> > Thinking about the name of these functions, since they are in a higher layer> than the ring buffer which performs some things with locking and buffers, we could> let this latter do his tricky low level work and simply offer some magic functions> with magic names:> > _ trace_reserve()> _ trace_commit()> _ trace_commit_stacktrace()The point I was trying to make is that the magic is not juststacktraces, it may well be some other whizbangfoobar that I don't knowright now.So perhaps, we indeed need some per tracer flags where the driver writercan state which kind of magic it _doesn't_ want performed.The default would be: magic is in the air... I.e. do whatever magic youmay find interesting, as I can't foretell.- Arnaldo
|
http://lkml.org/lkml/2009/2/5/574
|
CC-MAIN-2017-13
|
refinedweb
| 476
| 55.98
|
I have an Ubuntu Server running KVM. I'd like to get the benefits of ZFS so I was thinking of installing a virtual machine under KVM running Nexenta (or NexentaStor), allowing that virtual machine to have raw access to a couple of physical hard disks, and then having it share its file system with NFS so that Ubuntu can access it.
I've never tried setting up KVM so that the virtual machine has access to physical drives. Does this sound feasible, and is there anything I need to watch out for? Has someone already documented something like this? Does Nexenta/ZFS function basically as well in the virtual environment as if they were running base bones? I can take a small performance hit, but I don't want it to not be as reliable because of the virtualization. Thanks.
This is definitely possible under VMWare, specifically due to the hardware passthrough abilities... Take a look at the blog post at:
Running Nexenta in a virtual environment is usually done as a strategy for consolidating existing storage. Say, for example, you had several iSCSI boxes that you wanted to bring under one management set and consolidate that storage into a contiguous namespace. You could run Nexenta in a VM and use the iSCSI initiator to connect to those various iSCSI targets in your infrastructure. You can then add those devices to a pool (even raid/mirror them for greater redundancy). Then you can carve up the storage in the pool and share it out however you like. I know that strategy works very well.
For the sake of better I/O and more solid resource management I would advise using ESXi instead. It is a Hypervisor tailored for maximum VM performance, and allows for outstanding resource management. NexentaStor is demanding at times, and I tend to lean towards more robust solutions where my VM is going to be a high I/O system.
Given your base set of goals, I would strongly recommend looking at the KVM port that Joylent made to Open Indiana (same kernel that NexentaStor is using. This would let you place ZFS at the hypervisor level and run your linux VMs on top of it without kludgey hacks like running a VM to serve over NFS to other VMs.
By posting your answer, you agree to the privacy policy and terms of service.
asked
3 years ago
viewed
1150 times
active
2 years ago
|
http://serverfault.com/questions/239438/nexenta-under-kvm?answertab=oldest
|
CC-MAIN-2014-42
|
refinedweb
| 409
| 60.55
|
Python provides the dictionary data type in order to store items like keys and value. Dictionary items can be accessed using the keys and the value is returned for different purposes. The string is another type of data where text and other data are stored. As two popular variables or data typess converting a dictionary into a string is a popular operation. You may want to save the dictionary data into a file or database where the string is a very convenient and easy format for storage. Even the pickle can be used for storage it is a binary format and can not be read by other programming languages and modules easily. Also, the pickle is deprecated for some time and it has cross-platform problems.
Convert Dictionary To String with json.dumps() Method
JSON is a data format which is used to exchange data between different parties. The JSON format is very similar to the Python dictionary data type and the
json.dumps() method can be used to convert a dictionary into the string. In order to use the json.dumps() method the json module should be imported.
import json dct = { "name":"ahmet" , "surname":"ali" , "profession":"footballer"} print(dct) print(type(dct)) str = json.dumps(dct) print(str) print(type(str))
Convert Dictionary To String with str() Mehtod
Python provides the
str() method in order to convert a lot of different data types into the string. Like integer, float the dictionary data type and variables can be converted into a string using str() method. str() method is a built-in method that is provided by default and there is no need to import any module.
dct = { "name":"ahmet" , "surname":"ali" , "profession":"footballer"} print(dct) print(type(dct)) str = str(dct) print(str) print(type(str))
Convert String To Dictionary with json.loads() Method
If you have converted the dictionary into a srint for later use you will also need to convert back to the dictionary. You can use the
json.loads() mehtod which is the convert a string into the dictionary data type. In this case be cautious because the content of the string should be compatible with the dictionary data type.
import json mystr = '{ "name":"ahmet" , "surname":"ali" , "profession":"footballer"}' print(mystr ) print(type(mystr )) mydictionary= json.loads(mystr) print(mydictionary) print(type(mydictionary))
Convert String To Dictionary with ast.literal_eval() Method
Python also provides the
ast.literal_val() method in order to evaluate strings. This is very useful method where given and evaluated string will be converted into related data type where if the string content is dictionary like with the curly brackets, key-value pairs it will be converted into a dictionary.
import ast mystr = '{ "name":"ahmet" , "surname":"ali" , "profession":"footballer"}' print(mystr ) print(type(mystr )) mydictionary= json.loads(mystr) print(mydictionary) print(type(mydictionary))
|
https://pythontect.com/convert-dictionary-to-string-in-python/
|
CC-MAIN-2022-21
|
refinedweb
| 468
| 56.96
|
Created on 2009-04-04 16:08 by doko, last changed 2012-03-06 11:32 by nadeem.vawda. This issue is now closed.
GNU tar now supports lzma compression as a compression method. Please
consider adding lzma support to the tarfile module (either by using the
external lzma program or by adding a lzma extension to the standard
library).
lzma extension at
lzma is used in many tools (7zip, dpkg, rpm), offers faster
decompression than bzip2, slower compression than gzip and bzip2.
As for an lzma module - I would prefer one that isn't LGPL'ed. Instead,
it should link against a system-provide lzma library (which then might
or might not licensed under lpgl). I would probably exclude the lzma
module from Windows, as distributing the lzma sources along with the
Python binaries is too painful.
If we support LZMA, we should do so on all platforms; it kind of
restricts usefulness to only have it on some. Maybe the LZMA code in
one of the many archival tools in existence that supports it is not LGPL'd?
The LZMA implementation from 7-zip has been released as public domain
(since version 4.62 / Nov 2008) in the LZMA SDK:
sdk.html
So, there shouldn't be a license issue for Windows. I am not sure if
there are already system-provided LZMA libraries on Linux at this time.
> The LZMA implementation from 7-zip has been released as public domain
> (since version 4.62 / Nov 2008) in the LZMA SDK:
> sdk.html
That's good news. Now, if somebody could contribute a Python wrapper for
these...
> So, there shouldn't be a license issue for Windows. I am not sure if
> there are already system-provided LZMA libraries on Linux at this time.
There are. The Linux version apparently originates from the same
sources, so they might be API compatible. However, I wouldn't mind
if we extracted the entire lzma library from 7zip, and put it into
the source distribution.
I'm the author of the pyliblzma module, and if desired, I'd be happy to help out adapting pyliblzma for inclusion with python.
Most of it's code is based on bz2module.c, so it shouldn't be very far away from being good 'nuff.
What I see as required is:
* clean out use of C99 types etc.
* clean up the LZMAOptions class (this is the biggest difference from the bz2 module, as the filter supports a wide range of various options, everything related such as parsing, api documentation etc. was placed in it's own class, I've yet to receive any feedback on this decission or find any remote equivalents out there to draw inspiration from;)
* While most of the liblzma API has been implemented, support for multiple/alternate filters still remains to be implemented. When done it will also cause some breakage with the current pyliblzma API.
I plan on doing these things sooner or later anyways, it's pretty much just a matter of motivation and priorities standing in the way, actual interest from others would certainly have a positive effect on this. ;)
For other alternatives to the LGPL liblzma, you really don't have any, keep in mind that LZMA is "merely" the algorithm, while xz (and LZMA_alone, used for '.lzma', now obsolete, but still supported) are the actual format you want support for. The LZMA SDK does not provide any compatibility for this.
ps: pylzma uses the LZMA SDK, which is not what you want.
pyliblzma (not the same module;) OTOH uses liblzma, which is the library used by xz/lzma utils
You'll find it available at
> For other alternatives to the LGPL liblzma, you really don't have
> any,
If that's really the case (which I don't believe it is), then this
project stops right here. If the underlying library is LGPL, it would
require us to distribute its sources along with the Windows binaries,
which I'm not willing to do.
The XZ Utils website ( ) states the following:
."
So, liblzma is not the problem. But the license of PylibLZMA is LGPL3.
> If the underlying library is LGPL, it would
> require us to distribute its sources along with the Windows binaries,
> which I'm not willing to do.
Martin, this is wrong, you don't have to bundle the source *in* the object code package. Making it available on some HTTP or FTP site is sufficient.
(actually, if we don't modify the library source, we can even point at the original download site)
Per, on 2010-03-17, I asked you via email:
"I was looking at
and Martin's comments about the licensing of the bindings; is there a special reason for the lgpl3 license of the bindings, given that both python and xz-utils are not gpl'ed?"
Does pyliblzma need to be licensed under the lgpl3?
Am 26.05.2010 10:51, schrieb Antoine Pitrou:
>
> Antoine Pitrou<pitrou@free.fr> added the comment:
>
>> If the underlying library is LGPL, it would
>> require us to distribute its sources along with the Windows binaries,
>> which I'm not willing to do.
>
> Martin, this is wrong, you don't have to bundle the source *in* the object code package.
That's why I said "along". I'm still not willing to do that: making the
source available is still inconvenient. More importantly, anybody
redistributing Python binaries would have to comply also (e.g. on
CD-ROMs or py2exe binaries); this is a burden I don't want to impose
on our users. Fortunately, we don't have to, as the LZMA compression
itself is in the public domain. For the Python wrapper, I hope that
somebody contributes such a module under a PSF contributor agreement.
If nobody else does, I may write one from scratch one day.
if you're already looking at issue6715, then I don't get why you're asking.. ;)
quoting from msg106433:
"For my code, feel free to use your own/any other license you'd like or even public domain (if the license of bz2module.c that much of it's derived from permits of course)!"
The reason why I picked LGPLv3 in the past was simply just because liblzma at the time was licensed under it, so I just picked the same for simplicity.
I've actually already dual-licensed it under the python license in addition on the project page though, but I just forgot updating the module's metadata as well before I released 0.5.3 last month..
Martin: For LGPL (or even GPL for that matter, disregarding linking restrictions) libraries you don't have to distribute the sources of those libraries at all (they're already made available by others, so that would be quite overly redundant, uh?;). LGPL actually doesn't even care at all about the license of your software as long as you only dynamically link against it.
I don't really get what the issue would be even if liblzma were still LGPL, it doesn't prohibit you from distributing a dynamically linked library along with python either if necessary (which of course would be of convenience on win32..)..
tsktsk, discussions about python module for xz compression should anyways be kept at issue6715 as this one is about the tarfile module ;p
> tsktsk, discussions about python module for xz compression should
> anyways be kept at issue6715 as this one is about the tarfile module
> ;p
Ok, following up there.
Attached is a patch with the current state of my work on lzma integration into tarfile (17 test errors).
Python now has an lzma module. Lars, do you have the time to update your patch or should I do it?
I will be happy to, but my spare time is limited right now, so this could take about a week. If this is a problem, please go ahead.
There is plenty of time until 3.3. OTOH, if Eric wants to work on it now: you got a week :-) Do recognize that there is a patch to start from already.
I’m perfectly happy to let Lars do it next week or next month, there is no rush. The existing patch may even require very little or no change, as Nadeem’s module (in the stdlib) provides the same classes than the other lzma module which was used by the patch.
For those who want to test it first, I post the current state of the patch here. It is ready for commit, there are no failing tests. If nobody objects, I will apply it this weekend.
Some comments about 2011-12-08-tarfile-lzma.diff:
> elif self.buf.startswith(b"\x5d\x00\x00\x80") or self.buf.startswith(b"...
Micro-optimization: you can use self.buf.startswith((b"\x5d\x00\x00\x80", b"\xfd7zXZ")) here.
> raise ValueError("mode must be 'r' or 'w'.")
Error messages usually don't end with a dot (or am I wrong?).
It would be better to use a skip instead of just return here:
def test_no_name_argument(self):
if self.mode.endswith("bz2") or self.mode.endswith("xz"):
# BZ2File and LZMAFile have no name attribute.
return
In _Stream.__init__, for zlib:
> self.exception = zlib.error
Could you add a test for this change?
Patch looks great. I did a review on Rietveld.
New changeset 899a8c7b2310 by Lars Gustäbel in branch 'default':
Issue #5689: Add support for lzma compression to the tarfile module.
Thanks for the review, guys! I can't close this issue yet because it depends on #6715.
Great stuff! I'll close this issue along with issue 6715 once the buildbot
stuff is all sorted out.
Lars, as part of a small doc patch I want to change this in tarfile.rst:
The :mod:`tarfile` module makes it possible to read and write tar
archives, including those using gzip or bz2 compression.
-(:file:`.zip` files can be read and written using the :mod:`zipfile` module.)
+Use the :mod:`zipfile` module to read or write :file:`.zip` files, or the
+higher-level functions in :ref:`shutil <archiving-operations>`.
Any objection?
Please, go ahead!
There is failure on a XP buildbot. I don't know if it is a sporadic issue or not.
======================================================================
ERROR: test_append_lzma (test.test_tarfile.AppendTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Buildslave\3.x.moore-windows\build\lib\test\test_tarfile.py", line 1539, in test_append_lzma
self._create_testtar("w:xz")
File "D:\Buildslave\3.x.moore-windows\build\lib\test\test_tarfile.py", line 1486, in _create_testtar
with tarfile.open(self.tarname, mode) as tar:
File "D:\Buildslave\3.x.moore-windows\build\lib\tarfile.py", line 1721, in open
return func(name, filemode, fileobj, **kwargs)
File "D:\Buildslave\3.x.moore-windows\build\lib\tarfile.py", line 1826, in xzopen
mode=mode, fileobj=fileobj, preset=preset)
File "D:\Buildslave\3.x.moore-windows\build\lib\lzma.py", line 117, in __init__
preset=preset, filters=filters)
MemoryError
This failure seems to crop up often, but not on every run:
I've been able to reproduce the failure on my own XP machine;
I'll investigate it over the weekend.
Perhaps Paul can try to reproduce and diagnose the issue directly on the buildbot?
A simple rebuild and test run of that test in debug mode didn't fail...
I'll run the full test suite as a check, but that could take some time - that buildslave isn't the fastest in the world...
Not to worry - as I said in my previous message, I can reproduce the error
on my own XP machine.
I also noticed that running test_tarfile alone doesn't trigger the errors,
which leads me to suspect that the failure is due to some interaction with
another test getting run before test_tarfile. I'm currently trying to
determine what this test is.
I suspect that the problem is at least partially caused by the fact that
tarfile uses a default compresslevel of 9 for .tar.xz archives (rather
than the recommended value of 6). According to the man page for the xz
tool <>, using a
compresslevel of 9 can result in memory usage of up to 800MB during
compression, which is a significant fraction of the bot's 2GB of RAM.
(I suppose it would be a good idea to mention this in the documentation
for the lzma module, so users won't get bitten by this...)
Wouldn't it be better then to use a default compresslevel of 6 in tarfile? I used level 9 in my patch without a particular reason, just because I thought 9 must be better than 6 ;-)
Yes, that's a good idea. I've been testing a similar change, and it seems
to drop the peak memory usage for test_tarfile from around 810MB down to
under 200MB. It looks like 2GB genuinely isn't enough to reliably use LZMA
compression with preset=9.
You might want to use preset=None instead of explicitly saying preset=6,
though. This tells LZMAFile to use the default preset, and will allow you
to get rid of the if-statement on lines 1821-1823.
Something unrelated that I noticed in the surrounding code: gzopen and
bz2open validate the mode by testing 'len(mode) > 1 or mode not in "rw"'.
This would be simpler as 'mode not in ("r", "w")' (like you've done in
xzopen), and it would accept only "r" and "w" (but not "" or "rw").
Yes, that's much better. Thanks for the tip.
Patch looks good to me.
Ping. Windows buildbots are still failing with MemoryError because of this preset=9.
The patch looks good to me as well.
New changeset b86b54fcb5c2 by Lars Gustäbel in branch 'default':
Issue #5689: Avoid excessive memory usage by using the default lzma preset.
|
http://bugs.python.org/issue5689
|
CC-MAIN-2014-52
|
refinedweb
| 2,295
| 72.87
|
.Read David's complete post: Read the base article on superpackages:
JSR-294 Superpackages (1 messages)
In reference to an article named : The Open Road: Superpackages which address superpackages or JSR-294 in great detail, David Linsin blogs about his impressions on the subject.
- Posted by: Daniel Rubio
- Posted on: March 24 2008 02:45 EDT
Threaded Messages (1)
- restrict access to methods is needed also by Mihai Chezan on March 25 2008 19:10 EDT
restrict access to methods is needed also[ Go to top ]
I would like to have something like this: --file Aaa.java package com.example.demo; superpackage {"s1", "s2", "s3"}; public class Aaa { visibility{"s1", "s2"} void xxx() {} } --file Bbb.java package com.example.demo; superpackage {"s2"}; visibility {"s2"} class Bbb { public static doit() { Aaa a = new Aaa(); a.xxx(); } } --file Ccc.java package com.example.demo; superpackage {"s3"}; public class Ccc { public static main(String[] args) { Aaa a = new Aaa(); a.xxx(); ---> compiler error, class Ccc doesn't see the xxx method Bbb.doit(); ---> compiler error, class Ccc doesn't see class Bbb } }
- Posted by: Mihai Chezan
- Posted on: March 25 2008 19:10 EDT
- in response to Daniel Rubio
|
http://www.theserverside.com/discussions/thread.tss?thread_id=48802
|
CC-MAIN-2016-44
|
refinedweb
| 196
| 55.44
|
Share Posted January 6, 2017 Just wanted to share some nice functions I came across that can be used with the ModifiersPlugin. Doing a normal modulus calculation restarts the value at 0, which may not be what you want. 500 % 500 // => 0 This function will allow you to do a modulus operation for a min/max range. wrap(500, -100, 500); // => -100 function wrap(value, min, max) { var v = value - min; var r = max - min; return ((r + v % r) % r) + min; } And this is a modified version of that function that will make the modulus value "yoyo". mirroredWrap(600, -100, 500); // => 400 function mirroredWrap(value, min, max) { var v = value - min; var r1 = max - min; var r2 = r1 * 2; v = (r2 + v % r2) % r2; return v > r1 ? (r2 - v) + min : v + min; } With the first wrap function you can do some interesting stuff, like making an object appear in two different places, kind of like in those old asteroid games. And with the mirroredWrap, you can do stuff like creating multiple bounces with a single tween. See the Pen mRJeNX by osublake (@osublake) on CodePen . See the Pen XpbmYr by osublake (@osublake) on CodePen
|
https://staging.greensock.com/forums/topic/15737-modifiersplugin-helper-functions/
|
CC-MAIN-2022-33
|
refinedweb
| 194
| 67.08
|
Components and supplies
Necessary tools and machines
Apps and online services
About this project
All my dream is to done a full animatronic object in working condition. But it need lot of mechanism and costly too. So i plan for some thing cheap and wonderful. Then I plan it for sorting hat with the resources around me.
I use 5 servo motors and an Arduino to control this hat. I develop a custom software to record the positions in to Arduino EEPROM step by step from pc and when play it act as real. It take me a long days to plan and long times (full nights for 1 week) to finish.
Let we see how a art board, old cardboard, Waste cloth and few electronics combined with Pc to make a talking, eye blinking and bow and standing hat......
Total Amount is only 22$
Step 1: Materials and Tools Required
Materials Required
- Thick board Chat 2 Nos - 0.5$
- Old Daily Calendar Card board. - from Trash
- Old Sketche pen 5 Nos - From Trash
- Long screws and nuts. - 0.5$
- Arduino uno board. - 5$
- Servo Motors 5 Nos - 10$
- Regulated Power supply board.
- Self soldered Arduino shield board to control 6 servos.-2$
- Long Cloth ( I have only white waste Cloth if dark brown color available then no coloring problem).-Trash
- Poster Color (Dark Brown Color).- 1$
- Fevical (Paste to bind all parts)
- 12V dc power Supply- 3$
- Small Straws for Links
Tools Required
- Scale
- Scissors
- Soldering tools
- Painting brush
- PC (Computer)
-.
- Use Add button to add the sequence next to current last sequence. When press last sequence with servo position listed in the box and No of records have that count.
- Use Record button to start a fresh sequence.
- When click Add or record both button disable and set button only enable.
- Adjust the Scroll bars as required and click set then the servos move and show how it look in the hat. Then the button save is enable.,
- If you satisfy click Save. This command save the current position in the EEPROM and move to next sequence.
- If you never satisfy then change the scroll bars again and click set.
- On Click Save to save in EEPROM the Save button disable
- When all the action is complete click Run. The hat start acting.
- After click save Run, Set and save button disable and Record and add button enable.
Step 16: Testing after program
Step 17: Make a Skin
- Now the Sorting hat skeleton is ready.
- For skin I use waste dhoti. The color i have is only white, So i purchase Dark brown poster color to color the sorting hat.
- Spread the Cloth on the floor and draw a circle using thread and pen in the cloth. Draw a circle bigger than the one draw for the hot.
- Cut the cloth and saw on the open side to make the cone.
- After stretch reverse the cloth to make the stitch go inside.
- Like wise draw circle for Brim of the hat.
- Cut two clothes and stretch on the edges. Reverse the cloth to make stretch go in side.
- Insert the Brim cut in the chart board in to the cloth.
Step 18: Paste skin to the Hat
- It is the most complected and artistic work.
- Make all the links full Open apply Paste step by step to each portions and paste the cloth with the skeleton.
- While paste have the image on the mobile or pc and make flips in some places like horn bottom, eye lines like wise and paste up to bottom.
- Cut the center portion of the Brim for hat size.
- Paste the opening of the Brim to the Hat.
-
- Due to hardness of paste mouth got stuck up
- Free the mouth.
- Change the flow using program to wide open the mouth.
Step 20: Coloring
- If u use Dark brown color cloth then there is no need to color. But be care full when select the cloth, if the cloth is very thick and weight then the servo need more power.
- Color the Hat with the dark brown color.
- Tie ribbon between the hat top and the brim then allow it to hang on the back side.
- Paste two cloths on the sides of the hat to make it realistic.
- short forget to comment and encourage me friends.
Code
servocontrol.inoArduino
#include <Servo.h> #include <EEPROM.h> String inputString = ""; boolean stringComplete = false; Servo myservo3; Servo myservo5; Servo myservo6; Servo myservo9; Servo myservo10; String P1; String P2; String P3; String P4; String P5; int pos1; int pos2; int pos3; int pos4; int pos5; int rpos1[100]; int rpos2[100]; int rpos3[100]; int rpos4[100]; int rpos5[100]; int opos1; int opos2; int opos3; int opos4; int opos5; int seperator1=0; int seperator2=0; int noofrecords=0; int runstatus=0; int recpos=0; int currec=0; int pos = 0; void setup() { myservo3.attach(3); myservo5.attach(5); myservo6.attach(6); myservo9.attach(9); myservo10.attach(10); Serial.begin(9600); noofrecords=EEPROM.read(0); for(int i=0;i<noofrecords;i++) { pos=pos+1; recpos=(i*5)+1; rpos1[pos]=EEPROM.read(recpos); recpos=recpos+1; rpos2[pos]=EEPROM.read(recpos); recpos=recpos+1; rpos3[pos]=EEPROM.read(recpos); recpos=recpos+1; rpos4[pos]=EEPROM.read(recpos); recpos=recpos+1; rpos5[pos]=EEPROM.read(recpos); } runstatus=1; } void loop() { if (stringComplete) { stringComplete = false; // Serial.println(inputString); if(inputString.substring(0,6)=="Record") { EEPROM.write(0, 0); noofrecords=0; runstatus=0; Serial.println("Record"); } else if(inputString.substring(0,4)=="Save") { noofrecords=noofrecords+1; EEPROM.write(0, noofrecords); recpos=noofrecords-1; recpos=(recpos*5)+1; EEPROM.write(recpos, opos1); rpos1[noofrecords]=opos1; recpos=recpos+1; EEPROM.write(recpos, opos2); rpos2[noofrecords]=opos2; recpos=recpos+1; EEPROM.write(recpos, opos3); rpos3[noofrecords]=opos3; recpos=recpos+1; EEPROM.write(recpos, opos4); rpos4[noofrecords]=opos4; recpos=recpos+1; EEPROM.write(recpos, opos5); rpos5[noofrecords]=opos5; Serial.print("Saved"); Serial.println(noofrecords); } else if(inputString.substring(0,3)=="Add") { runstatus=0; Serial.println(noofrecords); delay(100); Serial.println("LAST"); Serial.println(rpos1[noofrecords]); Serial.println(rpos2[noofrecords]); Serial.println(rpos3[noofrecords]); Serial.println(rpos4[noofrecords]); Serial.println(rpos5[noofrecords]); } else if(inputString.substring(0,3)=="Run") { currec=0; runstatus=1; Serial.print("Run"); } else { // Serial.println(inputString); seperator1 = inputString.indexOf(','); P1=inputString.substring(0,seperator1); // Serial.println(P1); seperator1=seperator1+1; seperator2 = inputString.indexOf(',',seperator1); P2=inputString.substring(seperator1,seperator2); // Serial.println(P2); seperator1=seperator2+1; seperator2 = inputString.indexOf(',',seperator1); P3=inputString.substring(seperator1,seperator2); // Serial.println(P3); seperator1=seperator2+1; seperator2 = inputString.indexOf(',',seperator1); P4=inputString.substring(seperator1,seperator2); // Serial.println(P4); seperator1=seperator2+1; seperator2 = inputString.indexOf(',',seperator1); P5=inputString.substring(seperator1,seperator2); // Serial.println(P5); pos1=P1.toInt(); pos2=P2.toInt(); pos3=P3.toInt(); pos4=P4.toInt(); pos5=P5.toInt(); if (pos1<20) { pos1=20; }else if(pos1>90) { pos1=90; } if (pos2<20) { pos2=20; } else if (pos2>90) { pos2=90; } pos2=180-pos2; if (pos3<20) { pos3=20; } else if (pos3>90) { pos3=90; } if (pos4<20) { pos4=20; } else if (pos4>90) { pos4=90; } pos4=180-pos4; if (pos5<20) { pos5=20; } else if (pos5>90) { pos5=90; }; } } inputString = ""; } if(runstatus==1) { currec=currec+1; if (currec>noofrecords) { currec=1; delay(2000); } pos1=rpos1[currec]; pos2=rpos2[currec]; pos3=rpos3[currec]; pos4=rpos4[currec]; pos5=rpos5[currec]; Serial.println("RUNNING"); Serial.println(currec); Serial.println(pos1); Serial.println(pos2); Serial.println(pos3); Serial.println(pos4); Serial.println(pos5);; } delay(1000); } } void serialEvent() { while (Serial.available()) { char inChar = (char)Serial.read(); inputString += inChar; if (inChar == '\n') { stringComplete = true; } } }
Visual basic programVBScript
VERSION 5.00 Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX" Begin VB.Form Label2 BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Caption = "Talking Hat" ClientHeight = 5055 ClientLeft = 45 ClientTop = 435 ClientWidth = 6795 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5055 ScaleWidth = 6795 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmd_add Caption = "Add" Height = 420 Left = 120 TabIndex = 17 Top = 3870 Width = 1335 End Begin VB.CommandButton cmd_set Caption = "Set" Height = 420 Left = 1530 TabIndex = 16 Top = 3870 Width = 1335 End Begin VB.VScrollBar VScroll4 Height = 1050 Left = 915 Max = 20 Min = 90 TabIndex = 13 Top = 1140 Value = 20 Width = 315 End Begin VB.VScrollBar VScroll3 Height = 1050 Left = 3105 Max = 20 Min = 90 TabIndex = 12 Top = 1140 Value = 20 Width = 315 End Begin VB.VScrollBar VScroll2 Height = 1050 Left = 1680 Max = 20 Min = 90 TabIndex = 10 Top = 2445 Value = 20 Width = 315 End Begin VB.VScrollBar VScroll1 Height = 1050 Left = 2445 Max = 20 Min = 90 TabIndex = 8 Top = 2445 Value = 20 Width = 315 End Begin VB.TextBox txt_rectext Height = 4095 Left = 4440 Locked = -1 'True MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 4 Top = 195 Width = 2250 End Begin VB.CommandButton cmd_run Caption = "Run" Height = 420 Left = 2940 TabIndex = 3 Top = 4380 Width = 1335 End Begin VB.CommandButton cmd_save Caption = "Save" Height = 420 Left = 1530 TabIndex = 2 Top = 4380 Width = 1335 End Begin VB.CommandButton cmd_record Caption = "Record" Height = 420 Left = 120 TabIndex = 1 Top = 4380 Width = 1335 End Begin VB.VScrollBar VScroll5 Height = 1050 Left = 2085 Max = 20 Min = 90 TabIndex = 0 Top = 120 Value = 20 Width = 315 End Begin VB.Timer Timer1 Interval = 100 Left = 270 Top = 2970 End Begin MSCommLib.MSComm MSComm1 Left = 120 Top = 2910 _ExtentX = 1005 _ExtentY = 1005 _Version = 393216 CommPort = 2 DTREnable = -1 'True End Begin VB.Label Label7 Alignment = 2 'Center AutoSize = -1 'True Caption = "No of Records" Height = 195 Left = 4470 TabIndex = 15 Top = 4425 Width = 1050 End Begin VB.Label lbl_records AutoSize = -1 'True Caption = "0" Height = 195 Left = 5625 TabIndex = 14 Top = 4425 Width = 90 End Begin VB.Label Label2 Alignment = 2 'Center AutoSize = -1 'True Caption = "20" Height = 195 Left = 1740 TabIndex = 11 Top = 3555 Width = 180 End Begin VB.Label Label1 Alignment = 2 'Center AutoSize = -1 'True Caption = "20" Height = 195 Left = 2505 TabIndex = 9 Top = 3555 Width = 180 End Begin VB.Label Label5 AutoSize = -1 'True Caption = "20" Height = 195 Left = 2152 TabIndex = 7 Top = 1230 Width = 180 End Begin VB.Label Label4 AutoSize = -1 'True Caption = "20" Height = 195 Left = 982 TabIndex = 6 Top = 2310 Width = 180 End Begin VB.Label Label3 AutoSize = -1 'True Caption = "20" Height = 195 Left = 3172 TabIndex = 5 Top = 2310 Width = 180 End Begin VB.Image Image1 Height = 7485 Left = -2355 Picture = "Form1.frx":0000 Stretch = -1 'True Top = -900 Visible = 0 'False Width = 9060 End End Attribute VB_Name = "Label2" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim recrec As Boolean Dim s As String Private Sub cmd_add_Click() cmd_save.Enabled = False cmd_set.Enabled = True cmd_record.Enabled = False cmd_add.Enabled = False recrec = False MSComm1.Output = "Add" & vbCrLf For i = 1 To 2000 Next MSComm1.Output = "Add" & vbCrLf lbl_records.Caption = 0 End Sub Private Sub cmd_record_Click() cmd_save.Enabled = False cmd_set.Enabled = True cmd_record.Enabled = False cmd_add.Enabled = False MSComm1.Output = "Record" & vbCrLf For i = 1 To 2000 Next MSComm1.Output = "Record" & vbCrLf lbl_records.Caption = 0 End Sub Private Sub cmd_run_Click() cmd_set.Enabled = False cmd_save.Enabled = False cmd_run.Enabled = False cmd_record.Enabled = True cmd_add.Enabled = True MSComm1.Output = "Run" & vbCrLf End Sub Private Sub cmd_save_Click() cmd_save.Enabled = False cmd_run.Enabled = True MSComm1.Output = "Save" & vbCrLf lbl_records.Caption = Val(lbl_records.Caption) + 1 End Sub Private Sub cmd_set_Click() If Val(lbl_records.Caption) >= 75 Then MsgBox "Exit the Save limit", vbInformation, head Exit Sub End If MSComm1.Output = VScroll1.Value & "," & VScroll2.Value & "," & VScroll3.Value & "," & VScroll4.Value & "," & VScroll5.Value & "," & vbCrLf cmd_save.Enabled = True End Sub Private Sub Form_Load() MSComm1.PortOpen = True cmd_add.Enabled = True cmd_set.Enabled = False cmd_save.Enabled = False cmd_run.Enabled = False recrec = True End Sub 'Private Sub Timer1_Timer() ' s = MSComm1.Input ' If s <> "" Then ' Text1.Text = Text1.Text & s ' End If 'End Sub Private Sub Timer1_Timer() s = MSComm1.Input If s <> "" Then txt_rectext.Text = txt_rectext.Text & vbCrLf & s If recrec = False Then recrec = True lbl_records.Caption = Val(s) End If txt_rectext.SelStart = Val(Len(txt_rectext.Text)) End If End Sub Private Sub VScroll1_Change() Label1.Caption = VScroll1.Value End Sub Private Sub VScroll2_Change() Label2.Caption = VScroll2.Value End Sub Private Sub VScroll3_Change() Label3.Caption = VScroll3.Value End Sub Private Sub VScroll4_Change() Label4.Caption = VScroll4.Value End Sub Private Sub VScroll5_Change() Label5.Caption = VScroll5.Value End Sub
Author
jegatheesan
- 5 projects
- 42 followers
Published onNovember 11, 2016
Members who respect this project
you might like
|
https://create.arduino.cc/projecthub/jegatheesan/full-animatronic-sorting-hat-with-custom-software-22-433c8f
|
CC-MAIN-2019-43
|
refinedweb
| 2,051
| 60.41
|
Ticket #2175 (closed enhancement: fixed)
mako template performance problems
Description
There is a potential problem with mako template caching the way it is used by TG2. If you expose a controller method and decorate it with mako template it gets served 2 or 3 times slower than when you expose a "raw" method which uses mako.lookup.TemplateLookup? to rended template directly.
For example:
class MyController(object) @expose('mako:proj.templates.mako_speed') def automatic(self): return dict()
is 3 times slower than
from mako.template import Template from mako.lookup import TemplateLookup templates = '...full path...' mylookup = TemplateLookup( directories=[templates], # same difference with and without next line: #module_directory=templates, output_encoding='utf-8') def serve_template(templatename, **kwargs): mytemplate = mylookup.get_template(templatename) return mytemplate.render(**kwargs) class MyController(object) @expose() def manual(self): return serve_template('mako_speed.mak')
There is an example attached to this ticket. Put mako_speed.mak into your templates directory, and mako_speed.py into controllers directory. Expose MakoSpeedController? as "mako_speed" in your root controller.
Attachments
Change History
Changed 10 years ago by tvrtko.sokolovski
- attachment mako_speed.py
added
Changed 10 years ago by tvrtko.sokolovski
- attachment mako_speed.mak
added
template
comment:1 Changed 10 years ago by jorge.vargas
- Priority changed from normal to high
- Keywords profiling added
I think we should profile this, IMO it is a good task for tg2.0rc1
comment:3 Changed 10 years ago by mramm
- Summary changed from mako template caching problem to mako template performance problems
comment:6 Changed 10 years ago by faide
- Status changed from new to assigned
I was sure it was something like this but was too busy to search in details for the last few weeks.
Thanks for your work and tickets! I'll see what I can do about this ASAP.
Best regards, Florent.
comment:7 Changed 10 years ago by faide
I committed a first fix in r6275 that implements a cache for the template lookup. I'll add another cache to the get_dotted_filename function to speed things a little bit more.
Could you already test if it is better now ?
It successfully passes the tests on my machine but I unfortunately have no real Mako usage anywhere so I cannot be 100% sure of what I do :)
Florent.
comment:8 Changed 10 years ago by faide
comment:9 Changed 10 years ago by faide
As you can see we cannot inherit from the Mako TemplateLookup?, because this template lookup implies that your project is installed in an unzipped fashion which is not always the case. This led to this particular implementation.
If for any reason you want raw speed and don't care about zip safe-ness of your resulting application then you should certainly not use dotted names in templates anyway.
Thanks to both people who reported and added info about this issue. Please give us benchmark feedback here and happy TG'ing :)
Florent.
comment:10 Changed 10 years ago by tvrtko.sokolovski
It certainly helped, the numbers are:
- manually: 0.8 sec
- old mako: 4.2 sec
- new mako: 1.4 sec
But, this is a mixed blessing, because now I have to restart server each time I change a mako template, because it doesn't know how to reload changed template.
I'm going to try use_dotted_templatenames flag to use TemplateLookup?. How exactly do you enable it (which config file/section I have to modify).
comment:11 Changed 10 years ago by kikidonk
The same kind of caching logic that is applied in the original loader: should be re-implemented then, it seems quite a burden...
comment:12 Changed 10 years ago by faide
well in fact this kind of reloading based on mtime (os.stat(fname)) is quite difficult to emulate if not using file system based... But on the other hand if you are in production you won't need that time checking.
So this means we could add the same time-checking mechanism based on the environment we are in:
- in development: use the os.stat(templanefilename) to determine mtime and maybe reload from file
- in production: just ignore the time check and use only the cache...
comment:13 Changed 10 years ago by faide
as per this flag you can edit your application's config/app_cfg.py and add a line like this:
base_config.use_dotted_templatenames = False
if nothing is set in your file the default is True
WARNING: if you do this, you'll have to change the names of your templates in the controllers, but also in the templates themselves when using inheritance.
comment:14 Changed 10 years ago by faide
in r6288 I just added a system that allows you to reload your mako templates from the disk if they were modified... This will work by adding a config entry in the development.ini file:
templating.mako.reloadfromdisk = true
in the app:main section of this config file.
I recommend you do not use this option in production. And be warned this option is untested and may break badly if you use zipped egg deployment.
If you test and are happy with it I'll just update the templates for quickstart to add this option in the config template and add some docs about it.
Once this works we can begin to shave some CPU cycles here and there.
Waiting for your feedback....
comment:15 Changed 10 years ago by faide
added the config option in the default template: r6328
Please review the comments and rephrase if you think the explanations are not correct, because being the one who coded the stuff I don't see the thing as someone reading the comment for the first time and trying to figure what the option does.
If this is correct we'll close that issue and open a less urgent ticket to try and optimize the cache (we could easily shave some cycles...)
comment:16 Changed 10 years ago by faide
- Component changed from TurboGears to Documentation
putting this ticket in the documentation component so that it can be found during next Doc sprint...
comment:17 Changed 10 years ago by mramm
- Milestone changed from 2.0b6 to 2.0 RC 1
comment:18 Changed 10 years ago by faide
The attached optimization gives (on my machine in my tests) 1,6 % more speed for dotted names support with Mako (and certainly with others because it is an optimization for name lookups)
I did my test with "ab -n 10000 -c 1 ..." with and without the patch and I did the measures multiple times to make sure the measured made sense, shutting down the paste server between each measure.
1,6 % can be seen as not so much... or a lot depending on the POV.
comment:19 Changed 10 years ago by faide
For a reason I cannot explain my patch (in -u format) is not displayed correcly by trac, please click on the download original format link if you want to read it.
Changed 10 years ago by faide
- attachment dottednamesfinder.diff
added
A new patch for optimization with test_stack passing ... :)
comment:20 Changed 10 years ago by faide
I just changed my patch to fix the test_stack so that it passes all the tests :)
comment:21 Changed 10 years ago by mramm
- Status changed from assigned to closed
- Resolution set to fixed
- Milestone changed from 2.0rc1 to 2.0b6
controller
|
http://trac.turbogears.org/ticket/2175
|
CC-MAIN-2019-22
|
refinedweb
| 1,225
| 72.56
|
0
So my java class is a joke, and we're expected to learn how to do our assignments via the web...I'm a hard worker, but I'm just not good at this.
Assignment pic
There's the assignment image. I think i got how to do the first part with the adding random numbers to the list and sorting...but I can't find other resources online that help me understand the rest. Here's my code right now
import java.util.*; import java.io.IOException; import java.util.Scanner; import java.util.Random; public class LinkedListProgram { public static void main(String[] args) throws IOException { int i,number, ran; Scanner sc = new Scanner(System.in); LinkedList<Integer> list = new LinkedList<Integer>(); ListIterator li; String line; Random random = new Random(); int pick = random.nextInt(150); ListIterator listIterator = list.listIterator(); System.out.println("Enter # of nodes"); number = sc.nextInt(); if (number > 0) { for (i = 0; i < number; i++) list.add(1+ (int)(Math.random()*150)); Collections.sort(list); System.out.print(list + "\n"); System.out.println(listIterator.nextIndex()); } else System.out.println("\nnumber is less than 0\n"); } }
Thanks for any help solving this. I'm not familiar with any of this stuff, and everything I do know is based off of what I've found via google searches. I'm nowhere near as profficient at this as you may think.
|
https://www.daniweb.com/programming/software-development/threads/422054/linked-list-project
|
CC-MAIN-2017-47
|
refinedweb
| 232
| 52.66
|
Java Generics Tutorial – Example Class, Interface, Methods, Wildcards and much more
Genrics
Generics was added in Java 5 to provide compile-time type checking and removing risk of
ClassCastException that was common while working with collection classes. The whole collection framework was re-written to use generics for type-safety. Let’s see how generics help us using collection classes safely.
List list = new ArrayList(); list.add("abc"); list.add(new Integer(5)); //OK for(Object obj : list){ String str=(String) obj; //type casting leading to ClassCastException at runtime }
Above code compiles fine but throws ClassCastException at runtime because we are trying to cast Object in the list to String whereas one of the element is of type Integer. After Java 5, we use collection classes like below.
List<String> list1 = new ArrayList<String>(); // java 7 ? List<String> list1 = new ArrayList<>(); list1.add("abc"); //list1.add(new Integer(5)); //compiler error for(String str : list1){ //no type casting needed, avoids ClassCastException }
Notice that at the time of list creation, we have specified that the type of elements in the list will be String. So if we try to add any other type of object in the list, the program will throw compile time error. Also notice that in for loop, we don’t need type say we have a simple class as:
package com.journaldev.generics; public class GenericsTypeOld { private Object t; public Object get() { return t; } public void set(Object t) { this.t = t; } public static void main(String args[]){ GenericsTypeOld type = new GenericsTypeOld(); type.set("Pankaj"); String str = (String) type.get(); //type casting, error prone and can cause ClassCastException } }
Notice that while using this class, we have to use type casting and it can produce ClassCastException at runtime. Now we will use generics to rewrite the same class with generics type as shown below.
package com.journaldev.generics; public class GenericsType<T> { private T t; public T get(){ return this.t; } public void set(T t1){ this.t=t1; } public static void main(String args[]){ GenericsType<String> type = new GenericsType<>(); type.set("Pankaj"); //valid GenericsType type1 = new GenericsType(); //raw type type1.set("Pankaj"); //valid type1.set(10); //valid and autoboxing support } }
Notice the use of GenericsType class in the main method. We don’t need to do type-casting and we can remove ClassCastException at runtime. If we don’t provide the type at the time of creation, own naming conventions. Usually type parameter names are single, uppercase letters to make it easily distinguishable from java variables. The most commonly used type parameter names are:
- E – Element (used extensively by the Java Collections Framework, for example ArrayList, Set etc.)
- K – Key (Used in Map)
- N – Number
- T – Type
- V – Value (Used in Map)
- S,U,V etc. – 2nd, 3rd, 4th types method public static <T> boolean isEqual(GenericsType<T> g1, GenericsType<T> g2){ return g1.get().equals(g2.get()); } public static void main(String args[]){ GenericsType<String> g1 = new GenericsType<>(); g1.set("Pankaj"); GenericsType<String> g2 = new GenericsType<>(); g2.set("Pankaj"); boolean isEqual = GenericsMethods.<String>isEqual(g1, g2); //above statement can be written simply as isEqual = GenericsMethods.isEqual(g1, g2); //This feature, known as type inference, allows you to invoke a generic method as an ordinary method, without specifying a type between angle brackets. //Compiler will infer the type that is needed } }
Notice the isEqual method signature showing syntax to use generics type in methods. Also notice how to use these methods in our java program. We can specify type while calling these methods or we can invoke them like a normal method. Java compiler is smart enough to determine the type of variable to be used, this facility is called as type inference.
Generics Bounded Type Parameters
Suppose we want to restrict the type of objects that can be used in the parameterized type, for example in a method that compares two objects and we want to make sure that the accepted objects are Comparables. To declare a bounded type parameter, list the type parameter’s name, followed by the extends keyword, followed by its upper bound, similar like below method.
public static <T extends Comparable<T>> int compare(T t1, T t2){ return t1.compareTo(t2); }
The invocation of these methods is similar to unbounded method except that if we will try to use any class that is not Comparable, it will throw compile time error.
Bounded type parameters can be used with methods as well as classes and interfaces.
Generics supports multiple bounds also, i.e <T extends A & B & C>. In this case A can be an interface or class. If A is class then B and C should be interfaces. We can’t have more than one class in multiple bounds.
Generics and Inheritance
We know that Java inheritance allows us to assign a variable A to another variable B if A is subclass of B. So we might think that any generic type of A can be assigned to generic type of B, but it’s not the case. Lets see this with a simple program.
package com.journaldev.generics; public class GenericsInheritance { public static void main(String[] args) { String str = "abc"; Object obj = new Object(); obj=str; // works because String is-a Object, inheritance in java MyClass<String> myClass1 = new MyClass<String>(); MyClass<Object> myClass2 = new MyClass<Object>(); //myClass2=myClass1; // compilation error since MyClass<String> is not a MyClass<Object> obj = myClass1; // MyClass<T> parent is Object } public static class MyClass<T>{} }
We are not allowed to assign MyClass<String> variable to MyClass<Object> variable because they are not related, in fact MyClass<T> parent is Object.
Generic Classes and Subtyping
We can subtype a generic class or interface by extending or implementing it. The relationship between the type parameters of one class or interface and the type parameters of another are determined by the extends and implements clauses.
For example, ArrayList<E> implements List<E> that extends Collection<E>, so ArrayList<String> is a subtype of List<String> and List<String> is subtype of Collection<String>.
The subtyping relationship is preserved as long as we don’t change the type argument, below shows an example of multiple type parameters.
interface MyList<E,T> extends List<E>{ }
The subtypes of List<String> can be MyList<String,Object>, MyList<String,Integer> and so on.
Generics Wildcards
Question mark (?) is the wildcard in generics and represent an unknown type. The wildcard can be used as the type of a parameter, field, or local variable and sometimes as a return type. We can’t use wildcards while invoking a generic method or instantiating a generic class. In following sections, we will learn about upper bounded wildcards, lower bounded wildcards, and wildcard capture.
Generics Upper Bounded Wildcard
Upper bounded wildcards are used to relax the restriction on the type of variable in a method. Suppose we want to write a method that will return the sum of numbers in the list, so our implementation will be something like this.
public static double sum(List<Number> list){ double sum = 0; for(Number n : list){ sum += n.doubleValue(); } return sum; }
Now the problem with above implementation is that it won’t work with List of Integers or Doubles because we know that List<Integer> and List<Double> are not related, this is when upper bounded wildcard is helpful. We use generics wildcard with extends keyword and the upper bound class or interface that will allow us to pass argument of upper bound or it’s subclasses types.
The above implementation can be modified like below program.
package com.journaldev.generics; import java.util.ArrayList; import java.util.List; public class GenericsWildcards { public static void main(String[] args) { List<Integer> ints = new ArrayList<>(); ints.add(3); ints.add(5); ints.add(10); double sum = sum(ints); System.out.println("Sum of ints="+sum); } public static double sum(List<? extends Number> list){ double sum = 0; for(Number n : list){ sum += n.doubleValue(); } return sum; } }
It’s similar like writing our code in terms of interface, in above method we can use all the methods of upper bound class Number. Note that with upper bounded list, we are not allowed to add any object to the list except null. If we will try to add an element to the list inside the sum method, the program won’t compile.
Generics Unbounded Wildcard
Sometimes we have a situation where we want our generic method to be working with all types, in this case unbounded wildcard can be used. Its same as using <? extends Object>.
public static void printData(List<?> list){ for(Object obj : list){ System.out.print(obj + "::"); } }
We can provide List<String> or List<Integer> or any other type of Object list argument to the printData method. Similar to upper bound list, we are not allowed to add anything to the list.
Generics Lower bounded Wildcard
Suppose we want to add Integers to a list of integers in a method, we can keep the argument type as List<Integer> but it will be tied up with Integers whereas List<Number> and List<Object> can also hold integers, so we can use was added to provide type-checking at compile time and it has no use at run time, so java compiler uses type erasure feature to remove all the generics type checking code in byte code and insert type-casting if necessary. Type erasure ensures that no new classes are created for parameterized types; consequently, generics incur no runtime overhead.
For example if we have a generic class like below;
public class Test<T extends Comparable<T>> { private T data; private Test<T> next; public Test(T d, Test<T> n) { this.data = d; this.next = n; } public T getData() { return this.data; } }
The Java compiler replaces the bounded type parameter T with the first bound interface, Comparable, as below code:
public class Test { private Comparable data; private Test next; public Node(Comparable d, Test n) { this.data = d; this.next = n; } public Comparable getData() { return data; } }
Further Reading:
Generics doesn’t support sub-typing, so
List<Number> numbers = new ArrayList<Integer>(); will not compile, learn why generics doesn’t support sub-typing.
We can’t create generic array, so
List will not compile, read why we can’t create generic array?..
|
http://www.journaldev.com/1663/java-generics-tutorial-example-class-interface-methods-wildcards-and-much-more
|
CC-MAIN-2014-52
|
refinedweb
| 1,712
| 54.32
|
Basic Tools of GDI+
Introduction addition manipulation techniques that can applied to a
picture, the .NET Framework provides some other classes in the System::Drawing::Imaging
namespace, which is also part of the System.Drawing.dll library.
The Graphics Platform
To draw in GDI, you have to obtain a handle to the device context. This
is
done by declaring a variable or a pointer to HDC.
The Color To Fill Pen
The most basic tool you can use is the pen. The
GDI+ library provides a pen through the Pen class. To obtain a pen, you can declare a Pen
handle. The primary piece of information you must
specify about a pen is its color. To do this, you can use the following
constructor:
public:
Pen(Color color);
Here is an example:
System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
Color clrBlue = Color::Blue;
Pen ^ penRed = gcnew Pen(clrBlue);
}
If you have already created a pen, to change its color, you
can assign the desired color name or color value to the Pen::Color
property.
The Pen class provides more details about a pen than
that. For now, we can use a pen as simple as this one.
|
http://www.functionx.com/vccli/gdi+/introduction2.htm
|
CC-MAIN-2018-05
|
refinedweb
| 199
| 62.68
|
Take advantage of GrapeCity Documents for Excel and work with Excel documents with full feature support on Azure. Here are the steps needed to create a basic Documents for Excel web app and deploy it to Azure.
Step 1: Create a new ASP.NET Core MVC app
In Visual Studio, go to File > New > Project, and select ASP.NET Core Web Application
In the wizard that opens, select .NET Core – ASP.NET Core 2.0 – Web Application (Model-View-Controller) then click OK.
Step 2: Add reference to GrapeCity.Documents.Excel
Go to Dependencies > Manage NuGet Packages, and install the GrapeCity.Documents.Excel package.
Step 3: Clean up the Index.cshtml page
Clean up the Index.cshtml page (under Views\Home), so that it contains just this (this step is optional, as our controller will send XLSX content for this page):
Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="row"> </div>
Step 4: Modify HomeController.cs
Modify HomeController.cs (under Controllers) to generate the 'Hello, World!' Excel document.
And the following usings:
using System.IO; using GrapeCity.Documents.Excel;
Modify the Index() method like so:
public IActionResult Index() { // Create the 'Hello, World!' Excel document: var workbook = new Workbook(); var worksheet = workbook.ActiveSheet; worksheet.Range["B2"].Value = "Hello, World!"; // Save it to a memory stream: MemoryStream ms = new MemoryStream(); workbook.Save(ms, SaveFileFormat.Xlsx); ms.Seek(0, SeekOrigin.Begin); // Send it back to the web page: Response.Headers["Content-Disposition"] = "inline; filename=\"HelloWorld.xlsx\""; return new FileStreamResult(ms, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); }
Step 5: Test the app
From Visual Studio, run your app locally to make sure everything works. You should see the "Hello, World!" PDF opening in your default web browser.
Step 6: Publish the app to Azure
Go to to Build > Publish, create a new 'Microsoft Azure App Service' publish profile, select appropriate name, subscription details etc. The defaults should work just fine.
|
https://www.grapecity.com/blogs/how-to-deploy-excel-api-to-azure-in-6-steps
|
CC-MAIN-2020-05
|
refinedweb
| 316
| 53.78
|
At the beginning of 2004, I was working with a small team of Gemplus on the
EAP-SIM authentication protocol. As we were a bit ahead of the market,
our team was reassigned to work with a team of Verisign on a new
authentication method: OTP or One Time Password.
At this time, the existing one time password was a token from RSA that was using a clock to synchronize the passwords.
The lab of Versign came with a very simple but I should say very smart
concept. The OTP that you may be using with your bank or Google was born.
This is this algorithm and authentication method I describe in the following two articles. In this article, I present a complete code of the
OTP generator. It is very similar to the Javacard Applet I wrote
in 2004 when I started to work on this concept with the Versign labs.
This OTP is based on the very popular algorithm HMAC SHA. The HMAC SHA
is an algorithm generally used to perform authentication by challenge
response. It is not an encryption algorithm but a hashing algorithm that
transforms a set of bytes to another set of bytes. This algorithm is
not reversible which means that you cannot use the result to go back to
the source.
A HMAC SHA uses a key to transform an input array of bytes. The key is
the secret that must never be accessible to a hacker and the input is
the challenge. This means that OTP is a challenge response
authentication.
The secret key must be 20 bytes at least; the challenge is usually a
counter of 8 bytes which leaves quite some time before the value is
exhausted.
The algorithm takes the 20 bytes key and the 8 bytes counter to create
a 8 digits number. This means that there will obviously be duplicates
during the life time of the OTP generator but this doesn't matter as no duplicate can occur consecutively
and an OTP is only valid for a couple
of minutes.
There are few reasons why this is a very strong method.
Those few characteristics make the OTP a strong authentication protocol. The weakness in an authentication is usually the
human factor. It is difficult to remember many complex passwords, so
users often use the same one all across the internet and not really
a strong one. With an OTP, you don't have to remember a password,
the most you would have to remember would be PIN code (4 to 8 digits)
if the OTP token is PIN protected. In the case of an OTP sent by a
mobile phone, it is protected by your phone security. A PIN is short but
you can't generally try it more than 3 times before the token is locked.
The weakness of an OTP if there is one, is the media used to generate
or receive the OTP. If the user loses it, then the authentication could
be compromised. A possible solution would be to protect this device
with a biometric credential, making it virtually totally safe.
The code of the OTP generator follows:
public class OTP
{
public const int SECRET_LENGTH = 20;
private const string
MSG_SECRETLENGTH = "Secret must be at least 20 bytes",
MSG_COUNTER_MINVALUE = "Counter min value is 1";
public OTP()
{
}
private static int[] dd = new int[10] { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 };
private byte[] secretKey = new byte[SECRET_LENGTH]
{
};
private ulong counter = 0x0000000000000001;
private static int checksum(int Code_Digits)
{
int d1 = (Code_Digits/1000000) % 10;
int d2 = (Code_Digits/100000) % 10;
int d3 = (Code_Digits/10000) % 10;
int d4 = (Code_Digits/1000) % 10;
int d5 = (Code_Digits/100) % 10;
int d6 = (Code_Digits/10) % 10;
int d7 = Code_Digits % 10;
return (10 - ((dd[d1]+d2+dd[d3]+d4+dd[d5]+d6+dd[d7]) % 10) ) % 10;
}
/// <summary>
/// Formats the OTP. This is the OTP algorithm.
/// </summary>
/// <param name="hmac">HMAC value</param>
/// <returns>8 digits OTP</returns>
private static string FormatOTP(byte[] hmac)
{
int offset = hmac[19] & 0xf ;
int bin_code = (hmac[offset] & 0x7f) << 24
| (hmac[offset+1] & 0xff) << 16
| (hmac[offset+2] & 0xff) << 8
| (hmac[offset+3] & 0xff) ;
int Code_Digits = bin_code % 10000000;
int csum = checksum(Code_Digits);
int OTP = Code_Digits * 10 + csum;
return string.Format("{0:d08}", OTP);
}
public byte[] CounterArray
{
get
{
return BitConverter.GetBytes(counter);
}
set
{
counter = BitConverter.ToUInt64(value, 0);
}
}
/// <summary>
/// Sets the OTP secret
/// </summary>
public byte[] Secret
{
set
{
if (value.Length < SECRET_LENGTH)
{
throw new Exception(MSG_SECRETLENGTH);
}
secretKey = value;
}
}
/// <summary>
/// Gets the current OTP value
/// </summary>
/// <returns>8 digits OTP</returns>
public string GetCurrentOTP()
{
HmacSha1 hmacSha1 = new HmacSha1();
hmacSha1.Init(secretKey);
hmacSha1.Update(CounterArray);
byte[] hmac_result = hmacSha1.Final();
return FormatOTP(hmac_result);
}
/// <summary>
/// Gets the next OTP value
/// </summary>
/// <returns>8 digits OTP</returns>
public string GetNextOTP()
{
// increment the counter
++counter;
return GetCurrentOTP();
}
/// <summary>
/// Gets/sets the counter value
/// </summary>
public ulong Counter
{
get
{
return counter;
}
set
{
counter = value;
}
}
}
The methods FormatOTP() and checksum() are the heart of the OTP
algorithm. Those methods transform the result of the hmacsha into an 8
digits OTP.
FormatOTP()
checksum()
The attached code also contains an implementation of the HMAC SHA
algorithm. It is of course possible to use the standard hmacsha of the
.NET Framework but the code I provide in fact used a demo in a
prototype of smart card that was running a .NET CLR. At the time I
wrote this code, the cryptography namespace was not yet implemented by
the card.
This way, you can also see how a hmacsha algorithm is implemented.
There are usually 2 ways to perform an authentication with an OTP. I'm
going to describe the real case of an authentication to an online
banking site. I just want to be explicit with something. You cannot use
what I'm going to describe in this post to hack into a banking site! On
the contrary after reading this you should understand why using an OTP
as a second factor authentication is extremely secure.
The OTP by itself is already very secure for at least the 2 following reasons:
The second characteristic is very important in term of security. An OTP depends on 2 parameters:
Even if a hacker intercepts millions of OTP the algorithm is not
reversible which means that even if you know the key you can't go back
to the counter that was used to generate the OTP. So without the key
and the counter, it is virtually impossible even with millions of OTP
to find a pattern to guess the key and the current counter value.
Like many security protocols, the strength of the OTP is given by the
quality of the cryptography algorithm used, in this case HMACSHA1 which
is a proven challenge response algorithm. An other HMAC algorithm can
be used in place of HMACSHA as encryption algorithm have to become
stronger when CPU power is increasing. This can be done by increasing
the size of the key or by redesigning the algorithm itself.
OTP are usually used to perform authentication or to verify a
transaction with a credit card. In the case of a transaction an OTP is
sent to the mobile phone of the user, for an authentication if is
possible to use either a secure token or to request an OTP to be send
to the user phone.
This is usually the authentication method used when a transaction is
verified with an OTP. The bank system sends you an OTP and you then
have few minutes to enter this OTP. This mechanism doesn't need any
synchronization process as the OTP is originally generated by the
server and send to a third party device. The server expects that you
type the correct OTP within generally 2 mns. If you fail to do it, you
just ask a new OTP and then enter it within the given time.
When a system supports both authentication methods, it means that the
back-end has 2 different keys and counters; one pair for the OTP token
and one pair for the OTP transmitted by SMS.
The original product I worked on when we implemented one of
the first versions of the OTP in a Javacard was using an OTP token with a
screen or a mobile phone with a card applet to generate the OTP. In this model
both the server and the authentication token have to generate an OTP that must
be synchronized.
The process is the following: The user generates an OTP with
his token, type it and press OK. The server receives the OTP generated by the
token, it increments the counter and generates a new OTP.
This is where there is a possible synchronization issue.
Synchronization issues
If the user enters the correct OTP, then the server when it
increments the counter and calculate the OTP, the authentication will be
successful.
Now there could be few scenarios that could lead to a
desynchronization of the server counter and the authentication mechanism won't
work. In some cases it could be possible to resynchronize automatically the
counter but in some cases the user would have to resynchronize the server
counter using a specific procedure.
Few scenarios of desynchronization could arise:
If the OTP given by the user doesn't match the one of the
server, the server can try to auto-resynchronize itself by trying few counters
around the expected counter. In our server we would use 10 values around the
nominal counter value. If the synchronization cannot be done, the server would
retain the current counter value in order not desynchronize the server further.
However the server would have to implement a strategy to
inform that the server and token are totally desynchronized and a manual
synchronization must be performed.
Manual synchronization process
The server can propose a manual synchronization
process to the user. The OTP numbers are only 8 digits generated by the hash of
8 bytes counter and formatting a 20 bytes result. This means that it is
possible to get twice the same OTP for 2 different counter values. So
attempting synchronization with only one OTP value is not reliable. A manual
resynchronization process needs the user to enter 2 consecutive OTP, and then
the server can try to find the requested sequence as the probability to get the
same sequence of 2 OTPs for different counter values is extremely low if not
zero.
You can get the source code of the project from the ZIP files
attached to the article or you can follow it on github
where it will be updated regularly as this is a public repository.
OTP is a popular and quite simple authentication method; I hope those
articles will help you understand how it works behind the scenes.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
General News Suggestion Question Bug Answer Joke Rant Admin
Man throws away trove of Bitcoin worth $7.5 million
|
http://www.codeproject.com/Articles/592275/OTP-One-Time-Password-Demystified
|
CC-MAIN-2013-48
|
refinedweb
| 1,816
| 58.32
|
On 4-Aug-04, at 3:44 PM, Asko Kauppi wrote:
In the spirit of current library naming convention, I propose 'ext.*' to be the namespace for such non-ANSI C extensions.
ext.delay() ext.osx.applescript()
..and so on
um, why?
* os.delay(t, interruptable)
sleeps for approximately t seconds. Returns a true value; if the return value is numeric, it will be the actual duration of the sleep. If the second argument is a true value, the function may return earlier than the indicated time interval as the result of a signal being received.
If this function fails, it returns nil plus a string describing the error. In particular, os.delay(0, true) will return an error if the operating system is not capable of interrupting delays, and os.delay(0) will return an error if the os library does not implement delay.
Now, if this interface is accepted, then it can be implemented to that interface to some extent on any OS which has that facility. Platform independent code can test:
if not os.delay or not os.delay(0) then -- perhaps implement it as a busy loop end
if not os.delay(0, true) then -- make sleep times shorter -- end
In fact, if it passed the final stamp of approval, the interface could be added to the standard os library, always returning an error.
Rici
PD: In regard to applescript, which strikes me as an interesting project, I would have thought that osx.applescript would be sufficiently long as a package name. But that would be a true extension library, with no expectation of it being implemented on other OS's until someone figures out that it would be cool to implement Applescript on another platform.
In reply to your other question, do I oppose platform-independence in itself, my answer is no, I think it is a good idea. I just think it is not usually done very well.
On the other hand, GUI libraries which abstract away all the cool things about the Mac OS X interface do bug me. :)
|
http://lua-users.org/lists/lua-l/2004-08/msg00068.html
|
crawl-001
|
refinedweb
| 346
| 64.2
|
Breaking Changes in the Visual C++ 2005 Compiler
This topic discusses the behavior changes in Visual C++ 2005 that can cause code that worked in a previous release to either not compile, or to behave differently at run time.
For more information on new features, see Changes in Visual C++ 2005 and Earlier Editions, Changes in the Visual C++ 2005 Libraries, and Changes in Visual C++ 2005 Compiler, Language, and Tools.
- Pointer-to-members now require qualified name and &
Code written for previous versions of the compiler that just used the method name will now give Compiler Error C3867 or Compiler Warning C4867. This diagnostic is required by Standard C++. Now, to create a pointer to a member function, the address of operator (&) must be used with the fully qualified name of the method. Not having to use the & operator and the fully qualified name of the method can lead to logic bugs in code due missing parentheses in function calls. Using the function's name without an argument list results in a function pointer which is convertible to several types. This code would have compiled, leading to unexpected behavior at runtime.
- Class must be accessible to a friend declaration
Visual C++ compilers prior to Visual C++ 2005 allowed a friend declaration to a class that was not accessible in the scope of the class containing the declaration. Now, the compiler will give Compiler Error C2248. To resolve this error, change the accessibility of the class specified in the friend declaration. This change was made to comply with the C++ standard.
- __int asm 3 now compiles to native
When compiled with /clr, __asm int 3 did not cause native code to be generated; the compiler translated the instruction to a CLR break instruction. In Visual C++ 2005, __asm int 3 now results in native code generation for the function. If you want a function to cause a break point in your code and if you want that function compiled to MSIL, use __debugbreak. For more information, see __asm and /clr (Common Language Runtime Compilation). This change was made to be more deterministic about when to generate native code versus managed code; inline assembly code should generate native code.
- Explicit specialization not allowed as a copy constructor/copy assignment operator
Code that depends on an explicit template specialization for a copy constructor or copy assignment operator will now get Compiler Error C2299. Standard C++ prohibits this. This change was made for conformance reasons, to make code more portable.
- Unspecialized class template can't be used as a template argument in a base class list
Using an unspecialized template class name in the base class list for a class definition will result in Compiler Error C3203. It is illegal to use an unspecialized template class name as a template parameter in a base class list. Explicitly add the template type parameters to the template class name when using it as a template parameter in a base class list. This change was made for conformance reasons, to make code more portable.
- A using declaration of nested type no longer allowed
Code that has a using declaration to a nested type will now generate Compiler Error C2885. To resolve fully qualify references to nested types, put the type in a namespace, or create a typedef. This change was made for conformance reasons, to make code more portable.
- Compiler does not allow const_cast to down cast under /clr:oldSyntax
Prior to Visual C++ 2005 the Visual C++ compiler allowed the const_cast Operator to down cast when compiling source code that uses Managed Extensions for C++ syntax. Performing a down cast with const_cast now results in Compiler Error C2440. To resolve, use the correct cast operator (for more information, see Casting Operators). This change was made for conformance reasons.
- Compiler disallows forward declaration of a managed enum
Prior to Visual C++ 2005 the Visual C++ compiler allowed forward declarations of managed enums. Now, declaring and not defining a managed enum when compiling with any form of /clr will result in Compiler Error C2599. To resolve, always define managed enums at declaration. This change was made because forward declarations of managed enums were not always guaranteed to work correctly: the compiler cannot correctly identify the underlying type of the enum. Also the C++ Standard does not allow enum declarations.
- /YX compiler option is removed
/YX generated automatic pre-compiled headers support. It was used by default from the development environment. If you remove /YX from your build configurations and replace it with nothing, it can result in faster builds. In addition to the possibility of unexpected behavior with /YX, it is preferable to use /Yc (Create Precompiled Header File) and /Yu (Use Precompiled Header File), which give you more control on how precompiled headers are used.
- /Oa and /Ow compiler options are removed
/Ow and /Oa compiler options have been removed but will be silently ignored. Use the noalias or restrict __declspec modifiers to specify how the compiler does aliasing.
- /Op compiler option is removed
/Op compiler option had been removed. Use /fp (Specify Floating-Point Behavior) instead.
- /ML and /MLd compiler options have been removed
Visual C++ no longer supports single-threaded, statically linked CRT library support. Use /MT and /MTd instead. See C Run-Time Libraries for more information.
- /G3, /G4, /G5, /G6, /G7, and /GB compiler options have been removed
The compiler now uses a blended model that attempts to create the best output file for all architectures.
- /Gf has been removed
Use /GF (Eliminate Duplicate Strings) instead. /GF puts pooled strings into a read-only section, which is safer than the writeable section, where /Gf added them.
- /clr is not compatible with /MT
There is no support in the C Runtime Library to statically link to a managed application. All managed applications have to be dynamically linked (/MD). For more information on restrictions on using /clr, see /clr Restrictions.
- /GS is now on by default
Buffer overflow checking is now on by default. You can turn buffer overrun checking off with /GS-. See /GS (Buffer Security Check) for more information.
- /Zc:wchar_t now on by default
This is Standard C++ behavior; a wchar_t variable will default to the built in type instead of a short unsigned integer. This change will break binary compatibility when client code is linked with libraries that were compiled without /Zc:wchar_t (LNK2019). In that case, use /Zc:wchar_t- to revert to the old, non-standard behavior. This change was introduced to create conformant code by default.
For more information, see /Zc:wchar_t (wchar_t Is Native Type).
- /Zc:forScope now on by default
This is Standard C++ behavior; code that depends on the use of a variable declared in a for loop after the for loop scope has ended will now fail to compile. Use /Zc:forScope- to revert to the old, non-standard behavior. This change was introduced to create conformant code by default.
For more information, see /Zc:forScope (Force Conformance in for Loop Scope).
- Enforce parameter checking for Visual C++ attributes
Code that passes named attributes to the attribute constructor in quotes when the type is not a string and without quotes when the type is a string will now give Compiler Error C2065 or Compiler Warning (level 1) C4581. Previously all compiler attributes were parsed as strings, and if needed, the compiler inserted the missing quotes. Attribute support was enhanced by adding parameter checking validation. This will prevent unexpected behavior due to incorrect arguments to an attribute constructor.
For this release you cannot have a multi-byte character string (MBCS) in any argument to an attribute which takes an implicit string as an argument, even if the string is quoted (doing so can result in a corrupt .idl file). The workaround is as follows:
- Compiler now requires same template specification for multiple declarations of the same type.
If you have a forward declaration of a type so that you can create friends to that type, for example, the template specification of the type must be the same on all declarations for the type. Otherwise, the compiler will issue Compiler Error C2990.
- uuid attribute can no longer target managed types
The uuid (C++ Attributes) attribute was allowed on a user-defined attribute using Managed Extensions for C++, but will now generate Compiler Error C3451. Use GuidAttribute instead.
- Syntax change for passing managed arrays to custom attributes
The type of the array is no longer deduced from the aggregate initialization list. The compiler now requires you to specify the type of the array as well as the initializer list. The old syntax will now result in Compiler Error C3104. This change was required because the compiler could not always correctly deduce the array type from the aggregate initialization list.
- Compiler will not inject int as the default type in declarations
Code that is missing the type in a declaration will no longer default to type int the compiler will generate Compiler Warning C4430 or Compiler Warning (level 4) C4431. Standard C++ does not support a default int and this change will ensure that you get the type you really want.
- dynamic_cast has enhanced conformance to the C++ standard.
The C runtime library now does a dynamic_cast runtime check to ensure the compile-time type of the expression being cast refers to a public base class sub-object of either the cast target type (for down-cast) or most-derived object type (for cross-cast). For more information, see Breaking Changes in dynamic_cast.
- An rvalue cannot be bound to a non-const reference.
An rvalue cannot be bound to a non-const reference. In previous versions of Visual C++, it was possible to bind an rvalue to a non-const reference in a direct initialization. This code now generates Compiler Warning (level 1) C4350.
- Value types no longer have a default constructor emitted, this can cause type initializers to run at different points
Prior to Visual C++ 2005 static constructors (type initializers) in value types were run when an instance of the value type was created. To ensure that static constructors are run, access a static data member or (/clr:oldSyntax only) define an instance constructor. Not providing a default constructor for value types was done because the common language runtime does not guarantee it will always call a default constructor. Also, not providing a default constructor for value types improves performance.
- Boxed value types are now read only in verifiable (/clr:safe) contexts.
The common language runtime no longer allows modifying a boxed value type when compiling a verifiable assembly. The compiler now gives Compiler Warning C4972 when this is detected.
C4792 is only given if you change the value of the underlying value object via boxed value object. The error will not occur if you change a copy of the value object (for example, changing a boxed object)
- Native types are private by default outside the assembly
Native types now will not be visible outside the assembly by default. For more information on type visibility outside the assembly, see Type Visibility. This change was primarily driven by the needs of developers using other, case-insensitive languages, when referencing metadata authored in Visual C++.
- /clr now accepts new CLR syntax for Visual C++
Prior to Visual C++ 2005, /clr compiled Managed Extensions for C++ syntax. /clr now compiles the new CLR syntax and ./clr:oldSyntax compiles Managed Extensions for C++ syntax. For more information on /clr, see /clr (Common Language Runtime Compilation). For more information on the new syntax, see Language Features for Targeting the CLR.
- /clr no longer compiles C source code files
Prior to Visual C++ 2005, you could compile C source code files with /clr, however this will now result in Command-Line Error D8045. To resolve, change the file extension to .cpp or .cxx, or compile with /TP or /Tp. See /Tc, /Tp, /TC, /TP (Specify Source File Type) for more information.
- MSIL changes when testing for equality
See How to: Test for Equality (C++/CLI) for more information.
|
https://msdn.microsoft.com/en-US/library/ms177253(v=vs.90).aspx
|
CC-MAIN-2015-48
|
refinedweb
| 2,006
| 53.1
|
Before apr 1.0 is cast in stone any chance public enums and defines will get
sensible names?
e.g. take a look at:
typedef enum {
APR_NOFILE = 0, /**< no file type determined */
APR_REG, /**< a regular file */
APR_DIR, /**< a directory */
APR_CHR, /**< a character device */
APR_BLK, /**< a block device */
APR_PIPE, /**< a FIFO / pipe */
APR_LNK, /**< a symbolic link */
APR_SOCK, /**< a [unix domain] socket */
APR_UNKFILE = 127 /**< a file of some other unknown type */
} apr_filetype_e;.
Same goes for defines, for example:
#define APR_UREAD 0x0400 /**< Read by user */
#define APR_UWRITE 0x0200 /**< Write by user */
#define APR_UEXECUTE 0x0100 /**< Execute by user */
#define APR_GREAD 0x0040 /**< Read by group */
#define APR_GWRITE 0x0020 /**< Write by group */
#define APR_GEXECUTE 0x0010 /**< Execute by group */
#define APR_WREAD 0x0004 /**< Read by others */
#define APR_WWRITE 0x0002 /**< Write by others */
#define APR_WEXECUTE 0x0001 /**< Execute by others */
There are all related to files, why pollute the namespace with such short
names and not fix them to have a sensible prefix similar to above suggestion?
/^APR_FILETYPE_/ as in APR_FILETYPE_UREAD.
Further down in the same file we find:
#define APR_FINFO_LINK 0x00000001 /**< Stat the link not the file itself if
it is a link */
#define APR_FINFO_MTIME 0x00000010 /**< Modification Time */
#define APR_FINFO_CTIME 0x00000020 /**< Creation Time */
#define APR_FINFO_ATIME 0x00000040 /**< Access Time */
...
which looks great!
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker mod_perl Guide --->
mailto:stas@stason.org
|
http://mail-archives.apache.org/mod_mbox/apr-dev/200405.mbox/%3C40AEA6AC.40005@stason.org%3E
|
CC-MAIN-2018-34
|
refinedweb
| 216
| 53.14
|
This document describes how you protect the API endpoints for your application services that run in Anthos clusters. It includes an overview of the considerations that you need to make when exposing API endpoints,
When you deploy an application on Anthos clusters, you might need to expose the application's API endpoints to customers, to partners, or to other applications that run outside the cluster. It's important to protect these endpoints so that they're available and accessible only to authorized users and by services that you designate.
Before you expose API endpoints, you must understand the flows and operations that you want to permit into the application, within the application, and out of the application. You need to consider the following:
- Whether other services within the cluster need access to your service.
- What identities will be accessing your API endpoints.
- How authentication will be managed.
- How resources will be consumed.
- How you can help defend against DDoS attacks.
This blueprint recommends a defense-in-depth approach that starts at the edge of the cluster and provides layers of protection for services within the cluster.
The content in the protecting-api-endpoints directory in the GitHub repository that is associated with this blueprint provides instructions on how to configure the security controls that you need in order to protect your API end points.
Understanding the security controls that you need
This section discusses the controls that you must apply to help protect your API endpoints.
Apigee hybrid
Applying policies to your API endpoints
Apigee hybrid, a full-featured API management platform, provides controls to manage security, rate limiting, quota, and the analytics of API endpoints that are deployed across your clusters. The API runtime planes are deployed on Anthos clusters to process your API traffic, giving you control of runtime capabilities such as message transformation, traffic management, and OAuth.
In this hybrid deployment model, the runtime planes are tethered to the Apigee management plane in Google Cloud. As a result, you can take advantage of the features and scale of the cloud to control and manage your APIs across multiple runtime planes that are deployed to Anthos clusters.
When you expose API proxies on Apigee, you can configure the following built-in policies to help secure the API endpoints and further manage the flow of traffic to your backend systems:
- OAuth JWT, and JWS policies can be used to build your OAuth 2.0 and OpenID Connect flows. For more information, see the OAuth for Apigee home page.
- BasicAuthentication and VerifyAPIKey policies can be used for less complex authentication or when client identification alone is sufficient.
- JSONThreatProtection, XMLThreatProtection, and RegularExpressionProtection policies can help protect against API requests that could overwhelm parsers or that could be attempting content-level application attacks. You configure these policies to set the upper boundaries of known payload structures and to reject potentially malicious data.
- SpikeArrest policies can smooth the rate of traffic that's sent to your backend endpoints, which helps protect against sharp traffic spikes.
- Quota policies can impose quotas on your API consumers. This ensures that they stay within your traffic entitlements.
For more information about available policies, see the policy reference overview page.
In addition to proxy-level security configurations, Apigee allows for other platform- and environment-scoped security controls such as the following:
- Masking sensitive data from trace sessions.
- Storing sensitive data as Kubernetes Secrets.
- Using encrypted key-value maps (KVM) to create, read, update, and delete short-lived dynamic data at runtime.
In addition to using the application-layer security policies that are configured in API proxies, you can configure transport-layer security controls to secure connectivity to your backend systems. For example, you can define target servers to establish mutual TLS (mTLS) connections with backend systems. You can use the Apigee APIs to automate these configuration changes, including the rotation of certificates and keys used for mTLS connections. For more information about connectivity options and related patterns, see Apigee Southbound Connectivity Patterns on the Apigee site.
Apigee hybrid uses HTTPS and OAuth to secure the connections between its own components and the Apigee management plane. Components of the runtime plane authenticate against the Apigee APIs that are available on the management plane, using service accounts that are granted permissions following the principle of least privilege..
Identity Platform
Adding identity and access management functionality to applications
Identity Platform is a customer identity and access management (CIAM) platform that helps you add identity and access management to your applications. It helps protect user accounts and scale on Google Cloud. Identity Platform allows you to authenticate to your apps and services, like multi-tenant SaaS applications, mobile and web applications, APIs, and more.
Google Cloud Armor
Protecting against DDoS attacks and enforcing Layer 7 security policies for your application endpoints
Google Cloud Armor works with the Cloud Load Balancing infrastructure. It provides always-on attack detection and mitigation at the edge, and it provides a defense-in-depth approach to protecting endpoints that are deployed on Google Cloud, in a hybrid deployment, or in a multi-cloud architecture.
You can use a flexible rules language to create rules using any combination of Layer 3 through Layer 7 parameters and geolocation to protect your deployment. In addition, you can use predefined rules to defend against cross-site scripting (XSS) and SQL injection..
Bringing it all together
For protecting API endpoints for your applications that run in Anthos clusters, Anthos Service Mesh and Apigee hybrid serve separate purposes and provide complementary capabilities. Anthos Service Mesh is for service management, whereas Apigee is for API management. Anthos Service Mesh enables service-to-service communication and security within a cluster. A service mesh is business-function independent. In contrast, an API management platform like Apigee lets you define how you want your APIs exposed, managed, and consumed at scale.
You can use the controls described in this document to protect API endpoints for services running in Anthos clusters that are deployed on-premises, on Google Cloud, or across other public clouds.
For services running on-premises
The following diagram illustrates how you use the controls discussed in this blueprint for applications that run on-premises. (In the diagram, ASM refers to Anthos Service Mesh.)
When you manage your applications on premises, make your APIs accessible only through Apigee API proxies, without an alternative route to bypass Apigee. You use Apigee hybrid to help secure and control the traffic that is allowed to reach the Anthos Service Mesh of backend services that run in your Anthos cluster.
Note the following about this configuration:
- This architecture consists of two Anthos clusters on VMware user clusters. One hosts the Apigee hybrid runtime plane, and the other runs your services (application workloads).
- The load balancer in front of your Apigee hybrid cluster acts as a proxy and forwards client requests to the Apigee hybrid runtime plane. The runtime plane invokes the appropriate API proxy to process the request and to execute other policies that you might have configured.
- The API proxy uses its target configuration to route requests to the ingress of your application workloads cluster, using the load balancer that's in front of your application workloads cluster..
For services running on Google Cloud
The following diagram illustrates the controls you use to protect the API endpoints for applications that are deployed to an Anthos cluster on Google Cloud. (In the diagram, ASM refers to Anthos Service Mesh.)
To protect the exposed APIs for these services, you use Google Cloud Armor in conjunction with an Apigee hybrid runtime plane that runs in GKE. Google Cloud Armor determines whether incoming API traffic should be allowed at the edge. Requests are blocked if a Google Cloud Armor security policy produces a deny decision.
Note the following about this configuration:
- This architecture consists of two GKE clusters. One hosts the Apigee hybrid runtime plane, and the other runs your services (application workloads).
- Requests are first evaluated by Google Cloud Armor. If this results in an allow decision, the request is forwarded from the Google Cloud load balancer to the Apigee hybrid runtime plane in GKE.
- The Apigee hybrid runtime plane invokes the appropriate API proxy to process the request and to execute other policies that you might have configured.
- The API proxy uses its target configuration to route requests to the ingress of your application workloads cluster, using an internal Google Cloud load balancer..
Steps to apply the controls
The controls discussed earlier apply to both Anthos clusters and Anthos clusters on VMware. To integrate the controls discussed in this guide, map out their scope and the stage at which they need to be configured, as described in the steps that follow.
Create a GKE cluster to deploy Vault by using the guidance in the applicable cluster hardening guide (GKE or Anthos clusters on VMware). When you create your cluster, be sure you follow the hardening guide and use the
--enable-network-policyflag; network policies are required. This step lets you implement further traffic restrictions at the Pod level.
Install Anthos Service Mesh in the cluster that's running your application services.
Configure Anthos Service Mesh features to protect your services:
- Annotate the namespaces in your cluster where your application services are running to enable auto-injection of the sidecar proxy. Because sidecars are injected when Pods are created, you must restart any Pods that are already running in order for the change to take effect.
- Use authorization policies to define which traffic can pass within the service mesh, and use gateways to define which traffic can enter or leave the service mesh. Use network policies to ensure that traffic cannot bypass your egress gateways.
- Enable mutual TLS for service-to-service authentication based on identities provided by Anthos Service Mesh.
- Annotate the
istio-ingressgatewayservice to configure an internal load balancer. You do this so that the cluster that runs Apigee hybrid can route traffic to the services in this cluster through the internal load balancer.
Create and configure your cluster to run Apigee hybrid using the guidance in the applicable guide (GKE or Anthos clusters on VMware).
When you install your Apigee hybrid runtime plane in an Anthos cluster on Google Cloud, configure Google Cloud Armor security policies. These policies help protect the Apigee hybrid runtime plane that runs on GKE.
Configure Apigee hybrid to provide external authentication, quotas, and overall API policy management. For guidance on how to implement common policies to protect APIs, see the content in the protecting-api-endpoints directory in the GitHub repository that's associated with this blueprint.
Configure firewall rules to ensure that only the Apigee hybrid runtime is able to reach the cluster that runs your application services, using the configured internal load balancer.
|
https://cloud.google.com/architecture/anthos-protecting-api-endpoints-blueprint?hl=zh-tw
|
CC-MAIN-2021-25
|
refinedweb
| 1,792
| 51.07
|
useful to apply to a home surveillance camera, for example.
Prerequisites:
- You should already be familiar with the Raspberry Pi board – read Getting Started with Raspberry Pi
- You should have the Raspbian or Raspbian Lite operating system installed in your Raspberry Pi
- You can read this post for an introduction to the Raspberry Pi Camera V2 module
Enable the Rasperry Pi Camera Module
If you’re using the Raspberry Pi Camera Module, you need to enable the camera software in your Raspberry Pi in order to use it. In the Desktop environment, go to the Raspberry Pi Configuration window under the Preferences menu, open the Interfaces tab and enable the Camera as shown in figure below.
Or, in the Terminal window, type the following command:
You should see the Raspberry Pi software configuration tool. Select the Interfacing Options:
Enable the camera and reboot your Pi:
Find the Raspberry Pi IP address
To access your video streaming web server, you need to know your Raspberry Pi IP address. For that, use the following command:
You’ll be given a bunch of information, including your Raspberry Pi IP address. In my case, the RPi IP address is 192.168.1.112.
Connect the camera
Connecting the Raspberry Pi Camera Module is easy. With the Pi shutdown, connect the camera to the Pi CSI port as shown in the following figure. Make sure the camera is connected in the right orientation with the ribbon blue letters facing up as shown in the next figure.
Writing the script
The script for video streaming is shown below. You can find this script at the official PiCamera package documentation.
Create a new file called rpi_camera_surveillance_system.py:
Copy the following code to your newly created file:
# Web streaming example # Source code from the official PiCamera package # import io import picamera import logging import socketserver from threading import Condition from http import server</center> </body> </html> """ class StreamingOutput(object): def __init__(self): self.frame = None self.buffer = io.BytesIO() self.condition = Condition() def write(self, buf): if buf.startswith(b'\xff\xd8'): # == '/':',()
To save your file press Ctrl+X, type Y and Enter.
Accessing the video streaming
After writing the scrip, you can run it using Python 3. Run the next command:
Once the script is running, you can access your video streaming web server at: Replace with your own Raspberry Pi IP address, in my case
You can access the video streaming through any device that has a browser and is connected to the same network that your Pi.
You can use your Pi to monitor your home as a surveillance camera:
Wrapping up
I hope this project was useful! You could easily upgrade this home surveillance device to record video or notify you when motion is detected.
We also have a project on how to build a complete CCTV system with the Raspberry Pi using MotionEyeOS. Feel free to take a look..
160 thoughts on “Video Streaming with Raspberry Pi Camera”
excellent tutorial! I have it running since about a couple of minutes… and it works fine. Thanks!
Hi André.
We’re glad it works!
Thanks for your support.
Regards
Sara 🙂
thank you very much for this tutorial
Thanks for your support! 🙂
Hi Sara,
I am contacting you in regards to your “Video Streaming with Raspberry Pi Camera”. Article.
How can I stream and objects’ detection video? At the moment I can only see this through the HDMI output of the Raspberry pi.
Could you help? I can supply the code for a better reference
Thanks!!!
Excellent article guiding the new builder . I successfully built the project at one attempt and monitoring my house.
Thank you
Hi!Thank you!
We’re glad it worked! 🙂
hi
I would save video in 2hours in this code python
what should I do???????????
Hi.
This code is not prepared to record video.
You can take a look at this section “Recording video into a file” in this blog post
you have put it in aloop like
while true:
…………………..your code
sleep(x)//in seconds
Exceptionally easy. I have this running on a Raspberry Pi Zero w/ Wifi, it will be installed into a Pine Wood Derby Car to stream its run live to a computer set up during the race. I think the scouts are going to love this. What is even cooler, is that the car will be within the 5 oz needed to race! Even better, there is very little Lag on the fed. I am very impressed!!!!
Can you please guide me as to how I’d make a separate html file, in the code the html code is written with the python code. I want to add style.css so I can make my website cool. I’ve been trying myself but I can not link the html file with the py file
Hi. I’ll suggest something, but I’m not sure if it will work. I haven’t tested this method with this example. I’ve only tested using Python. It worked fine.
– Create your html text in a separated file. For example test.html. The file should be located on the same folder that your python script.
– Then, in your Python code, read the content of the html file and save it into the PAGE variable (which is the variable that contains the html content in the code). Here’s a snippet example that reads the content of a file and saves it in the text variable.
file = open(‘test.html’, ‘r’)
text = file.read().strip()
file.close()
I hope this helps.
This looks great, about to try it on my pi, but what about a password? Because if I have this monitoring my home, will someone with a password be able to see my live feed?
Hi.
This example doesn’t have a password. So, anyone inside your network that accesses the Raspberry Pi IP address can see your footage.
There are ways to add a password to your streaming server, but we don’t have any tutorial on that subject at the moment 🙁
If you want to build a more professional monitoring video streaming, I recommend using MotionEye, in which you can monitor several cameras at the same time, and it requires an authentication. We have tutorials about that:
– CCTV Raspberry Pi Based System with Storage using MotionEyeOS
– Install MotionEyeOS on Raspberry Pi – Surveillance Camera System
I hope this helps.
Regards,
Sara 🙂
Thanks
Works perfectly.
Thanks Adam! I’m glad it worked for you 🙂
Thanks. Simplest option and worked the first time.
Great tutorial! I used it and it worked like a charm.
Can you recommend how can I stream audio as well? I have a USB Microphone, how can I also stream audio over HTTP?
I’m glad it worked. Unfortunately I don’t have any example about that at the moment… Regards,
Rui
hello,
It works for me but for a short time. After that message WARNING:root:Removed streaming client and the camera stops working
any idea ?
Hi i’m South Korea student
I am so appriciate for you content!
Owing to you, I can finish my senior project perfectfully!
Speclially,
i doesn’t know that how can connect python with
God bless you!!!
Thank you!
Hi, great tutorial for Streaming, I want to be able to view it remotely when connected to another network, for example, if I have it set up at home and want to view it at work, any recommendations on how I would go about doing this using this script. Thanks in advance.
Hi Pedro.
The best way to do that is using MotionEyeOS.
It allows you to configure several settings to build a surveillance system.
–
–
It did not work for me. It shows,
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x14e95 Gerald.
I’m sorry for taking so long to get back to you.
I was trying to find an answer to your question.
I would like to command a robot via buttons that I want to insert in the html page, how can I do?
Hi Rossano.
Which board do you want to use to build the robot? Raspberry Pi?
We have a tutorial on how to control LEDs using Flask on a Raspberry Pi. That allows you to insert buttons and perform different actions depending on the request URL.
Here’s the tutorial: Raspberry Pi Web Server using Flask to Control GPIOs
The example shows how to control LEDs, but you can easily control a DC motor using the gpiozero library for raspberry pi: gpiozero.readthedocs.io/en/stable/api_output.html?highlight=motor#motor
I hope this helps.
Regards,
Sara 🙂
Great script – how do I rotate 180 degrees or flip the output in the code?
Hi.
Just add the following line to your code:
camera.rotation = 180
On line 87: github.com/RuiSantosdotme/Random-Nerd-Tutorials/blob/master/Projects/rpi_camera_surveillance_system.py
Regards,
Sara 🙂
Running the Python script, I get the following error.
It would be nice if you could give me a hint what to do.
^
File “rpi_camera_surveillance_system.py”, line 65
frame = output.frame
IndentationError: unindent does not match any outer indentation level
Hi Harrie.
It seems that you have a syntax error when it comes to indentation.
You may have modified something when you copied the code.
Try creating a new file by copying the code from here:
I hope this helps,
Regards,
Sara
Hi,
Got it working at once 🙂 just wondered if I can change from network cable to usb wifi dongel instead without making change in code?
Hi Frode.
Yes. It should work fine.
Regards,
Sara 🙂
Is it any way to change port to 80? When i change it in code i am getting an error:
” Traceback (most recent call last):
File “rpi_camera Stefano.. Let me know if it solves your problem.
Regards,
Sara 🙂
Hi, it gives me an error at importing socketserver library, what shoul I do?
Hi Judit.
What error are you getting?
I’ve seen this problem before, check if you are using Python 2.x or Python 3.x the name of the library you are trying to import is different. The library in Python2 is SocketServer, while the library in Python3 is socketserver. By default, a raspberry pi running on Raspbian would use python 2.
SOLUTIONS:
1. when running the script, type python3 .py
2. change all instances of socketserver in the program to SocketServer
Hi, whenever I try to run your code through the Python 3 IDLE I get the response that the syntax is invalid. Here is exactly what is in my code:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type “copyright”, “credits” or “license()” for more information.
>>> # Web streaming example
# Source code from the official PiCamera package
#
import io
import picamera
import logging
import socketserver
from threading import Condition
from http import server
PAGE=”””\
Raspberry Pi – Surveillance Camera
Raspberry Pi – Surveillance Camera
class StreamingOutput(object):
def __init__(self):
self.frame = None
self.buffer = io.BytesIO()
self.condition = Condition()
def write(self, buf):
if buf.startswith(b’\xff\xd8′):
# == ‘/’:
self.send_response(301)
self.send_header(‘Location’, ‘/index.html’)
self.end_headers()
elif self.path == ‘/index.html’:
content = PAGE.encode(‘utf-8’)
self.send_response(200)
self.send_header(‘Content-Type’, ‘text/html’)
self.send_header(‘Content-Length’, len(content))
self.end_headers()
self.wfile.write(content)
elif self.path == ‘/stream.mjpg’:
self.send_response(200)
self.send_header(‘Age’, 0)
self.send_header(‘Cache-Control’, ‘no-cache, private’)
self.send_header(‘Pragma’, ‘no-cache’)
self.send_header(‘Content-Type’, ‘multipart/x-mixed-replace; boundary=FRAME’)
self.end_headers()
try:
while True:
with output.condition:
output.condition.wait()
frame = output.frame
self.wfile.write(b’–FRAME\r\n’)
self.send_header(‘Content-Type’, ‘image/jpeg’)
self.send_header(‘Content-Length’, len(frame))
self.end_headers()
self.wfile.write(frame)
self.wfile.write(b’\r\n’)
except Exception as e:
logging.warning(
‘Removed streaming client %s: %s’,
self.client_address, str(e))
else:
self.send_error(404)
self.end_headers()
class StreamingServer(socketserver.ThreadingMixIn, server.HTTPServer):
allow_reuse_address = True
daemon_threads = True
with picamera.PiCamera(resolution=’640×480′,()
Thanks
Hi.
What is the syntax error that you’re getting?
Regards,
Sara 🙂
I get an error object has no attribute condition
What I am doing when this error occurred
When does that error happen? Can you provide more details? Which Camera, Raspbian OS version, Python version are you using?
Hello
I got the camera working good, but the day after the camera is not available. I have to run python3 rpi_camera_surveillance_system.py through putty to get it going again. Is it possible to get it to run 24/7?
Hello I am going to try this solution since I want to use to raspberris one for live transmission and other for whatching it …… However I don-t have the raspi cam any suggestion about using a usb web cam?? I can already read the webcam using openCV4 but what change should I do in this code to read that cam instead of raspi cam? Thanks
Hi Lennon.
If you want to use two raspberry pi boards one for transmission and the other for you to watch, I suggest using MotionEye OS.
It usually supports USB cameras.
I recommend taking a look at the following tutorials and see if it helps:
–
–
–
Regards,
Sara 🙂
i try it but if i want shoot a photo when object move around a pir the camerapi ontrol in nodered not respond the problem is a pyton that take complete control of cam
but for me is interesting take a photo with a person move around my pir
any idea?
Hi Fabio.
You can use motioneyeOS that allows you to install a complete CCTV system with lots of functionalities.
It has the option of taking a photo when motion is detected. If you want to record and take photos when motion is detected, I think motioneye is one of the best options – to install and to use.
Here are two tutorials about motioneye that you can easily replicate and adapt to your project:
–
–
Regards,
Sara
Nice script, works great. Has anyone tried H.264 as a stream? My camera is capable of it but I have not tried it yet. I was just going to change output from mjpeg to h264. Thanks for your time.
Hi Joe.
I haven’t tried that, but I think it is possible. You have to try it.
Regards,
Sara
Fantastic!
This is amazing for a dinosaur like me to get into. I really need to get into more Python coding though, and to think everything was done in assembly code a long time ago. Things have changed so much.
Well done!!
Thanks 🙂
Thanks John.
We’re glad you enjoyed the example.
Regards,
Sara 🙂
hello can you help me, Im getting an error
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x1a6f8 Rey.
great tutorial
any way to adjust the exposure?
Hi.
For adjusting the exposure using the picamera library, take a look at the following documentation:
– picamera.readthedocs.io/en/release-1.10/api_camera.html#picamera.camera.PiCamera.exposure_mode
– picamera.readthedocs.io/en/release-1.13/recipes1.html#capturing-consistent-images
Regards,
Sara
Thank you for the great tutorial
i also want to ask “how can i display sensor data(ex . temperature) along side the camera feed?” . i am still new to python programming dont know much about the libraries used in program .
Hi.
Thank you for following our tutorials.
Unfortunately, we don’t have information about what you’re looking for.
I think the information on the following link is a good starting point
raspberrypi.org/forums/viewtopic.php?t=35487
I hope this helps.
Regards,
Sara
Hi
Thank you so much for this, it works very well
Thanks Alot you made my day 😀
You’re welcome.
Regards,
Sara
First of all I would like to thank you for giving such a helpful content. I wanted to add led light (powered by the raspberry pi) in front of the pi camera, but I do not know how to turn on and off using the webpage. I need help to control the led from the same page (streaming webpage) by adding some buttons.
thank you in advance.
Hi.
We have a tutorial about controlling an LED via web server with the Raspberyr Pi. You may found it useful for your project.
Regards,
Sara
hi, it worked very well in the first attempt, after trying for hours with other codes.
thank you. but, can u help me with how the code works?
Hi Tharun.
Thank you for your interest, but we we don’t have any code explanation for this specific project.
Regards,
Sara
hey.. i want a code which can perform video streaming meanwhile save the videos of previous days i.e; the picamera has to save the videos daily while its streaming…..
Hi.
The best way to do that is using MotionEyeOS.
You can check our tutorials about MotionEyeOS below:
I hope this helps.
Regards,
Sara
Worked like a charm !!
The only change I had to make was on this line:
# removing the parameters.
with picamera.Camera() as camera:
Thank you for the excellent tutorial !
Hi Rui/Sara
Great tutorial as many others, i dabble about with raspberry pi’s alot, but i am not very techie or coder.
I installed your rpi_camera_surveillance_system.py and is working great, but my question is can i add to the script to have email notification with a picture as if a button was pressed like a doorbell.
I have tried motion and motioneye but did not get on with them.
Regards
Tony
Hi Tony.
motioneye is probably the best solution for what you are looking for, and it is very easy to use.
You can set up all your cameras in a graphical interface and send notifications when motion is detected. You can follow our tutorials about motionEye and see if you can follow through:
–
–
We don’t show motion detection or email notification in our tutorials, but you can easily search that online and see the settings you need to fill. Also, explore the user interface, and you’ll be able to find how to do that.
Regards,
Sara
Awesome work!
Hi,
In case anybody needs this. Here is the answer to my question.
import SocketServer
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class StreamingServer(SocketServer.ThreadingMixIn, HTTPServer):
Thanks Jerry
Great toturial!
I was able to get it working through the browser but is there a way to get to work on a vlc media player? I have had no luck with it so far.
Hi Mike.
We don’t have any tutorial about that subject.
Regards,
Sara
what if i use the logitech webcam ? did we use the same source code?
what if i use the logitech webcam ? did we use the same source code?
and can you show me the source code?
thank you..
Hi.
I think this code only works with the Raspberry Pi Camera.
If you want to use other cameras like webcams, the easiest way is to use motioneyeOS
There should be other codes compatible with USB cameras, but I don’t have any example about that at the moment.
Regards,
Sara
Man, I love it when a project is just
1. Copy
2. Paste
Great work, thanks very much!
Actually, just one question: how do I flip the camera view? I’ve had to mount mine upside down because of the camera holder.
Never mind, got it. Pro tip: read the comments in the code!
Thanks again!
Thank you for following our work 😀
worked straight out of the box.
Thankx
Great!
Hi, can we browse video stream of pi camera on android app ?
Hi.
It should be possible, but we don’t have any project about that subject.
Regards,
Sara
Hi, Folks,
Good Job! It’s not the first time I’m cross with yours works and here I am question again.
All I know about PI, which it’s not too much, I learned of my own. I would like to know if I can use this project in a different manner.
Is there any way of camera shows up in your device just only when I press a button in GPIO for example? I’m trying to do a door entry intercom Video/audio. Any clue?
Just like to say thanks, works really well.
Thanks 😀
I had trouble using this but after some struggle I figured it out (I’m new to Python):
Error I was getting:
Traceback (most recent call last):
File “rpi_camera_surveillance_system.py”, line 80, in
with picamera.PiCamera(resolution=’640 480′, framerate=24) as camera:
File “/usr/lib/python3/dist-packages/picamera/camera.py”, line 488, in __init__
self.STEREO_MODES[stereo_mode], stereo_decimate)
File “/usr/lib/python3/dist-packages/picamera/camera.py”, line 561, in _init_camera
w, h = resolution
ValueError: too many values to unpack (expected 2)
So in rpi_camera_surveillance_system.py above line 81 I added:
tupl = (640,480)
and then changed line 81 to call the tupl instead
with picamera.PiCamera(resolution=tup1, framerate=24) as camera:
and that solved my problem.
I hope this helps somebody.
Thanks for sharing.
Regards,
Sara
Yes, this information very well. thank you
Great tutorial – after having tried for a whole day, I stumbled over this explanation and got it working within 10 mins. Thanks!
in these project i don´t have to use open cv right?
Right.
Regards,
Sara
No, you don’t have to use OpenCV. It’s just a Python script running
why when i run the program for live feed there is no picture on the page?
here is error from terminal: 192.168.1.140 – – [03/Jan/2020 15:43:07] “GET /index.html HTTP/1.1” 200 –
192.168.1.140 – – [03/Jan/2020 15:43:07] “GET /stream.mjpg HTTP/1.1” 200 –
WARNING:root:Removed streaming client (‘192.168.1.140’, 52140): [Errno 104] Connection reset by peer
can you reply me i want to fix this error.
Thank you~ I run the script in my Raspberry pi successful ^-^
pretty wonderful tutorial~
thank you very much~
support yours always
Hi
can it stream both audio and video
Hi.
This particular example streams video only. We don’t have any example about audio.
Regards,
Sara
Great Tutorial. I have a question. I would like to have the Pi Zero W take a Pic and up load to a cloud service(Adafruitio) then shutdown properly. I could use an ESP8266 to wake the Pi with a relay. Is there a way to have the Pi boot run a program then shut down and poweroff. Thanks
Ramey
Hello! Great project! It works perfectly with just copy and paste, thank you.
I use my camera in a dark place, so I need to switch on the light with a relay connected to a raspberry port.
I do it with command line…could you be so gentle to add a button under the image to command a GPIO on and off please? Sorry but I’m not able to do it.
Thank you.
Can audio be streamed with the video?
Hi.
This example doesn’t stream audio.
Regards,
Sara
Hi Sara,
Great tutorial.
I am using a ‘PI zero w’ and it works great.
My next step it to implement tilt/pan.
Thanks
Hans
That’s great!
Regards,
Sara
I just came across this and I was happy to get it running out of the box so to speak. An excellent bit of code.
I found that Chrome in it’s latest incarnation is a poor web client though, it kept freezing after a while. The latest firefox is fine.
Great stuff.
70 yr old noobie youngster. did everything required but when I ran the start command I got the following:Traceback (most recent call last):
File “rpi_camera_surveillance_system.py”, line 2, in
import picamera
ModuleNotFoundError: No module named ‘picamera’
As I am using a wave share OV5647 and not the pi camera V2, (one arriving tomorrow) that is obviously the problem. I suspect that I need to change that line to read something along the lines of “import OV5647” but I don’t know the actual modules computer name. Or am I barking up the wrong tree
Hi Mike.
This particular project only works with the PiCamera.
When using the picamera make sure you have enabled the camera on the Raspberry Pi settings.
Regards,
Sara
Well, I’ve got the Pi Camera (v2), mounted the pi and the camera in the nice red and white case that I bough only to find that the case wall is too thick to allow the mini HDMI male to mate properly with the female. So after some surgery with the craft knife it’s now up and running……….except for: python3 rpi_camera_surveillance_system.py
Traceback (most recent call last):
File “rpi_camera_surveillance_system.py”, line 2, in
import picamera
ModuleNotFoundError: No module named ‘picamera’
Fortunately I have a fair bit of hair left to pull out in frustration while waiting a reply to say that the software only works with V1 (?)
Hi again.
I was using V2 camera.
Can you run this on the terminal?
sudo apt-get install python3-picamera
Hi Sara,
I have no problem using picamera, but is there a way to use usb camera?
The USB camera is Logitech c270.
Hi.
This particular project, only works with the PiCamera.
You can use motioneyeos to add all sorts of cameras:
Regards,
Sara
Thank you very much this works almost perfect. I used it for the camera live feed on octopi. There was a little issue i could solve already. octopi adds a random paramter to the end.
So the request was “ which could not be interpretet and caused a 404 answer
by splitting the string with
noParam = self.path.split(“?”,1)[0]
and using — noParam == “/stream.mjpeg” — instead of — self.path == “/stream.mjpg” —
i could solve the problem
What i love about this is the low CPU usage of aprox 7% on my raspberryPi 3B+ and the low latency way smaller the 1 second
OMG after days of trying dinosaur old things I found on the web I stumbled across this and it works!!! All I had to do was use your reply to Mike Wilson “sudo apt-get install python3-picamera” to swat the same error he was getting and I’m a happy camper. Thank you so much and stay safe in these weird times!
-Rob
Great tutorial! Thanks for that! It works pretty good for me.
One thing is missing for me. I want to increase the resolution to 1080p (1920 x 1080). When I changed parameters from 640×480 in two places, it seems like i’m getting a cropped image. Any ideas on how to get higher res stream?
Thanks again!
A bit late and maybe you figured it out by yourself now but here is what i’ve done :
at the top of the script change this :
To the width and height you want your video to be shown on the browser in your case you should have :
Is it just me or did the part that you put after the colons your comment not show up? On my end it looks like this:
“A bit late and maybe you figured it out by yourself now but here is what i’ve done :
at the top of the script change this :
To the width and height you want your video to be shown on the browser in your case you should have : ”
Where there’s nothing after the colons.
Could you try typing it again? Thanks!!
Thanks that was a great tutorial worked perfectly and was exactly what I have been looking for _/_
Great! 🙂
Thanks for that, I’m using it on a pi buggy that wanders around the house, (when the cat lets it). I had to dial back the fps to 2 to stop stressing the first generation pi I’m running it on, but works a treat now.
Excellent job with the script. Worked like a charm on first try!
Hello,
First of all, thanks for this post!
You say the camera can be accessed by any device on the local wi-fi.
While in my case it works for the browser running on the RPi, none of my other devices could access the camera using the local IP address.
I have searched the ‘net, but found nothing relevant.
Any suggestions?
BTW, Feliz Ano Novo !
Hi Sara –
After playing around with both MotionEyeOS and MotionEye running on a Raspberry pi 3 I was delighted to finally find something to stream video with almost no latency. Excellent! And your script worked out of the box. The video shows up on any machine’s browser in my network. All I tried before had latencies of up to 10 seconds which rendered a surveillance camera almost useless.
However, I wanted to stream the video from the Raspi (as a network camera) to MotionEye on a PC operated by Ubuntu Linux. But MotionEye refuses to add the camera saying “not a supported network camera”. The camera was specified as “Simple MJPEG camera”. Do you have an idea what I can do?
Regards from Hamburg
Rudi
Hi Rudi.
I’m glad the project worked straight out of the box.
As for the motioneyeOS issue, I have no idea.
I recommend posting an issue in the motioneyeos forum.
Regards,
Sara
Hi, thanks for your great job. I tested it and the framerate is really good. Also, I tested the same way with Flask (Miguel Grinberg’s job) but the framerate is bad.
You use mpeg streaming but with Flask it’s alway jpeg frames and I guess this occur latency.
My question is : is it possible to use websocket with your streaming’s example? I would like add button and data to the web page where there is the streaming.
Regards,
Steph
Hi Sara,
How can I stream an objects’ detection video? At the moment I can only see this through the HDMI output of the Raspberry pi.
Could you help? I can supply the code for a better reference.
Thanks!!!
Thank you so much!! Worked like a charm 🙂
Hi first of all thank you for the articel. I am using my pi camera with a jetson nano dev. board. Does this script works with jetson too or should I make changes in the script? If it doesn’t work which changes should I apply? I would be glad if you answer.
Hello, help. I am trying to use openCV to take the streamed video footage and apply image processing code. I am starting simple with trying to convert the video to grayscale. I am unsure of what needs to change in the original code in order to get it to work well with openCV library, any advice on where to start? The end goal will be for the code to stream video that identifies shapes within the frame. Thanks!
Great project and super code! I have the Pi camera and it worked fine. But not I need to go to a USB Connected camera for a new project. Any chance you have similar python code for using a USB (Logitech) connected camera instead. I can’t change O/S to the MotionEyeOS because the Pi that needs to run this is a special with Zwave, and THUM Sensor code system that has been running for more than 3 years. I do truly like your web server feature, so I am hopeful there is Python code changes that you can suggest to move from a Pi Camera to the USB Camera. I’m new to Python, so the learning curve would be steep for a 70+ year old to master in a reasonable time. Thanks for your help.
Check this out and let us know if it did work for you
hada-tech.com/index.php/2020/06/07/live-stream-usb-camera-with-raspberry-pi/
Already did that a couple of years ago. I like the simplicity of the Python code solution here, just inquiring if they had a similar Python code for a USB camera instead of the Pi Camera. I’ll keep looking. Thanks for your input.
Hello,
This tutorial is fantastic, thank you so much! I am however having an issue when trying to make a simple modification of this code that I was hoping someone would be able to help with. I have been able to get the code to work perfectly as is, but now I need to change the port from port 8000 to port 80. I thought this would be a simple switch of just changing out the line that says
address = (”, 8000)
to instead be
address = (”, 80)
but this gives me the following errors:
Traceback (most recent call last):
File “rpi_camera_surveillance_system2.py”, line 92, in
server = StreamingServer(address, StreamingHandler)
File “/usr/lib/python3.7/socketserver.py”, line 452, in init
self.server_bind()
File “/usr/lib/python3.7/ line 137, in server_bind
socketserver.TCPServer.server_bind(self)
File “/usr/lib/python3.7/socketserver.py”, line 466, in server_bind
self.socket.bind(self.server_address)
PermissionError: [Errno 13] Permission denied
I have made sure to keep the conditions exactly the same when running the original versus edited code, but it has not made a difference. Any help would be very appreciated!
Thanks,
Kerri
Reminder, the PiOS is just a linux kernel. To use ports <1024, you must run your code as root.
It’s been two weeks of web search to find a solution to stream my picam on my computer/phone/TV browser.
I found a lot of things and none of them was working the way i wanted until now.
Thanks a lot for this one, and the html code in your script is just a perfect thing that allows some customization.
LOVED IT
Hello,
Thank you so much for tutorial! Is there a way to make the script run after boot? So all that’s needed is to turn on the Pi and the stream becomes available?
Thanks!
Hi Ben.
I think this article explore exactly what you are looking for: raspberrytips.com/autostart-a-program-on-boot/
Regards,
Sara
Sara, I absolutely love the fact that you take the time to respond to all these issues. Very impressive. Good for you.
Hi.
Thanks for noticing that.
I try it. But in fact, I can’t answer all the comments or solve all the problems. But I try to help as much as I can.
Regards,
Sara
Hello there. Thank you very much for your hard work.
I’m new in this world. I was able to make it run, perfectly. I’d thank you for it.
But, actually I would like to be able to access from a different network, it would be possible without using MotionEyeOS?
I added a few sensors, and I would like to used it on my car and access using mobile internet.
Do you have any tip for me?!
Thank you very much once again.
Kind regards
Hi.
You can consider using ngrok:
Regards,
Sara
I’ll take a look.
Thank you, Sara.
Kind regards.
It is working perfectly, thank you. Would like to know if it is possible to store the videos in the computer through the local IP address? And can object detection alogrithm be used on a computer from the live streams using the IP address?
Hi, we are just wondering where ‘output’ is defined in the StreamingHandler class as we cannot see it. When trying to run this inside another thread we get an ‘output’ not being defined, but it does not seem to be being defined in your code either? Thanks.
In python, your scope is inclusive. This means that the output variable created in the with picamera.PiCamera(…) as camera: section, it is included in the scope when calling StreamingHandler during the streaming server declaration.
Hello Sara,
If only I had found your solution first, I would have saved a lot of time !!! The great thing is that it all worked out the first time and without too many complicated code! Strong and simple !
A big thank you to you !
Kind regards.
Hack
Hello,
Is there anyway to pause the script, while kodi is running?
Thanks
Joao
I would like to take a still picture in the form of a jpeg. I was wondering what code I would need to include to the already existing one.
I have been looking far and wide to update the video image with the current date/timestamp. I found an obscure piece of code: switchdoc.com/2019/07/mjpeg-mjpg-python-streaming-overlay/.
After fixing this code to work with the current version of python, i was able to get a timestamp working. However this extra processing causes the framerate to dip to less than 10 frames a second (i’d guess its less than 5, but i didn’t actually count). There is a method already included in picamera.PiCamera called annotate_text. What is the best method to either call this method once a second? or some other method to update the image?
Thanks.
I had a question regarding the IP address. Is there anyway to get around the issue of the RPi’s IP address changing? It happens every so often, causing me to have to go back into the RPi to find the new one so I can go to its new streaming URL. It’s particularly pesky because I have this IP-dependent URL embedded in code elsewhere, meaning that I need to update the code with each new IP address.
Thank you for any insight you can provide.
Hi.
We don’t have any tutorials about that.
But I found this article that should be what you’re looking for:
Regards,
Sara
Hi Anne,
You can set a Static (fix) IP address in the tab “Networking”.
Login as admin
Klick on the most left button and lookup the tab “networking”
Change dynamic into static. Make sure you stay in the range of your IP addresses but a little out of the most used ones. I have set for example 192.168.1.230, but for you it can be something else of course.
Have fun
A great project! Thanks! I wonder, could it be possible to set the exposure time say, to a max of 3 seconds and a minimum of 1s…? I am trying to use it in a place that is poorly illuminated.
Hi there! Great project!
I just wanted to know if it’s possible to change the streaming quality, because I think it’s not the utmost camera quality.
Hi, thankyou so much for this solution. Really helped with my final year project. I just wanted to know how I can combine a code for a motion sensor into this code.
I installed v4l2rtspserver, and played the rtsp stream with ffplay, and it works, but there’s a video delay. Then there’s the problem of serving an rtsp stream in a web page.
This is very simple, and there’s practically no delay! Thank you!
|
https://randomnerdtutorials.com/video-streaming-with-raspberry-pi-camera/?replytocom=365649
|
CC-MAIN-2022-21
|
refinedweb
| 6,550
| 74.9
|
I'll use Yahoo! Weather to check the current weather. From all information that it provides, we'll be mostly interested in temperature, humidity, wind speed, and visibility in the current location. The app will check the weather regularly, will allow you to show the current weather, and also provide a graph comparing average monthly weathers throughout years.
So let's start with the new project. I have quite a clean computer and want to do the app the nice way. So first of all, I will install
virtualenvto be able to install third-party python libraries in a closed environment which will only be used for this project (I have already installed
setuptoolsand
django).
# install virtualenv
sudo easy_install virtualenv
I created a directory
Projectsin my home directory and
cdto it.
Let's create a virtual environment and start the new project and app.
# create virtual environment "climate_change_env"
virtualenv climate_change_env
cd climate_change_env/
# activate the environment
source bin/activate
Since now I see
(climate_change_env)as a prefix to each command line. I'll type
deactivateat some point later to get out of this virtual environment.
# create django project "blog_action_day_2009"
django-admin.py startproject blog_action_day_2009
cd blog_action_day_2009/
# create django app "climate_change"
django-admin.py startapp climate_change
# create folders for templates and media
mkdir templates media
To get started quickly, I will use sqlite3 database now. As I am using python 2.5, I don't need to install sqlite3 module, because it's already there. So I open the
settings.pyand define those settings:
import os
PROJECT_DIR = os.path.dirname(__file__)
# ...
DATABASE_ENGINE = "sqlite3"
DATABASE_NAME = "blog_action_day_2009.sqlite3"
# ...
MEDIA_ROOT = os.path.join(PROJECT_DIR, "media")
MEDIA_URL = "/media/"
ADMIN_MEDIA_PREFIX = "/admin/media/"
# ...
TEMPLATE_DIRS = [
os.path.join(PROJECT_DIR, "templates"),
]
# ...
INSTALLED_APPS = (
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.admin",
"climate_change",
)
Now we'll need those parts:
- Models for locations and imported weather information.
- Management command for importing data from Yahoo! Weather.
- Template tag for displaying latest weather.
- View for displaying a graph.
But I'll continue about that tomorrow.
To end today's post, let's watch a video about a regular guy who talks about weather when he has nothing to say:
|
http://djangotricks.blogspot.com/2009/10/weather-app-tutorial-part-1-of-5.html
|
CC-MAIN-2015-18
|
refinedweb
| 361
| 50.53
|
good afternoon everyone i am working on a prime number generator and i am confused on a couple things. first thing is i am getting an error for my Boolean isPrime statement. also i have to create a method to generate the next prime number here is what i have so far. i commented out the next prime until i get the first half to work. i figured no sense in trying to do two separate methods at once. heres my code
/** This class prints out all the prime numbers of an input value. */ public class PrimeGenerator { public PrimeGenerator() { } { boolean isPrime(int num) boolean prime=true; for(int x=2; x<num; x++) if(num %x==0) prime=false; } /** Calculate the next prime number of an input. @return the next prime number */ /*public int nextPrime() { do while }*/ private int num; }
|
http://www.javaprogrammingforums.com/whats-wrong-my-code/380-prime-number-generator-program-java.html
|
CC-MAIN-2014-10
|
refinedweb
| 140
| 71.65
|
An example of fast numerical computation using Haskell
Problem statement
Consider the sequence of natural numbers obtained from iterating
an+1 = an/2 if an is even, else (3an + 1)/2
starting with a given a0. This is a slightly optimized version of the sequence in the Collatz conjecture. For example, with a0 = 12, the sequence is [12, 6, 3, 5, 8, 4, 2, 1, 2, 1, ...]. The sequence is also called the hailstone sequence and the mathematician Collatz conjectured that it reaches 1 for all values of a0. When it reaches 1, it is stuck in the cycle [1, 2, 1, 2 ...], so we will truncate the sequence at 1.
In the current problem, we would like find that a0 (in some range of numbers) which results in the longest hailstone sequence.
C implementation
#include <stdio.h> int main(int argc, char **argv) { int max_a0 = atoi(argv[1]); int longest = 0, max_len = 0; int a0, len; unsigned long a; for (a0 = 1; a0 <= max_a0; a0++) { a = a0; len = 0; while (a != 1) { len++; a = ((a%2==0)? a : 3*a+1)/2; } if (len > max_len) { max_len = len; longest = a0; } } printf("(%d, %d)\n", max_len, longest); return 0; }
On my machine (with gcc 4.7.3), it takes 0.4 seconds to find the longest sequence for the first million numbers.
$ gcc -O2 collatz.c $ time ./a.out 1000000 (329, 837799) real 0m0.429s user 0m0.424s sys 0m0.004s
Haskell implementation
The Haskell code is quite short and more importantly, it seems to express the idea rather than give a particular implementation.
import Data.Word import Data.List import System.Environment collatzNext :: Word32 -> Word32 collatzNext a = (if even a then a else 3*a+1) `div` 2 collatzLen :: Word32 -> Int collatzLen a0 = length $ takeWhile (/= 1) $ iterate collatzNext a0 main = do [a0] <- getArgs let max_a0 = (read a0)::Word32 print $ maximum $ map (\a0 -> (collatzLen a0, a0)) [1..max_a0]
But, it takes an atrocious 6 seconds for the same computation (with ghc 7.6.2 and llvm 3.2)
$ ghc -O2 -fllvm collatz.hs $ time ./collatz (329,837799) real 0m5.994s user 0m5.944s sys 0m0.040s
Faster Haskell implementation
At this point, one should ideally run the Haskell program with profiling enabled and see what's slowing it down. But for now, I'll venture a guess that it has something to do with the multiple lists being created by
iterate and
takeWhile which are finally reduced by
length. To test this, let's write a function
lenIterWhile that combines the three into one without generating any intermediate lists.
import Data.Word import Data.List import System.Environment collatzNext :: Word32 -> Word32 collatzNext a = (if even a then a else 3*a+1) `div` 2 -- new code collatzLen :: Word32 -> Int collatzLen a0 = lenIterWhile collatzNext (/= 1) a0 lenIterWhile :: (a -> a) -> (a -> Bool) -> a -> Int lenIterWhile next notDone start = len start 0 where len n m = if notDone n then len (next n) (m+1) else m -- End of new code main = do [a0] <- getArgs let max_a0 = (read a0)::Word32 print $ maximum $ map (\a0 -> (collatzLen a0, a0)) [1..max_a0]
This brings the time down to 0.54 seconds! This is quite close to the C speed (0.43 s) but it comes at the cost of some code readability.
Stream fusion
What we just did with
lenIterWhile is called stream fusion and has been implemented as a Haskell library that replaces the common list processing functions in Prelude and Data.List. You can install the stream fusion library with
cabal install stream-fusion. Armed with this library, we can get rid of the ugly
lenIterWhile and write instead:
import Data.Word import qualified Data.List.Stream as S import System.Environment collatzNext :: Word32 -> Word32 collatzNext a = (if even a then a else 3*a+1) `div` 2 collatzLen :: Word32 -> Int collatzLen a0 = S.length $ S.takeWhile (/= 1) $ S.iterate collatzNext a0 main = do [a0] <- getArgs let max_a0 = (read a0)::Word32 print $ S.maximum $ S.map (\a0 -> (collatzLen a0, a0)) [1..max_a0]
Notice that we only had to modify our first Haskell code to use list functions from Data.List.Stream in place of Prelude and Data.List. Also, at 0.51 seconds, this is slightly faster than our previous code, possibly because the
map and
maximum instances also got fused.
Cython implementation
To compare with another high-level language:
import sys cdef int collatzLen(int a0): cdef unsigned long a = a0 cdef int length = 0 while a != 1: a = (a if a%2 == 0 else 3*a+1) / 2 length += 1 return length def maxLen(max_a0): cdef int max_length = 0, longest = 0, a0, length for a0 in xrange(1, max_a0 + 1): length = collatzLen(a0) if length > max_length: max_length = length longest = a0 return max_length, longest if __name__ == '__main__': max_a0 = int(sys.argv[1]) print maxLen(max_a0)
The code is more verbose and looks rather similar to the C code. But, at 0.47 seconds (with cython 0.17.4), it is faster than the Haskell code.
$ cython --embed cycollatz.pyx $ gcc -O2 -I/usr/include/python2.7 cycollatz.c -lpython2.7 -o cycollatz $ time ./cycollatz 1000000 (329, 837799) real 0m0.470s user 0m0.460s sys 0m0.008s
Conclusion
The different implementations are compared in the table below.
Readability of any piece of code is somewhat subjective, but I would say that the fastest Haskell code is more readable than C or Cython. I would expect Haskell to keep this advantage in larger projects because its lazy list abstraction is useful and stream fusion makes the abstraction efficient.
There is a general conception that high-level languages are much slower than low-level languages. This example shows that that isn't necessarily true. In particular, when a language lets a programmer express their intent than give a specific implementation, a good compiler should be able to optimize the code very well. Thus, we can have the best of both worlds - small, maintainable code that also runs fast.
In the current case, there is some more exploration to be done. Although the Haskell code takes only 19% more time than C, it takes 5.7 times more memory and causes 3.7 times more page faults (as reported by GNU time). Also, the executable is 150 times bigger! It would be interesting to see what's causing these and figure out if they can be reduced.
|
http://www.mit.edu/~mtikekar/posts/stream-fusion.html
|
CC-MAIN-2017-39
|
refinedweb
| 1,059
| 75.2
|
>
I'm trying to achieve sprite billboarding like these games:
Ragnarok Online
Disgaea
Basically the player can freely rotate, pan and zoom the camera however he wishes, and the sprites will always look the same from any angle.
I've tried simply using LookAt, but for some reason that reverses the rotation of the sprites as well. I also need the sprites to not rotate 'sideways' when the sprite is not centered on the screen. - Although that could just be because of the perspective camera - I'm not sure.
Answer by Seerix
·
May 27, 2014 at 12:14 PM
I use this simple script to achieve that. You can set the target to be the camera.
public class FaceTargetScript : MonoBehaviour
{
public Transform target;
void Update () {
if (target != null)
transform.rotation = target.rotation;
}
}
Edit: I was too fast in answering and ignored you requirement to prevent them to angle when they're not in the center of the screen. I'll look further into it.
Edit 2: Code updated with working example.
I actually managed to solve it, but your one line solution beats mine by heaps, thanks xD
In case anyone is interested, here is the monstrosity I concocted
Vector3 oppositeCamera = transform.position - Camera.main.transform.position;
Quaternion faceCamera = Quaternion.LookRotation(oppositeCamera);
Vector3 euler = faceCamera.eulerAngles;
euler.y = 0f;
faceCamera.eulerAngles = euler;
transform.rotation = faceCamera;
Yours will probably serve your needs better though. My solution mimics the camera's viewing plane, so characters won't appear to be standing upright when viewing from high angles and that might look weird in your case.
Answer by MrScottyPieey
·
May 26, 2018 at 02:37 PM
It works in Unity 5.
Making sprites just rotate and not tilt.
3
Answers
Block Perspective in Top-Down 2D Games
2
Answers
How do I make a 2D sprite smoothly rotate upright?
1
Answer
Flip Sprite C#
0
Answers
How do I flip a 3D object to look towards left or right on a 2D plane
0
Answers
|
https://answers.unity.com/questions/715748/sprites-always-face-the-camera-camera-freely-rotat.html
|
CC-MAIN-2019-18
|
refinedweb
| 332
| 64.91
|
In this section we will read about how a Java programmer can allow the facility in the application that a user can provide the input using command line and the application produce the required output.
Command line argument is a way of providing input for the application. These inputs are given at the time of invoking application. Command line arguments are followed by a command for executing a class. Using command line argument a user can provide any number of arguments. The command line argument facilitate that the configuration information can be defined on launching of application. In an application command line argument is passed to the String array of its main method i.e. public static void main(String [] args) method.
Syntax :
java className args1 args2 args3 .... argsN
In programming these command line arguments are termed as follows :
args[0] = args1; args[1] = args2; .... .... args[N] = argsN;
e.g.
java HelloWorld Welcome To Roseindia
Example
Here I am giving a simple example which will demonstrate you about how the command line argument can be provided to the Java application. In this example you will see that a simple Java program will be created into which the input for the application will be given from the command line. In this example we will create a Java program that will simply print all the arguments given from the command line at the console.
PrintArguments.java
public class PrintArguments { public static void main(String args[]) { for(String str : args) { System.out.println(str); } } }
Output
First compile the above program and after successfully compiling the program execute the program and give the values for printing at console after the className followed by a white space as follows :
javac PrintArguments.java java PrintArguments Welcome To Roseindia Java Tutorial
Then the output will be as follows :
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Java Command Line Argument Example
Post your Comment
|
http://www.roseindia.net/java/beginners/command-line-argument-example.shtml
|
CC-MAIN-2015-11
|
refinedweb
| 332
| 54.42
|
Free for PREMIUM members
Submit
Learn how to a build a cloud-first strategyRegister Now
Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
Request- oriented data.
You should not free the memory returned by this function unless it is explictly mentioned below.
You need: CURLINFO_LASTSOCKET. (Added in 7.15.2)
Here is my suggestion how to use it:
#include <sys/types.h>
#include <socket.h>
#include <curl/curl.h>
...
int sd;
struct sockaddr_in sd_name;
socklen_t sd_len;
...
curl_easy_getinfo(CURL *curl, CURLINFO_LASTSOCKET, sd);
getsockname(sd, &sd_name, &sd_len);
// now your IP is sd_name.sin_addr.s_addr
how to call this code or where to insert - it's up to you, I didn't test it. Probably you need to register callback function right after connect and analise IP there.
|
https://www.experts-exchange.com/questions/21859977/libcurl-and-ip-address-resolving.html
|
CC-MAIN-2017-51
|
refinedweb
| 160
| 61.22
|
The shelve module in Python’s standard library is a simple yet effective tool for persistent data storage when using a relational database solution is not required. The shelf object defined in this module is dictionary-like object which is persistently stored in a disk file. This creates afile similar to dbm database on UNIX like systems. Only string data type can be used as key in this special dictionary object, whereas any picklable object can serve as value.
The shelve module defines three classes as follows −
Easiest way to form a Shelf object is to use open() function defined in shelve module which return a DbfilenameShelf object.
open(filename, flag = 'c', protocol=None, writeback = False)
The filename parameter is assigned to the database created.
Default value for flag parameter is ‘c’ for read/write access. Other flags are ‘w’ (write only) ‘r’ (read only) and ‘n’ (new with read/write)
Protocol parameter denotes pickle protocol writeback parameter by default is false. If set to true, the accessed entries are cached. Every access calls sync() and close() operations hence process may be slow.
Following code creates a database and stores dictionary entries in it.
import shelve s = shelve.open("test") s['name'] = "Ajay" s['age'] = 23 s['marks'] = 75 s.close()
This will create test.dir file in current directory and store key-value data in hashed form. The Shelf object has following methods available −
To access value of a particular key in shelf.
>>> s=shelve.open('test') >>> s['age'] 23 >>> s['age']=25 >>> s.get('age') 25
The items(), keys() and values() methods return view objects.
>>> list(s.items()) [('name', 'Ajay'), ('age', 25), ('marks', 75)] >>> list(s.keys()) ['name', 'age', 'marks'] >>> list(s.values()) ['Ajay', 25, 75]
To remove a key-value pair from shelf
>>> s.pop('marks') 75 >>> list(s.items()) [('name', 'Ajay'), ('age', 25)]
Notice that key-value pair of marks-75 has been removed.
To merge items of another dictionary with shelf use update() method
>>> d={'salary':10000, 'designation':'manager'} >>> s.update(d) >>> list(s.items()) [('name', 'Ajay'), ('age', 25), ('salary', 10000), ('designation', 'manager')]
In this article we learned about shelve module which provides convenient mechanism for storing persistent dictionary object.
|
https://www.tutorialspoint.com/python-object-persistence-shelve
|
CC-MAIN-2021-49
|
refinedweb
| 365
| 58.38
|
§Akka HTTP server backend (experimental)
Play experimental libraries are not ready for production use. APIs may change. Features may not work properly.
The Play 2 APIs are built on top of an HTTP server backend. The default HTTP server backend uses the Netty library. In Play 2.4 another experimental backend, based on Akka HTTP, is also available. The Akka HTTP backend aims to provide the same Play API as the Netty HTTP backend. At the moment the Akka HTTP backend is missing quite a few features.
The experimental Akka HTTP backend is a technical proof of concept. It is not intended for production use and it doesn’t implement the full Play API. The purpose of the new backend is to trial Akka HTTP as a possible backend for a future version of Play. The backend also serves as a valuable test case for our friends on the Akka project.
§Known issues
- WebSockets are not supported. This will be fixed once Akka HTTP gains WebSocket support.
- No HTTPS support.
- If a
Content-Lengthheader is not supplied, the Akka HTTP server always uses chunked encoding. This is different from the Netty backend which will automatically buffer some requests to get a
Content-Length.
- No
X-Forwarded-Forsupport.
- No
RequestHeader.usernamesupport.
- Server shutdown is a bit rough now. HTTP server actors are just killed.
- No attempt has been made to tune performance. Performance will to be slower than Netty. For example, currently there is a lot of extra copying between Play’s
Array[Byte]and Akka’s
ByteString. This could be optimized.
- The implementation contains a lot of code duplicated from Netty.
- There are no proper documentation tests for the code written on this page.
§Usage
To use the Akka HTTP server backend you first need to add the Akka HTTP server module as a dependency of your project.
libraryDependencies += "com.typesafe.play" %% "play-akka-http-server-experimental" % "2.4.0-M2"
Next you need to tell Play to use the new server backend. You can do this with a system property or by using a different class to start your application.
§Dev mode using a system property
To run dev mode with the Akka HTTP server you need to supply a system property when you call the
run command.
run -Dserver.provider=play.core.server.akkahttp.AkkaHttpServerProvider
§Functional testing using a system property
You can use the Akka HTTP server when using the
WithServer class in your functional tests. Supplying a system property will change the server used by all your tests.
To run tests with a system property you need to change your sbt settings to fork the tests and then supply the system property as an argument to Java.
fork in Test := true javaOptions in Test += "-Dserver.provider=play.core.server.akkahttp.AkkaHttpServerProvider"
§Functional testing using a ServerProvider class
Instead of using a system property you can supply a
ServerProvider instance to the
WithServer class in your functional tests.
import play.core.server.akkahttp.AkkaHttpServer "use the Akka HTTP server in a test" in new WithServer( app = myApp, serverProvider = AkkaHttpServer.defaultServerProvider) { val response = await(WS.url("").get()) response.status must equalTo(OK) }
§Deployed app with a system property
Once you’ve deployed your app with
dist you can tell it to use the Akka HTTP server by providing a system property when you run it.
/path/to/bin/<project-name> -Dserver.provider=play.core.server.akkahttp.AkkaHttpServerProvider
§Deployed app with a different main class
Instead of using Netty, you can choose to use the Akka HTTP server’s main class when you deploy your application. That means the application will always start with the Akka HTTP server backend.
Change the main class in your sbt settings.
mainClass in Compile := Some("play.core.server.akkahttp.AkkaHttpServer"). Note: when running Play in development mode, the current project’s resources may not be available on the server’s classpath. Configuration may need to be provided in system properties or via resources in a JAR file.
play { # Configuration for Play's AkkaHttpServer akka-http-server { # The name of the ActorSystem actor-system = "play-akka-http-server" # How long to wait when binding to the listening socket http-bind-timeout = 5 seconds akka { loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] loglevel = WARNING # Turn off dead letters until server is stable log-dead-letters = off actor { default-dispatcher = { fork-join-executor { parallelism-factor = 1.0 parallelism-max = 24 } } } } } }
Next: Reactive Streams integration
|
https://www.playframework.com/documentation/2.4.0-M2/AkkaHttpServer
|
CC-MAIN-2020-24
|
refinedweb
| 740
| 57.57
|
It's still a fairly simple code, just an if else-if else statement inside of a do-while loop.
The do-while loop works just fine, but each of the if statements is supposed to display some text, which they do, but the only display the first line of text with-in the do-while loop
/* mOS Beta v1.0 * * Developed By: Austin Hoffmaster [deer dance] * * Date Began: 22-4-09 * Date Ended: NULL * */ #include <iostream> #include <cmath> #include <string> #include <fstream> using namespace std; int main() { char x; do { cout << "Enter Command: "; cin >> x; if(x = 'HELP') { system("CLS"); cout << "\nThis is the help screen." << endl << endl; } else if(x = 'DIR') { system("CLS"); cout << "\nThis is the Directory Manager." << endl << endl; } else if(x = 'SYSINFO') { system("CLS"); cout << "\nThis is where the mOS system information will be displayed to you." << endl << endl; } } while(x = true); system("pause"); getchar(); return 0; }
Everytime I run the program, the do-while loop runs, but regardless of what I input, it spits out this line of text:
cout << "\nThis is the help screen." << endl << endl;
If anyone knows the solution to this problem, your help is much appreciated.
Also, I'm still fairly new to C++, so if there's anything else wrong with my code, please let me know.
Thank you again.
|
http://www.dreamincode.net/forums/topic/101510-if-else-if-elsedo-while-statement-trouble/
|
CC-MAIN-2013-20
|
refinedweb
| 221
| 74.22
|
Hello guys,

1. When I enable the authentication on impala service
2. I try to connect with impyla and I'm able to see data :
from impala.dbapi import connect conn = connect(host='w1.host.lan', database='db_grp1', port=21050, auth_mechanism="LDAP",user='user1', password="password1") cursor = conn.cursor() cursor.execute('select * from table1 ;') results = cursor.fetchall() print (results)
$ python3 test.py [(1, 'one'), (2, 'two'), (3, 'three')]
3. But on HUE I'm not able to retreieve data, if I disable the authentication, I can see again my table. (I have configured HUE to authenticate through LDAP and I'm able to authenticated successfully)
Here is the error :
Is that possible on HUE to "authenticate again" to impala to retrieve data ?
Kind Regards
|
https://community.cloudera.com/t5/Support-Questions/Hue-with-Impala-quot-Enable-LDAP-Authentication-quot-TSocket/m-p/90991
|
CC-MAIN-2019-43
|
refinedweb
| 124
| 52.36
|
I need to add a disclaimer. I understand that this method of adding breakpoints is common for debuggers like WinDbg. The target audience here is for those that mainly use and feel comfortable with Visual Studio debugging.
Often times, when I start investigating a bug, I know that a good place to start is when a particular class is being destructed. Easy enough, place the breakpoint on your destructor. However, what happens if you haven't created a destructor? Easy enough, code one and rebuild. One final problem, what happens if this given class lives in another component? Let's look at a substantially worthless example that illustrates this point.
namespace ExtNS
{
class ClassWithDestructor
{
public:
~ClassWithDestructor() {}
};
class ComponentClass : ClassWithDestructor
{
public:
ComponentClass( int data ) : m_importantData( data ) {}
int GetImportantData() { return m_importantData; }
private:
int m_importantData;
};
}
void main()
{
ExtNS::ComponentClass* c = new ExtNS::ComponentClass( 10 );
delete c;
}
Imagine for a moment that this class resides in an external component and contains some important, vital data for our program. Furthermore, consider that we have a bug where we have an invalid ComponentClass* and we want to know where our pointer is being deleted. First, we do not have the source code for this external component. Second and more important, the component class does not have an explicit destructor but its parent may.
Enter a nice feature in Visual Studio. We know that if a destructor is not explicitly defined but a parent class does, the compiler will generate one for us. We proceed with this knowledge. Ensure that symbols are loaded for the given component's library or executable (an explanation of how to accomplish this is outside the scope of this post). In the breakpoint window, click on the new dropdown and select "Break at Function..." Mine maps to [Ctrl+d, n]. Now, we enter our generated destructor as the function: ExtNS::ComponentClass::~ComponentClass.
If the function is found, you will see it as valid in the breakpoints window. Attach the debugger to a running instance and run the scenario. The breakpoint will hit whenever our class is being destructed. Obviously, we will not have the source code to see the breakpoint, but we can use the callstack to trace where we have stopped.
|
http://blogs.msdn.com/b/idle_coding/archive/2012/07/09/generated-destructor-debugging-in-visual-studio.aspx
|
CC-MAIN-2015-18
|
refinedweb
| 370
| 56.15
|
On 8/9/06, Nick Coghlan <ncoghlan at gmail.com> wrote: > A different way to enable that would be to include a set of non-keyword names > (a subset of the default builtin namespace) in the language definition that > the compiler is explicitly permitted to treat as constants if they are not > otherwise defined in the current lexical scope. Realistically, I want my own functions and class definitions to be treated that way (inlinable) most of the time. I don't want to start marking them with "stable". > The only thing that would break is hacks like poking an alternate > implementation of str or set or len into the global namespace from somewhere > outside the module. So what we need is a module that either rejects changes (after it is sealed) or at least provides notification (so things can be recompiled). In theory, this could even go into python 2.x (though not as the default), though it is a bit difficult in practice. (By the time you can specify an alternative dict factory, it is too late.) -jJ
|
https://mail.python.org/pipermail/python-3000/2006-August/002785.html
|
CC-MAIN-2019-35
|
refinedweb
| 179
| 60.45
|
Python helpers for the drake workflow language
Project Description
Utilities for making life easier in Python with Drake workflows.
Installing
Run pip install drakeutil.
Using
For Python steps inside your workflow include the line:
from drakeutil import *
This will populate the special family of variables INPUT, OUTPUT from the environment. For example:
somefile.out <- somefile.in [python] from drakeutil import * with open(INPUT) as istream: with open(OUTPUT) as ostream: for l in istream: for word in l.split(): print >> ostream, word
In the future we might add more helpers. Can you think of any that would be useful?
Changelog
0.1.0
- Support special INPUT and OUTPUT family of environment variables
- Provide mysql_cursor helper when MySQLdb module is installed
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|
https://pypi.org/project/drakeutil/
|
CC-MAIN-2018-17
|
refinedweb
| 145
| 64.51
|
public boolean checkInclusion(String s1, String s2) { int[] count = new int[128]; for(int i = 0; i < s1.length(); i++) count[s1.charAt(i)]--; for(int l = 0, r = 0; r < s2.length(); r++) { if (++count[s2.charAt(r)] > 0) while(--count[s2.charAt(l++)] != 0) { /* do nothing */} else if ((r - l + 1) == s1.length()) return true; } return s1.length() == 0; }
Update:
I gonna use pictures to describe what the above code does. The first "for" loop counts all chars we need to find in a way like digging holes on the ground:
Blank bars are the holes that we need to fill.
We scan each one char of the string s2 (by moving index r in above code) and put it in the right hole:
The blue blocks are chars from s2.
But if the char in s2 is not in s1, or, the count of the char is more than the count of the same char in s1, we got some thing like this:
Note the last blue block sticks out of ground. Any time we encounter a sticking out block - meaning a block with value 1 - we stop scanning (that is moving "r"). At this point, there is only one sticking out block.
Now, we have an invalid substring with either invalid char or invalid number of chars. How to remove the invalid char and continue our scan? We use a left index ("l" in above code) to remove chars in the holes in the same order we filled them into the holes. We stop removing chars until the only sticking out block is fixed - it has a value of 0 after fixing. Then, we continue our scanning by moving right index "r".
Our target is to get:
To check if all holes are filled perfectly - no more, no less, all have value of 0 - we just need to make sure (r - l + 1) == s1.length().
Update 2:
Thanks to mylemoncake comment. I have updated the last line to : return s1.length() == 0; This takes care of the case s1 is an empty string.
@fallcreek It has been a while since last time I programed in java, I dont really get 'while(--count[s2.charAt(l++)] != 0) { /* do nothing */}' what this means. Could you plaese shed a light?
while(l <= r){ if(--count[s2.charAt(l)] == 0){ l++; break; } l++; }
@rujia
I think this code can be rewrite as above (l <= r will be always true), silde the left window to find valid character, if not l = r+1. hope it will help you :)
Great solution! O(n) with small constant factor. I rewrote it in C++.
bool checkInclusion(string s1, string s2) { int count[26] = {}; for (char c:s1) count[c-'a']--; for (int l = 0, r = 0; r < s2.length(); r++) { int tmp = s2[r]-'a'; count[tmp]++; if (count[tmp] > 0) { // move left pointer l to reset count[tmp] = 0 while (s2[l] != s2[r]) --count[s2[l++]-'a']; --count[s2[l++]-'a']; } else if (r-l+1 == s1.size()) return true; } return s1.size() == 0; }
Great solution.I rewrote in my way.so I can understand easily.
class Solution {
public:
bool checkInclusion(string s1, string s2) {
vector<int> vec(128,0);
int begin=0,end=0;
for(char ch : s1){
vec[ch]++;
}
int count=s1.length();
while(end<s2.length()){
vec[s2[end]]--;
while(vec[s2[end]]<0&&begin<=end){
vec[s2[begin++]]++;
}
if(-begin+end+1==count) return true;
end++;
}
return false;
}
};
Same idea, added some comments.
public class Solution { public boolean checkInclusion(String s1, String s2) { int[] map = new int[26]; int sum = s1.length(); // construct frequency map for(int i = 0; i< s1.length(); i++){ map[s1.charAt(i) - 'a']++; } for(int r = 0, l = 0; r < s2.length(); r++){ char c = s2.charAt(r); if(map[c - 'a'] > 0){ map[c - 'a']--; sum--; //check for permutation match. if(sum == 0) return true; }else{ // if there is enough number for char c or c is never seen before. // we move left pointer next to the position where we first saw char c // or to the r+1(we never see char c before), //and during this process we restore the map. while(l<= r && s2.charAt(l) != s2.charAt(r)){ map[s2.charAt(l) - 'a'] ++; l++; sum++; } l++; } } return false; } }
@panzw said in 8 lines slide window solution in Java:
while(l<= r && s2.charAt(l) != s2.charAt(r)){
I think we should use l < r instead of l < = r, because when l == r , this condition can never be true ( s2.charAt(l) != s2.charAt(r))
Please correct me.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.
|
https://discuss.leetcode.com/topic/87884/8-lines-slide-window-solution-in-java
|
CC-MAIN-2017-51
|
refinedweb
| 785
| 83.86
|
Win a copy of Barcodes with iOS this week in the iOS forum or Core Java for the Impatient in the Java 8 forum!
So do you think changing it to
public synchronized void writeLog() {
...
}
can solve the problem simply ?
File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine.
To prevent concurrent access from other threads in the same JVM though, Ronnie's suggestion of synchronizing on a static object is more appropriate.
Originally posted by Ronnie Ho: Are many instances of this class being created? If yes, then the solution will not work because the synchronized writeLog() is trying to get the lock of an instance and there can be many instances of this class, so many instances can write to the "log" file at the same time. A simple solution can be
private static final Object obj;
public void writeLog() {
synchronized(obj) {
...
}
}
which gets the lock of the static variable that all instances of this class share.
This is a follow-up to my previous post about "thread safe and writing to a common file". I changed the code to include singleton. Here is sample public class LogWriter { private static LogWriter lw = new LogWriter(); private LogWriter() {} public static synchronized LogWriter getLogWriter() { if(lw == null) lw = new LogWriter(); return lw; } private synchronized writeLog() { // open file // write file // close file } } Does this work ? I guess in this case I don't need to put "synchronized" keyword for an "object" inside the "writeLog()" method, right ? This is because I ensure only one static global instance is created. Please help me verify it. thanks lot.
Also note that if you dont keep a reference to the class with the static variable somewhere
|
http://www.coderanch.com/t/378190/java/java/prevent-writing-common-file-time
|
CC-MAIN-2015-11
|
refinedweb
| 301
| 62.27
|
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item. More...
#include <pqOutputPort.h>
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item.
This makes it possible to refer to a particular output port in the server manager model. The pqPipelineSource keeps references to all its output ports. The only way to access pqOutputPort items is through the pqPipelineSource. One can obtain the pqPipelineSource item from a pqOutputPort using getSource(). Once the outputs can be named, we will change this class to use output port names instead of numbers.
Definition at line 58 of file pqOutputPort.h.
Returns the vtkSMOutputPort proxy for this port.
Returns the pqPipelineSource whose output port this is.
Definition at line 75 of file pqOutputPort.h.
Return the vtkSMSourceProxy for the source.
Returns the server connection on which this output port exists.
Returns the port number of the output port which this item represents.
Definition at line 90 of file pqOutputPort.h.
Returns the port name for this output port.
Returns the number of consumers connected to this output port.
Get the consumer at a particular index on this output port.
Returns a list of consumers.
Returns a list of representations for this output port in the given view.
If view == NULL, returns all representations of this port.
Returns the first representation for this output port in the given view.
If view is NULL, returns 0.
Returns a list of render modules in which this output port has representations added (the representations may not be visible).
Returns the current data information at this output port.
This does not update the pipeline, it simply returns the data information for data currently present on the output port on the server.
Collects data information over time.
This can potentially be a very slow process, so use with caution.
Returns the current data information for the selected data from this output port.
es_port is the output port from the internal vtkPVExtractSelection proxy.
Returns the class name of the output data.
Calls vtkSMSourceProxy::GetSelectionInput() on the underlying source proxy.
Calls vtkSMSourceProxy::GetSelectionInputPort() on the underlying source proxy.
Set the selection input.
Returns vtkDataAssembly associated with the current output dataset on this port, if any.
This method updates all render modules to which all representations for this source belong, if force is true, it for an immediate render otherwise render on idle.
Fired when a connection is added between this output port and a consumer.
Fired when a connection is removed between this output port and a consumer.
fired when a representation is added.
fired when a representation is removed.
Fired when the visbility of a representation for the source changes.
Also fired when representationAdded or representationRemoved is fired since that too implies change in source visibility.
called by pqPipelineSource when the connections change.
Called by pqPipelineSource when the representations are added/removed.
Definition at line 223 of file pqOutputPort.h.
Definition at line 224 of file pqOutputPort.h.
Definition at line 238 of file pqOutputPort.h.
Definition at line 239 of file pqOutputPort.h.
|
https://kitware.github.io/paraview-docs/latest/cxx/classpqOutputPort.html
|
CC-MAIN-2021-49
|
refinedweb
| 514
| 60.82
|
Sparse Table
Reading time: 20 minutes | Coding time: 10 minutes
Sparse table is a data structure which pre-process the information to answer static Range Queries. In this article, first we will understand what are sparse table with an example of Range Minimum Query. Then we will implement it in python and lastly, we will compare sparse tables with other algorithms to get an overall idea about it's optimality. Let's get started!
Lets start by considering the array below,
Now, lets say that I want to know the minimum value from the sub-array of this array. One can start with a brute force method but it would be off the charts if efficient solution is what one seeks. How about we try it with sparse table. To set up an static sparse table query, there are two major steps. First, to create a sparse table and second, to set up the query mechanism.
Creating a sparse table
We will be using the array from above to create a sparse table for Range Minimum Query (Static). First step would be create blank 2-D table of size, (array length) x (log(array length)). One might ask about the log, then I would say wait for now and go along with the tutorial, you will know the reason soon enough.
So, I have created a blank table where i represents the array length and j the log of it. If you get the log of the array value not in integers then take the closest greater integer value from that value. For example, log of 6 base 2 is somewhere between 2 and 3, so you should take the greater integer that is 3. Similarly, you can notice that there are three numbers on j axis.
Starting with j=0 and i=0, find the index i in the array, whose value is 4, and find the value of 2^{j}, which is 1. This means that starting from index i we need to consider the sub-array of length 1 or it should contain 1 element, which is 2^{j}. Calculating this for our example, the sub-array would only contain {4} because the limit of 1 element is reached. Now in this sub-array, which value is the lowest? Of course, it is 4 right? We will put the index of 4 which is 0 in our table. Just like below.
Now repeating the same for all the possible value of i, fixing j=0 our table should look like this.
Now our increases to j=1 and i=0. For this combination our sub-array would now contain two elements starting from index i (which is 0), {4, 6}. Well 4 is the smaller so we will put 0 in the table. Second step would be to increase i and it's value will be i=1. Our array would be {6,1}, from which 1 is the smallest value and it's index is 2. So, 2 will go to our table for i=1 and j=1. Our table would look like below at this point.
If you repeat the steps for every remaining combination of i till i=4 with j being at j=1, our table would just look like,
Now, we cannot go further because only one element left in the array and to move forward we need exactly 2. When you hit this kind of situation, like 2^{j} < (number of elements left), skip every possible value of i for that value of j. Increment the j, which will be j=2, and start from i=0. After you do this calculation for remaining combination, table should look like this,
Congrats! You have successfully made a sparse table for static range minimum query. Next step would be to understand how to decode the query so you can extract the range minimum.
Decoding the query
Considering the sparse table in the previous image, we will take some random cases to understand the decoding process. such as, find minimum value between (3, 5), (0, 5) and (0, 3).
Starting with (3,5), so this range contains this elements, {5,7,3}. First we will find out the length of this array, which is 3 and lets call it as 'l'. Then we will calculate log(3), or the log(length of the query), rounding to its minimum smallest integer if not and called it k. For our example, k will be 1. From this information, first_element=3 and k=1, we will look for index 3 in the i axis of the table and index 1 on j axis. The value at (i=3,j=1) is 3 which is the index of the array whose value is 5. Now we will subtract 2^{k} from the length of the query, which will be 3-2 = 1. This means 1 elements is still left in the query range. For that, we have to add this remaining value to original first_element value, 3+1=4. Now we will find for i=4 and and j=1 from the table for which the answer is index 5 whose value is 3. We had to do two sub queries, (3,4) and (4,5), and their answer is 5 and 3, respectively. The answer for our original query, (3,5), will be the minimum of these two value which is 3.
Try on remaining examples, let me know if you have any trouble solving them.
Python implementation of sparse table
Below is the python implementation of the sparse table data type for the range minimum query. Hope you find it useful.
import math def construct_sparse_table(arr): n = len(arr) sparse_table = [[-1 for i in range(n)] for j in range(int(math.log(n, 2))+1)] for j in range(int(math.log(n, 2))+1): for i in range(n): min_index = i if(i+(2**j)-1 < n): for x in range(i, i+(2**j)-1): if(given_array[x] < given_array[min_index]): min_index = x sparse_table[j][i] = min_index return sparse_table def query(arr, sparse_table, query_range): length_of_array = len(arr) min_elements = [] while length_of_array > 0: k = int(math.log(len(arr), 2)) min_elements.append(arr[sparse_table[k][query_range[0]]]) length_of_array = length_of_array - (2**k) return min(min_elements) if __name__ == '__main__': given_array = [4, 6, 1, 5, 7, 3] sparse_table = construct_sparse_table(given_array) query_list = [[3, 5], [0, 5], [0, 3]] for x in query_list: print(query(given_array, sparse_table, x))
Comparison
Of course, there are many ways to solve this problem but I bet this is not the worst so far. Below is the comparison table for the info.
I hope you enjoyed this article. Happy coding!
|
https://iq.opengenus.org/sparse-table/
|
CC-MAIN-2020-29
|
refinedweb
| 1,115
| 71.34
|
NAME
route — kernel packet forwarding database
SYNOPSIS
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
int
socket(PF_ROUTE, SOCK_RAW, int family);
DESCRIPTION.
One opens the channel for passing routing control messages by using the socket position, and delimited by the new length entry in the sockaddr. An example of a message with four addresses might be an ISO redirect: Destination, Netmask, Gateway, and Author of the redirect. The interpretation of which address by calling sysctl(3).
Messages include:, */
u_long rtm_inits; /* which metrics we are initializing */
} */
};
struct if_announcemsghdr {
};
The RTM_IFINFO message uses a if_msghdr header, the RTM_NEWADDR).
Specifiers for metric values in rmx_locks and rtm_inits are:
#define RTV_MTU 0x1 /* init or lock _mtu */ - unused */
*/
SEE ALSO
sysctl(3), route(8), rtentry(9)
The constants for the rtm_flags field are documented in the manual page for the route(8) utility.
HISTORY
A PF_ROUTE protocol family first appeared in 4.3BSD−Reno.
BSD November 4, 2004 BSD
|
https://man.cx/route(4)
|
CC-MAIN-2022-21
|
refinedweb
| 166
| 51.44
|
TagHelper is a new feature in ASP.NET MVC. If you haven’t already heard, TagHelpers have gained quite a bit of discussion among the techies, with some claiming the return of server side controls. Anyone remember:
<asp:TextBox
I personally don’t see a problem with TagHelpers, it’s just another simplification in mixing HTML with server generated content without the baggage of control life cycles, view state, events, etc. In fact, I believe it is a bit more cleaner approach.
This article is based on the beta version of ASP.NET 5 (or vNext). Things can and will change, so some of the information about TagHelpers might be out of date.
There are already articles on TagHelpers – the brilliant ones are by Scott Hanselman and Jeffrey T. Fritz (see resources). This article adds on top as:
TagHelpers allow preprocessing of HTML attributes with server side content - that is:
<a asp-About</a>
gets transformed to:
<a href="/Home/About">About</a>
Before dwelling deeper, let’s see how the current version of MVC behaves. This will also give us an appreciation of the need for TagHelpers.
In ASP.NET MVC 5, if we wanted to declare a link to another page (anchor tag), there are several options.
Perhaps the most common is using the HTML helper ActionLink method. There are several overloads, I am using the one that will let me set the action, controller and HTML attributes.
ActionLink
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
string controllerName,
Object routeValues,
Object htmlAttributes
)
A simple usage would be:
@Html.ActionLink("About this site",
"About","Home",null,new { @class="someClass"})
Another option would be to mix n match this in razor syntax.
<a href="@Url.Action("About",
"Home")" class="someClass">About this site</a>
We can also create our own Razor helpers or HTML helper extension methods.
While this is not bad, our scenario is simplistic, I am sure all of us know how tricky it can be to mix n match razor syntax with HTML. Another way of looking at this is, that in the first example we went razor first and added HTML attributes, whereas in the second instance, we went HTML first and added razor syntax.
This is where TagHelper come into the picture as we don't have to leave the comfort of HTML, and at the same time, we can utilize the power of C# server side. Considering the same example above, we can rewrite the anchor tag as:
<a asp-About this site</a>
To simplify what happens next - MVC will pass this anchor to a C# class (AnchorTagHelper) that will inspect the attributes and output the server generated content. It’s a cleaner way of mixing HTML and C# code.
AnchorTagHelper
This is different to the ASP.NET server side controls even though the syntax/concept might look extremely familiar. The main differences are:
Note: Some articles will refer to the use of controller and action attributes. However, there was a discussion on this issue and looks like out of the three popular approaches, the one with prefixing asp- has been selected in the current build. The other two options were to use @controller or just controller.
@controller
controller
ASP.NET already comes with a set of built TagHelpers. They live in the Microsoft.AspNet.Mvc.TagHelpers namespace and consists of:
Microsoft.AspNet.Mvc.TagHelpers
Anchor
Input
Label
TextArea
ValidationMessage
ValidationSummary
Form
We will take a quick look at all of these and their basic usage.
This tag will be applied to <a> anchor elements. At the moment, it is supports the following attributes:
<a>
asp-action
asp-controller
asp-fragment
asp-host
asp-protocol
asp-route
All of these are used to generate a URL for the href attribute of the anchor tag.
href
anchor
If the href is already set in the <a> anchor HTML element, an exception will be thrown if the tag helper attributes are set. So for example, the below will throw an exception.
<a> anchor
<a href="/Home/Index" asp-Home</a>
As the name suggests, this TagHelper is applied to <input> HTML elements. It is similar to the TextBoxFor HMTL extension method as it generates an input element bound to a property in the model. The input tag supports the following attributes:
TagHelper
<input>
TextBoxFor
input
asp-for
asp-format
The 'asp-for' attribute refers to a property in the model and is also used in various other tag helpers
The 'asp-format' applies the format after the value has been retrieved. This is useful for currencies, or date time values. For example (Birthday is a property on the model of type DateTime).
Birthday
DateTime
<input asp-
Note: The asp-for is of type ModelExpression, this is a new class in ASP.NET MVC 6 (vNext). The constructor takes a string parameter that evaluates to a property in the Model. We can also refer to nested objects - for example:
asp-for
ModelExpression
string
<input asp-</div>
Contrast this with TextBoxFor:
TextBoxFor
@Html.TextBoxFor(model => model.Birthday)
At the moment, there is a problem with the MVC 6 model binder, as entering a invalid date (abc) will display an exception message.
abc
The parameter conversion from type 'System.String' to type 'System.DateTime' failed. See the inner exception for more information.
System.String
System.DateTime
In the MVC 5, the exception message is reprocessed to a more user friendly version as:
The value 'abc' is not valid for Birthday
Same purpose as the HtmlExtension.LabelFor method - has only one attribute 'asp-for' used to define a property in the model (as discussed in InputTagHelper). It is applied to the <label> element.
HtmlExtension.LabelFor
InputTagHelper
<label>
<label asp-
The SelectTagHelper applies to the <select> element and supports two attributes 'asp-for' and 'asp-items'. As discussed before, asp-for is used to define a property in the model, whereas asp-items is used to define a collection of values of type IEnumerable<SelectListItem>.
SelectTagHelper
asp-items
asp-items
<select asp-
To add a default item, we can do this:
<select asp-
<option selected="selected" value="">Choose Country</option>
Just for comparison, the HtlmHelper way of doing this:
HtlmHelper
@Html.DropDownListFor(m=>m.Country, (IEnumerable<SelectListItem>)ViewBag.Countries)
The asp-items can evaluate to anything available to the view - it could be a property on the object, variable, etc.
We could declare in the view a variable:
@{
SelectListItem[] items =
{
new SelectListItem() { Text = "item 1" },
new SelectListItem() { Text = "item 2" }
};
}
and then use that as asp-items:
<select asp-
Processes the <textarea> element - supports only one attribute asp-for, where Information is a property on the:
<textarea>
Information
<textarea asp-</textarea>
This tag helper is used for displaying the validation-error message. It has the same purpose as the ValidationMessageFor HTML Helper. The interesting question here might be which HTML element it applies to? The ValidationMessageFor extension method generated a <span> element, similarly the ValidationMessageTagHelper applies on the <span> element.
ValidationMessageFor
<span>
ValidationMessageTagHelper
<span asp-
It has only one attribute asp-validation-for, which represents a field on the Model.
asp-validation-for
Model
<input asp-
<span asp-
Note: There is a new attribute called TagName that links a C# class with the HTML tag on which it is applied.
TagName
[TagName("span")]
public class ValidationMessageTagHelper : TagHelper
Used to display the summary of validation errors - like the HTML extension method ValidationSummary. It only supports one attribute asp-validation-summary that can have one of the following values:
asp-validation-summary
None
ModelOnly
Model
All
The asp-validation-summary is applied to a div element.
div
<div class="validation" asp-
Used to generate a <form> element. It supports the following attributes which are self explanatory.
<form>
asp-anti-forgery
This is similar to the HTML helper BeginForm method.
BeginForm
<form asp-
If the action attribute is specified on the form tag with the asp- attributes, it will throw an InvalidOperationException.
form
asp-
InvalidOperationException
<form asp-
<div>
<label asp-
<input asp-
<span class="validation" asp-
</div>
<strong>Validation Errors</strong>
<div class="validation" asp-
</form>
TagHelpers can be extended – like everything else. So we can create our own TagHelpers to augment our HTML controls. There is already an article discussing creation of TagHelper for Kendo date picker.
TagHelpers
The two basic steps required to use TagHelpers is:
Microsoft.AspNet.Mvc.TagHelpers
@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers"
@addtaghelper
If you are having difficulties in getting this to work, follow the sample project below.
Let’s now dig into a small project that will use both these attributes. The project was built using Visual Studio 2015 preview. There is also a section on building and running this without using Visual Studio near the end.
The project source is available at github here.
If you download the project and build using Visual Studio, please set the latest version of the KRE-CLR runtime otherwise the project will not build, following the steps in the section Latest Version below.
If you receive the error, "Could not find the Microsoft.AspNet.Loader.Interop nuget package in the packages folder of the current solution" - close Visual Studio and open the project again, it should work.
Could not find the Microsoft.AspNet.Loader.Interop nuget package in the packages folder of the current solution
It’s important to realize, that ASP.NET vNext is in a constant state of changes & updates. As such, when I downloaded and installed Visual Studio, the TagHelper changes were not available in the CLR. So, there are some perquisites to connect to the development feed and download the latest NuGet packages.
We will need to get the latest version of the CLR runtime. For that, we need to install KVM – this can be done by running the following in command prompt:
<code>@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex
((new-object net.webclient).DownloadString
(''))"
I found that KVM was using the NuGet feed to install the latest version of the runtime () which at this time did not contain the TagHelper changes. I had to change the feed to.
I looked at the kvm.ps1 file (at %userprofile%\.kre\bin\) and found it was using an environment variable KRE_NUGET_API_URL. So I had set it by:
KRE_NUGET_API_URL
$env:KRE_NUGET_API_URL = “”
In the same PowerShell window, run the following command to download and install the latest version of the CLR from the ASP.NET development feed.
kvm upgrade
To see the installed CLR, run the following command:
kvm list
Create a new ASP.NET Web Application. Check the “Create directory for solution”, so everything required is inside the solution. In the next screen, select the ASP.NET 5 Empty project.
We need to update the NuGet feed so the latest .NET packages can be downloaded. This is done by going into Tools -> NuGet Package Manager-> Package Manager Settings. Add a new package source, set the source as and Name as ASP.NET vNext, and click Update.
By default, Visual Studio uses the default KRE version from NuGet feed which at the time of writing this article is 1.0.0 beta 1. Not all the new options are available in this version. We will change this to the latest version which (now) is KRE-CLR-x86.1.0.00-rc1-10781. If you only see one version, make sure to have followed the steps to update the KRE. Also, the version you will see depends on the current build.
The next step is to add the references. Open project.json and add the following under dependencies.
"Microsoft.AspNet.Server.IIS": "1.0.0-rc1-10778",
"Microsoft.AspNet.Server.WebListener" : "1.0.0-rc1-11230"
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-12143",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-12143"
The first dependency allows hosting our application in IIS, the second one support self hosting. The other two are self explanatory.
In Startup.cs:
Add the following using statement:
using
using Microsoft.Framework.DependencyInjection;
Add the following in the method Configure:
Configure
app.UseServices(m => { m.AddMvc(); });
app.UseMvc();
Create a folder called Controllers, and add a new controller class called HomeController. Add the following two methods:
HomeController
public IActionResult Index()
{
return View();
}
public IActionResult About()
{
return View();
}
Create a folder called Views, and inside, add another folder called Home. Inside Home add two new MVC View Pages:
@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers"
<h2>TagHelper test website</h2>
<ul>
<li>
<a asp-Anchor tag</a>
</li>
</ul>
@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers"
<h2>About page</h2>
<p>This website is created to show case the new TagHelper functionality in Asp.Net vNext
</p>
<p>
<a asp-Back</a>
</p>
If you run the project, you should be able to see the tag helpers in action.
Let’s say you are going all ninja, and would like to build (& run) the project without using Visual Studio. If the answer is yes, keep reading.
Note: Please update KRE to the latest version following the steps mentioned earlier in Install KVM.
If you are planning on restoring packages using KPM command line, it is important to update the NuGet feed source. This can be done as follows:
<add key="aspnet5 " value="" />
kvm use 1.0.0-rc1-10781
kpm restore
k Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener
--server.urls
If you browse to - the website should be.
|
https://www.codeproject.com/Articles/853835/TagHelpers?fid=1875171&df=90&mpp=25&sort=Position&view=Normal&spc=Relaxed&prof=True&pageflow=FixedWidth
|
CC-MAIN-2021-31
|
refinedweb
| 2,222
| 55.84
|
.
Quoting from the Oracle docs -
."
Note the last sentence. Every time you reuse a connection (typically once per page) the application must reestabilsh the context.
In the application you have to capture who the "real" user is and the application must keep Oracle informed, on each connection re-use, of who the connection is being used by.
The context is kept in a SYS owned table -=20 TYPE AppCtxRecTyp IS RECORD ( namespace varchar2(30), attribute varchar2(3= 0),
value varchar2(4000));
TYPE AppCtxTabTyp IS TABLE OF AppCtxRecTyp INDEX BY BINARY_INTEGER;
It is very easy to home-roll a solution similar to Oracle's but I don't know of any way to do it better than Oracle's solution. And Oracle's solution has the benefit of being documented (even if not well known).
-- on Mon May 23 2005 - 09:23:06 CDT
Original text of this message
|
http://www.orafaq.com/maillist/oracle-l/2005/05/23/1241.htm
|
CC-MAIN-2014-52
|
refinedweb
| 148
| 51.58
|
refreshing @DataModel, nested Conversationsroberto roberto May 31, 2011 10:11 AM
Hi,
I have this in Conversation:
@AutoCreate @Name("alertsList") @Scope(ScopeType.CONVERSATION) public class AlertsList extends EntityQuery<Alert> { @DataModel(value = "alerts") @Override public List<Alert> getResultList() { return super.getResultList(); }
and a link in the view:
<s:link <h:outputText </s:link>
the 'read' method starts a nested conversation:
@Begin(nested = true, flushMode = FlushModeType.MANUAL) @End public void read(Alert alert) { alert.setStatus(Status.READ); this.getDAO().saveAndFlush(alert); }
how can I update the 'alerts' DataModel from the parent conversation without using events (because I want to update only the 'alerts' instance in my parent Conversation, not in all existing Conversations) ?
I tried 'alertsList.refresh()' in the read Method, but Seam Interceptors update the DataModel in the nested Conversation and the old DataModel remains in the parent.
What you think about all this? is a correct way?
1. Re: refreshing @DataModel, nested ConversationsMehmet Ali Karabulut Aug 10, 2012 4:14 AM (in response to roberto roberto)
I know this is an old thread but lately I spent a lot time on a similar issue and want to share what I came up with as as solution regarding this issue.
Scenario:
1- I have a list populated in a datatable on a xhtml page (/list.xhtml) with a long-running conversation(LRC).
2- I have a link to create a new entity of this list that redirects to a new xhtml page(/create.xhtml), which also starts a nested conversation. (@Begin(nested=true))
3- I fill in the form in this creation page and save the new entity. (entityManager.persist(newEntity);)
4- I click on the 'Return' button (which is a <h:commandButton> on the creation page with an action, not the confuse with browser back button) to return back to the original list page. Nested conversation is ended here. We now left with the parent LRC only. So far so good.
5- The problem: Datamodel is not updated with the recently added entity, even if I call the 'list' method on the return event. The newly created entity is missing.
I almost spent one day trying to figure out this problem and come up with this solution.
Here the problem is the 'Return' button of the creation page runs in the nested conversation, thus even if list() method is called manually here in this step, it won't affect the original list in the parent conversation.
The simple solution I found is to add a page action to the page.xml of the /list.xhtml page, which calls the list() method whenever the page is requested.
<action execute="#{actionBean.list}"/> (this also eliminates the need for the @Factory method call for the datamodel since this page action is called whenever page is rendered)
The 'Return' button of the /create.xhtml page navigates to the main page, destroying the conversation before redirect.
<navigation>
<rule if-
<end-conversation
<redirect view-</redirect>
</rule>
</navigation>
We then get back to parent conversation,and in the mean time main page renders which in turn calls the list() method of the SFSB in the parent conversation, thus refreshing the list appropriately.
There may be alternative work arounds on this problem such as calling the Conversation.instance().pop() which "Pops the conversation stack, switching to the parent conversation", and then calling the list() method in the action method of the 'Return' button in order to refresh the list. Although this method does the job so that it refreshes the list on the parent conversation correctly, I here got stuck with killing the nested conversation here, since a call to '<end conversation>' destroys all the conversations from the top since we are in the parent conversation now. If we omit the end conversation part, this time nested conversations stay in the memory until destroyed by seam according to the conversation time-out. I would be very happy to hear your solutions on this matter.
|
https://developer.jboss.org/thread/194102
|
CC-MAIN-2018-17
|
refinedweb
| 656
| 53.21
|
amir@exatel.net wrote:
> I am using the namespace extension for managing a private filesystem on
> a USB device. My problem is that i have files larger then 4G, and while
> transfering files using IStream COM interface , the transfer stops
> after 4G.
> Does any one knows what should I do so I could transfer a very large
> files?
I'm surprised you can find pendrives that large. Are you sure you're not
just running out of "disk" space?
--
Palladium? Trusted Computing? DRM? Microsoft? Sauron.
"One ring to rule them all, one ring to find them
One ring to bring them all, and in the darkness bind them."
|
http://fixunix.com/microsoft-windows/29440-namespace-extension-istream-interface.html
|
CC-MAIN-2015-18
|
refinedweb
| 108
| 79.3
|
I am authoring a domain model that I will later map to a database using EF Code First. This is my first project using Entity Framework, and although I've read a book about it a while back, I can't remember all the details of how it works.
In one part of the domain model I have a one-to-many relationship.
public class Parent
{
public IList<Child> Children { get; private set; }
}
After the user has modified an in-memory instance of
Parent, and clicks a button, then it will be time to persist that instance to the database. At that time, I must first run some domain-specific comparison logic between the instance as it exists in the database (before saving) and the unsaved modified version that's in memory. So I need to query the database to retrieve an unmodified duplicate of the
Parent instance and its
Children.
Does EF Code First let me safely run such a query? I just worry that when EF runs such a query it will see that each
Child is already in memory and so reuse those instances, and overwrite their modifications, instead of instantiating duplicates. In this situation, I in fact want the duplicates.
Code first lets you access the original and changed values of a tracked object like this:
Parent parent; ... var curVal = context.Entry(parent).Property(p => p.Property).CurrentValue; var origVal = context.Entry(parent).Property(p => p.Property).OriginalValue;
You should also be able to do this with individual values in the Children collection
Subsequent queries will supply a new set of entities with current database values, but if you want to check the cache the context holds, that's very straightforward as described here:
|
http://m.dlxedu.com/m/askdetail/3/1f572a8d07965e4c289eb8e74b3609d4.html
|
CC-MAIN-2018-51
|
refinedweb
| 288
| 50.67
|
Since session restore saves and restores session cookies, it significantly modifies expectations around session cookies (namely that session cookies expire when the browser quits). This can result in session cookies being kept alive for much longer in Firefox than expected. This has security implications as the longer a cookie is kept alive the great the risk of a brute force attack succeeding. Best practices around sliding window (i.e. idle) session cookie lifespans recommend a time-out of somewhere between 5-25 minutes. Websites that expect cookies to live longer than a day or two generally use 'persistent' cookies instead. I'm proposing that we should implement an absolute session cookie lifespan limit of 7 days, which means that a session cookie would expire after 7 days regardless of sliding window (keepalive) behavior. Another approach could be to implement a sliding window time limit of say 24 hours, but that would not necessarily address the underlying issue of session cookies being kept alive potentially indefinitely.
See also bug 443354, "Save and Quit" tabs should not save session cookies of to-be-restored tabs.
Yes, this grew out of discussions around bug 443354, which as written the Firefox team does not want to implement because the current behavior is useful for some people and not necessarily dangerous if you never ever share a computer. This and bug 529899 are partial solutions, though it really seems simpler to just offer an option with the home page setting to save my tabs with/without data. The proposed solution may be problematic: if the objection to bug 443354 is that users expect to restart their browser and have everything "just work", having sites mysteriously fail to do so every seven days may be worse than consistently forgetting session data.
> having sites mysteriously fail to do so every seven days may be worse than > consistently forgetting session data. Yes, I don't like that either. I sometimes keep my shopping pages open long time, and are happy when the shop doesn't expire me, so neither should Firefox.
I don't understand how this would help. What kind of "brute force" attack would this prevent? Is it an attack involving the client or the server?
Session cookie should expire after 5-25 minutes. If a site wants a session to remain alive for a week it should use a persistent cookie. Or we could stop persisting session cookies as part of tab restore. If someone can find examples of long live session cookies on major sites please put them in this bug.
> Session cookie should expire after 5-25 minutes. Who says that? The spec says: "Max-Age The default behavior is to discard the cookie when the user agent exits."(RFC 2109 4.3.1, RFC 2965 3.3.1) You could loosen the spec and redefine session cookies as one that applies only to the current *visit* of the website. That ends at latest when the user closed all pages of the site. There's absolutely nothing that support expiring the cookie after a certain time. In fact, if the site wanted that, it would have set Max-Age. It also breaks sites. As I said, I get really annoyed with shopping sites that empty my basket or even log me out just because I gather more information about the products I am about to buy, or want to think more about it before committing to the purchase. That may take hours, sometimes days.
See bug 650298 for an important threat situation. So, this bug title correctly specifies the problem, but the solution proposed here is IMHO not the proper one. Apart from interfering with normal use (see my comments above), it's not a complete fix for bug 650298. I close the browser and expect sessions to be gone, not somebody being able to go to my computer immediately after I leave the room and explicitly closed the browser. We should just do what the spec says and empty session cookies when the browser exists. "Session restore" should not restore cookies.
This bug is now 2 years old, and the DUPs show that this is still a significant threat.
The bug I filed, 697684, has just been marked a duplicate of this. It's subtlely different as I was interpreting the bug as being with the preferences option "Accept 3rd party cookies. Keep until I close Firefox" -- which is not enacted. Rather than the complicated sliding scale suggested here, I'd just like there to be two options in the preferences, with the difference made clear. So that people who choose to keep their tabs but not their cookies can do so.
> two options in the preferences, with the difference made clear. > choose to keep their tabs but not their cookies That's a good idea to break the tie that we have here.
This is a huge security issue, and the fact that Mozilla even allows such functionality makes me question what other security issues Firefox has hidden under the covers. This behavior makes it very easy for someone with malicious intent to enable "Show my windows and tabs from last time" on a public computer and then camp-out and wait for someone to close the browser thinking they had destroyed their session. Until this issue is addressed, not only will I not be using Firefox on public computers anymore, but my best practice moving forward will be to block Firefox from public facing applications that require authentication.
If a public computer allows visitors to change browser prefs, you have bigger problems than session restore.
You must look at this issue from the a web application security perspective. If I have a public facing web application that requires authentication, and I have no control over how the Firefox preferences are configured on public/shared computers, then I have no way to guarantee that my end users sessions are protected if they are using Firefox with "Show my windows and tabs from last time" enabled. From a application security perspective I have to assume that my end users won't hit Logout, and that the user may assume by closing the browser that their session was destroyed (not realizing that "Show my windows and tabs from last time" is enabled). Since I have don't have control over how Firefox is configured on public/shared computers, then my only option for securing my application against someone hijacking a previous users session on a public/shared computer is to block all users from using Firefox on our sites.
Dan, Jesse is saying that from a web app perspective, you cannot trust such a host *at all*. If you want to continue this point, please file a new bug. This bug here is talking from a user perspective, not a web app perspective.
Until this new feature its always been the case that application end-users as well as application providers could trust that when a user agent exits that it does not leave any lingering sessions active. So I think the point is valid from both the user and application perspective. The word "default" used in the specification leaves a lot to interpretation "Max-Age The default behavior is to discard the cookie when the user agent exits."(RFC 2109 4.3.1, RFC 2965 3.3.1), so I can see how you could make the argument that since "Show my windows and tabs from last time" is not enabled by default that Firefox does conform to the current specification. What are your thoughts about RFC 2109 4.2.2 where the specification states: Secure .... Given Firefox's strong commitment to security (); what about an approach where session cookies marked Secure are always destroyed on exit? The specification seems to leave this decision up to the user agent...and since it says "(possibly under the user's control)" it would seem you could make this the default behavior without the option to disable it. Thoughts? The spec also states that we can use a Cache-Control header to stop the user agent from caching the session cookie. Do you know if Firefox adheres to this requirement if "Show my windows and tabs from last time" is enabled? RFC 2109 4.2.3 * To suppress caching of the Set-Cookie header: Cache-control: no- cache="set-cookie".
The whole point of the feature is to act as if the browser was never closed. Why should updating (and therefore restarting) my browser require me to lose all my state? If you want to limit session lifetimes just expire your session tokens more eagerly - the browser is an /user/ agent.
Last comment...I think I've made my point clear. Simple, don't update your browser until you've finished what your working on. And if you lose your state then it's probably because the site intended it that way. If not, then the site should have used persistent cookies if they had state information that they had intended to be persisted. Session cookies are not to be saved past the life of the browser process because it is a security risk, it that simple.. This is a very big security hole and it should be closed.
James, while I don't really want to add more noise to this bug, I think you're conflating two different things here: Firefox is clearly able to differentiate a restart from explicitly closing the browser, as evidenced by the behavior when "When Nightly starts:" is set to either "Show a blank page" or "Show my home page". With this setting, closing and reopening the browser will not automatically restore the previous session, but restarting the browser for an update or a change to extensions *will*. I think everyone can see the advantages of saving session data across restarts, i.e. when you expect the browser to pop back up right away. When you explicitly close the browser and then reopen it later on, however, this is not so obvious. For one thing, web pages associated with stored tabs may have changed, leaving the session data significantly out of date. The security problems mentioned above are another disadvantage. I'm not saying what Firefox does right now is *wrong*, per se - for instance if the browser crashes, a user will expect (or at least hope) that their data was saved. On the other hand that same user may give up in frustration, not realizing the next person to open the browser will see their data. So it's not clear that Firefox' current behavior is unequivocally *right*, either.
@James "The whole point of the feature is to act as if the browser was never closed....If you want to limit session lifetimes just expire your session tokens more eagerly - the browser is an /user/ agent." You assume this, but it is not communicated to the *user* that you think this is the point of the feature.. The fact that this is not actual behaviour removes agency from the user.
>. Exactly. I do want to keep the pages open - be it newspaper articles that I want to read or MDC tabs for APIs that I need for my work - but I chose "Keep cookies until I close Firefox" *specifically* because I don't want to be tracked forever by Google or advertisers and I want a regular cut in the tracking. I want to appear that I am a completely new user who opens these articles. Currently, Firefox doesn't allow me that.
(In reply to Ben Bucksch (:BenB) from comment #29) > Currently, Firefox doesn't allow me that. This may not be obvious enough to satisfy everybody, but set browser.sessionstore.privacy_level to 2 (0 = save all session cookies, 1 = don't save https/secure, 2 = don't save any)
Firefox should do something smarter if your cookie settings and session restore settings are mutually contradictory. That needs a separate bug, though. This bug is about session restore with the default cookie settings.
I'd like to add a point to the discussion and a potential start for fixing this issue: So far, if "Show my windows and tabs from last time" is selected, all session cookies are saved and later restored. However, most of those cookies are for pages not in the user's current tabs, but for sessions belonging to already closed ones*. If any cookie is saved and restored in a later instance of Firefox, it should at least belong to pages in the "windows and tabs from last time." Any other cookie not represented in such population should be removed if "Keep until: I close Firefox" is selected. This keeps the current behaviour for people who, as commented, would leave their online shopping basket loaded, close Firefox and expect the basket to remain saved, while at least giving a partial solution for people worried about their cookies. If you don't want cookies for your mail to be restored you can at least close its tab, but still take advantadge of the "Show my windows and tabs from last time" option. With the current implementation, your mail info will be kept unless you explicitly log out. * I've experienced this behaviour with Youtube's HTML5 trial (no account involved), StackExchange (no logout button) or Twitter (no login related info, since I log out). All this pages remember some of my settings between sessions, eventhough they shouldn't, and I rarely keep their tabs open between browsing sessions.
Elideb, do you have any app tabs? If so, you're probably hitting bug 704779.
Most of the bugs marked as dups of this bug are actually dups of bug 345345.
(In reply to Jesse Ruderman from comment #33) > Elideb, do you have any app tabs? If so, you're probably hitting bug 704779. Jesse, I did have an app tab, indeed. I've unpinned it and tested again Youtube and StackOverflow and their cookies are still restored after closing and opening Firefox. I've tested this 5 times, all of them with the same result, so I'd say the app tab was not the issue, unless they screw things permanently. And even if that would be the case, I still think that making sure session restore only kicks in for remembered tabs (if "Keep until: I close Firefox") would be the way to go, fixing this bug and bug 704779 at the same time..
A bug I filed, bug 769127, was marked a duplicate of this one. The interaction between Session Restore and the Privacy Settings, specifically "Clear cookies" and "Active logins" on shutdown violates the Principle of Least Surprise [1]. There should, at the very least, be text in the preferences UI that says session cookies, and Active logins by association, will not be cleared if Session Restore is enabled. As a user, I am not signing away my privacy rights just because multiple people have access to the machine. The browser is not being clear that my preference to clear login information has been overridden by another preference. [1]
Additionally, I am not suggesting something as complicated as honoring session cookie duration or enforcing a 7-day maximum lifetime of said cookies. My request is either the browser delete the cookies, and obey my preference, or the browser's preferences pane tells me that Session Restore will result in the cookies not being deleted. Armed with the information, I can make an informed decision about whether Session Restore is worth the risk of secure logins persisting across sessions.
@Manoj: you can actually get Firefox to behave the way you want it to, it just isn't accessible via the UI: Quoting "For the concerned users, they can change the hidden prefs (browser.sessionstore.privacy_level & browser.sessionstore.privacy_level_deferred) to 1 or 2 (save HTTP session cookies & no cookies respectively)." I quite agree with you about principle of least surprise, and find it bizarre that Firefox are ignoring requests to have this as an option accessible via the UI -- and to remove the ambiguity in the current UI option.
The request bug 443354 is tightly connected to this one. (In reply to Dan from comment #20) > Until this issue is addressed, > not only will I not be using Firefox on public computers anymore, but my > best practice moving forward will be to block Firefox from public facing > applications that require authentication. (In reply to Dan from comment #22) You look in the wrong direction. The place you need is "Clear recent history..." in the menu "Tools". Although this feature deals with other than recent stuff and with more than history. This feature needs a rephrasing into something much more general, like "Clear personal data" or "Clear navigation data". (In reply to Dan from comment #26) >. Anyway, if you can control the public computer, you can bug it with a key-logger. This is easy, you only need a few minutes. (In reply to Bill Sanford from comment #37) >. That is your expectation. As a user, I expect otherwise. I expect my bank to remember me, I hate having to login again and again. It is a matter of compromise between security and usability, who are always in conflict. I think it is good to let the user decide. Let's inform the user better, and let's respect the user's informed choice.
(In reply to Nicolas Barbulesco from comment #44) > That is your expectation. As a user, I expect otherwise..... I > think it is good to let the user decide. Let's inform the user better, and > let's respect the user's informed choice. I absolutely agree. The problem is, that as is, Firefox does *not* behave in the way I think I have specified, as a user. I want to "keep my tabs" and "delete all cookies when I close firefox" -- so those are the options I select in preferences, and that is the behaviour I expect. I haven't selected an option saying "delete all my cookies when I close firefox, except for the ones for tabs that are still open", but that is what I'm getting. [Unless I make changes in about:config]. This is the point I was making in comment 17. A user who chooses these options in their preferences is already a pretty well informed user. The "bug" is in the fact that behaviour is not as the selected preferences seem to describe. Absolutely, let the user decide, but do *let* them decide. [Without needing to find this conversation online and make the changes in about:config]
Elizabeth is right. Nicolas, you are missing the point. Please try to understand the problem that people are addressing here. A key-logger is not the solution to it...
(In reply to Jesse Ruderman from comment #31) > Firefox should do something smarter if your cookie settings and session > restore settings are mutually contradictory. That needs a separate bug, > though. This bug is about session restore with the default cookie settings. FWIW I've filed bug 1244756 to give a warning in this case. I'm not sure giving a warning is the best solution, but just adding extra prefs or options isn't helpful unless the user already understand that these two options don't interact well.
Duplicates regarding not honoring the user preference to clear cookies on shutdown (Bug 697684, Bug 769127, Bug 794253 and Bug 1240288) have been fixed by Bug 529899 and Bug 1260360.
Created attachment 8759600 [details] [diff] [review] bug-530594.patch Hi Josh, I have added a option to let user chooses the website that be browsed can restore the session cookies or not. Would you help me to confirm my patch? Thanks!
Comment on attachment 8759600 [details] [diff] [review] bug-530594.patch Review of attachment 8759600 [details] [diff] [review]: ----------------------------------------------------------------- This code actually belongs to the Firefox frontend team, rather than the cookie peers in my opinion. ::: browser/components/sessionstore/SessionCookies.jsm @@ +123,5 @@ > name: cookie.name || "" > }; > + > + var restore_session = Services.prefs.getBoolPref("network.cookie.restore.session"); > + if (!Services.cookies.cookieExists(cookieObj) && restore_session) { It would make more sense to return immediately from this function if the preference value is false, since we won't do any work. ::: modules/libpref/init/all.js @@ +1902,5 @@ > pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontAcceptAny, 3-limitForeign > #ifdef ANDROID > pref("network.cookie.cookieBehavior", 0); // Keep the old default of accepting all cookies > #endif > +pref("network.cookie.restore.session", true); Since this is all browser-level session storage code that is controlled by the value, browser.sessionstore.restore_session_cookies would be a more meaningful name.
(In reply to Amy Chung [:Amy] from comment #52) > Created attachment 8759600 [details] [diff] [review] > bug-530594.patch > > Hi Josh, > I have added a option to let user chooses the website that be browsed can > restore the session cookies or not. > Would you help me to confirm my patch? > > Thanks! Hi Amy! On a technical level, yes, this patch allows configuring whether Session Restore should restore session cookies. I'm not clear on the plan here, though, since making the behaviour configurable via about:config and leaving the default behaviour isn't really enough to solve this in my opinion. Are there further changes planned for this bug?
Hi Josh, Would you offer me some candidates in Necko frontend team? I would like to add a UI option to let user choose the behavior of restoring session cookies. Thanks!
I think Mike de Boer has been active in session restore code in the frontend recently. You may want to email the firefox-dev mailing list () about your plans for the UI option.
As per-disused with Mike at mail, we already excited a preference id "browser.sessionstore.privacy_level" can satisfy for user request and need UX's input. Preference id "browser.sessionstore.privacy_level" already cover my patch (I didn't browse all comment on this bug), so can pass my patch. Thanks!
My understanding is that our current behavior is the same as Chrome's? If so I suggest we WONTFIX this bug--it doesn't seem worth the bustage/user confusion/unalignment with chrome to change it.
(In reply to Jason Duell [:jduell] (needinfo me) from comment #58) > My understanding is that our current behavior is the same as Chrome's? If > so I suggest we WONTFIX this bug--it doesn't seem worth the bustage/user > confusion/unalignment with chrome to change it. "Behavior is the same as Chrome" sounds like an exceptionally weak argument for privacy-sensitive features :-) What does WONTFIX mean here, though? My understanding of the state of this bug is that we now have about:config preferences to control behavior, but we have no UI for it. It's not clear whether such an UI could be made understandable enough (see bug 1286748) to be in the default product. We definitely don't want to change the default.
> It's not clear whether such an UI could be made > understandable enough (see bug 1286748) to be in the default product. We > definitely don't want to change the default. Well, as I have been asking for exactly this for, er, nearly 5 years, maybe I should make some suggestions. Here are a few: * Under Privacy: additional option for cookies in "keep until:" so that the options are now - they expire - I close Firefox: SAVE cookies from saved tabs - I close Firefox: ALSO DELETE cookies from saved tabs * Under Privacy: additional clicky box under "accept cookies from sites" which says "always save cookies from saved browser tabs". When this is selected (and it can be default for it to be selected) behaviour is the current default; when it is unselected, behaviour is what I expected. * Under General: "when firefox starts:" options - Show my home page - Show a blank page - Show my windows and tabs from last time (retain user data) - Show my windows and tabs from last time (discard user data). I agree the 3rd idea here isn't ideal because it forces the issue on users with a very casual interest in their preferences. I continue to hold the view that anyone who gets as far as the Privacy tab will understand the distinction, and many users, like me, will think the current UI options mean that they have selected behaviour to discard all cookies -- and be baffled / dismayed to find this not the case (see my comment 17 above).
It's probably better to continue the discussion about the UX in the bug that was filed for it (and which you even quoted in your response).
(In reply to Gian-Carlo Pascutto [:gcp] from comment #61) > It's probably better to continue the discussion about the UX in the bug that > was filed for it (and which you even quoted in your response). I thought convention was, once a bug is filed as a duplicate, all discussion should continue in the same place? But I'm only trying to follow convention, I'm happy either way. I've re-posted my suggestion above back in bug 697684.
(In reply to Elizabeth from comment #62) > I thought convention was, once a bug is filed as a duplicate, all discussion > should continue in the same place? Yes, that's correct. The problem was "fixed" in this bug by adding about:config preferences. There is a followup bug to see if there's a possibility to make an understandable UX to control those preferences, which is, I repeat, bug 1286748. I would imagine some kind of resolution there will cause this bug to be closed. > But I'm only trying to follow convention, I'm happy either way. I've re-posted my suggestion above back in bug 697684. It looks like that bug should have been duped to bug 529899 or bug 1260360 instead of this one. The behavior described there has been fixed already, as pointed out by comment 51.
Apologies, I misunderstood you. Going over to bug 1286748.
> "Behavior is the same as Chrome" sounds like an exceptionally weak argument for > privacy-sensitive features :-) Seconded. If we do everything like Chrome, there's no need for Firefox. Google has a significant business interest in tracking people, without gap, eternally. That's exactly the problem here. Google wants that, I don't. Chrome is the worst example you could pick.
In my recent cookie testing, session restore only retains session cookies for tabs that are still open when the browser shuts down. So not *all* session cookies live forever, just the ones for the sites you leave open all the time. That's better than nothing. Anyways, sites that really want to track you will use non-session cookies, so eagerly clearing session cookies is no protection.
|
https://bugzilla.mozilla.org/show_bug.cgi?id=530594
|
CC-MAIN-2017-34
|
refinedweb
| 4,463
| 62.07
|
Hello, You could look at the implementation of backtracking tarnsformer (BackT) in my monad library: The version there is written in continuation passing style so it may be a tad confusing at first. Another (similar in principle) implementation is like this: > module BackT where > > import Monad(MonadPlus(..)) > > newtype BackT m a = B { unB :: m (Answer m a) } > data Answer m a = Fail | Done a | Choice (BackT m a) (BackT m a) > > instance Monad m => Monad (BackT m) where > return a = B (return (Done a)) > B m >>= k = B (do x <- m > case x of > Fail -> return Fail > Done a -> unB (k a) > Choice m1 m2 -> return (Choice (m1 >>= k) (m2 >>= k)) > ) > > lift :: Monad m => m a -> BackT m a > lift m = B (do x <- m > return (Done x)) > > instance Monad m => MonadPlus (BackT m) where > mzero = B (return Fail) > mplus m1 m2 = B (return (Choice m1 m2)) Then you can write different tarversal schemas that perform the effects in different ways, e.g. find all answers in breadth first manner, or find one answer in depth first manner, etc. -Iavor On Mon, 28 Mar 2005 17:58:48 +0200, Pierre Barbier de Reuille <pierre.barbier at cirad.fr> wrote: > Hello, > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > >
|
http://www.haskell.org/pipermail/haskell-cafe/2005-March/009523.html
|
CC-MAIN-2014-41
|
refinedweb
| 210
| 59.26
|
increased chunk size
Dependencies: HTTPClient-SSL
Fork of MTS-Socket by
« Back to documentation indexShow/hide line numbers
IPStack.h
00001 #ifndef IPSTACK_H 00002 #define IPSTACK_H 00003 00004 #include <string> 00005 #include "CommInterface.h" 00006 00007 /** This class is a pure virtual class that should be inherited from when implementing 00008 * a communications device with an onboard IP stack. Examples of this would be a Wi-Fi 00009 * or Cellular radio. The inheriting class should map the device commands and functionality 00010 * to the pure virtual methods provided here. There should also be at least one or more calls 00011 * to setup the communication link specific paramters as an init method for example. This 00012 * would do things like configure the APN in a cellular radio or set the ssid for a WiFi device, 00013 * which cannot be accounted for in an abstract class like this one. Note that to provide physical 00014 * connection management methods this class inherits from CommInterface. 00015 */ 00016 class IPStack : public CommInterface 00017 { 00018 public: 00019 /// An enumeration for selecting the Socket Mode of TCP or UDP. 00020 enum Mode { 00021 TCP, UDP 00022 }; 00023 00024 /** This method is used to set the local port for the UDP or TCP socket connection. 00025 * The connection can be made using the open method. 00026 * 00027 * @param port the local port of the socket as an int. 00028 */ 00029 virtual bool bind(unsigned int port) = 0; 00030 00031 /** This method is used to open a socket connection with the given parameters. 00032 * 00033 * @param address is the address you want to connect to in the form of xxx.xxx.xxx.xxx 00034 * or a URL. If using a URL make sure the device supports DNS and is properly configured 00035 * for that mode. 00036 * @param port the remote port you want to connect to. 00037 * @param mode an enum that specifies whether this socket connection is type TCP or UDP. 00038 * @returns true if the connection was successfully opened, otherwise false. 00039 */ 00040 virtual bool open(const std::string& address, unsigned int port, Mode mode) = 0; 00041 00042 /** This method is used to determine if a socket connection is currently open. 00043 * 00044 * @returns true if the socket is currently open, otherwise false. 00045 */ 00046 virtual bool isOpen() = 0; 00047 00048 /** This method is used to close a socket connection that is currently open. 00049 * 00050 * @returns true if successfully closed, otherwise returns false on an error. 00051 */ 00052 virtual bool close(bool clearBuffer) = 0; 00053 00054 /** This method is used to read data off of a socket, assuming a valid socket 00055 * connection is already open. 00056 * 00057 * @param data a pointer to the data buffer that will be filled with the read data. 00058 * @param max the maximum number of bytes to attempt to read, typically the same as 00059 * the size of the passed in data buffer. 00060 * @param timeout the amount of time in milliseconds to wait in trying to read the max 00061 * number of bytes. If set to -1 the call blocks until it receives the max number of bytes 00062 * or encounters and error. 00063 * @returns the number of bytes read and stored in the passed in data buffer. Returns 00064 * -1 if there was an error in reading. 00065 */ 00066 virtual int read(char* data, int max, int timeout = -1) = 0; 00067 00068 /** This method is used to write data to a socket, assuming a valid socket 00069 * connection is already open. 00070 * 00071 * @param data a pointer to the data buffer that will be written to the socket. 00072 * @param length the size of the data buffer to be written. 00073 * @param timeout the amount of time in milliseconds to wait in trying to write the entire 00074 * number of bytes. If set to -1 the call blocks until it writes all of the bytes or 00075 * encounters and error. 00076 * @returns the number of bytes written to the socket's write buffer. Returns 00077 * -1 if there was an error in writing. 00078 */ 00079 virtual int write(const char* data, int length, int timeout = -1) = 0; 00080 00081 /** This method is used to get the number of bytes available to read off the 00082 * socket. 00083 * 00084 * @returns the number of bytes available, 0 if there are no bytes to read. 00085 */ 00086 virtual unsigned int readable() = 0; 00087 00088 /** This method is used to get the space available to write bytes to the socket. 00089 * 00090 * @returns the number of bytes that can be written, 0 if unable to write. 00091 */ 00092 virtual unsigned int writeable() = 0; 00093 00094 /** This method is used test network connectivity by pinging a server. 00095 * 00096 * @param address the address of the server in format xxx.xxx.xxx.xxx. The 00097 * default 8.8.8.8 which is Google's DNS Server. 00098 * @returns true if the ping was successful, otherwise false. 00099 */ 00100 virtual bool ping(const std::string& address = "8.8.8.8") = 0; 00101 00102 /** This method is used to get the IP address of the device, which can be 00103 * set either statically or via DHCP after connecting to a network. 00104 * 00105 * @returns the devices IP address. 00106 */ 00107 virtual std::string getDeviceIP() = 0; 00108 00109 /** This method is used to set the IP address or puts the module in DHCP mode. 00110 * 00111 * @param address the IP address you want to use in the form of xxx.xxx.xxx.xxx or DHCP 00112 * if you want to use DHCP. The default is DHCP. 00113 * @returns true if successful, otherwise returns false. 00114 */ 00115 virtual bool setDeviceIP(std::string address = "DHCP") = 0; 00116 }; 00117 00118 #endif /* IPSTACK_H */
Generated on Sun Dec 23 2018 20:44:36 by
|
https://os.mbed.com/users/kruenhec/code/MTS-Socket/docs/tip/IPStack_8h_source.html
|
CC-MAIN-2022-05
|
refinedweb
| 962
| 71.34
|
Serial comms in Python
- Pavils Jurjans
Now that I have set up the serial comms between Omega and Arduino, the next step is to write some Python code that talks to Arduino.
Installing python is easy:
$ opkg update $ opkg install python
But this does not install the Python serial library. I couldn't figure out which package should I install to be able to do
import serial.
- Pavils Jurjans
Ok, never mind, I've downloaded the library from
Extracted the tar and copied the serial folder to my project root.
Here's some Python code for quick reference:
import serial port = serial.Serial("/dev/ttyATH0", baudrate=115200, timeout=3.0) port.open() port.isOpen() port.write("blahblahblah")
Thank you so much for posting this. I plan to use one of my Onion's in this way.
- Adam Watts
I've never installed a python library before, how do you do it. I want to use pyserial as well
- Pavils Jurjans
@Adam-Watts, since the storage space on Omega is fairly limited, I did not install any Python package manager. If you use a module in one project, then its ok to copy the module folder in your project root.
Here's my file tree:
/root/myproject - project folder
/root/myproject/serial - pyserial module, "serial" folder copied from
/root/myproject/main.py - python script that does your stuff
In you main.py file, you can then just
import serialand Python will know that it has to look in the working directory for the module folder.
Has anyone managed to install pyserial for Python3?
pyserial isn't one of the packages listed by opkg.
When trying to build from the source ( and) I get an error:
"unable to open /usr/lib/python3.4/config-3.4/Makefile"; sure enough, the whole config-3.4 directory is missing after a python3-light install.
I'm unfamiliar enough with the python packages to know why.
(note: the soureforge link above is just for Python 2.7 and before, and is a bit dated).
Thanks in advance,
Bill
Hi @Bill-M, have you tried this
makefile?
|
http://community.onion.io/topic/251/serial-comms-in-python/7
|
CC-MAIN-2019-43
|
refinedweb
| 351
| 66.13
|
span8
span4
span8
span4
Hello,
What we do is get KMZs and run the ArcGIS tool to convert them to to layers in a file GDB. When you use the layer in ArcMap there is a field PopupInfo, which has HTML data we need to extract?? I have tried several recommendation with HTML, but nothing gets me to where I can flatten the data out into a usable table. Please let me know any suggestions?
@dbklingdom The trick is converting the HTML into XML so that you can use the FME XMLFlattener or similar XML tools. So the HTMLToXHTMLConverter and the XMLFlattener are probably what you need. There is still a bit of clean-up and renaming to do. I've attached an example workspace (2018.1). HTMLtoXMLexample.zip
There is probably a slightly more elegant way to flatten the XML, but this works with the sample data you sent us.
Hi @dbklingdom
I would recommend using the method in the following article:
You may need to modify the XQuery Expression in the XMLXQueryExtractor transformer based on the structure of your XHTML attribute. Try replacing the second line of the XQuery Expression in the article with:
for $x in /html/body/table/tr
FME_TODAY.zipThanks Mark this help out a lot. For some reason we are getting gaps in the attributes from the attributeCreator. I have dropped my work and some sample data if you get a chance to give it a try? Many thx
I think you may have replied to the wrong answer :) The 'gaps' in the attributes are caused by your AttributeCreator referring to list values that do not exist on the feature (eg. td{13}).
I have modified your workspace to work with the data attached as well as added an alternative workflow using the steps outlined in the linked article in my answer above.
Working NO fields_safeSupport.fmw
@debbiatsafe @takashi Thanks debbiatsafe! I had been able to get html/body/table/tr/td/table/tr prier to your reply, but the query run very nice as well. I have been trying to work a way to automagicly Expose the Attribute instead of typing them all. I have been trying Exploders and creates but look like I need a way to iterate _aggList{x}.html_Value. Any recommendation? Thx
@debbiatsafe Hey Thx for all the help!! Looks I keep running into ever changing HTML. the latestXquery.txt I get no data or an error '... Last line repeated 124 times ...'. I have been tweeing the query but not going anywhere. I think I need to skip the first tr is that possible? Thx again Brian ps. See somebody next week.
Hi @dbklingdom
I personally find using a text editor like Notepad++ to view the output from the HTMLToXHTMLConverter transformer very helpful in viewing the structure as it is possible to collapse nodes. This makes it easier to make changes to the XPath expression (/html/body/table/...) within the XQuery expression as required.
For example, for the text file linked above, the XQuery expression would be:
declare default element namespace ""; for $x in /html/body/table/tr/td/table/tr return fme:set-attribute($x/td[1]/text(),$x/td[2]/text())
If you are looking to make your workspace more dynamic, I would recommend looking at marcp's very helpful comment on the Exposing Feature Attributes from KML tag article. He suggested using the following XQuery expression which does not require an XPath expression to be specified.
declare default element namespace ""; for $x in //tr where (exists($x/td[1]) and compare($x/td[2]/text(),"<Null>")) return fme:set-attribute($x/td[1]/text(),$x/td[2]/text())
As the user mentions in their comment:
The //tr extracts rows, regardless of what comes before, which is very handy so that you don't really need to figure out the structure.
This should reduce the need to change the XQuery expression within the XMLXQueryExtractor.
Answers Answers and Comments
15 People are following this question.
Extract data and hyperlink from web page 2 Answers
HTMLReportGenerator Update 1 Answer
Query Javascript in html 1 Answer
Transpose Records based on intersection 1 Answer
How to show images of an email ? 2 Answers
|
https://knowledge.safe.com/questions/89637/extracting-html-from-the-popupinfo-field-of-a-gis.html
|
CC-MAIN-2019-43
|
refinedweb
| 701
| 62.78
|
Vulnerability Overview
After Adobe released a patch for this vulnerability, it was made public that this bug was already being exploited in the wild by some exploit kits like Angler and Nuclear Pack. This vulnerability is about an integer overflow in Adobe Flash Player when parsing a compressed ID3 tag which size exceed 0x2AAAAAAA bytes. An error in how the size of a dynamic allocated buffer is calculated, used as destination for final decompressed data, produces that too much data is copied to a small buffer. In other words, a heap-based buffer overflow. This bug was fixed in Adobe Flash player 18.0.0.232. However, this is an important fix because that version, the previous one 18.0.0.209, and new versions, introduce new exploit mitigations to avoid exploitation techniques as the one described in Haife's Li presentation using Vector. In fact, the exploits included in the exploit kits mentioned above, perform new bypasses as the ones described in the Project Zero blog spot.
Vulnerability analysis, finding the root cause
Natalie Silvanovich, from Google Project Zero (PZ), made public a PoC in order to trigger this bug. As the PoC seems to be written for Flash CS (or some compliant compiler) and I like more Apache Flex, I re-wrote the PoC like this:
package { import flash.display.*; import flash.media.*; import flash.utils.*; import flash.net.*; import flash.events.*; import flash.system.*; import flash.external.*; import avm2.intrinsics.memory.*; public class CVE_2015_5560 extends Sprite { public var mySound:Sound; function CVE_2015_5560() { logDebug("Loading MP3 file ..."); mySound = new Sound(); mySound.load(new URLRequest("CVE_2015_5560.mp3")); mySound.play(); logDebug("Triggering corruption :)"); setInterval(f, 1000); } private function f():void { mySound.id3; } } }
Anyway, the important thing here is the MP3 referenced in the code; that's the real file triggering the bug. Let's see a little bit the structure of the ID3 tag contained in the MP3 file with the help of the 010 Editor and its MP3 template:
We can observe the presence of an ID3v2 tag followed by another tag that the template couldn't recognize due to malformed data:
MP3: ID3v2 tag found MP3: warning: invalid ID3v2 tag header --> ERROR HERE!!! MP3: warning: invalid MPEG frame synchronization at offset 0xA MP3: warning: invalid MPEG header in frame at offset 0x1ACA4D MP3: warning: invalid MPEG frame synchronization at offset 0x1ACA51 MP3: first found MPEG frame parameters: MP3:- header ofsset: 0x1BB668 MP3:- bitrate: 192 kbit MP3:- MPEG-1 layer 3 MP3:- sampling frequency: 44100 Hz MP3:- channel mode: stereo MP3:- CRC protected: No MP3: ID3v1 tag found MP3: file parsing completed! MP3: valid MPEG frames found: 13324 MP3: average frame bitrate: 192 kbit
In the previous image, we can see the major and revision fields in the ID3 header with the values 3 and 0, respectively, which means that this is an ID3v2.3.0. Hence I'm going to use that version of the specs to perform my analysis of the tag. According to the specification, after the main ID3 header, we can find the so called ID3 frames, with the following structure:
Frame ID $xx xx xx xx (four characters) Size $xx xx xx xx Flags $xx xx
So, we have 10 bytes, adjusting this to what we have seen previously, our tag ends like this:
Frame ID: 'TEOB' Size: 0x000A9DDC Flags: 0x0080
First, we have the Frame ID. In our case, it is a user defined text information frame. After the Frame ID, we have the Size, 0xA9DDC. This is the frame size excluding the frame header, that is frame size - 10. At the end, we have the Flags, 0x0080. This field is composed by two bytes, 0x00 and 0x80. The first byte, 0x00, is the status message and the second one, 0x80, is used for encoding purposes. According to the mentioned in the 3.3.1. Frame header flags section, our first byte is 0x00, so, our result is:
- Tag alter preservation: Frame should be preserved.
- File alter preservation: Frame should be preserved.
- Read only: no read-only.
These are not important flags for us, let's see the other byte, 0x80 (10000000 in binary):
- Compression: 1 Frame is compressed using zlib with 4 bytes for 'decompressed size' appended to the frame header.
- Encryption: 0 Frame is not encrypted.
- Grouping identity: 0 Frame does not contain group information.
In this second byte, only the most significant bit, the Compression bit, is on so that indicates that our frame is compressed using zlib. Therefore, according to the specs, there must be decompression size (4 bytes) field after the frame header. In our case, our decompression size is 0x2AAAAAAA. What's next is the compressed data using zlib. Just to be sure, I wrote a small and ugly script to decompress the data:
import sys import zlib from struct import unpack print 'Opening file ...' fd = open(sys.argv[1], 'rb') data = fd.read() fd.close() print 'Reading tag size ...' tag_size = unpack('>L', data[0x0E:0x0E+4])[0] print 'Tag size: %x' % tag_size print 'Getting compressed data ...' compressed_data = data[0x18:0x18+tag_size] print 'Decompressing ...' decompressed_data = zlib.decompress(compressed_data) print 'Saving decompressed data to a file ...' fd = open('output.bin', 'wb') fd.write(decompressed_data) fd.close() print 'Done. Saved to output.bin'
This is the result:
The decompressed data contains a lot of 0x03 bytes. According to the PZ advisory, the decompression size is the value that causes the integer overflow so, it's important to pay a attention to this value during our debugging session. Just to see how Adobe Flash Player behaves using this PoC, I compiled the AS code and put the generated SWF file plus the MP3 file and an HTML file that loads the SWF in a folder and then started a webserver using Python like this: python -m SimpleHTTPServer 8888. My testing environment is Windows Ultimate SP1 with Adobe Flash Player 18.0.0.209 (32 bits). Once I requested the HTML and the SWF was loaded, this was the result:
In the previous image, EIP has the value 0x01000100 and in EAX we can recognize a know value, 0x03030303 (compressed data). In this case, we were a lucky guys because 0x03030303 is a mapped address and it content ended up in EIP. When this address is not mapped, the program crashes earlier, in a CALL [EAX+8], just in the virtual call of the id3 property from the mySound object.
Next step is to identify where the integer overflow is produced so we must find the function responsible for parsing the ID3 tag. Generally, an ID3 tag is used to show meta-information as the album name, music genre, artist name, etc; of a MP3 file (or any audiovisual container file) so I started to look for strings in IDA like "album", "genre", "author", etc. Through the "genre" string, I finally found a nice basic block where the tag seems to be parsed:
The sub_64F24E1F function is responsible for parsing all the frames in the archive. We can set a breakpoint at the very beginning of the function and start tracing to identify the important pieces of the code. Here's a brief summary of the most important pieces of the code. Just for convenience, I renamed the function to parse_id3_tag. What happens first in parse_id3_tag+24, when calling GetFrameInfo, is that the Frame ID is read:
parse_id3_tag+1D loc_64F24E3C: parse_id3_tag+1D xor ebx, ebx parse_id3_tag+1F push ebx parse_id3_tag+20 push 4 parse_id3_tag+22 mov ecx, esi parse_id3_tag+24 call GetFrameInfo parse_id3_tag+29 mov [ebp+var_14], eax parse_id3_tag+2C cmp eax, ebx parse_id3_tag+2E jz loc_64F25160
In EAX, we have the return value:
After that, the Size is read:
parse_id3_tag+43 parse_id3_tag+43 loc_64F24E62: parse_id3_tag+43 movzx eax, byte ptr [esi+20h] parse_id3_tag+47 push eax parse_id3_tag+48 push 4 parse_id3_tag+4A call GetFrameInfo
parse_id3_tag+61 push ebx parse_id3_tag+62 push 1 parse_id3_tag+64 mov ecx, esi parse_id3_tag+66 call GetFrameInfo >> encoding parse_id3_tag+6B push ebx parse_id3_tag+6C mov edi, eax parse_id3_tag+6E push 1 parse_id3_tag+70 shl edi, 8 parse_id3_tag+73 call GetFrameInfo >> status message parse_id3_tag+78 mov ecx, [ebp+var_8] parse_id3_tag+7B mov ebx, eax parse_id3_tag+7D mov al, [esi+20h] parse_id3_tag+80 or ebx, edi parse_id3_tag+82 cmp byte ptr [esi+21h], 4 parse_id3_tag+86 mov [ebp+var_20], ebx parse_id3_tag+89 mov [ebp+var_10], al parse_id3_tag+8C mov [ebp+var_1C], ecx parse_id3_tag+8F mov [ebp+var_1], 1 parse_id3_tag+93 jnz short loc_64F24F12
As we mentioned earlier, the Compression bit is on so there must be a call to get the decompression size value and that's exactly what happens next:
parse_id3_tag+103 push dword ptr [ebp+var_10] parse_id3_tag+106 mov ecx, esi parse_id3_tag+108 push 4 parse_id3_tag+10A call GetFrameInfo parse_id3_tag+10F sub [ebp+var_8], 4 parse_id3_tag+113 mov [ebp+var_1C], eax
Now that the frame size and the size for the decompressed data have been read, it's time to allocate the corresponding buffers to hold the data. Starting at parse_id3_tag+1BD, it allocates a buffer using frame size - 4 as the size for the buffer:
parse_id3_tag+1BD push 1 ; char parse_id3_tag+1BF push 0 ; int parse_id3_tag+1C1 push 1 ; int parse_id3_tag+1C3 push [ebp+var_8] ; int >> frame size parse_id3_tag+1C6 call AllocFrameBuffer parse_id3_tag+1CB add esp, 10h parse_id3_tag+1CE push dword ptr [ebp+var_10] ; char parse_id3_tag+1D1 mov ecx, esi parse_id3_tag+1D3 push eax ; int >> buffer to store data parse_id3_tag+1D4 push [ebp+var_8] ; int >> frame size - 4 parse_id3_tag+1D7 mov [ebp+var_18], eax parse_id3_tag+1DA mov edi, eax parse_id3_tag+1DC call CopyCompressedDataToBuffer parse_id3_tag+1E1 mov ebx, eax parse_id3_tag+1E3 mov al, [esi+21h] parse_id3_tag+1E6 cmp al, 4 parse_id3_tag+1E8 jnz short loc_64F2500F
Remember that the size was 0x0A9DDC and now it is 0x0A9DD8. In this case, 0x07A39000 is the buffer used to hold the compressed data. This data is copied there using the CopyCompressedDataToBuffer function:
After that, it allocates a buffer using the decompression size and then decompress and copy the data to the buffer:
parse_id3_tag+1FA parse_id3_tag+1FA loc_64F25019: parse_id3_tag+1FA mov edi, [ebp+var_1C] parse_id3_tag+1FD push 1 ; char parse_id3_tag+1FF push 0 ; int parse_id3_tag+201 push 1 ; int parse_id3_tag+203 push edi ; int >> decompression size parse_id3_tag+204 mov [ebp+var_24], edi parse_id3_tag+207 call AllocFrameBuffer parse_id3_tag+20C push ebx ; int >> frame size - 4 parse_id3_tag+20D push [ebp+var_18] ; int >> buffer with compressed data parse_id3_tag+210 lea ecx, [ebp+var_24] parse_id3_tag+213 push ecx ; int parse_id3_tag+214 push eax ; int >> buffer to store the data parse_id3_tag+215 mov [ebp+var_20], eax parse_id3_tag+218 call DecompressZlibData parse_id3_tag+21D add esp, 20h parse_id3_tag+220 test eax, eax parse_id3_tag+222 jnz loc_64F25160
At this point, we don't notice anything unusual, everything seems to be fine. We keep in mind that in 0x07C30000 we have the decompressed data but a little bit further, in parse_id3_tag+281, we see this:
parse_id3_tag+281 parse_id3_tag+281 loc_64F250A0: parse_id3_tag+281 mov eax, ebx parse_id3_tag+283 imul eax, 6 parse_id3_tag+286 add eax, 2 parse_id3_tag+289 cmp [esi+28h], eax parse_id3_tag+28C mov [ebp+var_20], eax parse_id3_tag+28F jge short loc_64F250DA
In EBX, we have the decompression size - 1 (this has to do with a little code that we overlooked [1]), 0x2AAAAAAC. Then, EBX is copied to EAX and multiplied by 6. The result is stored in EAX. Let's do some math: (0x2AAAAAAC * 6) + 2 = 0x10000000A Now we do find the bug, the integer overflow is very obvious, what only fits in 32 bits is 0x0A. Then, the result of this operation is used as a size to allocate a buffer in parse_id3_tag+2A6:
parse_id3_tag+2A6 parse_id3_tag+2A6 loc_64F250C5: ; char parse_id3_tag+2A6 push 1 parse_id3_tag+2A8 push 0 ; int parse_id3_tag+2AA push 1 ; int parse_id3_tag+2AC push eax ; int >> overflowed size parse_id3_tag+2AD mov [esi+28h], eax parse_id3_tag+2B0 call AllocFrameBuffer parse_id3_tag+2B5 add esp, 10h parse_id3_tag+2B8 mov [esi+24h], eax
In this case, the buffer starts at 0x04A7C920 and its size is, as we shown before, 0x0A. Then, in parse_id3_tag+2D5, there is a function call to copy the remaining decompressed data to the previously allocated buffer with the overflowed size:
parse_id3_tag+2CA push [ebp+var_1C] ; int parse_id3_tag+2CD lea eax, [ebx+edi] parse_id3_tag+2D0 push eax ; int >> value used as MAX counter(EBX+EDI) parse_id3_tag+2D1 push edi ; int >> src buffer (with decompressed data) parse_id3_tag+2D2 push ecx ; int >> dest buffer (allocated with overflowed size) parse_id3_tag+2D3 mov ecx, esi parse_id3_tag+2D5 call InternalMemcpy parse_id3_tag+2DA mov ecx, [ebp+var_20]
If we look it in Ollydbg, we see this:
We can see that one of the parameters used in the function call is 0x326DAAAD. This is the result of executing the lea eax, [ebx+edi] instruction located at parse_id3_tag+2CD. EBX had decompression size - 1 while EDI pointed to the buffer where the decompressed data +1 was, so, 0x02AAAAAAC + 0x07C30001 = 0x326DAAAD. This value it's going to be used in InternalMemcpy+D8 as one of the conditions in the loop. The other condition in the loop is to copy until a null byte is found. After tracing some rounds of the loop, we can see how the copy operation was performed beyond the 0x0A bytes:
Boom, heap overflow in sight!
Some words about the exploitation process
To summarize, the root vulnerability is an integer overflow that then ends up in a heap-based buffer overflow. In a very basic exploitation scenario, we must massage the heap in order to place a buffer with our data just after the buffer we overflow. Also, as we have protections such as ALSR/DEP/CFG that we must bypass in order to get reliable code execution, it would be a good idea to build some kind of read/write primitives that help us during the exploitation process. For Flash 18.0.0.209, the most used technique to exploit Adobe Flash was the one described by Haifei Li, entitled "Smashing the Heap with Vector: Advanced Exploitation Technique in Recent Flash Zero-day Attack". By incrementing the value stored in the length field of a Vector.<uint> object, we can read and write beyond the limits of the Vector. So, we could place a Vector.<uint> after our overflowed buffer and overwrite the metadata, the length field to be more accurate, and build our read/write primitive. The following picture (borrowed from Project's Zero post):
During the exploitation process, it ends up like this:
But starting from Adobe Flash 18.0.0.209 we have some new challenges to face before getting reliable code execution because new exploit mitigation mechanisms were added in order to avoid the mentioned method from Haifei Li. For example, now Flash has some heap isolation mechanism called heap partitioning in which objects like Vector.<uint> are isolated from the Flash heap and stored in the System heap. So, our exploitation scenario turns into something like this:
As if this were not enough, now we have better ASLR in the heap. To highlight:
- Allocations > 1 MB have better randomization
- In x64, the Flash heap ends up far away of any mapped area
Last but not least, a validation to the length fields of the Vector.<*> object was added. If you want to read more detailed information about all these new mechanisms introduced in Flash you can go the the excellent write up published by Project Zero. So, the only thing to think at this point is: we are screwed!. In order to exploit this bug in a reliable way, at least in Flash 18.0.0.209, we are going to not only allocate in a deterministic way (to avoid randomization) an object that places after our overflowed buffer (Flash heap) but also it must have the capability to give us the possibility (as the length of a Vector.<uint> object did it before) to generate a read/write primitive. So, please, stay tuned to see how this story ends!
Notes
- [1] We only get to the zone where the overflow occurs just if the JG jump located at parse_id3_tag+27B is not executed, that is, if the condition is False. Once the data was decompressed it takes the first byte of the buffer, it decrements the decompression size by 1 and compares it with 3. If it is greater, it goes to the end of the loop and process the next frame. If not, it goes to the overflow zone.
|
https://www.coresecurity.com/blog/analysis-of-adobe-flash-player-id3-tag-parsing-integer-overflow-vulnerability-cve-2015-5560
|
CC-MAIN-2019-26
|
refinedweb
| 2,726
| 63.12
|
When I play my transform changes and I have set the prefab to the same position to be sure, I am trying to make my bullet fire out of my gun barrel here is the script
using UnityEngine; using System.Collections;
public class Shooting : MonoBehaviour {
public Rigidbody BulletPrefab;
public float speed = 100f;
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0)){
Rigidbody BulletInstance;
BulletInstance = Instantiate(BulletPrefab, transform.position, transform.rotation) as Rigidbody;
BulletInstance.AddForce(transform.forward * speed);
}
}
}
thanks!
Make sure that "transform" is located at the gun muzzle.
what exactly is the problem you are having?
My bullets spawn above my player even if I move the transform of my bullet spawn point
and my spawn is placed at the muzzle but it just spawn over my player
Answer by superluigi
·
Jan 18, 2015 at 10:46 PM
If I'm not mistaken, the final line of your code has it adding force to your bullet every Update and at the transform.forward of your gun and not the bullet. You should always handle physics such as addforce in fixedUpdate and not Update, and your line also means that when your player turns the bullet is gonna turn with it (because every frame it will = the forward of your gun instead of the forward of the bullet)
are you shooting in first person view? If that's the case then when you look up, you might not see the bullet if your script isn't attached to the camera or something with the cameras rotation. Let me know so i can help you further and explain exactly what i mean
no im in third and it spawns above my player wherever I place it, thanks for answering though!
ook so is your spawn point an empty game object? the fix is really quite simple. Separate your game view from your scene view, and make sure that you don't maximize your game view when you hit play. Now select your spawn point in the hierarchy and check if it's above your player when you hit play, also check if it moves with your player when he walks.
my spawn point is a sphere and I can move it to my barrel but it will just move back over my player when I hit play, also it moves with the player but it will move further away every second, I think it might be my animation because it makes my soldier move slightly every frame, it also wont shoot forward in front of my spawn point like it should be
ok that's weird. I never apply root motion from animations to my characters, so i can't necessarily say if it leaves your transform alone while the character moves, but I doubt that's the case. There's absolutely no reason for the sphere spawn point to jump to the top of your character unless a script is telling it to do so. Check every code you have that references the sphere spawn point and look for the line where you're messing with it's transform.position. Also before you do that, real quickly turn off apply root motion on your character so that the animation doesn't move it's position, hit play and check if the sphere still jumps to the top of your character. Also try deactivating your animator if possible (might not be possible depending on your code) and check if it still does that. finally, while in play mode, in the scene view select and manually drag your character and check if the sphere follows yourRef error
1
Answer
Instantiate Problem
2
Answers
how to spawn on random postion but non on static positions
0
Answers
Bullet only goes in a single way
0
Answers
How to Spawn Object at next Empty Location
1
Answer
|
https://answers.unity.com/questions/879600/when-i-set-spawn-point-to-a-transform-when-i-play.html
|
CC-MAIN-2019-35
|
refinedweb
| 645
| 60.99
|
24 January 2007 23:27 [Source: ICIS news]
TORONTO (ICIS news)--Kinder Morgan, a US energy and petrochemicals logistics company, said on Wednesday that it agreed to buy, for $50m (€39m), BP’s 50% stake in the Cochin natural gas liquids (NGL) and petrochemicals pipeline system.
Kinder Morgan already holds a 50% stake in the pipeline system.
It expects to close the transaction within the first quarter and will then also take over the operation of the line from BP, a ?xml:namespace>
BP announced last year it would upgrade the 1,900-mile line citing possible stress corrosion. It also suspended ethylene shipments on the line which transports NGLs and other petrochemical products from
Dow Chemical said in August last year it was shutting down all of its chemical manufacturing plants in Sarnia by end 2008 and cited lack of affordable feedstock due to the suspension of ethylene shipments on Cochin.
Asked about the status of the line and the cost of upgrading it, the spokeswoman said that Kinder took these factors into account in negotiating the transaction with B
|
http://www.icis.com/Articles/2007/01/24/9001131/kinder-morgan-to-take-over-cochin-petchem-pipeline.html
|
CC-MAIN-2014-15
|
refinedweb
| 181
| 50.3
|
Red Hat Bugzilla – Bug 73024
missing dependency on libelf?
Last modified: 2008-05-01 11:38:03 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020809
Description of problem:
After upgrading up2date to 2.9.55-2 and rpm to 4.1-1.0, up2date will no longer
run. I had to update libelf to 0.8.2-2
Version-Release number of selected component (if applicable):
How reproducible:
Always
Steps to Reproduce:
1.Install null
2.Update up2date and rpm from the RHN null channel
3.Try to run up2date again
Actual Results: Traceback (most recent call last):
File "/usr/sbin/up2date", line 9, in ?
import rpm
ImportError: /usr/lib/librpmdb-4.1.so: undefined symbol: gelf_getehdr
Expected Results: rpm should have refused to upgrade itself to rpm 4.1 because
of the missing dependency on (the newer version of) libelf.
Additional info:
Fixed in rpm-4.1-1.03
|
https://bugzilla.redhat.com/show_bug.cgi?id=73024
|
CC-MAIN-2018-34
|
refinedweb
| 163
| 54.49
|
by Michael Hunger
How you can use a GraphQL API for database administration
A recent discussion at graphql-europe made me realize that GraphQL would make for an amazing API for database administration.
You know that plethora of functions and options to control details from security, indexing, metadata, clustering, and other operations?
I used the trip home on the train to build a GraphQL admin endpoint for Neo4j, exposing all available procedures either as queries or mutations. Using Kotlin, this was fortunately a matter of only a few lines (200) of code. And it worked surprisingly well.
If you know of any other database that exposes its admin-API via GraphQL, please let me know in the comments — I’d love to have a look.
And if you get inspired to base some of your work on this idea, I’d be honored, even more so with attribution :)
TL;DR
You can get your Neo4j Admin API served at
/graphql/admin by installing the lastest version of the
neo4j-graphqlextension. In Neo4j Desktop just click "Install GraphQL" in the Plugins section of your database (
version 3.4.0.1). You might need to configure a basic auth header for your database user’s credentials. Then you’re ready to query your new and shiny Admin API via GraphiQL or GraphQL Playground.
The endpoint is not limited to built-in procedures. External libraries like APOC, graph-algorithms, or neo4j-spatial are automatically exposed.
Benefits
In my book, the biggest benefit is the self documenting nature of GraphQL APIs based on the strict schema provided.
The strong typing, documentation, and defaults for both input and output types increase the clarity and reduce the number of trial-and-error attempts. The custom selection of output fields and optional deeper traversal of result structures allows for quick customizations of what you want to retrieve.
With the clear separation into read queries and write mutations, it is easy to reason about the impact of a call.
And of course the amazing auto-complete with inline help and the automatically available documentation in GraphiQL and GraphQL-Playground make interacting with such an API a joy. ?
Parameterizing all inputs and limiting result sizes is just icing on the ?.
Another advantage is that you can combine multiple queries into a single call. All relevant information for a full screen is retrieved in a single request.
Of course you can use all the available GraphQL tools like middleware or libraries for quickly building front-end applications (apollo-tools, React, semantic-ui, victory, etc.). That allows you to integrate these APIs quickly into your monitoring/administration scripts or dashboards.
Implementation Details
Like the regular GraphQL endpoint in
neo4j-graphql, this is a server extension serving GET, POST, and OPTIONS endpoints. They take in queries, variables and operation names to execute within a single transaction. After execution, the results or errors are returned as JSON to the client.
The necessary graphql-schema is built from the available user-defined-procedures deployed in Neo4j.
You have to explicitely allow procedures to be exposed via the config setting
graphql.admin.procedures.(read/write) with either Neo4j procedure syntax or admin-endpoint field names. For example, you could set it to:
graphql.admin.procedures.read=db.*,dbms.components,dbms.queryJ*graphql.admin.procedures.write=db.create*,dbIndexExplicitFor*
User Defined Procedures
In 2016, Neo4j 3.0 got a neat new extension point. You could provide annotated Java methods as user defined procedures, which then were callable either stand-alone or as part of your database queries. As our (React-based) Neo4j-Browser moved from HTTP to a binary transport, the original management REST-APIs were augmented with procedures providing the same functionality.
Each procedure can take parameters and returns a stream of data with individually named columns, similar to regular query results. Both inputs and outputs can use data types from the Cypher type system.
call dbms.listConfig('dbms.connector.http') yield name, value, description;
╒══════════════════════════════╤═══════╤════════════════════════╕│"name" │"value"│"description" │╞══════════════════════════════╪═══════╪════════════════════════╡│"dbms.connector.http.enabled" │"true" │"Enable this connector."│├──────────────────────────────┼───────┼────────────────────────┤│"dbms.connector.https.enabled"│"true" │"Enable this connector."│└──────────────────────────────┴───────┴────────────────────────┘
Ever since, a large amount of functionality has been moved to procedures and functions, giving us a broad selection of things to expose via GraphQL.
To construct the schema, I iterated over the available procedures, creating one field for each procedure.
I took the named procedure parameters as input arguments and used custom output types (per procedure) holding the returned columns. Input parameters with default values could be nullable, the others are defined as non-null. Procedure descriptions turned into field descriptions, and the deprecation information was also transferred.
I mapped basic scalar types and lists directly to GraphQL types.
Only for the
Map (dict/object) type did I have to map to a
List<Attribute> where each attribute is
type Attribute { name: String! value: String type: String! = "String"}
which worked suprisingly well both for inputs and outputs.
Similarly, I created custom types for
Node,
Relationship and
Path.
For these four custom types, I added the appropriate (de-)serialization code. All other unknown types were rendered to strings.
The resolver for each field just executes the wrapped procedure with the input arguments from the environment. The results are then mapped to the output type fields (optionally transformed) and returned to the endpoint.
Based on their metadata, I combined the fields into object types for Queries and Mutations, respectively.
And that was basically it.
I was surprised myself when I fired up GraphiQL after deploying the extension that I was able to intuitively call any of the queries and mutations without hiccups.
Challenges
My biggest challenge is the lack of namespaces in GraphQL. While you can substructure queries nicely with nested types, the same is not available for mutations.
To keep the API naming consistent across both, I decided not to substructure queries and like mutations, and instead joined the capitalized parts of the namespace and procedure name together.
So
db.labels turns into
dbLabels .
Another slight challenge was the missing information about read vs. write operations in the
DBMS and
SCHEMA scopes of Neo4j procedures. So I had to use a whitelist to determine "read-only" ones, which of course is not sufficient.
Notables
Something that other API technologies don’t have built in, and which is really cool, is the ability to choose and pick any number of queries or mutations you want to run in a single request.
If necessary, you can even alias multiple invocations of the same query with different parameters (think statistics per database).
And you can even run graph-algorithms or cypher statements as part of this API, which is kinda cool.
Next Steps
Currently, I only directly expose the procedures parameters and results to the users. Going forward, it would be nice to derive higher level types that offer their own (dynamic) query fields, like
- a Label type that also can return counts
- a Server type that can provide its cluster role or other local information
- adding more dynamic fields with parameters on a Node or Relationship type for custom traversals
I would love ? a bunch of monitoring and management mobile-, web-apps and command-line-clients to be built on top of this management API.
I’m excited to see where we could improve the usability and what feedback and requests we get. Of course the first target would a graph-app for Neo4j Desktop. So if you’re interested in any of this, please reach out and let’s chat.
Happy hacking! — Michael
If you run into any problems, please add a comment or raise a GitHub issue.
|
https://www.freecodecamp.org/news/using-a-graphql-api-for-database-administration-1a5039b43c8f/
|
CC-MAIN-2019-35
|
refinedweb
| 1,266
| 54.73
|
Recently, I was asked to write a position paper of sorts for a company that was interested in using Perl as a development language. The local universities have nothing to do with Perl, and its generally only known by a few Unix admins and webmasters...so, finding and training people would also be a factor in adopting Perl (all the universities teach Java and bits of C as standard)...
Of course, Perlmonks was a good place to start looking, and I wrote the following document...
Perl is an open source cross platform scripting language.(). Originally designed and written in 1987 () as a powerful replacement for Unix shell scripting languages such as sed and awk, Perl is now widely used () in many different organizations and many different spheres of computing activity. Text processing and data analysis, as well as CGI scripting are domains which have been dominated by Perl in recent years.
Now in release 5.6.1, Perl is developed by a group of volunteers, with several commercial organizations ( being the main player) actively aiding and abetting. Documentation and literature for Perl is widely available on the Internet and in downloadable form. Perl itself is freely distributed in both source form and as binaries for many different operating systems (), including Unix (Solaris, AIX, BSD variants, HP-UX), MacOS, Win32, Irix, VMS, BeOS, OS/2 etc.
What Perl and Java have in common
They're both freely available for download and use. (However, Perl is open source, Java is not.) They are both cross platform, however Perl itself is more stable on a larger number of platforms (personal experience: Java on Linux isn't very stable, although there is improvement esp. with 1.3SE. Perl on Linux is a commonly used webserver platform). Perl and Java both have garbage collection and dynamic memory allocation. Java and Perl both allow object oriented programming, although Perl can also be programmed in functional or procedural styles.
Perl and Java both have similar toolkits for most common tasks, such as database access (JDBC for Java, DBI for Perl).
Perl - Key differentiators
Regular expressions: Perl pioneered incorporating regular expressions into a language. Since Perl, other languages such as Python, PHP and even Java (from 1.4 onwards) use regexps for text matching. However, the re engine in Perl is far more sophisticated.
for example: the Rx cookbook ()
Update 2: Blew away the regexp per Ovid's comment.. Yes, absolutely right.. It took lots of dissecting before I got it..
Speed of development
Generally fewer lines of code per task than C, C++ or Java.. an often quoted metric is 3 lines of Java code per line of Perl code.
@elements = ('A'..'Z', 0..9);
[download]
#!/usr/bin/perl -w
use strict;
my @elements = ('A'..'Z', 0..9);
my $regkey = join '', map { $elements[ rand @elements ] } 1..15;
[download]
High traffic sites that use Perl (see)
Quoting directly from this node,
" is all Perl. Deja is all Perl. uses Perl for nearly all their backend operations. Yahoo is mostly Perl behind the scenes. Altavista is all Perl, except for the purchased software. Sportsline.CBS.com is "80% Perl". "
</document>
I somehow am not very satisfied with the way it turned out (although I've already submitted a first draft).. Particularly, any other high traffic sites that use Perl (a perlmonks link mentioned Amazon, eToys etc, so I didn't repeat those).. any other key differentiators between Perl and Java ? (apologies, but Java is the language that they know, and they wanted a comparison)
Please note that I am not looking to start a flamewar here. I feel there aren't enough software companies that really take Perl seriously (where I come from, anyway), and I want to increase awareness, in a small way... any critiques or additions to the stuff above appreciated, and gratefully accepted...
Besides, this gathers all the Perl advocacy that I could find in one place... It'll be a useful point of reference, at the very least :o)
And besides, saying that the program takes less lines of code isn't necessarily a reason for choosing Perl over Java. *Why* is it good that a Perl program takes less lines of code? (Maintenance, maybe?) Give them reasons, not just assertions.
This program doesn't do what you think it does:
my @elements = {'A'..'Z', 0 .. 9 };
my $i = 0;
my @regkey;
while($i++ < 15) { push(@regkey,$elements[rand($#elements + 1)]);
+}
print @regkey, "\n";
[download]
HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80
+e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HAS
+H(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a
+90)HASH(0x80e4a90)
[download]
my @elements = ('A'..'Z', 0..9);
my $regkey = join '', map { $elements[ rand @elements ] } 1..15;
[download]
Anticipate the arguments they're going to give for languages other than Perl. "Java is an industry standard"; "Java is faster"; "Students are learning Java"; etc. Give counter-arguments for these.
> However, the re engine in Perl is far more sophisticated and
> capable of better matches
[download]
I think what you mean to say is: Perl has a more powerful regular expression engine. And then you need to find examples of *how* it is more powerful.
UPDATE: Oops, so you did mention CPAN. However, I
think you should make it a stronger point. :)
A couple of thoughts:
Incidentally, if you must include the regex, at least have pretty formatting so it looks nice:
$/ = ''; # paragrep mode
while (<>) {
while ( m{
\b # start at a word boundary (begin letters)
( # capture to $1
\S+ # one or more non-spaces
) # find chunk of non-whitespace
\b # until another word boundary (end letters)
( # capture to $2
\s+ # separated by some whitespace
\1 # whatever was in $1
\b # until another word boundary
)+ # one or more sets of those
}xig ) {
print "dup word '$1' at paragraph $.\n";
}
}
[download]
Just looking at that code, even when nicely formatted, makes me wince when I think about trying to convert anyone with it. Sure, we know what <>, $/, $., $1, and \1 mean, not to mention the /x, /i and /g modifiers on the regex, but those are going to scare the heck out of someone and make 'em long for Python or something.
If you show them some code, I think some 'baby Perl' would be a nice way to start.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
-- Frag.
For example you are building a simple system that takes user
input from a form and puts it into a database.
With java - you need to build it, compile it, run it, and
check the database.
With perl, you can code and test the routine that grabs the input.
You can code and test the routine that builds the sql queries to put the data into the database.
You can effectively code an entire system in parts, assemble and run.
I very often will work on one piece of a script at a time, and bash all the bits
together when they all work. Can't do that with Java.
You certainly cannot build a one or two line piece of code to test regex's in Java.
Now in your situation, short - documented and runnable bits of code make training
easier, and makes converting those *on the edge* easier.
Another neat touch would be make a java and perl version of the document, something that could put the
document in a nice html format in their browser. Then show them the source code for each and (if possible) go through
the steps to make a change or two. Edit-run vs edit-compile-run.
EEjack
I agree with almost all the comments made to date. If I was writing this doc I would emphasise:
Perl has been around for many years (more than Java) and as a direct result all the major bugs have been ironed out.
Perl is very cross platform, and reliably so. Java still has some *issues* to use the term coined by the company of he who may not be named.
Open source and CPAN mean that library routines to perform most tasks are available that are not only widely used, but tested, updated, etc, etc
Perl can do OO just like Java. It can also do procedural. More importantly it can readily be developed in sections that can be easily and independently tested and debugged.
Add the CPAN libray bit again where you note that there is a lot of *free* high quality, well tested code available - if you don't have to write and debug it you save time, money and hassles.
Give a really simple example of how Perl is shorter, this is C as I don't do Java although I am told it is similar.
In Perl:
print "Hello world\n";
In C:
#include <stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
So what if Perl code is shorter. I would emphasise easier to write, easier to test, easier to debug and easier to maintain - as a result *less cost* to implement any given solution.
Bottom line $ terms is what really counts. This is why I would choose Perl over other languages for most (but not all) tasks.
Perl is interpreted Java half compiled into bytecode. Both are fast enough to do most jobs. Who cares which is faster if both are fast enough? Having to compile Java (or anything) for testing is a pain compared to Perl's ease of running and testing.
Target your audience. If it is suits emphasise development time, reliability, and dollars.
If it is programmers emphasise laziness by utilising CPAN, ease of coding, plus whatever else you think might help.
With the links take one link from each domain. It kinda looks as though perlmonks.com is the only perl site in existence. Not that this is not a great site but you want to emphasise the wide use of perl, so give a wide variety of links to the same info.
Well that's my 10c worth
cheers
tachyon
Hell yes!
Definitely not
I guess so
I guess not
Results (50 votes),
past polls
|
http://www.perlmonks.org/?node=Perl%20Advocacy
|
CC-MAIN-2014-52
|
refinedweb
| 1,692
| 72.16
|
{-# LANGUAGE CPP #-} -- | Get the arguments from the command line, ensuring they are -- properly encoded into Unicode. -- -- base 4.3.1.0 has a System.Environment.getArgs that does not return -- a Unicode string. Instead, it simply puts each octet into a -- different Char. Thus its getArgs is broken on UTF-8 and nearly any -- non-ASCII encoding. As a workaround I use -- System.Environment.UTF8. The downside of this is that it requires -- that the command line be encoded in UTF8, regardless of what the -- default system encoding is. -- -- Unlike base 4.3.1.0, base 4.4.0.0 actually returns a proper Unicode -- string when you call System.Environment.getArgs. (base 4.3.1.0 -- comes with ghc 7.0.4; base 4.4.0.0 comes with ghc 7.2.) The string -- is encoded depending on the default system locale. The only problem -- is that System.Environment.UTF8 apparently simply uses -- System.Environment.getArgs and then assumes that the string it -- returns has not been decoded. In other words, -- System.Environment.UTF8 assumes that System.Environment.getArgs is -- broken, and when System.Environment.getArgs was fixed in base -- 4.4.0.0, it likely will break System.Environment.UTF8. -- -- One obvious solution to this problem is to find some other way to -- get the command line that will not break when base is updated. But -- it was not easy to find such a thing. The other libraries I saw on -- hackage (as of January 6, 2012) had problems, such as breakage on -- ghc 7.2. There is a package that has a simple interface to the UNIX -- setlocale(3) function, but I'm not sure that what it returns easily -- and reliably maps to character encodings that you can use with, -- say, iconv. -- -- So by use of Cabal and preprocessor macors, the code uses -- utf8-string if base is less than 4.4, and uses -- System.Environment.getArgs if base is at least 4.4. -- -- The GHC bug is here: -- -- <> module System.Console.MultiArg.GetArgs ( getArgs, getProgName ) where #if MIN_VERSION_base(4,4,0) import qualified System.Environment as E ( getArgs, getProgName ) #else import qualified System.Environment.UTF8 as E ( getArgs, getProgName ) #endif -- |. getArgs :: IO [String] getArgs = E.getArgs -- | Gets the name of the program that the user invoked. See -- documentation for 'getArgs' for important caveats that also apply -- to this function. getProgName :: IO String getProgName = E.getProgName
|
http://hackage.haskell.org/package/multiarg-0.12.0.2/docs/src/System-Console-MultiArg-GetArgs.html
|
CC-MAIN-2015-27
|
refinedweb
| 400
| 53.68
|
Sometimes it’s desirable to make internal types and members available to other assemblies. A good example of this is when writing unit tests.
I have to confess that sometimes I would temporarily make a method public so I could more easily unit test it. Or I would generate a private accessor, but that can be annoying when you refactor code later on.
But aside from unit testing, I never had a good reason to make internals available to other assemblies. That recently changed when I was coding a serializable type that looks something like this:
[DataContract] public class SessionResponse { [DataMember] public SessionState SessionState { get; internal set; } [DataMember] public Guid SessionKey { get; internal set; } }
The SessionState and SessionKey properties are set by the server, so it makes sense for them to be readonly on the client. The problem is that the code on the server side that sets these properties is in a different assembly from where the serializable type is defined.
This results in a compilation error since the “internal” modifier restricts access to that assembly only. What we need is to make these assemblies “friends”. You can read more about friend assemblies on MSDN here.
An assembly can be made a friend of another by marking it with the InternalsVisibleTo assembly attribute.
For example, in the AssemblyInfo.cs file of the assembly that contains the SessionResponse type, I added the following:
[assembly: InternalsVisibleTo("MyServerAssemblyName, PublicKey=0047…")]
My server assembly already had a strong name, so I didn’t have to generate one. But the problem was obtaining its public key so I could fill in the PublicKey value in the InternalsVisibleTo attribute.
I found a helpful blog entry here that shows how to do it. You basically need to open up a Visual Studio command prompt, and then use the .NET Strong Name Utility to extract the public key from your strong name key file:
sn.exe -p MyStrongNameKey.snk MyStrongNameKey.PublicKey
sn.exe -tp MyStrongNameKey.PublicKey
Be sure to remove the line breaks from the public key that is displayed in the console before pasting it into the InternalsVisibleTo attribute.
And that’s it! Now the server assembly can set the SessionState and SessionKey properties, and these properties will be readonly on the client.
Hope this helps.
|
https://larryparkerdotnet.wordpress.com/2009/10/
|
CC-MAIN-2018-30
|
refinedweb
| 380
| 55.24
|
Asp.net Mvc form radio button textboxs for date and add button
This project received 8 bids from talented freelancers with an average bid price of $31 USD.Get free quotes for a project like this
Skills Required
Project Budget$30 USD
Total Bids8
Project Description
I need a form working. its template attached. It ll jt bind one model class.
public class Test
{
public int testid { get; set; }
public DateTime StartAnalysisDate { get; set; }
public DateTime EndAnalysisDate { get; set; }
public bool AnalysisType { get; set; }
}
there ll be two radio button. one is daily one is weekly.
there are 2 textbox
and there is one add button.
when you select daily radiobutton. second textbox ll disappear.
in textboxs will have calenders with jquery.
when dates are selected in calenders, there ll be some analysis ll come according to the selections. so you can create some list
|
https://www.freelancer.com/jobs/C-Sharp-Programming-HTML.1/Asp-net-Mvc-form-radio/
|
CC-MAIN-2015-14
|
refinedweb
| 145
| 67.96
|
My question is in regards to my code below. Basically, I've come to the point when I am using too many if's and else's and my program gets confused. The point of the first if is to check if the command line arguments anywhere contain just a's just b's or both simultaneiously. Assuming a and b stand for two different books, I want my program to print out whether I am starting one new book or two new books (respectively). I only want to make my first if work, I don't wish to change any other bits of the code unless absolutely nessesary.
public class TwoBookReader { public static void main(String args[]) { PageCounter pca = new PageCounter(); PageCounter pcb = new PageCounter(); boolean changed = true; String book = "a"; PageCounter currentBook = pca; int bookmark=0; for(int i = 0; i < args.length; ++i) { if (args[i].matches("[a]*") && args[i].matches("[b]*")) //CODE I WANT TO CHANGE... { System.out.println("Starting two new books"); } if(args[i].equals("a")) { book = "a"; currentBook = pca; changed = true; } else if(args[i].equals("b")) { book = "b"; currentBook = pcb; changed = true; } else if(args[i].equals("x")) { bookmark=currentBook.whatPageAmIOn(); System.out.println("Bookmarked page " + bookmark + " in " +book); } else if(args[i].equals("r")) { System.out.println("Return to page " + bookmark + " in " +book); } else { if(!changed) { System.out.println("Still reading from "+book); } else { System.out.println("Reading from "+book); } for(int j = 0;j < Integer.parseInt(args[i]);++j) { System.out.println("Read page "+currentBook.whatPageAmIOn()); currentBook.readPage(); } System.out.println("Put "+book+" down"); changed = false; } } } }
This is what the program prints out. I don't know why it completely ignores the first if!
C:\Users\Downloads>java TwoBookReader
a 3 x 3 b 2 a r 2
Reading from a
Read page 1
Read page 2
Read page 3
Put a down
Bookmarked page 4 in a
Still reading from a
Read page 4
Read page 5
Read page 6
Put a down
Reading from b
Read page 1
Read page 2
Put b down
Return to page 4 in a
Reading from a
Read page 7
Read page 8
Put a down
----------------------
fanks!
|
http://www.javaprogrammingforums.com/whats-wrong-my-code/33284-too-many-ifs-elses.html
|
CC-MAIN-2014-15
|
refinedweb
| 365
| 72.56
|
Lists & Maps
When your scripts start getting more complex, you will find that you need to use data structures such as
lists and maps (i.e. hashtables, hashmaps, dictionaries, etc). First we will cover lists, they are very simple to use in
python.
Let's enhance our previous script on classes to now store a list of users.
#!/usr/bin/env python
import sys
#User class
class User:
name = ""
age = 0
height = 0
weight = 0
def save(self, f):
f.write(self.name + '\n')
f.write(str(self.age) + '\n')
f.write(str(self.height) + '\n')
f.write(str(self.weight) + '\n')
def loadFromFile(self, f):
self.name = f.readline().rstrip()
self.age = int(f.readline())
self.height = float(f.readline())
self.weight = int(f.readline())
def loadFromInput(self):
self.name = raw_input('Enter User Name (Q to exit): ')
if self.name == 'Q':
return
self.age = int(raw_input('Enter Age: '))
self.height = float(raw_input('Enter Height (in feet): '))
self.weight = int(raw_input('Enter Weight: '))
def display(self):
print ''
print 'User Information:'
print 'User Name :', self.name
print 'User Age :', self.age
print 'User Height:', self.height
print 'User Weight:', self.weight
#main program code
users = []
def createUsers():
while 1:
u = User()
u.loadFromInput()
if u.name == 'Q':
break
users.append(u)
def saveUsers():
f = open('users.info', 'w')
f.write(str(len(users)) + '\n')
for u in users:
u.save(f)
f.close()
def readUsers():
f = open('users.info', 'r')
num = int(f.readline())
for i in range(num):
u = User()
u.loadFromFile(f)
users.append(u)
f.close()
def displayUsers():
for u in users:
u.display()
if len(sys.argv) > 1 and sys.argv[1] == 'READ':
readUsers()
else:
createUsers()
saveUsers()
displayUsers()
Again the class object is created, this time it adds another parameter to save() and loadFromFile() to take the file object
as a parameter instead of opening it in the function each time. The idea of this script is that it will loop while asking
for you to enter user info until you enter the name as "Q", then it will quit and save the list. Again if you give the
parameter "READ" to the script, it will read the data from a file.
Under the "#main program code" comment, we first create a list with the variable name "users". This is the list where we
will keep the users added or read. Next we define a function to create users, this will loop until the name is Q and then
break from the while loop. After each user is loaded it will call the append method to add the user to the list.
Next the saveUsers() function will open a save file, write the number of users in the list, then save each user to the file.
The readUsers() function works much the same, it opens the file, reads the number of entries in the file from the first line,
then reads each user from the file and adds it to the users list. The display() method loops through all users and calls the
display() method.
Let's run this once to create some data and then again to read the data:
$ ./userTest.py
Enter User Name (Q to exit): User1
Enter Age: 1
Enter Height (in feet): 2
Enter Weight: 3
Enter User Name (Q to exit): User2
Enter Age: 4
Enter Height (in feet): 5
Enter Weight: 6
Enter User Name (Q to exit): User3
Enter Age: 7
Enter Height (in feet): 8
Enter Weight: 9
Enter User Name (Q to exit): Q
User Information:
User Name : User1
User Age : 1
User Height: 2.0
User Weight: 3
User Information:
User Name : User2
User Age : 4
User Height: 5.0
User Weight: 6
User Information:
User Name : User3
User Age : 7
User Height: 8.0
User Weight: 9
$ ./userTest.py READ
User Information:
User Name : User1
User Age : 1
User Height: 2.0
User Weight: 3
User Information:
User Name : User2
User Age : 4
User Height: 5.0
User Weight: 6
User Information:
User Name : User3
User Age : 7
User Height: 8.0
User Weight: 9
The next data structure we will cover is the map, which is generally referred to as a dictionary in python.
This type of data structure is where you map one variable to another. For instance, we could have a "properties" map, where
we will set properties and then retrieve them when needed.
For this simple example we will create a properties map and use it to store properties for a URL that we will call and
print the contents of.
#!/usr/bin/env python
import urllib
properties = {}
properties['protocol'] = 'http'
properties['host'] = ''
properties['port'] = '80'
properties['path'] = '/trends/'
#the properties in this map represent the URL:
#
url = properties['protocol'] + '://' + \
properties['host'] + ':' + \
properties['port'] + \
properties['path']
print 'Reading URL', url
response = urllib.urlopen(url)
print response.read()
Here we create a map named properties by initializing the variable with {}. We use a string for the key for the map, the following
keys are used: 'protocol', 'host', 'port', 'path'. They are given a value so when we lookup the keys the values are returned.
The map is very flexible and this is just a simple illustration of how to use one. In the next section we will cover
how to use enumerations in python.
Prev (Strings) |
Next (Enums)
|
http://www.dreamsyssoft.com/python-scripting-tutorial/lists-maps-tutorial.php
|
CC-MAIN-2014-10
|
refinedweb
| 886
| 75.1
|
.
To override a Perl built-in routine with your own version, you need to import it at compile-time. This can be conveniently achieved with the
subs pragma. This will affect only the package in which you've imported the said subroutine:
use subs 'chdir'; sub chdir { ... } chdir $somewhere;
To override a built-in globally (that is, in all namespaces), you need to import your function into the
CORE::GLOBAL pseudo-namespace at compile time:
BEGIN { *CORE::GLOBAL::hex = sub { # ... your code here }; }
The new routine will be called whenever a built-in function is called without a qualifying package:
print hex("0x50"),"\n"; # prints 1
In both cases, if you want access to the original, unaltered routine, use the
CORE:: prefix:
print CORE::hex("0x50"),"\n"; # prints 80
This documentation provided by Tels <nospam-abuse@bloodgate.com> 2007.
|
http://search.cpan.org/~miyagawa/perl-5.13.6/lib/CORE.pod
|
CC-MAIN-2018-17
|
refinedweb
| 139
| 55.17
|
-11-2013293
This item is only available as the following downloads:
( PDF )
Full Text
PAGE 1
ERYNWORTHINGTON Staff writerINVERNESS My dad is a veterinarian veteran. We should honor our Afghanistan veterans because they work hard to protect our country. Sometimes they get hurt badly like losing a leg. Sometimes veterans get killed. But we should honor veterans who protect our country. My father was once a veteran. He had to be far away from my family four times. When he was gone I worried he would get hurt or even killed. Thankfully it never happened. No, my dad is home with my family. That was what I wanted. Fourth-grader Ennara Billotti bravely read her firstplace essay in front of hundreds of attendees at Inverness Primary Schools 19th annual Veterans Day program Thursday. Her father, Christopher Billotti, proudly stood at attention in the audience. Tears slipped from his eyes as he listened to his daughters words. When she finished he walked up and kissed her gently on the forehead and said, I am proud of you Ennara. Thirdto fifth-grade Inverness Primary students wrote essays for the Randy Allers Essay Contest about honoring our veterans from the Afghanistan and Iraq wars, explained the new Veterans Day program coordinator as she takes the torch from Sandy Cross and kindergarten teacher Mary Tyler. The upper grades wrote essays and the younger students drew pictures honoring military retirees. Allers is credited with helping forge the schools connection to local veterans when he started visiting because of his grandchildren. We have been working very hard the last two weeks to educate our children, Tyler said to the veterans in attendance. They want to know what is a veteran. What do they do? Why do we honor them? What is the holiday Veterans Day all about? It is amazing how much they have absorbed. They have developed a deep appreciation for you and what you have done for our country. NANCYKENNEDY Staff writerPINE RIDGE If theres a veterans event in Citrus County, John Stewart is there. A retired U.S. Air Force chief master sergeant and Vietnam War veteran, locally he is involved in Operation Welcome Home and Honor Flight, is vice chairman of the Citrus County Veterans Advisory Board and chaplain for VFW Post 4252 in Hernando, among other things. During his time in service he was a member of the militarys elite Special Operations Forces, focusing on unconventional warfare, counterinsurgency, emergency contingency missions, and psychological operations. While in Vietnam, he was in contact with Agent Orange and now, as a result, 100 percent disabled. Stewart is a vocal advocate for veterans needs and issues and strongly believes America can do much better to support its veterans. Citrus County has more than 22,000 registered veterans and many more POLL NOVEMBER 11, 2013Floridas Best Community Newspaper Serving Floridas Best CommunityVOL. 119 ISSUE 96 50 CITRUS COUNTY Dogs have their day at annual K-9 Karnival./ Page A3 INDEX Classifieds................B7 Comics....................B6 Crossword................B5 Editorial..................A12 Entertainment..........A4 Horoscope................A4 Lottery Numbers......B3 Lottery Payouts........B3 Movies......................B6 Obituaries................A6 TV Listings................B5 ONLINE POLL:Your choice?Do you care if county commissioners live outside of their district? A.Yes. They need to be advocates for their particular district, so should live there. B. No. Districts dont make sense since commissioners represent the county at-large. C.Yes, otherwise certain districts might get preferential treatment. To vote, visit www. chronicleonline.com. Click on the word Opinion in the menu to see the poll. Results will appear next Monday. Find last weeks online poll results./ Page A3 For video, click on this story at www. chronicle online.com. HIGH82LOW63Partly sunny to mostly cloudy.PAGE A4TODAY& next morning MONDAY INSIDE What do you think of major retail stores being open on Thanksgiving Day? Are you a Black Friday shopper? QUESTION OF THE WEEK Tara Mangels It wouldnt kill us to not shop for one day and let the retail workers be with their families for the holiday. The Thanksgiving specials could just as easily be online deals so everyone can still spend the day with family if they want to. I would never shop on Thanksgiving and I hate Black Friday because it brings out the worst in people. As they say, Only in America will people trample over each other to buy things we cant afford or dont need exactly one day after we give thanks for what we already have. Angela Hamrick Atrocious greed and the very reason I fully support companies like Publix who close their doors on holidays so families may share the day together. If one does not have family nearby, please visit a hospital, nursing home, disabled veteran, or a neighbor in need; youll save money and be a better person for it. Ricky Ellison For those of us who work in retail as I do and have to work on Thanksgiving Day, sure its a bummer that we miss some family time, but the pay is also time and a half so it makes it a little bit easier to cope with. Plus most places dont schedule you for all day long, usually just 4-6 hours. Peggy DeFrancisco I wish that everyone could just forget sales and shopping for one day and just stay home and enjoy the holiday. David Seibert Its great for consumers as a choice I guess. Its nice for the employee also who gets double time. As for retailer profit that day, not sure about that one. Contribute! Like us at facebook.com/ citruscounty chronicle and respond to our Question of the Week. MondayCONVERSATION Veteran ensures a warm welcome See MONDAY/ Page A11 Philippine typhoon deaths climb into thousands Associated PressT See TYPHOON/ Page A7 VETERANS DAY EVENTS The 21st annual Veterans Day Parade and 11th Hour Memorial Ser vice will take place in Inverness this morning. The grand marshal for the parade is Afghanistan veteran Capt. Lesley A. Caron, commander, 690th Military Police Company, Florida Army National Guard, which is based in Crystal River. Honorary marshals for the parade are Iraq and Afghanistan War veterans and their families. Parade begins at 10 a.m. and will proceed from the Citrus High Sc hool parking lot along West Main Street to North Pine Avenue to Courthouse Square, pass by the reviewing area on the north side of the Old Courthouse and terminate in the county courthouse parking lot on Martin Luther King Jr. Ave. MATTHEW BECK/ChronicleEugene Quinn VFW Post 4337 Honor Guard member Don Saylor, left, and Honor Guard Captain Victor Podolak display the proper way t o fold the American flag Thursday afternoon at the 19th annual Veterans Day program at the Inverness Primary School. Eugene Quinn VFW Post 4337 Honor riflemen Randolph Bellamy, left, and Terry Loper share a laugh Thursday during the program conducted by Inverness Primary School students. One of the kindergarteners gives the thumbs-up to another classmate during the opening of the program. Veterans feted at Inverness Primary See SALUTE/ Page A11Patriotic salute
PAGE 2
Man is free after witness recants NAPLES A Florida man who had been accused of armed robbery is free after a key witness recanted her story. The Naples Daily News reported Jarryd Webb was released from the Collier County jail last week. The 26yearbs defense attorney, Giovana Upson, said she knew the truth would eventually come out.Sheriff honored by Jewish societyAVENTuraTurnberry Jewish Center. South Floridas President Dan Rakofsky said the sheriff has demonstrated that his priorities include fighting crime, supporting the men and women who do the work of the Broward Sheriffs Office and reaching out to various groups within Broward County to foster partnerships between BSO and all members of the community. According to the organizations website, the society is a fraternal and charitable organization of law enforcement officers, firefighters and other active and retired criminal justice and public safety professionals of Jewish faith or heritage.Feds tout benefits of wildlife refugesMIAMI said visitors to the countrys.Lotto jackpot rises to $29 millionTALLAHASSEE The jackpot in the Florida Lotto game has grown to $29 million after no one matched the six winning numbers in the latest drawing, lottery officials said Sunday. Fifty tickets matched five numbers to win $3,457.50 each; 2,415 tickets matched four numbers for $55.50 each; and 43,371 tickets matched three numbers for $5 each. The winning Florida Lotto numbers selected Saturday were 9-12-15-21-33-45. Man killed, raped Orlando woman Associated PressORLANDO Denise Collins was found nude, moaning, covered in blood and barely conscious in her apartments apartmentsdegree murder, sexual assault and burglary almost a year later. He was found guilty at his 1994 trial, during which experts testified that blood and semen samples taken from Collins bed were compatible with Kimbroughs DNA. More than two decades after Collins death, Kimbrough is scheduled to be executed Tuesday at Florida State Prison in Starke. He lived 22 years too long and too well and hes going to go out clean and easy, and he doesnt deserve it, said Diane Stewart, Collins mother, in a recent telephone interview. She didnt go out that way, and he doesnt deserve what hes getting. He should go out the way she did. Thats how we feel. Stewart, who lives in New Jersey, said she planned to attend the execution with Collins sister. Kimbroughs didnt hire a mental health professional to evaluate him. Kimbroughs attorneys had blamed Collins former boyfriend for the crimes. He had beaten her previously, they said, and he had a key to her apartment. That evidence was excluded from his trial, and Kimbroughs attorneys argued it should have been allowed to be introduced to jurors. Gary Boodhoo, the former boyfriend, described the defense attorneys allegations as ludicrous.A2MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLE STATE Let the experts at NuTech Hearing help you discover the best hearing devises at the lowest prices! Were here for you! Visit us in person or at Turn down the TV! Its shaking the house! What about your blouse? I said: Put your shoes on. We are going to NuTech Hearing. CUSTOM AIDS Sound familiar? We Can Help! In the United States alone, 36 million adults have some degree of hearing loss. In recent years, more and more people have opted for a modern hearing system. Thanks to enormous advances in hearing aid technology, its now easier than ever to hear what youve been missing! FREE Test Dates are available from November 11-18, 2013 Annual Hearing Test: SMART Annual Hearing Test: GENIUS If you want to pay more for better hearing... THATS YOUR BUSINESS! If you want to pay less...THATS OUR BUSINESS! Call today for a FREE Consultation Free 000GHFQ CALL NOW! Using a miniature video otoscope, well painlessly look inside your ear canal and show it on a monitor and you can watch along! NEW LOCATION Stop In & Say Hello! OCALA EAST 352-671-2999 3405 SW College Rd. Suite 207 Next to Red Lobster in Colours Plaza 000GHRG 776 N. Enterprise Pt., Lecanto 746-7830 000GJW2 Visit our Showroom Next to Stokes Flea Market on Hwy. 44 Visit Our New Website For Great Specials Wood Laminate Tile Carpet Vinyl Area Rugs StateBRIEFS Execution set Tuesday From wire reports Darius Kimbroughscheduled to die Tuesday.
PAGE 3
Around theCOUNTY County offices closed todayCitrus County government offices are closed today in observance of Veterans Day. The county landfill will be open from 8 a.m. to 2:30 p.m. Libraries are closed today but will return to normal business hours on Tuesday. All community buildings and parks are closed. Bicentennial Pool will be open normal business hours. Animal Services will be closed. Purple Heart group to meet Aaron A. Weaver Chapter 776 Military Order of the Purple Heart (MOPH) will conduct its bimonthly meeting at 1p.Smokeout day is Nov. 21On Thursday, Nov. 21, Citrus Memorial will celebrate the Great American Smokeout, encouraging smokers to use the date to make a plan to quit, or to plan in advance and quit smoking that day. Tobacco use remains the single largest preventable cause of disease and premature death in the U.S., yet about 43.8 million Americans still smoke cigarettes nearly one in every five adults. As of 2010, there were also 13.2 million cigar smokers in the U.S. and 2.2 million who smoke tobacco in pipes. In Citrus County, more than 28,000 citizens are current smokers. Tobacco Free Florida offers free smoking cessation classes and nicotine replacement therapy. There is no cost and, in fact, a pack-a-day smoker who quits can save nearly $1,500 over the course of a year. For more information, call 877-U-CAN-NOW or visit. com. From staff reports STATE& LOCAL Page A3MONDAY, NOVEMBER 11, 2013 CITRUSCOUNTYCHRONICLE QUESTION: How to you feel about revelations the U.S. has spied on non-enemy foreign countries? Outraged. This will cause our closest allies to forsake us. 22 percent (50 votes) Its awkward but probably necessary for our national security. 28 percent (66 votes) It doesnt bother me because those other countries are likely guilty of the same thing. 50 percent (116 votes) Total votes: 232. ONLINE POLL RESULTS Open Your Heart to adoption or fostering ERYNWORTHINGTON Staff writerIn observance of National Adoption Month, advocates are encouraging Citrus County residents to open their hearts to adoption and fostering. From 10 a.m. to 1p.m. Saturday, Nov.16, Kids Central Inc. and Community Alliance of Citrus County are hosting the inaugural Open Your Heart program at the Crystal River Mall, 1801 U.S. 19 N., Ste. 331, Crystal River. This is the third Open Your Heart event we have done in Circuit 5 Citrus, Marion, Lake, Sumter and Hernando, said foster parent recruiter Rosey Moreno-Jones. The idea is to host an event for people who are interested in fostering or adopting through the Department of Children and Families. The informational program will feature children and parent ambassadors who will share their stories of success and trials of the paths they have followed through fostering and adopting. We want folks to hear it from the people that have lived and experienced that life, Moreno-Jones said. One of the speakers will be a 15-year-old girl who was 13 years old when she was put into foster care. She was hurt and scared and began acting out because of her fears, which resulted in multiple placements. A couple in their late 20s with no children contemplated fostering. They had never fostered before and took the teen in. She has been with this couple a year, making straight As and Bs and flourished into a new person with lots of future opportunity. Community Alliance of Citrus County facilitator Renea Teaster said Citrus County is in an emergency state for foster homes. I believe that Citrus County should be a county that takes care of its own. Right now we are not doing that in foster care, Teaster said. We are not meeting the needs because there are a lot of children that get sent out of the county because we dont have enough placement homes. Its challenging at this point because we know there are families in Citrus County that would open their homes and hearts to foster children in the county if they came to this event. Moreno-Jones told theChronicleapproximately 150 children have been removed from their biological parents in Citrus County. Some have been placed with relatives. However, Citrus Countys 14 licensed homes are not sufficient to care for the remainder of the children. The overall average number of beds we have available is 24, she said. However, not every bed is a perfect match for every child. We dont want to split up sibling groups, boys cant be with girls and some children are allergic to pets. We would like to have at least three bed possibilities for every child. Teaster said she has been to two of the other Open Your Heart events. It is very moving to hear the testimonies from the parents and kids, she said. You will laugh and cry. I want to encourage people even if they have that vague, remote interest to come out and find out more. It can be something that can move you in that direction. For more information, call Kids Central Inc. at 352-873-6332. WHAT: Open Your Heart, foster and adoption informational program. WHEN: 10 a.m. to 1 p.m. Saturday, Nov. 16. WHERE: Crystal River Mall, 1801 U.S. 19 N., Ste. 331, Crystal River. INFO: For more information, visit kidscentralinc.org or call 352-873-6332. Day for the dogs MATTHEW BECK/ChronicleJennifer Ornoski of Hernando spends time Saturday morning rubbing her dogs belly at the fifth annual K-9 Karnival at Inverness Liberty Park. Ornoski said she adopted Beethoven, an adult golden retriever/corgi mix three weeks ago from Citrus County Animal Services. The event was sponsored by the Greater Inverness Olde Towne Association of Businesses. Lee was one of the many dogs up for adoption Saturday at the K-9 Karnival in Inverness. Cheryl Ward from Citrus County Animal Services works with Lady Bug on Saturday at the fifth Annual K-9 Karnival at Inverness Liberty Park. Ward, working at one of the many informative booths, said, We are trying to teach people how to work with their dog without pressure, force or pain. ON THE NET Citrus County Animal Services: The third annual Back in Black adoption event runs through Nov. 30 at the shelter. Adopt a black pet at reduced fees. For theRECORD Domestic arrest Danny Suggs, 60, of Ocala, at 1:09 p.m. Nov. 8 on an active warrant for violation of an injunction for protection against domestic violence. No bond.Other arrests Kathleen Lyons, 21, of South Alice Point, Homosassa, at 8:20p.m. Nov.7 on an active warrant for felony violation of probation, stemming from an original charge of burglary. Lyons was transported to the Citrus County Detention Facility via USG7 from the Pinellas County Jail. Bond was denied. Jerone White, 37, of Lady Susan Drive, Casselberry, at 8:18p.m. Nov.7 on an active warrant for felony violation of probation, stemming from an original charge of failure to stop or remain at a crash involving an injury. White was transported to the Citrus County Detention Facility via USG7 from the Seminole County Jail. Bond was denied. Scott Jutras, 50, of Homosassa, at 7:56a.m. Nov.8 on a felony charge of aggravated battery with intent to do great bodily harm. Bond $5,000. Joseph Ferrera 60, of West JP Court, Homosassa, at 11:48a.m. Nov.8 on felony charges of trafficking or attempting to traffic in stolen property, and grand theft. According to his arrest affidavit, Ferrera is accused of stealing an air conditioning unit, then having someone sell the parts for scrap at InterCounty Recycling. Bond $7,000. Ryan Payne, 21, of Northwest Highway 329, Reddick, at 1:29p.m. Nov.8 on two active warrants for felony violation of probation, stemming from original charges of grand theft, and dealing in stolen property. Payne was transported to the Citrus County Detention Facility from the Marion County Jail. Bond was denied. Ban on Workplace Discrimination: The Senate on Nov. 7 voted, 64-32, to outlaw workplace discrimination based on one's sexual orientation or gender identity, just as existing federal laws prohibit bias at work on the basis of race, sex, religion, nationality, age or disability. A yes vote was to send S 815 to the House, where GOP leaders say they will not schedule a floor vote. Bill Nelson, Yes; Marco Rubio, No. Exemptions Based on Religion: The Senate on Nov. 7 refused, 43-55, to broaden an exemption in S 815 (above) for houses of worship and groups mainly engaged in religious pursuits. A yes vote was to also exempt all entities owned, controlled by or officially linked to houses of worship and affiliated organizations, even if they are for-profit commercial enterprises. Nelson, No; Rubio, Yes. Key votes ahead: In the week of Nov. 11, the Senate will take up a bill to increase federal regulation of compounded drugs. The House schedule was to be announced. 2013 Thomas Reports Inc. Call: 202-667-9760.HOW YOUR LAWMAKERS VOTEDKey votes for the week ending Nov. 8 by Voterama in Congress Bill Nelson Marco Rubio
PAGE 4
Birthday Take hold of your life in the coming months. Take time to cultivate your inner talents and explore new possibilities. Delve into different cultures and add innovations into your lifestyle. Scorpio (Oct. 24-Nov. 22) Changes at home will inspire you to take on a new project. You may have to work on your presentation skills. Improvements to your methods will pay off handsomely. Sagittarius (Nov. 23-Dec. 21) Outsiders wont see things the same way you do. Stick close to home and make significant changes that will improve your life and your surroundings. Capricorn (Dec. 22-Jan. 19) Put your money on the line. Indulge in a venture that could change the way you live and the people you associate with. The stars are within your reach. Aquarius (Jan. 20-Feb. 19) Learn from your mistakes. New avenues or ideas now may not pay off immediately, but given time you will find a way to make them do so. Pisces (Feb. 20-March 20) Call up friends or make arrangements that favor love, romance or family fun. Entertaining your peers or a client will boost your professional and financial status. Aries (March 21-April 19) Buckle down and make every move count. Watch out for pitfalls or traps that might land you in trouble. Keep watch over your possessions and avoid excess. Taurus (April 20-May 20) Get into the swing of things. Indulge in activities that allow you to show off. Romance is on the rise, and specials plans on your part will meet with a warm reception. Gemini (May 21-June 20) Make your daily round carefully. Expect someone to lead you astray or put blame on you. Cancer (June 21-July 22) Enjoy getting out and taking part in activities and events that allow you to use your skills and display your talents. Networking will lead to an unusual but fruitful proposal. Leo (July 23-Aug. 22) Dont hem or haw when asked what you are up to. Keep your answers concise and your questions direct. Dealing with home improvements can be costly. Virgo (Aug. 23-Sept. 22) A problem or confusion situation can be cleared up with honest and freewheeling communication. Love is in the stars. Libra (Sept. 23-Oct. 23) Complete whatever job youve been given without complaint. Find a way to alleviate impulsivity by staying physically active. TodaysHOROSCOPES Today is Monday, Nov. 11, the 315th day of 2013. There are 50 days left in the year. This is Veterans Day in the U.S., Remembrance Day in Canada. Todays 1921, the remains of an unidentified American service member were interred in a Tomb of the Unknown Soldier at Arlington National Cemetery in a ceremony presided over by President Warren G. Harding. In 1992, the Church of England voted to ordain women as priests. Ten years ago: In Galveston, Texas, millionaire Robert Durst was found not guilty of murdering Morris Black, an elderly neighbor who Durst said hed killed accidentally. Five years ago: President George W. Bush marked his last Veterans Day as president at a New York pier, speaking at the rededication of the USS Intrepid Sea, Air and Space Museum. One year ago: Jill Kelley, an unpaid social liaison to MacDill Air Force Base in Tampa identified as the recipient of harassing emails from David Petraeus girlfriend, acknowledged her friendship with the former CIA director. Todays Birthdays: Actress Bibi Andersson is 78. Golfer Fuzzy Zoeller is 62. Singer Marshall Crenshaw is 60. Actor Stanley Tucci is 53. Actress Demi Moore is 51. Actress Calista Flockhart is 49. Actor David DeLuise is 42. Actor Leonardo DiCaprio is 39.).Today inHISTORY CITRUSCOUNTY(FL) CHRONICLE HI LO PR NA NA NA HI LO PR 80 62 0.00 HI LO PR 83 62 0.00 HI LO PR 79 61 0.00 HI LO PR NA NA NA HI LO PR 78 58 0.00 YESTERDAYS WEATHER Partly sunny to mostly cloudyTHREE DAY OUTLOOK Partly sunny, stray shower, rain chance 10% Breezy and cooler, a sprinkle is possibleHigh: 82 Low: 63 High: 81 Low: 59 High: 68 Low: 41TODAY & TOMORROW MORNING TUESDAY & WEDNESDAY MORNING WEDNESDAY & THURSDAY MORNING Exclusive daily forecast by: TEMPERATURE* Sunday 83/62 Record 91/36 Normal 80/53 Mean temp. 73 Departure from mean +6 PRECIPITATION* Sunday 0.00 in. Total for the month 0.70 in. Total for the year 52.84 in. Normal for the year 48.28 in.*As of 7 p.m. at InvernessUV INDEX: 5 0-2 minimal, 3-4 low, 5-6 moderate, 7-9 high, 10+ very high BAROMETRIC PRESSURE Sunday at 3 p.m. 30.11 in. DEW POINT Sunday at 3 p.m. 62 HUMIDITY Sunday at 3 p.m. 56% POLLEN COUNT** Trees and grasses were absent and weeds were light.**Light only extreme allergic will show symptoms, moderate most allergic will experience symptoms, heavy all allergic will experience symptoms.AIR QUALITY Sunday was good with pollutants mainly particulates. ALMANAC CELESTIAL OUTLOOK SUNSET TONIGHT ............................5:38 P.M. SUNRISE TOMORROW .....................6:51 A.M. MOONRISE TODAY ...........................1:52 P.M. MOONSET TODAY ............................1:03 63 pc Ft. Lauderdale 83 74 pc Fort Myers 86 71 pc Gainesville 79 54 pc Homestead 82 70 sh Jacksonville 75 57 pc Key West 83 75 sh Lakeland 84 67 pc Melbourne 81 68 pc City H L Fcast Miami 83 73 sh Ocala 81 58 pc Orlando 83 63 pc Pensacola 76 55 s Sarasota 85 69 pc Tallahassee 78 52 pc Tampa 84 70 pc Vero Beach 82 68 pc W. Palm Bch. 83 71 pc FLORIDA TEMPERATURESNortheast winds from 10 to 15 knots. Seas 2 feet. Bay and inland waters will have a moderate chop. Partly cloudy today. Gulf water temperature74 LAKE LEVELSLocation Sat. Sun. Full Withlacoochee at Holder 29.55 29.49 35.52 Tsala Apopka-Hernando 38.65 38.63 39.25 Tsala Apopka-Inverness 39.86 39.85 40.60 Tsala Apopka-Floral City 40.56 40.54 71/45 44/28 63/30 74/46 28/15 70/57 62/51 53/23 30/22 55/47 53/39 46/27 65/48 83/73 76/54 57/38 THE NATION Albany 51 41 .02 pc 49 28 Albuquerque 66 39 s 68 42 Asheville 66 40 s 58 36 Atlanta 70 49 s 65 48 Atlantic City 64 45 pc 56 42 Austin 69 61 pc 74 54 Baltimore 61 39 pc 58 37 Billings 44 32 sn 30 22 Birmingham 73 52 s 71 46 Boise 59 35 pc 64 40 Boston 58 42 .03 pc 52 36 Buffalo 51 41 sh 47 28 Burlington, VT 47 37 .12 rs 42 25 Charleston, SC 72 53 pc 69 48 Charleston, WV 55 42 pc 58 34 Charlotte 73 37 s 60 38 Chicago 49 35 rs 44 28 Cincinnati 52 38 pc 56 31 Cleveland 50 41 sh 48 31 Columbia, SC 66 43 s 65 42 Columbus, OH 49 40 sh 52 28 Concord, N.H. 46 31 .03 pc 49 24 Dallas 65 56 pc 71 45 Denver 68 30 pc 63 30 Des Moines 50 28 sn 38 18 Detroit 49 40 rs 46 27 El Paso 76 42 pc 74 46 Evansville, IN 58 41 pc 59 32 Harrisburg 53 31 pc 52 35 Hartford 60 40 pc 51 33 Houston 75 53 pc 76 54 Indianapolis 48 36 sh 52 25 Jackson 71 51 s 73 51 Las Vegas 75 49 s 76 53 Little Rock 67 54 pc 67 46 Los Angeles 81 56 pc 70 57 Louisville 58 43 pc 58 34 Memphis 69 45 s 66 45 Milwaukee 49 40 sn 39 26 Minneapolis 42 33 pc 28 15 Mobile 75 56 s 74 52 Montgomery 76 55 s 73 48 Nashville 67 38 s 65 39 New Orleans 75 61 s 76 57 New York City 61 44 pc 53 39 Norfolk 69 45 s 59 42 Oklahoma City 65 51 pc 67 35 Omaha 53 31 sn 38 18 Palm Springs 84 54 s 87 60 Philadelphia 62 43 pc 54 38 Phoenix 83 58 s 89 60 Pittsburgh 54 41 c 49 28 Portland, ME 44 35 .05 pc 49 28 Portland, Ore 57 43 pc 58 47 Providence, R.I. 59 43 .01 pc 50 35 Raleigh 72 38 s 61 40 Rapid City 57 28 sn 26 20 Reno 70 30 pc 69 41 Rochester, NY 51 39 .04 sh 48 28 Sacramento 72 42 pc 72 50 St. Louis 55 41 sh 60 28 St. Ste. Marie 40 34 .14 sn 31 21 Salt Lake City 65 35 s 64 38 San Antonio 69 64 pc 75 57 San Diego 78 59 s 70 57 San Francisco 64 51 pc 64 51 Savannah 75 53 pc 71 48 Seattle 52 47 .07 pc 55 47 Spokane 43 38 trace pc 52 33 Syracuse 50 38 .21 sh 49 28 Topeka 59 34 pc 56 23 Washington 66 41 pc 57 38YESTERDAYS NATIONAL HIGH & LOW HIGH 88 Punta Gorda, Fla. LOW 12 Gunnison, Colo. MONDAY CITY H/L/SKY Acapulco 88/79/pc Amsterdam 45/42/sh Athens 69/62/r Beijing 51/28/s Berlin 40/34/sh Bermuda 75/65/sh Cairo 79/61/pc Calgary 37/30/s Havana 87/73/ts Hong Kong 72/67/sh Jerusalem 76/61/s Lisbon 67/52/s London 52/47/sh Madrid 67/40/pc Mexico City 70/54/sh Montreal 41/23/sh Moscow 42/35/sh Paris 44/41/c Rio 88/77/s Rome 60/55/pc Sydney 63/58/sh Tokyo 52/42/sh Toronto 45/27/sh Warsaw 40/37/c WORLD CITIES Sunday Monday City H L Pcp. Fcst H L Sunday Monday City H L Pcp. Fcst H L Weather Central, LP, Madison, Wi. Monday TuesdayCity High/Low High/Low High/Low High/LowChassahowitzka* 12:11 a/7:52 a 12:01 p/8:26 p 1:07 a/9:12 a 1:30 p/9:31 p Crystal River** 10:22 a/5:14 a 11:28 p/5:48 p 11:51 a/6:34 a /6:53 p Withlacoochee* 8:09 a/3:02 a 9:15 p/3:36 p 9:38 a/4:22 a 10:04 p/4:41 p Homosassa*** 11:11 a/6:51 a /7:25 p 12:17 a/8:11 a 12:40 p/8:30/11 MONDAY 12:08 6:21 12:33 6:46 11/12 TUESDAY 12:54 7:06 1:18 7:30 FORECAST FOR 3:00 P.M. MONDAY HI LO PR 78 61 0.00, composites, chenopods Todays count: 4.6/12 Tuesdays count: 4.4 Wednesdays count: 1,000 screamers wait for MTV starsAMSTERDAM More than a thousand screamers overwhelmingly young female music fans lined up Sunday on the edges of an arrivals hall to catch sight of their favorite stars ahead of the MTV Europe Music Awards. Although the women were ushered to the edges of a red carpet through doors reading Screamers Entrance, their presence was not entirely scripted. Stephanie Strougo a Brazilian-Dutch teenager, said auditions were conducted for two days in Amsterdam to win a slot. She said she had to pass a 30-second singing test to prove my love of music. Sundays lineup included performances by Miley Cyrus, Katy Perry and Bruno Mars. Strougo said she is most excited to see British singer-songwriter Rita Ora.Rockers Wood, Taylor play bluesNEW YORK Another Roll ingminute set of guitar-grinding Jimmy Reed blues songs from Wood and Taylor. The duo played a few shows at the club earlier in the week, too, tearing into the likes of Bright Lights Big City and Going to New York.Thor 2 bashes box office with $86MSuperheroes continue to defeat their foes at the box office. Disneys. Estimated ticket sales for Friday through Sunday at U.S. and Canadian theaters, according to Rentrak. Final domestic figures will be released Monday. 1. Thor: The Dark World, $86.1million. 2. Jackass Presents: Bad Grandpa, $11.3million. 3. Free Birds, $11.1million. 4. Last Vegas, $11.1million. 5. Enders Game, $10.2million. 6. Gravity, $8.4million. 7. Years a Slave, $6.6million. 8. Captain Phillips, $5.8million. 9. About Time, $5.1million. 10. Cloudy with a Chance of Meatballs 2, $2.8million. From wire reports Associated PressKaty Perry poses for photographers backstage Sunday with her award for Best Female at the 2013 MTV Europe Music Awards, in Amsterdam, Netherlands. A4MONDAY, NOVEMBER11, 2013 000GEF6 in Todays Citrus County Chronicle LEGAL NOTICES Foreclosure Sale/Action Notices . . . . . . . . . . . . . . . . . B9 79 60 0.00
PAGE 5
CITRUSCOUNTY(FL) CHRONICLEMONDAY, NOVEMBER11, 2013 A5 000G8S3 Crystal River Boathouse 1935 SE Hwy 19 Nov. 13, 20, 22 at 10:00 am & 2:00 pm Dunnellon Bentlys Restaurant 11920 N Florida Ave Nov. 26 at 10:00 am & 2:00 pm Inverness Golden Corral Inverness 2605 E Gulf to Lake Highway Nov. 19 at 10:00 am & 2:00 pm Homosassa Two Guys from Italy 5792 S Suncoast Blvd Nov. 21 at 10:00 am & 2:00 pm
PAGE 6
Leonard Lenny Bates, 71BEVERLY HILLSLeonard P. Lenny Bates, 71, of Beverly Hills, Fla., passed away Friday, Nov.8, 2013, at his home. A native of Philadelphia, Pa., he was born Aug.18, 1942, to Patrick and Margaret (Rolle) Bates, one of five children. Mr. Bates enjoyed two careers during his life. He was a retired truck driver of nearly 30 years with Mack Transportation and Jorgenson Steel and was also retired from the U.S. Army and the Army National Guard, attaining the rank of sergeant first class, with 21 years of service. Lenny, as he was known to many, served in the Desert Shield and Desert Storm campaigns and was a talented photographer who captured the beauty that he saw in the world, through his lens, holding membership in the Art Center Camera Club of Citrus County. He was also a member of CMUG, an avid Apple and MacIntosh user club. Mr. Bates is survived by his wife of nearly 50 years, Barrie L. Bates, Beverly Hills; son Patrick Bates (wife Hil-Dee), Brooksville, Fla.; daughter Susan Rosenfeld (husband David); siblings Patricia Malone, Street, Md.; Richard Bates, Robesonia, Pa.; Barbara Gardner, Ashville, N.C., and Michael Bates, San Carlos, Calif.; and grandchildren Alec, Kaden, Sativa and Jacey. Memorial Mass will be celebrated at Our Lady of Grace Catholic Church, Beverly Hills, Fla., with Fr. Theobald Weria, celebrant, in the near future and will be announced at. com. Fero Funeral Home, Beverly Hills. Navaratna Bellam, 72HERNANDONavaratna Siromani Bellam, age 72, of Hernando, Fla., died Sunday, Nov. 10, 2013, at her home in Hernando. Cremation arrangements are under the care of Strickland Funeral Home with Crematory, Crystal River, Fla. Michele Mickey Collins, 67HOMOSASSAMichele Mickey Collins, 67, of Homosassa, Fla., passed away Nov.7, 2013, in her home after a short fight with pancreatic cancer. For more than 43 years, she was the best friend and greatest wife to her husband, Jim Collins, a retired firefighter. She was a devoted and loving mother to her son, Ralph Collins of Clearwater; daughter, Paula Collins Pedley of Spring Hill; and three grandchildren. Mickey was born Oct.9, 1946, in St. Petersburg, and grew up in the Dunedin area of Pinellas County. She and her husband owned and operated several Health Clubs and later she started a successful Interior design/Sewing business. They both were avid motorcyclists and rode through most of the National Parks. Her favorite area was the mountains of the western states. Mickey was an accomplished artist who enjoyed woodcarving. She loved all outdoor activities, camping, fishing, scuba diving, and was a competitive bodybuilder. She requested that instead of a funeral, the family hold a Celebration of Life with family and friends at a later date. They request that any donations be sent to Hospice of Citrus County, P.O. Box 641270, Beverly Hills, FL 34464. Sign the guest book at Mitchell, 56ST. PETERSBURGAllen Mitchell, 56, of St. Petersburg, Fla., died Oct.27, 2013. Survivors include his daughter, Monique; son, Robert; father, Wesley Mitchell; brothers, John and David; sister, Ruth Conley. A memorial service will be at 1:30p.m. Nov.15, 2013, at the Florida National Cemetery, Bushnell. Sign the guest book at Leaming, 73HOMOSASSAT. Joyce McIlvaine Leaming, 73, of Homosassa, Fla., passed away Oct.24, 2013, at Hospice House, Lecanto, Fla. A native of New Bruns wick, N.J., she was born Jan.12, 1940, to William and Teresa (Varga) McIlvaine, one of five children. She was raised in South River, N.J., and lived in Brigintine, N.J., before moving to Homosassa 22 years ago. Mrs. Leaming was a retired administrator for the Atlantic City Medical Center. Joyce was a former member of both Harley-Davidson and Retreads Motorcycle Clubs, both of Citrus County, Fla., and was also a member of First United Methodist Church of Homosassa. Mrs. Leaming is survived by her husband of 22 years, Robert P. Leaming, Homosassa; daughter Jamie Hamonds, Arizona; sisters Karen Satterthwaite (husband Richard), Charlotte Fitzgerald and Melanie Boyce, all of South River, N.J.; brother Bill McIlvaine, also of South River, N.J.; and grandchildren Keegan and Bailey of Arizona. A memorial service of remembrance will be at 10:30a.m. Tuesday, Nov.26, at First United Methodist Church of Homosassa with inurnment following at Florida National Cemetery, Bushnell, Fla., at 2p.m. Wilder Funeral Home, Homosassa, Fla. Rob Harnig III, 51INVERNESSRobert A. Rob Harnig III, 51, of Inverness, passed away Thursday, Nov.7, 2013, at Seven Rivers Regional Medical Center. A native of West Islip, Long Island, N.Y., he was born Nov.29, 1961, to George and Bettyann (Haake) Harnig, one of three children. Mr. Harnig moved to Citrus County 31 years ago from Fleischmann, N.Y., as well as Joshua Kyle of St. Petersburg; parents George and Bettyann Harnig, Beverly Hills; his parents-in-law Ludwig and Teresa Vita, Fayetteville, N.Y.; brother Steve Harnig (wife Alexa), Mount Pleasant, S.C.; sister Chris Osterhoudt (husband Rick), Margaretville, N.Y.; and his beloved dogs Maxy, Savannah Hannah and Sir Charles. The Funeral Service of Remembrance will be at Shepherd of the Hills Episcopal Church, Lecanto, at 1p.m. Wednesday, Nov.13, with Fr. Ladd Harris officiating. In lieu of flowers, please make memorial contributions to the YMCA Youth Basketball Program, Ocala, Fla. Interment will be private. Fero Funeral Home, Beverly Hills. www. ferofuneralhome.comJimmie Knight, 95FORT MYERSJimmie A. Knight, 95, of Fort Myers, Fla., passed away Nov.8, 2013. She was born Feb.22, 1918, in Webster County, Miss. She was one of 11 children born to G.W. and Lula B. Shaffer. In 1947, Jimmie. In 1986, she moved to Fort Myers, Fla. While living there, she faithfully supported the Buckingham Presbyterian Church. Jimmie loved to work in the yard and her azaleas and poinsettias were admired by many. She was preceded in death by her husband, Jont A. Knight Jr.; infant daughter, Doris Reid; grandson, Greg Schol; and seven of her siblings. She is survived by two daughters: Hattie Lou Smith (Sam), Fort Myers, Fla., Janet K. Schol (Ron), Gainesville, Fla.; two sisters: Eva Peshek and Bobbie Shaffer; one brother, James Shaffer; four grandsons: Sam W. Smith Jr., Mark Smith, Victor Smith and Dean Schol; and eight great-grandchildren. Memorial contributions may be made to Buckingham Presbyterian Church, or Hope Hospice Lehigh. Arrangements in care of Anderson Patterson Funeral Services, Lehigh Acres, Fla. patterson.comCharles Correia, 77LECANTOCharles J. Correia, age 77, Lecanto, died Nov.8, 2013, under the loving care of his family and Hospice of Citrus County. Charles was born Jan.2, 1936, in East Taunton, Mass., to the late Charles D. and Leonelda Correia. He served our country in the U.S. Air Force. Charles was employed by United Airlines as an airline mechanic for more than 37 years, a job he thoroughly enjoyed. He was known to his family as Mr. Fix-It. He enjoyed traveling, his computer and model airplanes. Left to cherish his memory is his wife of 50 years, Elizabeth Correia; sons Brian and his wife Stacy Correia of Chantilly, Va., and Alan Correia, Carpentersville, Ill.; and his sister Mary Wainfor, East Taunton, Mass. Inurnment will be private at the Florida National Cemetery in Bushnell. Chas. E. Davis Funeral Home with Crematory is assisting the family with arrangements. Sign the guest book at Lorenzo, 88CITRUS HILLSRuth E. Lorenzo, age 88, Citrus Hills, died Saturday, Nov. 9, 2013. Chas. E. Davis Funeral Home with Crematory is assisting the family with private arrangements.A6MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLE Closing time for placing ad is 4 business days prior to run date. There are advanced deadlines for holidays. To Place Your In Memory ad, 000GICR Contact Anne Farrior 564-2931 Did you make your reservations for your FREE Seminar? Lets meet at The Boat House Restaurant 1935 SE Hwy. 19, Crystal River JOIN US TO LEARN ABOUT PLANNING YOUR FUNERAL AND CEMETERY ARRANGEMENTS IN ADVANCE. Tuesday, Nov. 12 Lunch 11 am Seating limited Please call 352-746-4646 for reservations 000GLOD 000GG9M 000GGVP Serving all of Citrus County (352) 726-2271 Serving all your cremation needs. / 000GM2E James O. Wright 1937 2012 Loved baseball, his music career and operating his Jimmys P Nut trailer business. Even though you are not here, you will always be in my heart. Your loving wife, Joann Inverness Homosass a Beverly Hills (352) 726-2271 1-888-746-6737 000GGVS SERVING ALL YOUR CREMATION NEEDS So Valiantly They Served For Information and costs,call 726-8323 Burial Shipping CremationFuneral HomeWith Crematory000EHVX OBITUARIES The Citrus County Chronicles policy permits free and paid obituaries. Email obits@chronicle online. com or phone 352-563-5660 for details and pricing options. All obituaries will be edited to conform to Associated Press style unless a request to the contrary is made. DEADLINES Deadline is 3 p.m. for obituaries to appear in the next days edition. Jimmie Knight Robert Harnig III Leonard Bates Obituaries SO YOU KNOW Free obituaries, run one day, can include: full name of deceased; age; hometown/state; date of death; place of death; date, time and place of visitation and funeral services. Joyce Leaming
PAGE 7agos more than 7,000 islands, with Leyte, Samar and the northern part of Cebu appearing to bear the brunt of the storm. About 4 million people were affected by the storm, the national disaster agency said. Video from Eastern Samar provinces dont know how I will restart my life, I am so confused, an unidentified woman said, crying. I dont governmentsomes biggest immigrant communities. The Philippines is annually buffeted by tropical storms and typhoons, which are called hurricanes and cyclones elsewhere. The nation is in the northwestern Pacific, right in the path of the worlds No. 1 typhoon generator, according to meteorologists. The archipelagos exposed eastern seaboard often bears the brunt.WORLDCITRUSCOUNTY(FL) CHRONICLEMONDAY, NOVEMBER11, 2013 A7 or Bifocals $ 12 9 11/30/13 2 PAIR EYEGLASSES ONE LOW PRICE Single Vision $ 99GHR9 20/20 Eyecare N OW A CCEPTING Over 1,000 Frames In Stock Blackshears II Aluminum 795-9722 Free Estimates Licensed & Insured RR 0042388 Years As Your Hometown Dealer 000GHRB HWY. 44 CRYSTAL RIVER 2013 2013 2013 2013 Rescreen Seamless Gutters Garage Screens New Screen Room Glass Room Conversions Log on today for veterans resources chronicleonline.com your news. anywhere. anytime. 000G9FB 000G9FB 000GAKK One Day Only! 9am-3pm Saturday, November 16, 2013 Florida Public Utilities Community Showcase At the Crystal River National Guard Armory I 352.746.9028 TYPHOONContinued from Page A1 SOURCE: Weather Underground Central Philippines APThe strongest typhoons A typhoon is a mature tropical cyclone that develops in the western part of the Pacific Ocean. The top 10 highest sustained winds for a typhoon: TYPHOON (local name)YEARWIND SPEED (mph) LANDFALL 2013 2010 1998 2012 1970 2006 1995 1989 1989 1970 196 180 180 175 175 160 160 160 160 160 Haiyan/Yolanda Megi/Juan Zeb/Iliang Bopha/Pablo Joan/Sening Cimaron/Paeng Angela/Rosing Elsie/Tasing Gordon/Goring Georga/Pitan Philippines* Luzon Luzon Philippines* Luzon Luzon Philippines* Luzon Luzon Luzon
PAGE 8
LifeSouth bloodmobile schedule for November. and Fridays), 8a.m. to 5p.m. Saturdays and 10a.m. to 5p.m. Sundays. Visit for details. 11 a.m. to 4 p.m. Monday, Nov.11, VFW Post 7122, 8191 S. Florida Ave., Floral City.. 11 a.m. to 4:59p.m. Wednesday, Nov.20, Cypress Creek Academy, 2855 W. Woodland Ridge Drive, Lecanto. 1 to 5 p.m. Thursday, Nov.21, Seven Rivers Regional Medical Center, 6201 N. Suncoast Blvd., Crystal River. 10 a.m. to noon Thursday, Nov.21, Walmart Supercenter, 1936 N. Lecanto Highway, Lecanto. 11 a.m. to 5 p.m. Friday, Nov.22, Lowes, 2301 E. Gulf-to-Lake Highway, Inverness. 10 a.m. to 5 p.m. Saturday, Nov.23, Love Motorsports, 2021 S. Suncoast Blvd., Homosassa. 8 a.m. to 1 p.m. Sunday, Nov.24, Our Lady of Fatima Catholic Church, 550 U.S. 41 S., Inverness. 9 to 11 a.m. Monday, Nov.25, Nature Coast EMS, 3876 W. Country Hill Drive, Lecanto. Noon to 5 p.m. Monday, Nov.25, Walmart Supercenter, 1936 N. Lecanto Highway, Lecanto. 11 a.m. to 5 p.m. Tuesday, Nov.26, AAA Roofing, 1000 N.E. Fifth St., Crystal River. 10 a.m. to 4 p.m. Wednesday, Nov.27, Walmart Supercenter, 2461 W. Gulf-to-Lake Highway, Inverness. Offices closed Thursday, Nov.28 Happy Thanksgiving. 10 a.m. to 4 p.m. Friday, Nov.29, Bealls, 346 N. Suncoast Blvd., Crystal River. 9:30 a.m. to 4 p.m. Saturday, Nov.30, Homosassa Springs Wildlife State Park, 4150 S. Suncoast Blvd., Homosass-Lake Highway, Crystal River. 352795-8668. Citrus United Basket (CUB) 9 a.m. to 2:30 p.m. Monday through Friday, 103Mill Ave., Inverness, to assist Citrus County residents facing temporary hardship. Call CUB at352-344 2 p.m. the second and fourth Tuesdays monthly, 1501 S.E. U.S. 19... Crystal River United Methodist Church 9 a.m. to 1:30.. 352344. 352513-4960. Calvary Chapel of Inverness Feed the Hungry, noon to 1 p.m. Thursdays, soup kitchen from 11:30 a.m. to 1 p.m. Tuesdays, 960 S. U.S. 41. 352-726-1480. Our Fathers Table 11:30 a.m. to 12:30 p.m. Saturdays at St. Annes Anglican Church, one mile west of the Plantation Inn on West Fort Island Trail. 352-795228. A8MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLELOCAL 000GIKGIK OUR LADY OF FATIMA CHURCH 550 U.S. HWY. 41 SOUTH, INVERNESS, FL TUESDAY AT NOON & THURSDAY AT 6:30PM $10 Package (Includes Jackpots) $5 Speed Package 000DSMO New: STINGER JACKPOT SPECIAL Progressive Bingo, increases weekly, with a maximum payout of $1199 8 speed games . . . . . . . $50 payout 18 regular games . . . . . $50 payout 2 Jackpots . . . . . . . . . . . $150 and $200 50/50 game Winner take all (If attendance is less than 100, prizes may be reduced) KNIGHTS OF COLUMBUS 352/746-6921 Located County Rd. 486 & Pine Cone Lecanto, FL (1/2 Mile East of County Rd. 491) 000GIKR PROGRESSIVE JACKPOT WEDNESDAY & FRIDAY Doors Open 4:30 PM Games Start 6:00 PM ALL PAPER BINGO PRIZES $ 50 TO $ 250 WINNER T AKES ALL POT-O-GOLD Smoke-Free Environment FREE Coffee & Tea TV Monitors for Your Convenience ~ Sandwiches & Snacks ~ Tuesday Bingo Doors Open 4:30pm Game 6 pm VIP Drawing Kellner Auditorium 102 Civic Circle 352-746-6258 NOW 3 Video Monitors 000E5CA Free Coffee & Tea Refresh me n t s Available B I N G O B I N G O New Mystery Game $2 50 worth of free specialsGFI7 Doors open at 4pm Starts at 6 PM Doors open at 4pm Doors open at 4pm Starts at 6 PM Starts at 6 PM NO CASH ON PREMISESGIL0 F LORAL C ITY L IONS B INGO at the Community Building 726-5107 Every Wednesday 6:30 pm 25 cent games at 4pm 20 games 000GIKT Bonanza 4 speed games and 18 regular games with Jackpot $24 in door prizes B 10 I 19 For a Day or Night of Fun and to Meet New Friends. Come and Play! To place your Bingo ads, call 563-5592 9203147 000GIKAGM1E FoodPROGRAMS PHOTO ID REQUIRED Most programs require a photo ID and other proof of residency. Plan to bring identification when applying for food, or phone the program for details. BloodDRIVES Donors must be at least 17, or 16 with parental permission, weigh a minimum of 110 pounds and be in good health to be eligible to donate. A photo ID is also required.
PAGE 9
Trans fat doesnt stir much discussion Associated PressWASHINGTONas Health, says a national trans fat ban is a big deal. After all, the FDA estimates it will prevent 20,000 heart attacks and 7,000 deaths a year. Levi doesnt.NATIONCITRUSCOUNTY(FL) CHRONICLEMONDAY, NOVEMBER11, 2013 A9 000GIU1 MAKE YOUR APPOINTMENT TODAY! Citrus County Call 726-4646 Marion County Call 622-5885 TD000040921 FL#CAC1816408 AL#08158 CARPET CLEANING TILE AND GROUT HARDWOOD FLOORS UPHOLSTERY Trai ned Technicians Pre-Spray Insured Pre-Vacuumed Drug Free Deodorizer optional Uniformed Supershield optional Furniture Moved Enzyme F or Pets optional AIR DUCT CLEANING Tr uck Mounted System No Airborne Dust 2 Trained Technicians Whole System Cleaning Whole Duct Work Under Negative Pressure 000GLX2 352-621-7700 HOME SERVICES Illuminate the holidays with beautiful holiday lighting from Bush Home Services. We offer high end lighting options that we will design, install, take down, and store for you until next year! All projects are completely customized to fit YOUR design needs. Call us today for a free consultation! Nanny state debate
PAGE 10
Hadassah chapter to meetA regular meeting of the Beverly Hills chapter of Hadassah will be today at 1 p.m. at the Kellner Auditorium, 102 Civic Circle, Beverly Hills. The guest speaker this month is Jasen Melson who will talk about safety in the home. Hadassah is a 100-yearold service organization open to all men and women of every faith. It supports colleges, universities, medical schools, medical research including stem cell research, hospitals, infrastructure and childrens camps in both Israel and America. For more information, contact Miriam Fagan at 352-746-0005.Garden club to meet at preserveThe Garden Club of Crystal River will meet at 1 p.m. today at the St. Martin Marsh Aquatic Preserve, Crystal River State Park. The featured speaker is Jane Weber, who will give a presentation titled Preparing Our Gardens for Winter and Winter Flowers. For information, call Jenny Wensel at 352795-0844.Sew-Ciety to meet MondayThe Florida Sewing Sew-Ciety will meet at 9 a.m. today at Citrus County Canning Facility, 3405 W. Southern St., Lecanto. There will be an interesting serger project and additional serger techniques for attendees to become familiar with. All sewing enthusiasts are invited to attend the FSS monthly meetings. For more information, call Dee at 352-527-8229.Club to gather today in LecantoThe German American Club of West Central Florida will meet at 7 p.m. today at the Knights of Columbus Hall, 2389 W. Norvell Bryant Highway, Lecanto. After a brief business meeting and election of directors, there will be a social hour with refreshments and horse racing games. All are welcome. For information call 352-637-2042 or 352-7467058.PFLAG to gather TuesdayPFLAG Lecanto (Parents, Family and Friends of Lesbians and Gays) will meet from 7 to 9 p.m. Tuesday at the Unity Church of Citrus County, 2628 W. Woodview Lane, 352-419-2738 or email pflag.lecanto @gmail.com.Learn to play the harmonicaThe Citrus County Harmonica Club jams from 5 to 7 p.m. Tuesdays at the Heads & Tails Lounge, 1.5 miles south of Floral City on U.S. 41. Beginners are welcome. Harmonicas are available for $5. A free group lesson incorporating the Harmonica Exercise for Lung Program (HELP) developed by Dr. John Schaman will be offered. If you ever wanted to learn to play harmonica, heres your chance. Breathe better, live longer, have more fun. The Citrus County Harmonica Club has no dues, no officers and no membership list. For information, call Bruce at 202-669-1797.Employees group welcomes retirees Chapter 776 of the National Active and Retired Federal Employees Association (NARFE) invites all active and retired employees, surviving annuitants and guests to attend its meeting at 12:30 p.m. Tuesday at Mamas Kuntry Kafe, 1787 W. Main St., Inverness. This months speaker will be from SHINE (Serving the Health Insurance Needs of the Elderly), part of the Department of Elder Affairs. For more information, call 352-522-1923.Genealogical Society.Reiki group meets in HomosassaReiki Gentle Touch Circle meets 5:30 to 7 p.m. Wednesday and Wednesday, Nov. 20, at the Homosassa Library. Everyone is welcome. For more information, call Kristie at 352-6285537.League to host environmentalistThe League of Women Voters of Citrus County will host environmentalist Helen Spivey as guest speaker at 10:15 a.m. Tuesday at the Central Ridge Library in Beverly Hills. Born in Ocala in 1928, she eventually moved to Crystal River in 1970. Spivey is most well known for her work with the Save the Manatee Club and her leadership in the states acquisition of Three Sisters Springs and that ongoing preservation. All interested men and women are invited. The LWVCC is an educational, nonpartisan organization. Light refreshments will be served; bring your own soft drinks. For more information, call 352-746-0655.Extension offers free plant clinicsThe free Master Gardener Plant Clinics for November will discuss what to do to have beautiful, colorful yards 12 months of the year. This is also the time to plant cool-season vegetables and herbs. The clinic will explain which flowers, bulbs, vegetables, herbs and fruiting plants to add during winter. The schedule is: Tuesday 1 p.m. at Lakes Region Library, Inverness. Wednesday 1:30 p.m. at Central Ridge Library, Beverly Hills. Wednesday, Nov. 20 1 p.m. at Citrus Springs Library. Tuesday, Nov. 26 2 p.m. at Homosassa Library. These will be the final Master Gardener Plant Clinics for 2013. They will return in January 2014. Email the Citrus County master gardeners at masterG1@bocc.citrus.fl.us. Call the Extension Service at 352-527-5700.Middle school slates talent showCitrus Springs Middle Schools eighth annual Talent Show will be from 6 to 8 p.m. Friday,. The show will feature performances by the staff and students. Tickets are $3 in advance and $5 at the door. Concessions will be available. For information, call Stephenie Purinton at 352-344-2244, ext. 4417. Take Stock offers scholarshipsTake Stock in Children is a program that helps economically disadvantaged students and their families realize their dream of sending their child to college. To be considered for a scholarship, a child must be in public school in sixth, seventh or eighth grade, meet the financial eligibility requirements, agree to remain drug, alcohol and crime free and get good grades. Take Stock in Children scholarships are provided through the Florida Prepaid Foundation. Applications are available in the guidance offices of Citrus County School Districts middle schools, through the Take Stock office or at. For more information, call Take Stock in Children for Citrus and Levy counties at 352-344-0855. Deadline for applications is Friday. The program is sponsored by the Citrus County Sheriffs Office.Builders collect toys for childrenThe Citrus County Builders Association (CCBA), in partnership with the U.S. Marine Corps Reserve Toys for Tots and StoreRight Self Storage Lecanto, hopes to brighten the Christmas holidays for some of the children affected by the continued depressed economy. The goal is to assist 100 Citrus County children with toys for Christmas. To that end, the public is requested to help with the Building a Better Christmas effort for the kids. Those who may know of anyone who might benefit from a helping hand with a toy(s) this holiday season, is asked to have them call Melissa Sutherland at Air Care Heating & Cooling, 352-621-3444 or 352464-3181 for more information. Assistance and sponsorship forms are also available on the Web at and are due no later than Nov. 27.Daystar needs clothes for kids, just across from the Publix shopping center. Clothing may be dropped off from 9 a.m. to 2 p.m., or the items can be placed in the collection box anytime. During 2012, Daystar assisted 1,024 households with clothing.A10MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLECOMMUNITY NEWS NOTES 000GHR One Treatment One Treatment Lasts 4 Months Lasts 4 Months ERECTILE DYSFUNCTION does NOT have to control your life... Insurance Accepted Insurance Accepted 000GL2H Call Now (352) 746-6327 1982 N. Prospect Ave., Lecanto, FL
PAGE 11
Students welcomed the crowd of veterans in the schools cafeteria and dedicated their hour of performances to gratitude for our countrys heroes. I am very proud of all of our schools in the district because this is the third veterans event I have been to today, said Superintendant of Schools Sandra Sam Himmel. When I leave here, I am headed to the fourth one. I am very proud as an American to know that our schools have the pride and the patriotism to carry on our flag for years to come. The more that we educate our younger generations, the longer the flag will continue to be carried on. Im very proud of our schools. The Honor Guard of VFW Post 4337 demonstrated the folding of the flag, explaining each of the 13 steps that ended with the flag in a tight triangle with the appearance of a cocked hat, which serves as a reminder of the nations early soldiers, sailors and Marines. The fourthand fifthgrade Eagle chorus performed several songs including the Armed Forces Medley, which brought veterans to their feet as their branch of service was mentioned in song. Numerous classes presented patriotic performances including Tylers kindergarten class, which presented a POW/MIA empty-chair ceremony on stage. As a final salute of gratitude, the students lined up in the schools long hallways for the Hall of Heroes and Veterans Garden walk as students clapped and cheered for the veterans as they filed out into the garden. It was a slow, emotional procession, as veterans stopped often for handshakes, hugs and photos. Words of thank you were heard from many young lips.Contact Chronicle reporter Eryn Worthington at 352-563-5660, ext. 1334. who are not registered with the local Veterans Affairs office. As last years Veterans Day Parade grand marshal and keynote speaker at the 11th Hour Memorial Service, Stewart said, As a nation, weve begun to lose our spirit, and more and more were forgetting our patriots, patriotism and our veterans. If it continues, our veterans futures look very bleak. In honor of Veterans Day, the Chronicle recently sat down with retired Chief Master Sgt. John Stewart at his home in Pine Ridge to talk about local veterans issues, beginning with Operation Welcome Home. CHRONICLE: Operation Welcome Home Thats Barbara Mills thing. Whats your involvement with it? STEWART: Im a board member we have four members and also the secretary and the web master for our website, veterans.org. What we do is, for every troop that comes back from Afghanistan we also did the Iraq War, too we welcome them home with a big party and ceremony at one of the local veterans organizations. They have a dinner, which brings in money for the club, and all the veterans organizations show up and we give the troop a gift basket and gift cards from local businesses. Its also for the family we dont forget the family. CHRONICLE: Is this a national organization? STEWART: No. In fact, last night I was Googling, trying to find other similar things, and I found one in Baltimore. But as far as what we do, I havent been able to find anything. We get requests from places as far away as Connecticut to come and do an Operation Welcome Home for someone, but we cant. There should be one in every community. CHRONICLE: What goes into doing an event? STEWART: First we have to find out when theyre coming back ...many are just on leave, not getting out. Then we have to get the family together, and its usually done in a very short time. Weve done one in less than 24 hours notice. Our last one we had three weeks notice. We have to find a veterans club that can handle that many people and have them set it up for us. Barbara does a tremendous job, and shes so busy with so many other things. Shes one of the best people we have in this county. I call myself her go-fer. CHRONICLE: These troops, are they from Citrus County? STEWART: They have to have grown up here, went to high school here or lived here. CHRONICLE: Whats the cost per event? STEWART: Were a nonprofit and we have not one dollar unless somebody donates it to us. I cant put a cost figure on it because it depends on donations. We used to get gift cards from local businesses, restaurants, but now we have to buy one to get one. A lot of the money comes out of our own pockets, but its worth it to support the troops. I get very upset when people wont donate or give us a gift card. I think people ought to come to us. We shouldnt have to go to them. CHRONICLE: About how many a year do you do? STEWART: Weve done over 300 so far since we started in I think it was 2009. We did 160 at one time when the guard unit in Crystal River came back. CHRONICLE: How important is this to the veteran and his or her family? STEWART: Being a Vietnam vet myself, you can go on and on about how we were treated, but I wont get into that. However, when these guys come back I know of some who have done six or seven tours in the war theyre traumatized when they come back, and they need this as part of their healing. I have hardly ever talked to a troop that did not have some problems when he came back ...We use the Operation Welcome Home to talk to them as best we can about getting help. ... A gentleman the other night the storys been in the Chronicle. He had a house built for him; hed lost a leg. He was at a Welcome Home for another troop and I told him, Look around you. These are the people who are going to help you, the veterans. CHRONICLE: One of the things that concerns you is a lack of participation from the community. Tell me about that. STEWART: Heres an example: Just go to an Operation Welcome Home, and if we have 100 people there were lucky to have three who have not served in the military or who are not a family member of the serviceman. Were not getting any outside people coming in, and I think thats bad. Its the same way about donations. All the donations basically come from the same people. Here we are, were veterans donating to one another. Most of our organizations have very little money to begin with, and what frustrates me is the community doesnt donate to us and help Operation Welcome Home and Honor Flight, the veterans programs that are well-known here. We have to go out and beg for it. CHRONICLE: Why do you think that is? STEWART: I dont know. What concerns me, the wars going to end and theyre going to come back are they going to forget them any more than they are right now? The problems that we see I was looking at the figures on the troops coming back, and 25 percent of them have Post Traumatic Stress Disorder and 7 percent have Traumatic Brain Injuries. When you figureLOCALCITRUSCOUNTY(FL) CHRONICLEMONDAY, NOVEMBER11, 2013 A11 000G7MX 0% APR with payment in full in 36 months OR 5.9% APR with custom payments of 1.75% AND Up to $1000 in Trade-In Allowances Financing offers apply only to Trane Qualifying Equipment and financed under the Trane/Wells Fargo program and will not apply to any incremental purchases/charges placed on The Home Projects Visa card issued by Wells Fargo Financial National Bank. Sales completed between September 16 and November 15, 2013. Installations and subsequent claim submissions in the TPCC must be completed within 30 days from the date of sale to be eligible. 000GK6J Are Gophers turning your yard into a Mound Field? WE CAN CONTROL GOPHERS GUARANTEED! Call The Gopher Patrol to find out how. 352-279-9444 Complimentary Inspections MONDAYContinued from Page A1 SALUTEContinued from Page A1 MATTHEW BECK/ChronicleVeterans, guests, teachers, staff and students gather in the Inverness Primary School cafeteria Thursday to listen to dozens of chorus members sing patriotic music. 000GHE8 See MONDAY / Page A13
PAGE 12
Congress responsible for sequesterA letter published on Oct. 30, incorrectly blames the president for the sequester. Congress devised the sequester as a program so destructive that Congress would have to pass a more rational bill to address the budget deficit. Because teaparty Republicans are determined to derail the nations economy they did nothing. President Obama presented a $4.3 trillion grand bargain bill that adjusted a wide range of budget items that would reduce the deficit significantly. The Republican Party refused to put it to a vote for fear in Mitch McConnells words that it would get Obama re-elected. Stan Clewett Homosassa OPINION Page A12MONDAY, NOVEMBER 11, 2013 At the 11th hour on the 11th day of November 1918, an armistice silenced the guns of the first World War. With the first World War hailed as the war to end all wars, Nov. 11 was originally celebrated in America as Armistice Day to honor the sacrifices of those Americans who served during the war. Sadly, however, the war to end all wars was followed two decades later by the even more devastating second World War, which was followed a short five years later by the Korean War. Given the recurring cycle of warfare, veterans organizations successfully lobbied Congress in 1954 to designate Armistice Day as Veterans Day. Since being designated as Veterans Day, Nov. 11 has become a day for communities across our land to honor all American veterans by giving thanks to those men and women who have served in the Armed Forces of the United States, at home and abroad, in war and peace. Veterans are ordinary people who are family members and neighbors. However, they are extraordinary citizens because they selflessly accepted our nations call to duty and willingly endured the risks, rigors and hardships of military service to protect and secure Americas precious liberties. While they do not seek the praise that their service warrants, Veterans Day is a special time for our community to salute its veterans by showing appreciation for their devotion to duty with a simple Thank you for your service. As we pause on this Veterans Day to thank our veterans for their service and to let them know that we will forever appreciate their sacrifices on our behalf, we renew the covenant between America and the men and women who have protected and defended her. The importance of this covenant can never be taken for granted because how a nation remembers its defenders reflects its true character and conscience. As noted by President Calvin Coolidge, The nation which forgets its defenders will itself be forgotten. We as a community and as a nation must never forget our defenders and forever appreciate their service. Courage is the thing. All goes if courage goesJ.M. Barrie, May 3, 1922 Thank you, veterans COMMUNITY SALUTE Pragmatists still have place in GOP We have a young friend who ran the Young Republicans during her college years and now works for a GOP consulting firm. Shes a loyal party member, but she has a problem. Shes didnt leave my party, my party left me. Today our young friend feels the same way, and shes not alone. A GOP dominated by the likes of Sen. Ted Cruz and the tea party is in danger of strangling its centrist wing. But Tuesdays election provides a spark of hope for the GOPs Constructive Caucus. The decisive re-election of New Jersey Gov. Chris Christie a cardcarrying pragmatist and the defeat of Ken Cuccinelli a tea party hero who ran for governor of Virginia shows that pragmatists might still have a place in the GOP after all. Thats hesintonss statesists creed when he told Politico: People expect government to work for them ... and you can compromise without compromising your principles. Its its a loser in a purple state like Virginia. And purple places decide national elections. Its not at all clear that Christie can win the Republican nomination for president in 2016. Voters in Republican primaries tilt far to the right, as the governors pal Giuliani discovered in 2008. But after Tuesday, reasonable Republicans know they are not completely alone. Theres still a home for them in the GOP, at least in New Jersey.Steve and Cokie Roberts can be contacted by email at stevecokie@gmail.com. THE ISSUE:Veterans Day.OUR OPINION:Forever appreciated the sacrifices of those who served. OPINIONS INVITED The opinions expressed in Chronicle editorials are the opinions of the newspapers editorial board.We reserve the right to edit letters for length, libel, fairness and good taste.SEND LETTERS TO: The Editor, 1624 N. Meadowcrest Blvd., Crystal River, FL 34429. Or, fax to 352-563-3280, or email to letters@chronicleonline.com .LETTERto the Editor Way to go, CongressmanA few days ago I read the article by Congressman Nugent in the Chronicle. I was greatly impressed by what he had to say. He voted actually exactly as the people in Citrus County wanted him to vote. The tea party recently has been maligned by the left and it recently has been painted as the bad guys by the left. And in reality, all we want is fiscal responsibility and constitutional compliance and thats exactly what Congressman Nugent voted for when he did vote on that bill.Left lane courtesyLeft lane logic says theres no problem in the left-hand lane because youre just going the speed limit. In the written article in the same paper (Nov. 1) it says that because one car wouldnt let the other lady pass, her dog died because she was trying to rush him to the hospital or the veterinarian. So, if someones behind you in the left lane, move over (because) you dont know whats FIGHTING BLIGHT Neighborhoods get second chance Vacant, decaying houses of little interest to potential buyers are of interest to the Neighborhood Stabilization Program (NSP). The abandoned, foreclosed-upon homes become eyesores, negatively impacting property values, dragging down the vitality of neighborhoods and contributing nothing to the county tax base. Under the federally funded stabilization program, however, such residences are given a new lease on life, thanks to funding from the federal Department of Housing and Urban Development (HUD). Administered in Citrus County by the Housing Services Division, 50 properties have been identified for rehabilitation with $3.9 million in funds from HUD. This is not a housing giveaway. The county uses the HUD grant money to purchase and rehab the blighted structures then makes them available for sale or rent to qualified lowto moderateincome residents. County tax dollars are not used and funds from home sales go back into the stabilization program. While from a realestate business standpoint between the county purchase, restoration and sale the undertaking is a financial loser, the goal of the program is central to its name stabilization. Once rehabbed, these modest-size homes go for about $50,000. The upside is, people who may otherwise have been unable to afford a home become homeowners and taxpayers, contributing to the county coffers. Equally important, the pride that comes with homeownership lends stability to neighborhoods, boosts surrounding home values and generates a greater sense of community. The housing foreclosure epidemic has hit Florida especially hard. Enticing people to realize the dream of homeownership is a positive step in the long road to recovery. To learn more about the program and eligibility requirements, go to the county website at. fl.us/commserv/housing/nsp/ htm; or call Housing Services at 352-527-7520. THE ISSUE:Neighborhood Stabilization Program.OUR OPINION:Investing in communites pays off.
PAGE 13
2 million have been in and out over there, thats a tremendous number of people. The community needs to get involved. If they dont want to come and show up to these ceremonies that were doing and we publicize them then at least donate to them and help out these troops. CHRONICLE: Lets change the subject a little bit. The local veterans organizations, youve got the VFWs and American Legions and the DAV there are a lot of veterans organizations in Citrus County. What purpose do they serve for veterans? STEWART: First of all, its for camaraderie. Its same with police or firefighters. When you can sit down with someone else whos served and you both understand military terms, theres camaraderie. Its fundraising, too. Thats another thing that bothers me people talk about the American Legion and the VFW posts and their bars. Yeah, theyve got bars; thats part of it, but its fundraising to support the veterans. Thats what theyre there for and why they were established. Unfortunately, theyre in serious trouble, most of them. CHRONICLE: Why is that? STEWART: When you look back, most were run big-time by World War II and Korean War veterans, but weve lost so many of them 1,000 World War II veterans a day. Whose shoulders are they on now? Vietnam veterans. Ill be blankety blank years old shortly, and were dying like flies, and there arent that many of us to begin with that can come out and run things. So, youre down to the new guys from Operation Enduring Freedom and Iraq and Desert Storm. But theyre young; theyre working; they have families to raise. They cant come in. CHRONICLE: But when the organizations first started, they were young and working and raising families. STEWART: Its changed. Attitudes have changed ... also, here in Citrus County were predominantly a retirement area and we dont have the people to draw from. CHRONICLE: Are veterans organizations in other communities, in other states where there are younger people, are they having the same problems? STEWART: Some are; some arent. I was in Nebraska I lived there for a couple of years and theyve combined the posts. They took the American Legion, the VFW and the DAV and went into one post in order to survive, and thats the only way they could because they also had no young people. CHRONICLE: Combining posts could that happen here in Citrus County? STEWART: They might have to. I do know of one post thats in a very serious financial situation, and if something doesnt occur within the next 12 months, I dont think theyll be open. CHRONICLE: Would it be two VFWs or two American Legions joining together? STEWART: That would probably be the easiest politically. But the problem whos going to be in charge? Everybody has pride in their own organization. Ive been a post commander before, and combining posts would be difficult, but you may have to if we dont get people to start coming in and supporting it. People think because its a VFW or American Legion you cant come in, but you can come in as a guest, come to the dinners, dances lots of things that go on. There needs to be more publicity to let people know whats going on. Will people come? I dont know. CHRONICLE: Talk to me about the biggest need of veterans in Citrus County. STEWART: Support from the community were supporting ourselves. For example, the Massing of the Colors last week and some other recent functions that were well publicized by theChronicle, and it was the same bunch of people, the same veterans that show up, honoring ourselves. Thats what bothers me were honoring ourselves. Were the ones who should be honored. A few things the community should be doing donating locally to Operation Welcome Home and Honor Flight ... shaking hands with someone wearing their hat or shirt, a veteran, and saying thank you for serving our country. Tell people they can get help at the local VA. I met a troop in front of Walmart who has severe PTSD. Hed been back for some time and was having all kinds of problems. I ended up kneeling and praying with him in front of Walmart, begging him to go get help. There needs to be changes to the tax code. Im working with Commissioner Joe Meek on that. I recently sold a house Im a 100 percent disabled vet because of Agent Orange and when I moved into this house I lost my tax exemption for one year and got a bill for $3,000. A veteran should not be paying taxes like that. CHRONICLE: Chief, our time is up, but I want to thank you for your service and wish you a happy Veterans Day. STEWART: Thank you. At the parade youll see me there with all the gang. I hope well have a good time and that everyone will come out and join us. Contact Chronicle reporter Nancy Kennedy at 352-564-2927 or nkennedy @chronicleonline.com. MONDAYContinued from Page A11 MATTHEW BECK/ChronicleRetired U.S. Air Force Chief Master Sgt. John Stewart discusses his passionate feelings toward the countys veteran population. LOCALCITRUSCOUNTY(FL) CHRONICLEMONDAY, NOVEMBER11, 2013 A13 000GE8X CALL TODAY FOR A FREE QUOTE! 720 N.E. Highway 19, Crystal River (352) 563-1590 AUTO MOTORCYCLE BOATS RVS HOME MOBILE HOME FLOOD LIABILITY 000GJWD BATTS *One pack per household Citrus County residents only 000GG97 Informed Veterans know where to find the resources they need. GET INFORMED. Informed Veterans read the Chronicle. 000GK0T Nov. 15 & 16 from 9am to 2pm Handmade Gifts, Made in the USA from around the county. Lunch and HUMW bake sale. Holidaze Crafters of HUMC Holidaze Crafters of HUMC Holidaze Crafters of HUMC Hernando United Methodist Church 2125 E. Norvell Bryant Hwy. (486), Hernando Call Robin for info 352-445-1487 A few things the community should be doing donating locally to Operation Welcome Home and Honor Flight ... shaking hands with someone wearing their hat or shirt, a veteran, and saying thank you for serving our country. John Stewartretired U.S. Air Force chief master sergeant and Vietnam War veteran.
PAGE 14
Reflected Associated PressThe United State Capitol is seen Sunday lit by the setting sun near in the nearly empty reflecting pool on Capitol Hill in Washington. 3 killed, 2 hurt in fiery NC wreckBUIES CREEK, N.C. Troopers said three people died in a crash in Harnett County after the driver of a pickup truck sped away from a license checkpoint. The North Carolina Highway Patrol said the checkpoint was set up on U.S. Highway 421 near Campbell University around 2:30 a.m. Sunday. Troopers said 23-yearold Shane Garner of Coats was driving the truck and didnt stop for the checkpoint. Authorities said he turned off U.S. 421, lost control and hit a tree. The truck burst into flames. Authorities said Garner, 20-year-old Austin Ferrell of Buies Creek and 16-yearold Casey Edens of Lillington were killed in the wreck. Two 17-year-old women from Fuquay Varina survived, but are in critical condition. All five were in the cab of the truck. Troopers think Garner had been drinking alcohol. They continue to investigate the crash.Atheists flock to mega-churches LOS ANGELES It looked like a typical Sunday morning at any megachurch. Several hundred people, including families with small children, packed in for more than an hour of rousing music, an inspirational sermon, a reading. From wire reports Nation BRIEFS NATION& WORLD Page A14MONDAY, NOVEMBER 11, 2013 CITRUSCOUNTYCHRONICLE Honoring Associated PressBritains Queen Elizabeth II listens during the service of remembrance Sunday at the Cenotaph in Whitehall, London. The annual remembrance service is to remember those who have lost their lives serving in the Armed Forces. Greek govt survives votingATHENS, Greece Greeces conservativesocialist coalition government has survived a noconfidence partys parliamentary group.Bahamas: Four die in plane crashNASSAU, Bahamas Four people, all believed to be U.S. citizens, died Sunday in a small plane crash off the Bahamas northernmost island, said police in the archipelago off Floridas. Information about the victims identities was not immediately provided by Bahamian authorities. Israel: World soft on PalestiniansJERUSALEM Israelsraels seriousness about peace. In an address to Jewish leaders from North America, Netanyahu said that it was time for the world to turn a critical eye on the Palestinians. World BRIEFS From wire reports French halt talks Associated Presshrans trustworthiness, and the longstanding French tradition of speaking out on the world stage. Critics faulted France for alleged grandstanding. After the Geneva talks ended early Sunday with no deal, diplomats including U.S. Secretary of State John Kerry saidlineans ability to make an atomic bomb, while Tehran sought some easing of sanctions stifling its economy. But French Foreign Minister Laurent Fabius broke the nearuniform silence of the diplomats during the talks by using French radio to express reservations about Ir havent. Two students killed in party shooting Associated PressHOUSTON Celebratory gunshots fired at a girlstoyear-old male and the other a 16-yearold female, were students at Cypress Springs High School, Garcia said. He chastised the party organizers, who advertised the event on social media, saying you have no control on who to expect at your door. Authorities are searching for two gunmen, he said, one whos about 17 years old and the other believed to be about 22. Its a horrible combination of immaturity, access to a firearm, and the inability to control ones self, he said. Garcia said party organizers arranged to have people searched as they entered the home. Anytime you have to factor in a bouncer and being searched at the door, you have already taken a turn for the worse, he said. Sheriffs neighbors fence and entered through a back gate. They wasnt supposed to be here whoever they was, Boulden said. Annual cattle fair in India Associated PressIndian camel herders sit near their camels Sunday during. Associated PressThe Navy experimental unmanned aircraft, the X-47B, taxies to its launch position on the flight deck Sunday aboard the nuclear powered aircraft carrier USS Theodore Roosevelt, off the Virginia coast. The Navy says the tests have demonstrated a drones ability to integrate with the environment of an aircraft carrier. Unmanned aircraft test flight Associated PressBloody footprints seen outside the house Sunday in a Houston suburb after two people were killed and at least 22 others were injured Saturday night when gunfire rang out at a large house party, sending partygoers fleeing in panic, authorities said. Authorities seek two gunmen.
PAGE 15
NFL/B2 Scoreboard, briefs/ B3 Golf, tennis/B4 Basketball, NHL/ B4 Puzzles/ B5 Comics/ B6 Classifieds/ B7 College football/B7 Ravens survive wild finish to top Bengals in OT. / B2 SPORTSSection BMONDAY, NOVEMBER 11, 2013 CITRUSCOUNTYCHRONICLE Johnson widens lead on Kenseths bad day In prime position to claim sixth Sprint Cup title Associated PressAVays season finale at Homestead by finishing third in a workmanlike performance for the five-time champion. Johnson will take his sixth title by finishing 23rd or better next week. Were heading into Homestead in the position we want to be in, Johnson said. Ill have to go down there and run 400 miles. Its far from over. Youve dont Season comes to a close Winless no more Successful finish to Speedways 2013 campaignSEANARNOLD CorrespondentINVERNESS Aaron Williams scored a $1,200 payday with a win in the Citrus County Speedways first-ever, singleevent Sportsman State Championship, and Robbie Yoakam brought home $850 after prevailing in the Modified Mini Stock State Championship and notching the fastest qualifying time on the final night of racing this year at the Inverness track on Saturday. In other championship events, Gator Hise collected his second feature win in as many races in Open Wheel Modifieds and Curtis Flanagan was a feature winner in both Pure Stocks and Street Stocks. Shawn Jenkins rode to his second victory of 2013 in the Mini Stock division. The championships were not tied to points or season standings, and are part of a new endof-the-season tradition being established under new track promoter Gary Laplant. Just one yellow flag came out between the 75-lap Sportsman and 50-lap Mod Mini events. They were great races, said Laplant, who succeeded Mike Reed in August. To go that many laps with some drivers that havent been racing at this racetrack, thats tremendous. And for being the first time run here, and it being put together on short notice, the Sportsman car count was excellent at 21. Williamson started from the third row and eventually had to get by Brandon Morris, whos been nearly unstoppable at Citrus this year in winning six of his eight Sportsman events at the track. Williamson, of Lakeland, secured the lead with a deft move on lap 39, where he momentarily rode three-wide with Morris and a lap car. Ocalas Chris Harvey finished third, one spot ahead of Beverly Hills Jay Witfoth. Were actually friends, Williamson said of Morris, and its only the second time weve See SPEEDWAY/ Page B3 Associated PressJacksonville running back Maurice Jones-Drew gets past Tennessee defensive tackle Karl Klug (97) to score a touchdown on a 6-yard run Sunday in the first quarter in Nashville, Tenn. The Jaguars earned their first win of the season 29-27. Jaguars end skid, beat Titans 29-27 for first victory of season Associated PressNASHVILLE, Tenn. Its Im tonight. The Jaguars (1-8) scored the most points in a game this season. They never trailed and forced four turnovers they turned into 17 points. Its definitely a great feeling, Jaguars quarterback Chad Henne said. Hopefully we can build on this. We cant become complacent and say we got our first win ... weve still got to improve on what weve nights offense.esse. Bryan Anger pinned the Titans at their 1 with a 42-yard punt, and the Jaguars got a safety when rookie right guard Chance Warmack was called for holding SenDerrick Marks in the end zone. That safety with 7:44 left was the winning margin. NFL actionSee Page B2 for the rest of Sundays NFL scores and updated standings. Besieged Dolphins, Bucs deal with distractions Troubled teams meet tonight in Tampa Associated PressTAMPA The Tampa Bay Buccaneers wont allow themselves to be drawn into conjecture about another teams problems. They have enough of their own to be concerned about. Distractions ranging from the messy handling of the benching of quarterback Josh Freeman to an outbreak of MRSA infections in the locker room and speculation about coach Greg Schianos job security have kept the winless Bucs (0-8) in the headlines all season long. Those troubles pale in comparison to what the Miami Dolphins are going through with the NFL examining accusations of misconduct within the team. When the intrastate rivals get together for a nationally televised matchup tonight, the spotlight will be on them for the wrong reasons. One struggling team searching for its first win, the other trying to show theyre not as dysfunctional as theyve been portrayed to be with the league probing whether Dolphins offensive lineman Jonathan Martin was harassed or bullied by teammate Richie Incognito, who has been suspended for conduct detrimental to the team. Im 0-8. Thats enough on my back, Tampa Bay offensive lineman Donald Penn said, declining to answer questions about the situation brewing in Miami, 280 miles to the south. On Monday, when everybody lines up, distractions go out the window. ... Thats just the way it is. Nobody cares about your problems when you get out there on that field. The Dolphins (4-4) are coming off an overtime victory over the first-place Cincinnati Bengals that snapped a fourgame skid and should have spawned hope for a strong second-half push. Instead, the Dolphins will roll into town with gaping holes on the left side of the offensive line where Martin, whos left the team, and Incognito usually line up. Coach Joe Philbin believes the team has the resolve to stick together and play well. I learned at a very young age that football is nothing but facing adversity and Monday Night FootballWho: Tampa Bay vs. Miami When: 8:30 p.m. Where: Tampa TV: ESPN See MNF/ Page B3 Associated PressKevin Harvick celebrates Sunday in victory lane after winning the AdvoCare 500 NASCAR Sprint Cup Series race in Avondale, Ariz. See JOHNSON/ Page B3
PAGE 16
CITRUSCOUNTY(FL) CHRONICLENATIONALFOOTBALLLEAGUE AMERICAN CONFERENCEEast WLTPctPFPAHomeAwayAFCNFCDiv New England720.7782341755-0-02-2-04-2-03-0-03-1-0 N.Y. Jets540.5561692314-1-01-3-02-4-03-0-02-1-0 Miami440.5001741872-2-02-2-03-3-01-1-00-2-0 Buffalo370.3001992592-3-01-4-02-6-01-1-01-2-0 South WLTPctPFPAHomeAwayAFCNFCDiv Indianapolis630.6672221933-2-03-1-04-2-02-1-02-0-0 Tennessee450.4442001962-3-02-2-03-3-01-2-00-2-0 Houston270.2221702481-3-01-4-02-3-00-4-01-1-0 Jacksonville180.1111152910-4-01-4-01-5-00-3-01-1-0 North WLTPctPFPAHomeAwayAFCNFCDiv Cincinnati640.6002341864-0-02-4-04-3-02-1-01-2-0 Cleveland450.4441721973-2-01-3-03-3-01-2-02-1-0 Baltimore450.4441881893-1-01-4-04-4-00-1-02-2-0 Pittsburgh360.3331792182-2-01-4-03-4-00-2-01-1-0 West WLTPctPFPAHomeAwayAFCNFCDiv Kansas City9001.0002151115-0-04-0-06-0-03-0-01-0-0 Denver810.8893712385-0-03-1-04-1-04-0-02-0-0 San Diego450.4442122022-2-02-3-02-4-02-1-00-2-0 Oakland360.3331662233-2-00-4-03-3-00-3-01-2-0NATIONAL CONFERENCEEast WLTPctPFPAHomeAwayNFCAFCDiv Dallas540.5562572094-1-01-3-05-1-00-3-03-0-0 Philadelphia550.5002522440-4-05-1-04-2-01-3-02-2-0 N.Y. Giants360.3331652432-2-01-4-02-4-01-2-01-2-0 Washington360.3332302872-2-01-4-01-5-02-1-00-2-0 South WLTPctPFPAHomeAwayNFCAFCDiv New Orleans620.7502161464-0-02-2-04-0-02-2-02-0-0 Carolina630.6672141153-1-03-2-06-2-00-1-02-0-0 Atlanta270.2221862512-3-00-4-02-4-00-3-01-2-0 Tampa Bay080.0001241900-4-00-4-00-6-00-2-00-3-0 North WLTPctPFPAHomeAwayNFCAFCDiv Detroit630.6672382163-1-03-2-05-2-01-1-03-1-0 Chicago540.5562592473-2-02-2-03-4-02-0-02-2-0 Green Bay540.5562452123-2-02-2-03-3-02-1-02-1-0 Minnesota270.2222202792-3-00-4-01-6-01-1-00-3-0 West WLTPctPFPAHomeAwayNFCAFCDiv Seattle910.9002651594-0-05-1-06-0-03-1-03-0-0 San Francisco630.6672271553-2-03-1-03-2-03-1-02-1-0 Arizona540.5561871984-1-01-3-04-4-01-0-00-3-0 St. Louis460.4002242342-3-02-3-01-5-03-1-01-2-0 Jaguars 29, Titans 27Jacksonville1037929 Tennessee0731727 First Quarter JaxJones-Drew 6 run (Scobee kick), 13:29. JaxFG Scobee 32, 6:31. Second Quarter JaxFG Scobee 44, 10:47. TenThompson 9 pass from Fitzpatrick (Bironas kick), :41. Third Quarter JaxTodman 5 run (Scobee kick), 10:17. TenFG Bironas 39, 5:15. Fourth Quarter TenFG Bironas 37, 12:50. JaxTeam safety, 7:44. TenFitzpatrick 4 run (Bironas kick), 4:15. JaxBlackmon 21 fumble return (Scobee kick), 2:32. TenWalker 14 pass from Fitzpatrick (Bironas kick), :40. A,143. JaxTen First downs1319 Total Net Yards214362 Rushes-yards30-5427-83 Passing160279 Punt Returns2-62-15 Kickoff Returns4-1204-81 Interceptions Ret.1-172-7 Comp-Att-Int14-23-226-42-1 Sacked-Yards Lost3-201-9 Punts7-43.45-43.8 Fumbles-Lost3-05-3 Penalties-Yards4-196-45 Time of Possession29:2430:36 INDIVIDUAL STATISTICS RUSHINGJacksonville, Jones-Drew 21-41, Todman 3-11, Robinson 4-3, Sanders 1-0, Henne 1-(minus 1). Tennessee, C.Johnson 12-30, Greene 9-22, Locker 3-18, Fitzpatrick 3-13. PASSINGJacksonville, Henne 14-23-2180. Tennessee, Fitzpatrick 22-33-0-264, Locker 4-9-1-24. RECEIVINGJacksonville, Jones-Drew 433, Lewis 3-39, Shorts III 2-42, Brown 2-40, Harbor 1-13, Burton 1-11, Todman 1-2. Tennessee, Wright 7-78, C.Johnson 5-43, Walker 4-62, Washington 3-29, Greene 3-10, Hunter 2-51, Thompson 1-9, Stevens 1-6. MISSED FIELD GOALSNone.Rams 38, Colts 8St. Louis 72110038 Indianapolis00808 First Quarter StLC.Long 45 fumble return (Zuerlein kick), 12:12. Second Quarter StLStacy 1 run (Zuerlein kick), 14:30. StLAustin 98 punt return (Zuerlein kick), 10:28. StLAustin 57 pass from Clemens (Zuerlein kick), 6:58. Third Quarter StLAustin 81 pass from Clemens (Zuerlein kick), 13:55. StLFG Zuerlein 32, 5:15. IndD.Brown 13 pass from Luck (Fleener pass from Luck), 1:35. A,004. StLInd First downs 1221 Total Net Yards372406 Rushes-yards37-14014-18 Passing 232388 Punt Returns4-1453-25 Kickoff Returns1-274-60 Interceptions Ret.4-340-0 Comp-Att-Int9-16-031-52-4 Sacked-Yards Lost2-153-33 Punts 5-48.46-49.7 Fumbles-Lost2-11-1 Penalties-Yards8-462-20 Time of Possession30:3829:22 INDIVIDUAL STATISTICS RUSHINGSt. Louis, Cunningham 7-72, Stacy 26-62, Austin 1-4, Clemens 3-2. Indianapolis, Luck 4-17, Richardson 5-2, Havili 1-1, Herron 1-0, D.Brown 2-(minus 1), Hasselbeck 1-(minus 1). PASSINGSt. Louis, Clemens 9-16-0-247. Indianapolis, Luck 29-47-3-353, Hasselbeck 2-5-1-68. RECEIVINGSt. Louis, Austin 2-138, Givens 2-54, Stacy 2-6, Cunningham 1-18, Cook 117, Harkey 1-14. Indianapolis, Hilton 7-130, D.Brown 5-64, Fleener 4-33, Whalen 3-36, Richardson 3-33, Heyward-Bey 3-30, Havili 3-25, Herron 1-57, Brazill 1-11, Reed 1-2. MISSED FIELD GOALSNone.Giants 24, Raiders 20Oakland 1073020 N.Y. Giants 777324 First Quarter OakPryor 1 run (Janikowski kick), 14:07. NYGTaylor 21 blocked punt return (J.Brown kick), 9:22. OakFG Janikowski 33, 3:21. Second Quarter NYGRandle 5 pass from Manning (J.Brown kick), 7:36. OakPorter 43 interception return (Janikowski kick), 1:18. Third Quarter OakFG Janikowski 24, 6:56. NYGA.Brown 1 run (J.Brown kick), 2:15. Fourth Quarter NYGFG J.Brown 23, 8:04. A,366. OakNYG First downs 1219 Total Net Yards213251 Rushes-yards25-10738-133 Passing 106118 Punt Returns1-(-1)3-30 Kickoff Returns2-771-19 Interceptions Ret.1-431-65 Comp-Att-Int11-26-112-22-1 Sacked-Yards Lost4-163-22 Punts 6-42.34-30.3 Fumbles-Lost1-13-2 Penalties-Yards8-651-5 Time of Possession27:5832:02 INDIVIDUAL STATISTICS RUSHINGOakland, Jennings 20-88, Pryor 5-19. N.Y. Giants, A.Brown 30-115, Hillis 521, Manning 3-(minus 3). PASSINGOakland, Pryor 11-26-1-122. N.Y. Giants, Manning 12-22-1-140. RECEIVINGOakland, D.Moore 3-45, Reece 3-30, Rivera 2-22, Jennings 2-19, Streater 1-6. N.Y. Giants, Nicks 4-49, Randle 3-50, Cruz 3-37, A.Brown 1-4, Hillis 1-0. MISSED FIELD GOALSNone.Lions 21, Bears 19Detroit 707721 Chicago 703919 First Quarter ChiMarshall 32 pass from Cutler (Gould kick), 12:37. DetDurham 5 pass from Stafford (Akers kick), 5:57. Third Quarter DetJohnson 4 pass from Stafford (Akers kick), 12:58. ChiFG Gould 25, 7:25. Fourth Quarter ChiFG Gould 32, 9:17. DetJohnson 14 pass from Stafford (Akers kick), 2:22. ChiMarshall 11 pass from McCown (run failed), :40. A,431. DetChi First downs 2119 Total Net Yards364338 Rushes-yards26-14520-38 Passing 219300 Punt Returns0-01-16 Kickoff Returns3-714-114 Interceptions Ret.1-01-35 Comp-Att-Int18-35-127-49-1 Sacked-Yards Lost0-02-12 Punts 4-44.55-42.6 Fumbles-Lost1-00-0 Penalties-Yards5-515-39 Time of Possession28:2531:35 INDIVIDUAL STATISTICS RUSHINGDetroit, Bush 14-105, Bell 10-41, Stafford 2-(minus 1). Chicago, Forte 17-33, Jeffery 2-5, Bush 1-0. PASSINGDetroit, Stafford 18-35-1-219. Chicago, Cutler 21-40-1-250, McCown 6-90-62. RECEIVINGDetroit, Johnson 6-83, Pettigrew 5-70, Bush 3-8, Ross 2-28, Fauria 1-25, Durham 1-5. Chicago, Jeffery 9-114, Marshall 7-139, M.Bennett 4-29, Forte 4-16, E.Bennett 2-10, Fiammetta 1-4. MISSED FIELD GOALSDetroit, Akers 45 (WR). Ravens 20, Bengals 17 OTCincinnati00314017 Baltimore10700320 First Quarter BalClark 1 pass from Flacco (Tucker kick), 9:42. BalFG Tucker 36, 4:39. Second Quarter BalT.Smith 7 pass from Flacco (Tucker kick), 6:30. Third Quarter CinFG Nugent 32, 10:37. Fourth Quarter CinBernard 18 pass from Dalton (Nugent kick), 8:22. CinGreen 51 pass from Dalton (Nugent kick), :00. Overtime BalFG Tucker 46, 5:27. A,992. CinBal First downs 2118 Total Net Yards364189 Rushes-yards31-12030-85 Passing 244104 Punt Returns6-623-17 Kickoff Returns2-502-41 Interceptions Ret.2-33-46 Comp-Att-Int24-51-320-36-2 Sacked-Yards Lost5-305-36 Punts 6-37.28-44.4 Fumbles-Lost1-01-1 Penalties-Yards9-1348-65 Time of Possession37:5837:02 INDIVIDUAL STATISTICS RUSHINGCincinnati, Bernard 14-58, Green-Ellis 9-36, Dalton 6-22, M.Jones 1-7, Hawkins 1-(minus 3). Baltimore, Pierce 8-31, Rice 18-30, Taylor 1-18, Flacco 1-4, Leach 2-2. PASSINGCincinnati, Dalton 24-51-3-274. Baltimore, Flacco 20-36-2-140. RECEIVINGCincinnati, Green 8-151, Bernard 8-37, Eifert 3-55, Sanu 3-26, Al.Smith 1-3, M.Jones 1-2. Baltimore, Rice 626, T.Smith 5-46, Dickson 3-28, J.Jones 2-17, Pierce 2-12, M.Brown 1-10, Clark 1-1. MISSED FIELD GOALSCincinnati, Nugent 42 (WL).Seahawks 33, Falcons 10Seattle 3203733 Atlanta 037010 First Quarter SeaFG Hauschka 39, 7:32. Second Quarter SeaFG Hauschka 43, 11:53. AtlFG Bryant 53, 6:30. SeaKearse 43 pass from Wilson (Hauschka kick), 5:33. SeaFG Hauschka 44, 1:52. SeaTate 6 pass from Wilson (Hauschka kick), :01. Third Quarter SeaFG Hauschka 53, 7:49. AtlD.Johnson 12 pass from Ryan (Bryant kick), 1:02. Fourth Quarter SeaLynch 1 run (Hauschka kick), 8:48. A,309. SeaAtl First downs 2516 Total Net Yards490226 Rushes-yards42-21116-64 Passing 279162 Punt Returns3-550-0 Kickoff Returns1-223-64 Interceptions Ret.0-00-0 Comp-Att-Int19-26-023-36-0 Sacked-Yards Lost1-82-10 Punts 2-41.05-53.4 Fumbles-Lost0-02-1 Penalties-Yards9-801-15 Time of Possession35:3024:30 INDIVIDUAL STATISTICS RUSHINGSeattle, Lynch 24-145, Michael 8-33, Wilson 3-20, Turbin 7-13. Atlanta, Rodgers 3-31, Ryan 3-15, Jackson 9-11, Snelling 1-7. PASSINGSeattle, Wilson 19-26-0-287. Atlanta, Ryan 23-36-0-172. RECEIVINGSeattle, Tate 6-106, Baldwin 576, Kearse 3-75, Lynch 3-16, Willson 1-19, Turbin 1-(minus 5). Atlanta, Douglas 7-49, Rodgers 5-28, Gonzalez 3-29, Snelling 3-25, Jackson 3-9, White 1-20, D.Johnson 1-12. MISSED FIELD GOALSNone.Eagles 27, Packers 13Philadelphia7317027 Green Bay 037313 First Quarter PhiJackson 55 pass from Foles (Henery kick), 5:57. Second Quarter PhiFG Henery 25, 1:16. GBFG Crosby 26, :02. Third Quarter PhiCooper 45 pass from Foles (Henery kick), 11:21. PhiFG Henery 41, 7:28. GBBostick 22 pass from Tolzien (Crosby kick), 3:22. PhiCooper 32 pass from Foles (Henery kick), :10. Fourth Quarter GBFG Crosby 35, 12:19. A,011. PhiGB First downs 1923 Total Net Yards415396 Rushes-yards37-20430-99 Passing 211297 Punt Returns0-01-2 Kickoff Returns2-104-69 Interceptions Ret.2-860-0 Comp-Att-Int12-18-029-44-2 Sacked-Yards Lost3-171-8 Punts 2-38.52-48.0 Fumbles-Lost1-11-0 Penalties-Yards5-655-31 Time of Possession25:3634:24 INDIVIDUAL STATISTICS RUSHINGPhiladelphia, McCoy 25-155, Foles 8-38, Brown 4-11. Green Bay, Lacy 2473, Tolzien 1-19, Starks 4-5, Kuhn 1-2. PASSINGPhiladelphia, Foles 12-18-0-228. Green Bay, Tolzien 24-39-2-280, Wallace 5-50-25. RECEIVINGPhiladelphia, Jackson 4-80, Cooper 3-102, Avant 2-25, Casey 1-8, Celek 1-7, McCoy 1-6. Green Bay, Boykin 8-112, Nelson 6-56, J.Jones 4-44, Bostick 3-42, Lacy 2-11, Kuhn 2-10, Starks 1-9, White 1-9, Quarless 1-8, R.Taylor 1-4. MISSED FIELD GOALSPhiladelphia, Henery 39 (WL). Green Bay, Crosby 53 (WR), 42 (WR).Steelers 23, Bills 10Buffalo 300710 Pittsburgh 0107623 First Quarter BufFG Carpenter 20, 6:16. Second Quarter PitFG Suisham 36, 8:47. PitCotchery 5 pass from Roethlisberger (Suisham kick), 1:55. Third Quarter PitBell 4 run (Suisham kick), 3:02. Fourth Quarter PitFG Suisham 37, 8:00. PitFG Suisham 23, 4:34. BufGragg 2 pass from Manuel (Carpenter kick), :03. A,406. BufPit First downs 1619 Total Net Yards227300 Rushes-yards22-9533-136 Passing 132164 Punt Returns4-152-74 Kickoff Returns1-181-1 Interceptions Ret.1-571-37 Comp-Att-Int22-39-118-30-1 Sacked-Yards Lost3-234-40 Punts 9-36.95-39.0 Fumbles-Lost1-01-0 Penalties-Yards4-306-42 Time of Possession24:4435:16 INDIVIDUAL STATISTICS RUSHINGBuffalo, Jackson 12-55, Spiller 8-23, Manuel 2-17. Pittsburgh, Bell 22-57, Dwyer 6-38, Sanders 1-25, F.Jones 4-16. PASSINGBuffalo, Manuel 22-39-1-155. Pittsburgh, Roethlisberger 18-30-1-204. RECEIVINGBuffalo, Gragg 4-25, Johnson 3-48, Chandler 3-21, Spiller 3-11, Jackson 37, Easley 2-13, Goodwin 2-9, Hogan 1-16, Graham 1-5. Pittsburgh, A.Brown 6-104, Sanders 4-13, Bell 3-39, Cotchery 2-31, Palmer 1-8, Miller 1-6, Dwyer 1-3. MISSED FIELD GOALSNone. Ravens survive in OT Lions edge Bears 21-19 for first in NFC North Associated PressBALTIMOREgame.Steelers 23, Bills 10PITTSBURGH Pittsburgh shut down rookie quarterback E.J. Manuel in his return, pounding the Bills in a 23-10 win. Ben Roethlisberger passed for 204 yards and a touchdown, LeVe.Lions 21, Bears 19CHICAGO Calvin Johnson had two second-half touchdown receptions, Reggie Bush rushed for 105 yards and the Detroit Lions beat Jay Cutler and the Chicago Bears 21-19 in a key matchup of NFC North rivals. Johnson broke Herman Moores.Seahawks 33, Falcons 10ATLANTA Russell Wilson threw a pair of touchdown passes, Marshawn Lynch ran for 145 yards and the Seattle Seahawks routed the hapless Atlanta Falcons 33-10 in a one-sided rematch of last seasons.Giants 24, Raiders 20EAST RUTHERFORD, N.J. (AP) Terrell Thomas returned an interception 65 yards to set up a go-ahead 1-yard touchdown run by fellow comebacker Andre Brown, and the New York Giants won their third straight game, 24-20.Panthers 10, 49ers 9SAN FRANCISCO Drayton Florences interception in the final minute sealed a 10-9 victory for Carolina to snap the San Francisco 49ers fivegame.Rams 38, Colts 8INDIANAPOLIS Tavon Austin returned a punt 98 yards for a touchdown and caught two TD passes, almost single-handedly ending the Rams three-game losing streak with a stunning 38-8 victoryyard TD to Austin in the first half and an 81-yarder to Austin in the second half. Indy (6-3) struggled again without Reggie Wayne. Andrew Luck finished 29 of 47 for 353 yards with one TD and three interceptions.Eagles 27, Packers 13GREEN BAY, Wis. Nick Foles threw three long touchdown passes and the Philadelphia Eagles pulled away for a 27-13 victory over the injuryravaged Green Bay Packers, who lost backup quarterback Seneca Wallace to a groin injury. A week after throwing for seven TDs, Foles was at it again. He found DeSean Jackson for a 55-yard score, and connected with Riley Cooper for secondhalf touchdowns from 45 and 32 yards. Philadelphia (5-5) won a battle of attrition at Lambeau Field. Wallace started for Green Bay (5-4) after Aaron Rodgers hurt his left collarbone in last weeks loss to the Chicago Bears. Wallace was replaced after the first series by Scott Tolzien, who threw for 280 yards and a score but was intercepted twice.Broncos 28, Chargers 20SAN DIEGO Peyton Manning threw for 330 yards and four touchdowns, three to Demaryius Thomas, as he efficiently led the Denver Broncos to a 28-20 victory against San Diego has thrown for 3,249 yards and 33 touchdowns in nine games. San Diego fell to 4-5.Cardinals 27, Texans 24GLENDALE, Ariz. Carson Palmer threw two touchdown passes and the Arizona Cardinals held on to send the Houston Texans to their franchise-record seventh consecutive loss, 27-24. games first play when John Abraham knocked the ball out of Case Keenums arm and Matt Shaughnessy returned it 6 yards for a touchdown. Keenum threw three touchdown passes, two on remarkable catches by Andre Johnson. J.J. Watt forced two fumbles, recovering both of them for Houston. The second one set up Johnsons 5-yard TD catch that cut the lead to three with 4:34 to play. Associated PressCincinnati wide receiver A.J. Green (18) pulls in a pass Sunday under pressure from Baltimore strong safety James Ihedigbo during the second half in Baltimore. Green caught a touchdown pass on the final play of regulation, but the Ravens won in overtime 20-17.B2MONDAY, NOVEMBER11, 2013
PAGE 17
SCOREBOARDCITRUSCOUNTY(FL) CHRONICLE raced against each other this year. I was fortunate enough to outrun him. Unfortunately, he had issues (with a cylinder), but either way, I think we had the faster car. Its awesome, payout-wise, because we race on a shoestring budget. If this car doesnt make enough money at the end of the night, it doesnt come out to the racetrack the next time. Yoakam went inside of third-place finisher Robbie Storer on lap 19, and, without any cautions, built a cushion from there in the leader position. Clint Foley, a three-time Mod Mini champion at Citrus who won five of his eight features this year, made his way from the back row to finish second without any practice or qualifying. Hise, who won his first-ever OWM feature two weeks ago, captured his second win in wire-towire fashion over 40 laps one night after his Citrus football team won its first county championship in seven years. He and Zephyrhills Devin McLeod (second place) broke away from the six-car field after a couple of cautions, but McLeod could never seriously threaten the 16-year-old upand-comer. Starks Jason Garver came in third. Hise kept a concerned eye on McLeod in his rearview. I knew that 21 (McLeod) was coming fast, Hise said. He came from the back, so I was worried on the last caution, but my brother (Steven Hise) told me on the radio that we were good. This thing was a dominator tonight, thats all I can really say about it, he added about his No. 43. From two weeks ago, we hit the spot with the setup and we mostly kept it the same, with a few changes for the better. Flanagan rode Jason Wallers No. 3 to victory in Pure Stocks before tallying his 12th Street Stock feature win of the year. Jason went hunting (Saturday), and I thought it was an opportunity to have a little fun and make a couple of bucks, Flanagan said. It marked the 2013 Street Stock champions 50th feature win in his own No. 3. Floral Citys Bubba Martone battled Flanagan throughout in finishing second in the Street Stock race, and New Port Richeys Randy Spicer captured second place in Pure Stocks. In Mini Stocks, Jenkins and Bushnells Bill Ryan occupied the front after previous-leaders Mark Patterson and Shannon Kennedy received penalties for locking up on the second turn of lap 12. The former pair swapped leads on three occasions, with Jenkins, of Lakeland, sealing the win on a strong inside move on the final turns of the penultimate lap. Weirsdales Jerry Daniels scored third place. The Speedways annual banquet will be held at the Citrus County Auditorium at the Fairgrounds on Jan. 11, from 6 to 11 p.m. Contact Sherry Goode at (727) 207-4742, or at sherry.citrusspeedway @gmail.com for tickets. SPEEDWAYContinued from Page B1 On the AIRWAVES TODAYS SPORTS MENS COLLEGE BASKETBALL 7 p.m. (ESPNU) Kent State at Temple 8 p.m. (FS1) Missouri-Kansas City at Creighton 9 p.m. (ESPNU) Colorado State at Gonzaga 11 p.m. (ESPN2) BYU at Stanford 1 a.m. (ESPN2) Western Kentucky at Wichita State 3 a.m. (ESPN2) Akron at St. Marys NBA BASKETBALL 7:30 p.m. (FSNFL) Orlando Magic at Boston Celtics 9 p.m. (NBA) Denver Nuggets at Utah Jazz WOMENS COLLEGE BASKETBALL 7 p.m. (ESPN2) Stanford at Connecticut 9 p.m. (ESPN2) Tennessee at North Carolina BOXING 10 p.m. (FS1) Fidel Maldonado Jr. vs. Luis Ramos Jr. 11 p.m. (ESPNU) College Armed Forces Invitational (taped) COLLEGE FOOTBALL 12 p.m. (FS1) Texas at West Virginia (taped) 12 p.m. (FSNFL) Kansas at Oklahoma State (taped) 12:30 a.m. (ESPNU) Virginia Tech at Miami (Taped) NFL FOOTBALL 8:25 p.m. (ESPN) Miami Dolphins at Tampa Bay Buccaneers GOLF 8 p.m. (GOLF) Patriot Cup (taped) NHL HOCKEY 1 p.m. (SUN) Tampa Bay Lightning at Boston Bruins TENNIS 1 p.m. (TENNIS) ATP Barclays World Tour Finals, Doubles Final 3 p.m. (ESPN2) ATP Barclays World Tour Finals, Final 8 p.m. (TENNIS) ATP Barclays World Tour Finals, Final (same-day tape) Note: Times and channels are subject to change at the discretion of the network. If you are unable to locate a game on the listed channel, please contact your cable provider. Prep CALENDAR TODAYS PREP SPORTS GIRLS BASKETBALL 7 p.m. Crystal River at Vanguard Citrus County SpeedwayRace finishes for Nov. 9 Mod Mini Stock State Championship (50 laps) No.DriverHometown 1xRobbie YoakamHernando 7Clint FoleyDunnellon 9Robbie StorerZephyrhills 98James EllisBrooksville 44Michael LawhornClermont 34Kevin HarrodFloral City 24Phil EdwardsCrystal River 47Richard KuhnOcala 45Dean ButrumVenice 8James RussellLakeland 69Shaun CaterHernando 50Sammy MillsLakeland Sportsman State Championship (75 laps) No.Driver Hometown 13Aaron WilliamsonLakeland 56Brandon MorrisMulberry 51Chris HarveyOcala 4Jay WitfothBeverly Hills 17Mike Bell Brooksville 11Daniel Colin IIISt. Cloud 10Todd Foote-BironSpring Hill 14Dave ColprittLakeland 157Jason RendellLakeland 12David WilliamsonMulberry 78Robert Kuhn Jr.Dunnellon 37Kenner BrownJacksonville 21Daniel WebsterBrooksville 16Patrick MennengaOcala 199Brett JenkinsLakeland 116Brent RobinsonOcala 20Kyle MaynardWeirsdale 114John BuzinecSummerfield 66Andy NichollsOrlando 88Craig CuzzoneLakeland 111Charlie BrownLakeland 8Tim WilsonFloral City OWM (40 laps) No.Driver Hometown 43Gator HiseInverness 21Devin McLeodZephyrhills 27Jason GarverStark 75Bobby BlakeGrande Island 18Shane ButlerBushnell 01Herb Neumann Jr.Inverness Pure Stocks No.Driver Hometown 3Curtis FlanaganInverness 22Randy SpicerNew Port Richey 75Mike GilkersonBushnell 185Lane WilsonFloral City 26Seth CarterMinneola 44Glen ColyerHomosassa 81Scott McAllisterHernando Mini Stocks No.Driver Hometown 43Shawn JenkinsLakeland 33Bill Ryan Bushnell 11Jerry DanielsWeirsdale 20Shannon KennedySummerfield 73Jason TerryBelleview 22Mark PattersonWebster 56David FortschLake Panasoffkee 71Wayne HeaterHomosassa 6Eddie HudakLecanto Street Stocks No.Driver Hometown 3Curtis FlanaganInverness 99Bubba MartoneFloral City 48Dora ThorneFloral City 92Ted Head AuburndaleNASCAR Sprint Cup AdvoCare 500Sunday. 41. (31) Travis Kvapil, Toyota, engine, 129, 42.1, 3, $64,150. 42. (40) Landon Cassill, Chevrolet, brakes, 63, 27.9, 0, $52,150. 43. (41) Tony Raines, Chevrolet, brakes, 29, 26.3, 0, $48,650. 55101;.NFL scoresThursdays Game Minnesota 34, Washington 27 Sundays, late Open: Cleveland, Kansas City, N.Y. Jets, New England Today.Panthers 10, 49ers 9Carolina 070310 San Francisco 36009 First Quarter SFFG Dawson 52, 10:45. Second Quarter SFFG Dawson 43, 13:34. SFFG Dawson 25, 6:16. CarD.Williams 27 run (Gano kick), 1:52. Fourth Quarter CarFG Gano 53, 10:05. A,732. CarSF First downs1510 Total Net Yards250151 Rushes-yards30-11124-105 Passing13946 Punt Returns5-653-35 Kickoff Returns2-421-18 Interceptions Ret.1-21-41 Comp-Att-Int16-32-111-22-1 Sacked-Yards Lost4-306-45 Punts7-45.77-48.7 Fumbles-Lost3-11-1 Penalties-Yards3-254-25 Time of Possession32:0327:57 INDIVIDUAL STATISTICS RUSHINGCarolina, D.Williams 8-46, Stewart 13-41, Newton 7-17, Tolbert 2-7. San Francisco, Gore 16-82, Kaepernick 4-16, Hunter 3-8, James 1-(minus 1). PASSINGCarolina, Newton 16-32-1-169. San Francisco, Kaepernick 11-22-1-91. RECEIVINGCarolina, Smith 6-63, LaFell 448, Ginn Jr. 2-19, Tolbert 2-16, Olsen 1-14, Hixon 1-9. San Francisco, Manningham 3-30, Boldin 3-23, Gore 2-21, Miller 1-10, K.Williams 1-5, V.Davis 1-2. MISSED FIELD GOALSCarolina, Gano 48 (WL).Broncos 28, Chargers 20Denver 7147028 San Diego 067720 First Quarter DenJ.Thomas 74 pass from Manning (Prater kick), 9:18. Second Quarter SDFG Novak 26, 14:58. SDFG Novak 40, 9:05. DenD.Thomas 11 pass from Manning (Prater kick), 6:38. DenD.Thomas 7 pass from Manning (Prater kick), :13. Third Quarter DenD.Thomas 34 pass from Manning (Prater kick), 11:34. SDWoodhead 7 pass from Rivers (Novak kick), 8:38. Fourth Quarter SDMathews 1 run (Novak kick), 10:42. A,847. DenSD First downs 2220 Total Net Yards397329 Rushes-yards22-8435-131 Passing 313198 Punt Returns 2-60-0 Kickoff Returns4-1030-0 Interceptions Ret.0-00-0 Comp-Att-Int 25-36-019-29-0 Sacked-Yards Lost2-174-20 Punts 5-46.65-47.6 Fumbles-Lost2-11-0 Penalties-Yards3-286-40 Time of Possession21:5738:03 INDIVIDUAL STATISTICS RUSHINGDenver, Moreno 15-65, Ball 5-20, Manning 2-(minus 1). San Diego, Mathews 1459, R.Brown 9-36, Woodhead 6-27, Rivers 5-7, Weddle 1-2. PASSINGDenver, Manning 25-36-0-330. San Diego, Rivers 19-29-0-218. RECEIVINGDenver, Moreno 8-49, D.Thomas Florida LOTTERY Here are the winning numbers selected Sunday in the Florida Lottery: CASH 3 (early) 2 2 5 CASH 3 (late) 0 2 7 PLAY 4 (early) 4 6 9 5 PLAY 4 (late) 9 5 5 8 FANTASY 5 15 23 26 35 36 Players should verify winning numbers by calling 850-487-7777 or at. Saturdays winning numbers and payouts: Powerball: 3 9 37 49 56 Powerball: 32 5-of-5 PBNo winner No Florida winner 5-of-52 winners$1 million No Florida winner Lotto: 9 12 15 21 33 45 6-of-6No winner 5-of-650$3,457.50 4-of-62,415$55.50 3-of-643,371$5 Fantasy 5: 19 23 27 31 33 5-of-53 winners$86,517.59 4-of-5348$120 3-of-510,743$10.50MONDAY, NOVEMBER11, 2013 B3 7-108, J.Thomas 3-96, Decker 3-52, Welker 321, Green 1-4. San Diego, Gates 4-62, Allen 441, Woodhead 4-17, V.Brown 3-35, Royal 2-36, Green 1-25, Mathews 1-2. MISSED FIELD GOALSSan Diego, Novak 37 (WL).Cardinals 27, Texans 24Houston 7100724 Arizona 776727 First Quarter AriShaughnessy 6 fumble return (Feely kick), 14:46. HouA.Johnson 7 pass from Keenum (Bullock kick), 5:55. Second Quarter AriHousler 12 pass from Palmer (Feely kick), 13:57. HouGriffin 2 pass from Keenum (Bullock kick), 9:37. HouFG Bullock 48, 6:31. Third Quarter AriFG Feely 35, 6:06. AriFG Feely 21, :02. Fourth Quarter AriRoberts 19 pass from Palmer (Feely kick), 6:42. HouA.Johnson 5 pass from Keenum (Bullock kick), 4:34. A,845. HouAri First downs 1719 Total Net Yards235332 Rushes-yards21-7629-97 Passing 159235 Punt Returns 2-126-74 Kickoff Returns5-1182-38 Interceptions Ret.1-00-0 Comp-Att-Int 22-43-020-32-1 Sacked-Yards Lost3-421-6 Punts 7-58.95-43.8 Fumbles-Lost1-12-2 Penalties-Yards7-535-29 Time of Possession28:5231:08 INDIVIDUAL STATISTICS RUSHINGHouston, Tate 15-56, Keenum 213, D.Johnson 4-7. Arizona, Ellington 11-55, Mendenhall 13-42, Taylor 2-6, Palmer 2-(minus 2), Peterson 1-(minus 4). PASSINGHouston, Keenum 22-43-0-201. Arizona, Palmer 20-32-1-241. RECEIVINGHouston, Hopkins 6-69, A.Johnson 5-37, Posey 3-34, Tate 3-8, G.Graham 218, G.Jones 1-19, D.Johnson 1-14, Griffin 1-2. Arizona, Roberts 5-72, Housler 4-57, Fitzgerald 3-23, Floyd 2-31, Ellington 2-18, Ballard 1-15, Dray 1-9, Mendenhall 1-9, Brown1-7. MISSED FIELD GOALSHouston, Bullock 40 (BK).NBA standingsEASTERN CONFERENCE Atlantic Division WLPctGB Philadelphia43.571 Toronto34.4291 Boston34.4291 New York24.3331 Brooklyn24.3331 Southeast Division WLPctGB Miami 43.571 Atlanta 33.500 Charlotte33.500 Orlando 34.4291 Washington24.3331 Central Division WLPctGB Indiana 701.000 Cleveland34.4294 Milwaukee23.4004 Detroit 23.4004 Chicago 23.4004 WESTERN CONFERENCE Southwest Division WLPctGB San Antonio61.857 Houston 43.5712 Dallas 43.5712 Memphis33.5002 New Orleans34.4293 Northwest Division WLPctGB Oklahoma City51.833 Minnesota42.6671 Portland 42.6671 Denver 14.2003 Utah 07.0005 Pacific Division WLPctGB Phoenix 52.714 L.A. Clippers43.5711 Golden State43.5711 L.A. Lakers34.4292 Sacramento15.1673 Sundays Games San Antonio 120, New York 89 Oklahoma City 106, Washington 105, OT Phoenix 101, New Orleans 94 Minnesota at L.A. Lakers, late.NHL standingsEASTERN CONFERENCE Atlantic Division GPWLOTPtsGFGA Tampa Bay161240245439 Toronto171160225140 Detroit18954224548 Boston161051214530. Sundays Today Tampa Bay at Boston, 1 p.m. fighting through it and coming out on top, Dolphins defensive tackle Jared Odrick said. Forgive the Bucs for having a been there, done that mind-set about playing through adversity. Tampa Bay has coped with the messy handling of the benching and subsequent release of Freeman that played out over the first month of the season, as well as three players being diagnosed with MRSA infections. The Bucs are 0-8 for the first time since 1985 and have dropped 13 of 14 games dating to last season. Nobody cares about whats going on. Thats the reality of it. Youve got to fight through it, Schiano said of the potential for off-field distractions to impact performance on the field. Thats the job of the team and coach. MNFContinued from Page B1 caution was called for Josh Wises heds finish was his worst of the Chase, and worst since he was 23rd at Watkins Glen in August. Harvick, meanwhile, picked up his fourth win of the season when Edwards ran out of gas headed to the white flag. Harvick sailed by on the last lap for his fourth win of the year. JOHNSONContinued from Page B1 US womens soccer team beats Brazil 4-1ORLANDO Sydney Leroux scored twice in the first half and the U.S. womens U.S. finished the year 13-0-3.Djokovic joins Nadal in ATP finerers hopes of finishing a disappointing season on a high note, defeating the six-time champion 7-5, 6-3 in the other semifinal. Unbeaten in his round-robin matches this week, the secondseeded Djokovic extended his winning streak to 21 matches since losing in the U.S. Open final to Nadal. The two will play for the title today. Nadal leads Djokovic 22-16, but the Serbian won their latest match last month in Beijing.From wire reports SPORTS BRIEFS
PAGE 18
B4MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLESPORTS Surging Rangers hand Panthers ninth straight loss Associated PressNEW YORK. New York (9-8) went over .500 for the first time this season. Brian Campbell scored his second of the game to cut Floridas deficit to 4-3 with 7:03 left.Canadiens 4, Islanders 2MONTREAL Alex Galchenyuk and Lars Eller each had a goal and two assists, and the Montreal Canadiens ended a four-game losing streak with a 4-2 victory over the New York Islanders.. Devils 5, Predators 0NEWARK, N.J.. Jagr, who also had an assist, boosted his career totals to 686 goals and 1,015 assists, to put him at 1,701. Blackhawks 5, Oilers 4CHICAGO Marcus Kruger scored the tiebreaking goal with 8:16 left in the third period, Duncan Keith added a power-play goal 1:55 later and the Chicago Blackhawks beat the Edmonton Oilers 5-4 for their third straight victory. Brandon Saad, Andrew Shaw and Bryan Bickell also scored for the Stanley Cup champion Blackhawks (12-24), who are 6-0-1 in their last seven games.Avalanche 4, Capitals 1DENVER Semyon Varlamov stopped 33 shots and Nick Holden scored his first NHL goal to break a second-period tie, lifting the soaring Colorado Avalanche to a 4-1 win over the Washington Capitals..Ducks 3, Canucks 1ANAHEIM, Calif.. Corey Perry had a goal and an assist, helping Anaheim improve the NHLs best record to 15-3-1 and the best home start in franchise history to 8-0.Jets 5, Sharks 4, SOWINNIPEG, Manitoba Andrew Ladd scored the tying goal with 1:43 remaining in regulation and then delivered the shootout winner to lift the Winnipeg Jets over the San Jose Sharks 5. Associated PressFlorida left wing Sean Bergenheim, left, battles for the puck Sunday against New York Rangers defenseman Anton Stralman at Madison Square Garden in New York. Crystal River grads win tennis tourney ERICVANDENHOOGEN CorrespondentThe 9th Annual Fall Fest Tournament at Crystal River High School was a homecoming of sorts for two of its past stars the team of Chris Lavoie and Brian deMontfort. Both had played in some of these events separately, but this was the first time since their high school days they doubled together. They quickly found the magic that made them nearly unbeatable in their tennis careers at Crystal River High School. The first couple of rounds they made short work of their opponents, but ran into some stiffer competition from two ex-top guns from Hernando County, Chris Nyholm and Erik Lawson. They were an unbeatable team in their years at Hernando High School. Lavoie and deMontfort won the first set 6-3 with a combination of power and finesse. In the second set they fell behind 2-5, but crawled back to a 7-5 second set and championship win. It was a joy to watch and hopefully all teams, including these two, will put the next tournament, the 10th Annual Crystal River Open on Feb. 8-9, 2014, on their calendar. A lot of matches went to three sets, and at the end of the day we saw several players eventually running out of gas playing their sixth match of the weekend. Thank you everybody. Hope to see you again next time. The results were: Womens Final East: Anne Finnin/Judy Jeanette def. Anna Mirra/Kim Knudsen, 3-6, 6-3, 7-5. Womens Final North: Jane Wilson/Rhonda Lane def. Lisa Steed/Linda Martin, 6-4, 0-6, 6-2. Womens Final West: Micki Brown/Sally deMontfort def. Veronica Williams/Maddie Lewis, 6-4, 6-2. Womens Final South: Vicki Lavoie/Cecily Buck def. Noreen Vicente/Andrea Vicente, 7-6, 6-2. Mens Final East: Brian deMontfort/Chris Lavoie def. Erik Lawson/Chris Nyholm, 6-3, 7-5. Mens Final North: Mike Brown/Donny Simmons def. Dave deMontfort/Jim Lavoie, 6-1, 7-5. Mens Final West: Andy Belskie/Barney Hess def. Ron Risane/Mike Walker, 6-0, 6-0. Mens Final South: Wayne Steed/Vinnie Tremante def. Nicholas Pais/Coty Willey, 4-6, 7-5, 6-3. Mixed Final East: Anna Mirra/Mike Walker def. Kim deMontfort/Brian deMontfort, 3-6, 6-3, 7-6. Mixed Final North: Lisa Steed/Wayne Steed def. Jane Wilson/Randy Robins, 6-0, 6-1. Mixed Final West: Maddie Lewis/Coty Willey def. Linda Martin/Vinnie Tremante, 6-4, 7-5. Mixed Final South: Veronica Williams/Nicholas Pais def. Leslie Sherry/Marcial Irizarry, 6-4, 5-7, 6-3. Mens BBBRIEFS No. 1 Kentucky 93, Northern Kentucky 63LEXINGTON, Ky. Julius Randle scored 22 points en route to another double-double that led top-ranked Kentuckys 93-63 blowout of Northern Kentucky on Sunday. Guard Aaron Harrison added 16 points for Kentucky. No. 21 Notre Dame 80, Stetson 49SOUTH BEND, Ind. Jerian Grant and Garrick Sherman scored 15 points each and No. 21 Notre Dame won for the second game in three days, 80-49 over Stetson on Sunday. Pat Connauhgton added 10 points for the Irish (2-0), while Sherman led the team with nine rebounds.From wire reports NBABRIEFS Spurs 120, Knicks 89NEW YORK Danny Green had 24 points and a career-high 10 rebounds, and the San Antonio Spurs pounded the New York Knicks 120-89 on Sunday for their fourth straight victory. Kawhi Leonard scored 18 points and Tony Parker had 17 for the Spurs. Carmelo Anthony and Andrea Bargnani both scored 16 for the Knicks.Thunder 106, Wizards 105, OTOKLAHOMA CITY Kevin Durant scored 33 points, including a tying 3 late in regulation and the go-ahead foul shots in overtime that sent the Oklahoma City Thunder past the Washington Wizards 106-105. John Wall missed a driving layup attempt at the buzzer for Washington. Bradley Beal scored a career-high 34 points for the Wizards.Suns 101, Pelicans 94PHOENIX Eric Bledsoe scored 24 points and Markieff Morris came off the bench to score 23 as the Phoenix Suns beat the New Orleans Pelicans 101-94. Gerald Green scored 15 and Goran Dragic added 12 for the Suns, who have won four of five. Jason Smith scored 22 points for the Pelicans.From wire reports PHIL CASTILLO /Special to the ChronicleCrystal River High School alums Chris Lavoie, left, and Brian deMontfort claimed the 9th Annual Fall Fest Tournament Mens East doubles title. Dubuisson wins Turkish Airlines Open by two Associated PressANTALAYA, Turkey Victor Dubuisson held off some of golfs biggest names, including Tiger Woods, to win the inaugural Turkish Airlines Open by two shots on Sunday for his first European Tour victory. Dubuisson entered the day with a five-shot lead but with Woods, Justin Rose, Henrik Stenson and Ian Poulter among those chasing him. Dubuisson started the fourth round with nine straight pars but had three birdies on his last four holes for a 3-under 69 that gave him a 24-under total of 264. Jamie Donaldson shot a 63 including a hole-in-one at the 16th to climb up the leaderboard and finish second, two shots back. Woods and Rose were another two strokes behind in a tie for third. Stenson, the Race to Dubai leader, finished in a tie for seventh after a 69.Kirk survives rollercoaster finish to win McGladrey Classic.Adam Scott wins Australian PGAGOLD COAST, Australia.Taiwans Teresa Lu wins Mizuno ClassicSHIMA, Japan Taiw. South Koreas Chella Choi, tied with Lu with two holes to play, had a 66 to finish second. Stacy Lewis, the 2012 winner, tied for eighth at 7 under after a 70. Associated PressVictor Dubuisson plays a shot Sunday from the 6th tee during the final round of the Turkish Open at the Montgomerie Maxx Royal Course in Antalya, Turkey.
PAGE 19
MONDAY, NOVEMBER11, 2013 B5CITRUSCOUNTY(FL) CHRONICLEENTERTAINMENT PHILLIPALDER Newspaper Enterprise Assn.As we approach the holiday season, lets. Todays diagram shows the only bridge deal in the book. If this layout occurred during, say, an 11table duplicate, there would no doubt be 11 different auctions. Here, in particular, Easts double was bizarre after hearing her partner raise diamonds. Note that East would have made five diamonds if she had guessed spades correctly. After West led a low heart, South, a student at the college, called for dummys 10, and East ruffed. She then cashed the spade ace: six, three, five. East, not guessing that the three was Wests. Alaska State Troopers Brain Games Brain Games Brain Games Brain Games None of the Brain Games Church Rescue: Country Salvation G None of the Brain Games (NICK) 28 36 28 35 25Sponge.Sponge.Sponge.ThunderFull HseFull HseFull HseFull HseFull HseFull HseFriendsFriends (OWN) 103 62 103 Dateline on OWNDateline on OWNDr. Phil PG Dr. Phil PG Dr. Phil PG Dr. Phil PG (OXY) 44 123 Preachers of L.A.Preachers of L.A.Snapped PG Snapped PG Snapped: KillerSnapped PG (SHOW) 340 241 340 4 Reindeer Games (2000) R Time of Death MAHomeland Gerontion MA Masters of Sex All Together Now MA Homeland Gerontion MA Masters of Sex All Together Now MA (SPIKE) 37 43 37 27 36 Killer Elite (2011) Jason Statham. A special-ops agent must rescue his mentor. The Expendables (2010, Action) Sylvester Stallone, Jason Statham, Jet Li. (In Stereo) NRGT Academy G Killer Elite (2011) (In Stereo) R (STARZ) 370 271 370 Dancing on the Edge MA After the Sunset (2004) Pierce Brosnan. (In Stereo) PG-13 Evil Dead (2013) Jane Levy. (In Stereo) R Looper (2012) Bruce Willis. (In Stereo) R (SUN) 36 31 36 College Football Florida State at Wake Forest.NHL Ho ckey T ampa Bay Lightning at Boston Bruins. From TD Garden in Boston. Golf Destination Golf America Swing Clinic Tee It up With (SYFY) 31 59 31 26 29Terminator 3 Ghost Rider (2007) Nicolas Cage. A motorcycle stuntman is a supernatural agent of vengeance. PG-13 Outlander (2008, Action) James Caviezel. An alien joins forces with Vikings to hunt his enemy. R Star Trk: Cntct (TBS) 49 23 49 16 19SeinfeldSeinfeldSeinfeldFam. GuyFam. GuyFam. GuyBig BangBig BangBig BangBig BangConan (N) (TCM) 169 53 169 30 35 Billy Budd (1962, Drama) Robert Ryan, Terence Stamp. NR Jaws (1975, Horror) Roy Scheider, Robert Shaw. PG Zanjeer (1973, Drama) Amitabh Bachchan, Pran. Premiere. NR (TDC) 53 34 53 24 26Fast N Loud (In Stereo) Fast N Loud (In Stereo) Fast N Loud: Revved Up (N) Fast N Loud (N) (In Stereo) Bar Hunters PGBar Hunters Fast N Loud (In Stereo) (TLC) 50 46 50 29 30Long Island MediumUntold Stories of ERUntold Stories of ERUntold Stories of ERUntold Stories of ERUntold Stories of ER (TMC) 350 261 350 A Film With Me in It (2008) Dylan Moran. NR War Horse (2011) Emily Watson. A horse sees joy and sorrow during World War I. PG-13 Lincoln (2012) Daniel Day-Lewis, Sally Field. (In Stereo) PG-13 (TNT) 48 33 48 31 34Castle The Late Shaft PG Castle Den of Thieves PG Castle Food to Die For (In Stereo) PG Castle Overkill PG (DVS) Major Crimes CSI: NY Brooklyn Til I Die (TOON) 38 58 38 33 RegularRegularAdvenRegularStevenMAD PGKing/HillClevelandBurgersAmericanFam. GuyFam. Guy (TRAV) 9 54 9 44Bizarre FoodsBizarre FoodsBizarre FoodsBizarre FoodsBizarre FoodsBizarre Foods (truTV) 25 55 25 98 55Worlds Dumbest...Worlds Dumbest...Worlds Dumbest...JokersJokersJokersJokersWorlds Dumbest... (TVL) 32 49 32 34 24GriffithGriffithGriffithGriffithGriffithGriffithRaymondRaymondFriendsFriendsKingKing (USA) 47 32 47 17 18NCIS Life Before His Eyes NCIS Secrets (DVS) WWE Monday Night RAW (N) (In Stereo Live) PG, V Covert Affairs River Euphrates (WE) 117 69 117 Will & Grace Will & Grace Will & Grace Will & Grace CSI: Miami Last Straw CSI: Miami No Good Deed CSI: Miami Rest in Pieces CSI: Miami At Risk (In Stereo) (WGN-A) 18 18 18 18 20Funny Home VideosFunny Home VideosFunny Home VideosFunny Home VideosWGN News at NineMotherRules Dear Readers: In honor of Veterans Day, here is one of our favorite pieces, written by John Alton Robinson of Monroe, La. Freedom From the Tomb of the Unknown Soldier To the silverhaired crowns of our fathers From the shores of Tripoli To the Pacificsances: Fathers Day and my birthday have come and gone, and I didnt hear a word from any of you. Christmas is coming, and I expect more of the same. You are not orphans. You didnt rear yourselves. You didnt. Its dont) MINCE HOBBYLAVISH ABSURD Saturdays Jumbles: Answer: When the young sheep fought over their sleeping arrangements, it was BED-LAMB Now arrange the circled letters to form the surprise answer, as suggested by the above cartoon.THAT SCRAMBLED WORD GAMEby David L. Hoyt and Jeff Knurek Unscramble these four Jumbles, one letter to each square, to form four ordinary words. MOCAM LAGEZ RAWDOT TALYEL Tribune Content Agency, LLC All Rights Reserved. For more about Guest Jumblers Week check out Jumble on Facebook Print your answer here: MONDAY EVENING NOVEMBER The top 12 artists perform. PGThe Blacklist (N) NewsJay Leno # (WEDU) PBS 3 3 14 6World News Nightly Business PBS NewsHour (N) (In Stereo) Antiques Roadshow (In Stereo) G JFK: American Experience (Series Premiere) The life of John F. Kennedy. (N) PG Hero From Bay Last Measure % (WUFT) PBS 5 5 5 41JournalBusinessPBS NewsHour (N)Antiques RoadshowJFK: American Experience PG BBC T. Smiley ( (WFLA) NBC 8 8 8 8 8NewsNightly NewsNewsChannel 8 Entertainment Ton.The Voice Live Top 12 Performances The top 12 artists perform. (N) PG The Blacklist General Ludd (N) NewsJay Leno ) (WFTV) ABC 20 20 20 NewsWorld News Jeopardy! (N) G Wheel of Fortune Dancing With the Stars (N) (In Stereo Live) PG Castle A Murder Is Forever (N) PG Eyewit. News Jimmy Kimmel (WTSP) CBS 10 10 10 10 1010 News, 6pm (N) Evening News Wheel of Fortune Jeopardy! (N) G How I Met2 Broke Girls (N) Mike & Molly Mom (N) Hostages The Good Reason (N) 10 News, 11pm (N) Letterman ` (WTVT) FOX 13 13 13 13FOX13 6:00 News (N) (In Stereo) TMZ (N) PG omg! Insider (N) Bones The Dude in the Dam (N) Sleepy Hollow The Midnight Ride FOX13 10:00 News (N) (In Stereo) NewsAccess Hollywd 4 (WCJB) ABC 11 11 4 NewsABC EntInside Ed.Dancing With the Stars (N) (N) (In Stereo Live) PG Castle A Murder Is Forever (N) PG NewsJimmy Kimmel @ (WMOR) IND 12 12 16Modern Family Modern Family Big Bang Theory Big Bang Theory Big Bang Theory NFL Football Miami Dolphins at Tampa Bay Buccaneers. From Raymond James Stadium in Tampa, Fla. (N) (Live) Modern Family Family Tradition (N) PG Beauty and the Beast (N) EngagementEngagementThe Arsenio Hall Show O (WYKE) FAM 16 16 16 15Animal Court Citrus Today County Court Casita Big Dog Zorro PGYour Plumber Moving On GCold Squad (DVS) Eye for an Eye Fam Team S (WOGX) FOX 13 7 7SimpsonsSimpsonsBig BangBig BangBones (N) Sleepy Hollow FOX PGCriminal Minds PGCriminal Minds PGCriminal Minds PGCriminal Minds Criminal Minds (A&E) 54 48 54 25 27Gangsters: Americas Most Evil Gangsters: Americas Most Evil Gangsters: Americas Most Evil Gangsters: Americas Most Evil Gangsters: Americas Most Evil Gangsters: Americas Most Evil (AMC) 55 64 55 The Longest Day (1962, War) John Wayne, Robert Mitchum. G Apocalypse Now Redux (2001, War) Marlon Brando, Robert Duvall, Martin Sheen. An Army agent goes upriver in Cambodia to kill a renegade. R (ANI) 52 35 52 19 21To Be AnnouncedInfested! No Escape PG Monsters Inside Me (In Stereo) PG Monsters Inside Me Dying Abroad PG Extreme Animal Obsessions (N) Monsters Inside Me Dying Abroad PG (BET) 96 19 96 106 & Park: BETs Top 10 Live Top 10 Countdown (N) PG HusbandsHusbandsHusbandsBlack Girls Rock! 2013 Queen Latifah; Venus Williams. PG Husbands (BRAVO) 254 51 254 Vanderpump RulesReal HousewivesReal HousewivesVanderpump RulesReal HousewivesHappensReal (CC) 27 61 27 33South Park Tosh.0 Colbert Report Daily ShowAt MidnightFuturama South Park MA South Park MABrickleberrySouth Park MA Daily ShowColbert Report (CMT) 98 45 98 28 37Reba PG Reba PG Reba PG Reba PG Ghostbusters II (1989) Bill Murray. A long-dead Carpathian warlock attempts to return to Earth. Cops Reloaded Cops Reloaded Cops Reloaded (CNBC) 43 42 43 Mad Money (N)The Kudlow Report60 Minutes on CNBCAmerican GreedCar Car Mad Money (CNN) 40 29 40 41 46SituationCrossfireErin Burnett OutFrontAnderson CooperPiers Morgan LiveAC 360 Later (N)Erin Burnett OutFront (DISN) 46 40 46 6 5Jessie G GoodCharlie Dog With a Blog G Jessie G Tinker Bell (2008) Voices of Mae Whitman. G Jessie G Shake It Up! G Austin & Ally G Gravity Falls Y7 GoodCharlie (ESPN) 33 27 33 21 17SportCtrMonday Night Countdown (N) (Live) NFL Football Miami Dolphins at Tampa Bay Buccaneers. (Live) SportCtr (ESPN2) 34 28 34 43 49SportsNation (N)Womens College Basketball Womens College Basketball College Basketball (EWTN) 95 70 95 48FaithNever FarDaily Mass G The Journey HomeEvangeRosaryWorld Over Live PGSo. PoleWomen (FAM) 29 52 29 20 28 The Blind Side (2009, Drama) Sandra Bullock, Tim McGraw. PG-13 Forrest Gump (1994, Comedy-Drama) Tom Hanks. An innocent man enters history from the s to the s. PG-13 The 700 Club (In Stereo) PG (FLIX) 118 170 The Three Musketeers (1993) Charlie Sheen. (In Stereo) PG The Way of the Gun (2000) Ryan Phillippe. (In Stereo) R Dangerous Minds (1995, Drama) Michelle Pfeiffer. R Fifty Pills R (FNC) 44 37 44 32Special ReportGreta Van SusterenThe OReilly FactorThe Kelly File (N)Hannity (N) The OReilly Factor (FOOD) 26 56 26 DinersDinersGuys GamesDinersDinersDinersDinersDiners, Drive DinersDiners (FS1) 732 112 732 FOX Football DailyUFCUFCCollege Basketball Boxing (FSNFL) 35 39 35 FameShipMagicNBA Basketball Orlando Magic at Boston Celtics. (Live)MagicIn MagicWorld Poker Tour (FX) 30 60 30 51 Made of Honor (2008, RomanceComedy) Patrick Dempsey. PG-13 27 Dresses (2008, Romance-Comedy) Katherine Heigl. A young woman is always a bridesmaid and never a bride. PG-13 27 Dresses (2008) (GOLF) 727 67 727 Golf Central (N)The Golf Fix (N)Golf Patriot Cup. (Taped) The Greatest Game Ever Played (2005) (HALL) 59 68 59 45 54 Single Santa Seeks Mrs. Claus (2004) Crystal Bernard. Hitched for the Holidays (2012, RomanceComedy) Joey Lawrence. Naughty or Nice (2012, Fantasy) Hilarie Burton, Gabriel Tigerman, Matt Dallas. (HBO) 302 201 302 2 2 Taking Chance (2009) NR Argo (2012, Historical Drama) Ben Affleck, Alan Arkin. (In Stereo) R Crisis Hotline The Sitter (2011) Jonah Hill. (In Stereo) R EastboundAndre Ward (HBO2) 303 202 303 The Pacific MA The Pacific Leckie returns home. MA Real Time With Bill Maher MA Boardwalk Empire MA The Hobbit: An Unexpected Journey (2012) Ian McKellen. PG-13 (HGTV) 23 57 23 42 52Hunt IntlHunt IntlLove It or List It GLove It or List It GLove It or List It GHuntersHunt IntlLove It or List It G (HIST) 51 25 51 32 42Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG The Bible Noah endures Gods wrath. V Bible Secrets Revealed PG Big History PG Big History PG (LIFE) 24 38 24 31 His and Her Christmas (2005, Comedy-Drama) Paula Devicq. NR A Nanny for Christmas (2010, Comedy) Emmanuelle Vaugier. NR All About Christmas Eve (2012, Comedy) Haylie Duff, Chris Carmack. PG-13 (LMN) 50 119 Baby for Sale (2004) Dana Delany. A couple helps bust a baby broker. Taken From Me: The Tiffany Rubin Story (2011) Taraji P. Henson. NR Headlines: The Tiffany Rubin Story Taken: Missing Children with Elizabeth (MAX) 320 221 320 3 3 Red Tails (2012) Cuba Gooding Jr., Nate Parker. (In Stereo) PG-13 Two Weeks Notice (2002) Sandra Bullock. (In Stereo) PG-13 The Negotiator (1998, Suspense) Samuel L. Jackson. (In Stereo) R WANT MORE PUZZLES? Look for Sudoku and Wordy Gurdy puzzles in the Classified pages. Poem illustrates efforts of those who served country
PAGE 20
B6MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLECOMICS Pickles Crystal River Mall 9; 564-6864 Bad Grandpa (R) 12:15 p.m., 5:30p.m., 7:55p.m. Captain Phillips (PG-13) 12:35p.m., 3:50p.m., 6:55p.m. The Counselor (R) 12:50 p.m., 4:35 p.m., 7:20p.m. Enders Game (PG-13) 12:45 p.m., 4 p.m., 7:15p.m. Free Birds (PG) 4:05 p.m., 7:35p.m. Free Birds (PG) In 3D. 1:25 p.m. Nopasses. Gravity (PG-13) 1:30p.m. Gravity (PG-13) In 3D. 4:40 p.m., 7:40p.m. Nopasses. Last Vegas (PG-13) 1:15 p.m., 4:30 p.m., 7:45p.m. Thor: The Dark World (PG-13) 1 p.m., 4:15p.m. 7:30p.m. Nopasses. Thor: The Dark World (PG-13) In 3D. 12:30p.m., 3:45p.m., 7p.m. Nopasses. Citrus Cinemas 6 Inverness; 637-3377 Bad Grandpa (R) 1:30 p.m., 4:30p.m., 7:30p.m. Captain Phillips (PG-13) 12:50p.m., 3:50p.m., 6:50p.m. Enders Game (PG-13) 1 p.m., 4p.m., 7:15p.m. Free Birds (PG) 4:40 p.m., 7:25p.m. Free Birds (PG) In 3D. 1:40p.m. Nopasses. Gravity (PG-13) 4:15p.m. Gravity (PG-13) In 3D. 1:15p.m., 7:20p.m. Nopasses. Thor: The Dark World (PG-13) 12:45p.m., 7p.m. Nopasses. Thor: The Dark World (PG-13) In 3D. 3:45p.m. Nopasses.T MZC IVHXWS ZL UWXR TAVF. KUW NWWM FKC NR BKOFCMKMO HMS NWWM KM CFW THXKMW VZXGI LZX LZAX RWHXI. BWW CXWUKMZPrevious Solution: If I could rent someone elses subconscious occasionally maybe I could get a decent nights sleep. Richard Lewis (c) 2013 by NEA, Inc., dist. by Universal Uclick 11-11
PAGE 21
COLLEGEFOOTBALLCITRUSCOUNTY(FL) CHRONICLEMONDAY, NOVEMBER11, 2013GEFH 000GEFW Commercial, Residential and Service Plumbers needed.Call 352-726-5601 or submit resume to modernplumbing@ tampabay.rr.com. DFWP TOWER HANDStarting at $10.00/Hr Bldg. Communication Towers. Travel, Good Pay & Benefits. OT, 352-694-8017 Mon.-Fri. AIRLINE CAREERSbegin here -Get FAA approved Aviation Maintenance Technician training. Housing and Financial aid for qualified students. Job placement assistance. Call Aviation Institute of Maintenance 877-741-9260 www .FixJet s.com. Need a JOB? #1 Employment source is Classifieds firstemployment Classifieds ww.chronicleonline.com Need a job or a qualified employee? This areas #1 employment source! PT Breakfast/ Lunch CookTwo years Exp. preferred. Apply at Oak Run on SR200 & 110th Street, email resume to jobs @deccahomes.com or call 352-854-6557 X13 for more info.EEO/DFWP. Lost 9/8/13 Tri colored beagle.Neutered male,weighs 40 lbs. Special needs pet. Last seen on N. Lee St. Beverly Hills. If you have seen JoJo please call 352-249-3107 or 352-476-3140. Please help JoJo to come home. We miss him terribly. Found Small Brown Dog, Nov. 3, Lecanto on Hwy 44 (352) 726-3007 Accordion Player wanted for parties and lessons. Call Ray (352) 503-6361 Crypt/ Niche x2 Fero Memorial Garden Memory Building B, North side, eye level. $600/ea 701-400-6482 BUYING JUNK CARS Running or Not CASH PAID-$300 & UP (352) 771-6191 2 Free Horses,Saved from Glue Factory 1 Mare, 1 Gelding, rideable, exp. rider 352-302-6843 All Free: Fabric Recliner, Queen sz sofa bed, table lamp, twin keyboard electric organ. Call for one or all (352) 637-2136 FREE Fancy Tail Guppies (352) 560-3019 Pom and Jack Russell male, 6 mos, must be fenced yard pls call (352) 637-1903 $$ CASH PAID $$FOR JUNK VEHICLES 352-634-5389 Taurus MetalRecycling Best Prices for your cars or trucks also biggest U-Pull-It with thousands of vehicles offering lowest price for parts 352-637-2100 Your world first.Every Dayvautomotive Classifieds Your Worldof garage sales Classifieds ww.chronicleonline.com Well ahead of No. 3 Ohio State in standings Associated PressFlorida State took firm hold of second place in the BCS standings behind topranked. Late Saturday No. 16 UCLA 31, Arizona 26TUCSON, Ariz. Freshman linebacker Myles Jack played offense, too, rushing for 120 yards on six carries, including a 66-yard touchdown run to help No. 16 UCLA beat Arizona 31-26. On defense, Jack had eight tackles and recovered KaDeem CareysAs first offensive play. Evans also had a 4-yard scoring catch. Arizonas B.J. Denker had a pair of fourthquarter touchdown passes to Nate Phillips.No. 17 Fresno St. 48, Wyoming 10LARAMIE, Wyo. Derek Carr threw for 366 yards and four touchdowns, and Josh Quezada rushed for 105 yards and a score as No. 17 Fresno State defeated Wyoming 48-10. Fresno State (9-0, 6-0 Mountain West) is one of six Top 25 teams that remain undefeated. Wyoming (4-5, 2-3) is 0-15 against ranked teams under fifth-year coach Dave Christensen and hasnt beaten a Top 25 team since 2002, when the Cowboys defeated No. 24 Air Force 34-26. Carr completed 33 of 46 passes with no interceptions before being pulled for the night with 9:45 left and the game well in hand. He has gone 229 pass attempts without an interception.Pittsburgh 28, No. 24 Notre Dame 21PITTSBURGH James Conner ran for two short touchdowns, including the go-ahead score with 9:36 remaining as Pittsburgh upset No. 24 Notre Dame 28-21. Tom Savage passed for 243 yards and two scores to Devin Street as the Panthers (5-4) took advantage of some sloppy play by the Fighting Irish (7-3) to end Notre Dames fourgame winning streak. The Irish turned it over three times, including a pair of fourth-quarter interceptions by Tommy Rees. Rees completed 18 of 39 for 318 yards and two touchdowns but was picked off by Pitts Ray Vinopal on consecutive passes in the final quarter. TJ Jones caught six passes for 149 yards and a touchdown and ran for another but Notre Dames hopes for a Bowl Championship Series bowl bid vanished in a sloppy final 15 minutes. FSU takes firm hold of second in BCS BCS standingsNov. 10, 2013 AvgPv 1. Alabama.99581 2. Florida St..96192 3. Ohio St..89264 4. Stanford.86895 5. Baylor.86186 6. Oregon.76653 7. Auburn.72069 8. Clemson.72007 9. Missouri.71188 10. South Carolina.558412 11. Texas A&M.547315 12. Oklahoma St..467114 13. UCLA.454819 14. Fresno St..431716 15. N. Illinois.350518 16. Michigan St..341717 17. UCF.341121 18. Oklahoma.292610 19. Arizona St..283322 20. Louisville.280620 21. LSU.275713 22. Wisconsin.261224 23. Miami (Fla.).147111 24. Texas.1092NR 25. Georgia.0857NRAP Top 25The Top 25 teams in The Associated Press college football poll, with first-place votes in parentheses, records through Nov. 9, total points based on 25 points for a first-place vote through one point for a 25th-place vote, and previous ranking: RecordPtsPv 1. Alabama (56)9-01,4721 2. Florida St. (3)9-01,4183 3. Ohio St.9-01,3104 4. Baylor8-01,3035 5. Stanford8-11,2726 6. Oregon8-11,1392 7. Auburn9-11,1097 8. Clemson8-11,0498 9. Missouri9-11,0129 10. Texas A&M8-290911 11. South Carolina7-285713 12. Oklahoma St.8-178015 13. UCLA7-266916 14. Michigan St.8-163318 15. UCF7-159619 16. Fresno St.9-058817 17. Wisconsin7-250321 18. LSU7-347010 19. Louisville8-146720 20. N. Illinois9-039622 21. Arizona St.7-236223 22. Oklahoma7-228512 23. Texas7-2185NR 24. Miami7-212114 25. Georgia6-378NR Others receiving votes: Mississippi 68, Minnesota 60, Nebraska 16, Duke 11, Southern Cal 10, Washington 9, Ball St. 7, Virginia Tech 5, BYU 3, Notre Dame 2, Houston 1.USA Today Top 25The USA Today Top 25 football coaches poll, with first-place votes in parentheses, records through Nov. 10, total points based on 25 points for first place through one point for 25th, and previous ranking: RecordPtsPvs 1. Alabama (58) 9-01,546 1 2. Florida State (4) 9-01,485 3 3. Ohio State 9-01,401 4 4. Baylor 8-01,376 5 5. Stanford 8-11,307 6 6. Clemson 8-11,164 7 7. Oregon 8-11,162 2 8. Missouri 9-11,083 9 9. Auburn 9-11,069 10 10. Oklahoma State 8-1965 11 11. Texas A&M 8-2898 13 12. South Carolina 7-2830 15 13. Louisville 8-1653 16 14. Fresno State 9-0646 17 15. UCLA 7-2641 18 16. Michigan State 8-1620 19 17. Oklahoma 7-2510 8 18. LSU 7-3476 12 19. Central Florida 7-1468 21 20. Wisconsin 7-2460 22 21. Northern Illinois 9-0445 20 22. Arizona State 7-2262 24 23. Miami (Fla.) 7-2228 14 24. Texas 7-2176NR 25. Minnesota 8-291NR.Harris Top 25The Top 25 teams in the Harris Interactive College Football Poll, with first-place votes in parentheses, records through Nov. 10, total points based on 25 points for a first-place vote through one point for a 25th-place vote and previous ranking: RecordPtsPv 1. Alabama (105)9-02,6251 2. Florida State9-02,5143 3. Ohio State9-02,3734 4. Baylor8-02,3045 5. Stanford8-12,2406 6. Oregon8-11,9682 7. Clemson8-11,9407 8. Missouri9-11,8558 9. Auburn9-11,8439 10. Texas A&M8-21,58212 11. Oklahoma State8-11,54514 12. South Carolina7-21,41715 13. Fresno State9-01,12417 14. Louisville8-11,10416 15. Michigan State8-11,09018 16. UCLA7-21,02619 17. LSU7-391911 18. Northern Illinois9-082520 19. Central Florida7-179121 20. Oklahoma7-273210 21. Wisconsin7-267422 22. Arizona State7-247524 23. Miami (FL)7-245713 24. Texas7-2247NR 25. Georgia6-3102NR. CFB POLLS
PAGE 22
B8MONDAY,NOVEMBER11 A-1 Hauling, Cleanups, garage clean outs, trash, furniture & misc. Mark (352) 287-0767 JEFFS CLEANUP/HAULING Clean outs/ Dump Runs Brush Removal Lic. 352-584-5374 SMITTYS APPLIANCE REPAIR. Also W anted Dead or Alive W ashers & Dryers. FREE PICK UP! 352-564-8179 Bs Marina & Campground Yankeetown Deep Water & Covered Boat Slips352-447-5888 Your world first.Every Dayvautomotive Classifieds 000GEFP Sugarmill Woods2/2/1, like new, long Term, (352) 428-4001 HERNANDOAffordable Rentals Watsons Fish Camp (352) 726-2225 INVERNESS1/1 near CM Hospital $475 incld water/garb $950 moves you in 352-422-2393 INVERNESS55+ park Enjoy the view! 2 bd, 1 bath Lot rent, car port, water, grass cutting included. Call 800-747-4283 for details BRING YOUR FISHING POLE! INVERNESS, FL55+ park on lake w/5 piers, clubhouse and much more! Rent incl. grass cutting and your water 1 bedroom, 1 bath @$395 Pets considered and section 8 is accepted. Call 800-747-4283 For Details! LECANTOLeisure Acres 3/2 SW, water & garbage inc. application & bckgrnd req. $600. mo. (352) 628-5990 3 BR, 2BA, partially furnished. Attached screen rm & carport 55+ park. Lot rent $235 includes water & trash pickup, great for snowbird or elderly person $12,500. For Sale or Lease to own (352) 212-4265 RETRO LOOK SMALL BODYSEMI-HOLLOW ELECTRIC 12STRING W/GROVERS JINGLE JANGLE SOUND! $185. 352-601-6625 HEATER WITH FAN HOLMS 1500 watt excellent condition, used very little. $10.00 (352)257-4076 Electric Treadmill$395. Almost New (352) 795-3086 The Will haul away unwanted riding lawn mowers for FREE in Inverness area. 726-7362 3 HP 10 Sears Craftsman Table Saw $150 or trade 8 Pc. Drum Set, w/ yamaha electric guitar $125. or trade (352) 795-8863 ALUM. 8 FTLADDER Davidson Model 428-08, Type II Commercial OSHAapproved VGC $80 Call 352-794-6721 APPLIANCES like new washers/dryers, stoves, fridges 30 day warranty trade-ins, 352-302-3030 CALLIOPE Plays from a CD, 5 ft. tall, very colorful, excellent for festivals, crafts shows, draws a crowd quickly $300. (352) 795-3424 CANON MP280 PRINTER Great condition, needs ink, black colored, also a scanner, $25 (352)465-1616 Electronic KAWAI Organ 2 key boards, 11 pedals, 50 tonal adj. $125 obo; blond oval kit table w/ 4 chrs, 50x33, pedestal $40 352-249-8970 FL. JUMBO SHRIMP Fresh 15ct @ $5.00lb, Stone Crab@$6.00lb delivered352-897-5001 SCOOTER AND LIFT a Celebrity 3-wheel scooter and a Haramar rear (behind the car)lift. Both in very good condition. $1000 for both. please call before 8 PM 352-270-2319 PIANO Korg SP-250 Digital Piano, Full Keyboard, $250. (352) 382-5632 USA made Patio Chairs 2 adj. high backs and 2 gliders white powder coast frames $225.00 (352) 513-4232 1 Full Size Bed w/ Mattress, spring, head/foot board $85 Patio Table, Nice, new $75 No calls before 11am (352) 628-4766 3Pc. Liv. Rm. Set beige matching sofa loveset & chair, cocktail tble glass $800. Jr. Din. Room, table w/leaf, hutch, 6 chairs, stone washed $400. 352-423-0062,SMW, 38 ROUND COFFEE TABLE with lazy susan. Maple. Nice condition. $30. 527-1239 SET. Table, 4 chairs, hutch and sideboard. Medium wood. Nice condition. $300. 527-1239 HUTCH. 36 X 18 X 69 high. Medium color wood. Excellent condition. $65.... 527-1239 King size-Rattan Head Board and frame w/2 box springs.$50.00 352-212-2051 OAK TRIPLE DRESSER w/ mirror and 5 drawer chest. Great cond. $300/set. or $175 ea. Will deliver (352) 249-1031 Office Furniture -Oak Wood, great cond. Pedestal desk, 2 drwr file, comp desk, lg bookcase. $400 (352) 527-2778 RECLINING LOVESEATbrown leather good $70 503-7668 SOFA Beautiful Floral Print, no smkg or pets. No tears or stains. Citrus Hills $150. Can email photo 352-527-2778 SWIVELROCKER. Gold fabric. Good condition. $30. 527-1239 20 PATIO STONES 12 round, white concrete, clean,barely used. $1.25 each or $20. for all (352)382-5297 AFFORDABLE Top Soil, Mulch, Stone Hauling & Tractor Work (352) 341-2019 RIDING LAWN MOVER Troy-Bilt 18.5 HP42 Lawn Tractor $600.00 352-637-4849 MEDICAL OFFICE TRAINEES NEEDED!Train to become a Medical Office Assistant. NO EXPERIENCE NEEDED! Online training gets you Job ready ASAP. HS Diploma/GED & PC/Internet needed! (888)528-5547 Crank up Victrola 1920s 78 rpm Brunswick & Victor Portable $325. for both (352) 344-5283 HOT TUB, 6 pers, like new, 64 jets, colored lights, built in stereo w/ CD player. Orig $9000, asking $2500 (352) 302-9845 APPLIANCES like new washers/dryers, stoves, fridges 30 day warranty trade-ins, 352-302-3030 GE electric 30 stove, brand new never used, white $300.; 40 gal elec hot water heater. Used 1 week, $150 (352) 341-4902 Hamilton Beach Microwave 6 mo old. exc cond $25 860-605-3094 KENMORE DRYER heavy duty, super capacity, very good condition $100. (352) 522-0141 Small Window Air conditioner $50. Portable Ice Maker $65. Both Like New (352) 637-2117 SMITTYS APPLIANCE PALM DETAIL SANDER HARBOR FREIGHTUsed once. $10.00 (352)257-4076 CASSETTE TAPES 27 Brand new, never opened. $14.00 for all (352)257-4076 VCR TAPES 12 BRAND NEW plus binus of 4 used. $10.00 for all. (352)257-4076 VCR TAPES BRAND NEW, never used 12 new plus bonus of 4 used. $10.00 for all. (352)257-4076 Diestler Computer New & Used systems repairs. Visa/ MCard 352-637-5469 L Shape Bar and 5 Capt. Swivel Chairs, $100. 352-228-9295 Lloyd Flanders Wicker Club Chairand wicker rocker, Linen color, $300. (352) 527-2491 citruschronicleFollow the
PAGE 23
MONDAY,NOVEMBER11,2013 B 9 CITRUS COUNTY (FL) CHRONICLE CLASSIFIEDS 464-1111 MCRN Kennedy, Carol D. 09-2013-CA-001093 NOA PUBLIC NOTICE IN THE CIRCUIT COURT OF THE FIFTH JUDICIAL CIRCUIT IN AND FOR CITRUS COUNTY, FLORIDA CIVIL DIVISION CASE NO. 092013CA001093XXXXXX FEDERAL NATIONAL MORTGAGE ASSOCIATION, Plaintiff, vs. UNKNOWN SUCESSOR TRUSTEE OF THE CAROL D. KENNEDY LIVING TRUST AGREEMENT DATED 3/6/09; Defendants. NOTICE OF ACTION TO:UNKNOWN SUCESSOR TRUSTEE OF THE CAROL D. KENNEDY LIVING TRUST AGREEMENT DATED 3/6/09 Names and Residences are Unknown UNKNOWN BENEFICIARlES OF THE CAROL D. KENNEDY LIVING TRUST AGREEMENT DATED 3/6/09 Names and Residences are Unknown YOU ARE NOTIFIED that an action to foreclose a mortgage on the following described prope1ty in Citrus County, Florida LOTS 13 AND 14, BLOCK 258, OF INVERNESS HIGHLANDS SOUTH, ACCORDING TO THE MAP OR PLAT THEREOF AS RECORDED IN PLAT BOOK 3, PAGES 51 THROUGH 66, INCLUSIVE,-138304 465-1111 MCRN Baughman, Wilma 09-2013-CA-000385 NOA PUBLIC NOTICE IN THE CIRCUIT COURT OF THE FIFTH JUDICIAL CIRCUIT IN AND FOR CITRUS COUNTY, FLORIDA CIVIL DIVISION CASE NO. 092013CA000385XXXXXX FEDERAL NATIONAL MORTGAGE ASSOCIATION, Plaintiff, vs. THE UNKNOWN SPOUSES, HEIRS, DEVISEES, GRANTEES, CREDITORS, AND ALL OTHER PARTIES CLAIMING BY, THROUGH, UNDER OR AGAINST WILMA J. BAUGHMAN A/K/A WILMA JUNE BAUGHMAN, DECEASED; et al,. Defendants. NOTICE OF ACTION TO: THE UNKNOWN SPOUSES, HEIRS, DEVISEES, GRANTEES,CREDITORS, AND ALL OTHER PARTIES CLAIMING BY, THROUGH, UNDER OR AGAINST WILMA J. BAUGHMAN A/K/A WILMA JUNE BAUGHMAN, DECEASED; et al,. Current Residence ls Unknown YOU ARE NOTIFIED that an action to foreclose a mortgage on the following described prope1ty in Citrus County, Florida LOT 11, BLOCK B, POINT OWOODS UNIT 1, ACCORDING TO THE PLAT THEREOF, RE CORDED IN PLAT BOOK 4, PAGE 5, OF THE-128933 466-1111 MCRN Heath, Jimmie 2011-CA-002079 Notice of Action PUBLIC NOTICE IN THE CIRCUIT COURT OF THE FIFTH JUDICIALCIRCUIT, IN AND FOR CITRUS COUNTY, FLORIDA CASE NO.:2011-CA-002079 THE BANK OF NEW YORK MELLON TRUST COMPANY, N.A., AS TRUSTEE FOR GREENPOINT MANUFACTURED HOUSING CONTRACT TRUST, PASS-THROUGH CERTIFICATE, SERIES 1998-1, acting by and through GREEN TREE SERVICING LLC, as Servicing Agent 345 St. Peter Street 1100 Landmark Towers St. Paul, MN 55102, Plaintiff, v. JIMMIE L. HEATH, IF LIVING, BUT IF DECEASED, THE UNKNOWN HEIRS, DEVISEES, GRANTEES, ASSIGNEES, CREDITORS, LIENORS AND TRUSTEES OF JIMMIE L. HEATH, THE UNKNOWN HEIRS, DEVISEES, GRANTEES, ASSIGNEES, CREDITORS, UBNORS, AND TRUSTEES OF NANCYM. HEATH A/K/ANANCYMAE HEATH, DECEASED, AND ALLOTHER PERSONS CLAIMING BY, THROUGH, UNDER, AND AGAINST THE NAMED DEFENDANTS A/K/AJIMMIE HEATH, JR. A/K/AJIMMIE LEE HEATH II,THE UNKNOWN HEIRS, DEVISEES, GRANTEES, ASSIGNEES, CREDITORS, LIENORS, AND TRUSTEES OF FLORENCE M.KLEMENCIC, A/K/AFLORENCE MAE KLEMENCIC A/K/AFLORENCE MAE KLEMENIC, DECEASED, AND ALLOTHER PERSONS CLAIMING BY, THROUGH, UNDER, AND AGAINST THE NAMED DEFENDANTS N/K/AJIMMIE HEATH, JR. A/K/AJIMMIE LEE HEATH 11, IRIS POTTS, PATSYA. SEAVERS, individually, and as successor trustee of the FORREST W. SEAVERS INTER-VIVOS TRUST AGREEMENT OF MARCH 29, 1990,CITRUS COUNTY, FLORIDA, CLERK OF COURT, COUNTYOF CITRUS, a political subdivision of the State of Florida, Defendants NOTICE OF ACTION TO: THE UNKNOWN HEIRS, DEVISEES, GRANTEES, ASSIGNEES, CREDITORS, LIENORS AND TRUSTEES OF JIMMIE L. HEATH, DECEASED YOU ARE NOTIFIED that a civil action has been filed against you in the Circuit Court, County of Citrus, State of Florida, to foreclose certain real property described as follows: SEE EXHIBIT A; TOGETHER WITH THAT CERTAIN 1998 PEACH STATE 28 x: 64 SOUTHERN COMFORT MOBILE HOME SERIALNUMBER: PSHGA21389AB. Commonly known as: 9823 SOUTH PARKSIDE AVENUE FLORALCITY,FLORIDA344 11th day of October, 2013. CLERK OF COURT (SEAL) By: /s/ Vivian Cancel, Deputy Clerk EXHIBIT A Lot 10 of an unrecorded subdivision in Section 28, Township 20 South, Range 20 East, Citrus County, Florida and being more particularly described as follows: Commence at the NE corner of Section 28, Township 20 South, Range 20 East, thence S 0 0005 W along the East line of said Section 28, said line also being the West line of Block A, Derby Oaks, as recorded in Plat Book 8, pages 107 through 109, public records of Citrus County, Florida, a distance of 1608.64 feet to the Point of Beginning, thence continue S 0 0005 W along said East line a distance of 176.31 feet, thence S 89 5940 W, parallel to the North line of said Section 28, a distance of 223.32 feet to a point on a curve, concaved Westerly, having a central angle of 90 and a radius of 60.36 feet, thence Northwesterly along the arc of said curve a distance of 47.40 feet to the P.T. of said curve, chord bearing and distance between said points being N 22 3008 W 46.19 feet, said point being the P.C. of a curve, concaved Northeasterly, having a central angle of 45 and a radius of 60.36 feet, thence Northwesterly along the arc of said curve a distance of 47.41 feet to the P.T. of said curve, said point being on the East right of way line of a County Road, thence N 0 00 05 E along said right of way line a distance of 90.95 feet, thence N 89 5940 E parallel to the North line of said Section 28, a distance of 258.68 feet to the Point of Beginning. Published in the CITRUS COUNTYCHRONICLE, November 4 & 11, 2013. 000GEFCVROLET, Camaro, convertable, auto, AC, 1 owner $4,400. Cry. Riv. (727) 207-1619, Cell CHRYSLER2006, Town & Country leather, dvd, $6,998 352-341-0018 HONDA2007, Element, Hard to find, cold A/C, runs great, Must See, Call (352) 628-4600 CHEVROLET04 Corvette, Conv Artic White, torch red leather, polished alum. wheels, auto heads up display, bose, senior owned pristine, 11k $27,900 obo 352-513-4257 $4,400, 352-563-0615 Onan Marine Generator, 7KW gas with hush exhaust sys. can demonstrate $900 (352) 601-3656 ** PLYMOUTH Acclaim, AC, new tires & brakes, very clean 86K mi. runs great $3,000 obo 352 382-3900, 634-3880 SATURN2009 Aura, 94,500 mi Runs perf. Full Equipd $7750 (352) 302-4057 INVESTORS 3/2 MH, 1 Acre, Newer Roof, A/C exc. tenants in place $47K obo Cash 352-503-3245 WOODED LOT on Lee Woods Dr., HOMOSASSA has Wetlands, $5,000. 352-621-1664 4BR /1 BABlock home, above ground pool. Fenced, Appliances, Kindness Terr. off Grover Clev, $42K As is. 352-419-8816 Newer Section of Beverly HIlls Upscale home built in 1994. Two bedroom, two bath & two car garage. New A/C and roof. $85,900 352-422-6129 Timberlane Estates! 3/2/2, w/ screen pool, Located on 1 AC 2690 W. Express Lane Reduced $129,000 795-1520 or 634-1725! $214,000 352-341-0118 3/2/2 in the Highlands; Very Clean w/ large screened patio,& attached storage shed. Lg corner lot in great neighborhood $89,9 00 Connell Heights 4/2/2 Pool Home, Spacious, FP, fenced back yd. custom built 2005, Great Location $195k 352-422-7077 Rock Crusher Area 3Br/2Ba/1CG, newly renovated, including new, lights, fans, appliances, and flooring $72,900 352-422-4533 TAMI SCOTTExit Realty Leaders 352-257-2276 exittami@gmail.com When it comes to Realestate ... Im there for you The fishing is great Call me for your new Waterfront Home LOOKING TO SELL? CALLME TODAY! 4 Beautiful Acres next to lake. Well, paved streets. Horses OK 9157 E Orange Ave FLORAL CITY. 941-358 -6422, 941-320-0433 BEVERLYHILLS2bed/bath, $675. mo. FIRST MONTH FREE! (352) 422-7794/2 St arting @
PAGE 24
B10MONDAY, NOVEMBER11, 2013CITRUSCOUNTY(FL) CHRONICLE 000GJOP THANK YOU VETERANS ON BEHALF OF CRYSTAL AUTOMOTIVE EMPLOYEES AND OUR FAMILIES, WE WISH TO OFFER A HEART FELT THANK YOU FOR ALL YOU HAVE DONE. TODAY THROUGH VETERANS DAY... ANY VETERAN OR FAMILY MEMBER CAN PURCHASE ANY NEW CHEVY AND MAKE NO PAYMENTS TILL MEMORIAL DAY 2014.* MAKE NO PAYMENTS UNTIL MEMORIAL DAY.* *with approved credit loan for 72 months @3.99 APR. Certain restrictions apply. See dealer for detai ls. WAC. ^Maximum value $20.00 while supplies last. Visit today and test drive any vehicle and Crystal will buy you dinner at The Boathouse Restaurant ^ in Crystal River
|
http://ufdc.ufl.edu/UF00028315/03293
|
CC-MAIN-2018-47
|
refinedweb
| 27,317
| 66.44
|
#include <RF24Network.h>#include <RF24.h>#include <SPI.h>#include <Wire.h>RF24 radio(8,9); RF24Network network(radio); const uint16_t home_node = 00; const uint16_t distant_node = 01; struct payload_t { // Structure of our payload byte ID;};void setup(void) { Serial.begin(115200); SPI.begin(); radio.begin(); network.begin(/*channel*/ 92, /*node address*/ distant_node);}void loop(void) { byte ID = 1; for (int i = 0; i < 50; i++) { payload_t payload = {ID}; RF24NetworkHeader header(/*to node*/ home_node); bool ok = network.write(header,&payload,sizeof(payload)); if (ok) Serial.println("ok."); else Serial.println("failed."); delay (300); } delay(15000);}
#include <RF24Network.h>#include <RF24.h>#include <SPI.h>#include <Wire.h>RF24 radio(8,9); RF24Network network(radio); const uint16_t home_node = 00; const uint16_t distant_node = 01;struct payload_t { byte ID;};//const unsigned long interval = 3000; //unsigned long last_sent;int count = 0;void setup(void){ Serial.begin(115200); SPI.begin(); radio.begin(); network.begin(/*channel*/ 92, /*node address*/ home_node);}void loop(void){ RF24NetworkHeader header; payload_t payload; network.update(); while ( network.available() ) { // Is there anything ready for us? bool ok = network.read(header, &payload, sizeof(payload)); if (ok) // Non-blocking { count++; Serial.println ("count="); Serial.println (count); } else Serial.println ("Failed"); }}
I did some reading on the NRF24L01+ and you're right, the error isn't anywhere near to something that could be useful. I'm thinking of switching to a 433 mHz transmitter/receiver pair which should yield a usable error rate. I think if I switch to these I can better establish a relationship between distance and packet reception. The goal isn't to deriev an exact distance but to set up a few units and approximate position. I've seen threads online such as this and this where it seems possible. You clearly know your radios very well so what do you think about a different radio? And thank you again for being so helpful.
Lots of people have this 'idea' that you can use RSS1 for distance measurement and triangulation, it gets asked on here every couple of days.If it were a useful method of measuring distance, then there ought to be zillions of worked examples of it working. I cant recall seeing one.
Hmm, then how would you recommend a DIY solution to position tracking then? I only need to know if a tag is located in a specific room, accuracy to a couple inches etc, is not necessary.
So you want to 'track' people to specific rooms ?Is there a reason why you did not describe this requirement in your original post ?You have also not explained at all what it is you are actually trying to do or indeed why ?
I apologize I wasn't being clear. This is a personal project I want to use as a proof of concept. I wanted to track my pets inside the house and I learned that indoor positioning systems were quite pricy so I tried to make my own using cheap parts but clever logic. My goal is to track within about a meter accuracy but I figured it would be best to start by just knowing whether the tracked animal was in a specific room to start and go from there. Eventually I would like to expand the idea to other applications while still keeping a lower materials cost than other consumer or DIY solutions.
In theory, packet counting would work but you need a radio with a linear signal to distance ratio which is easier said than done apparently.
And its not that you need a 'radio' with a linear signal to distance ratio, electromagnetic wave do degrade according to a square law (twice the distance four times less signal etc), you need to remove all the issues relating to antenna orientation and signal reflections.
So would you say continuing this project in this manner is pointless or do I need to retool my approach taking into account more variables such as antenna orientation, signal reflection, degradation etc, as you pointed out?
Several suggestions have been made, have you considered carrying out some practical experiments ?
|
http://forum.arduino.cc/index.php?PHPSESSID=ompdjf90js1m2jsfm88vngc6h0&topic=498860.0
|
CC-MAIN-2017-47
|
refinedweb
| 676
| 54.42
|
...
CodingForums.com
>
:: Server side development
>
Java and JSP
> Class Loading: How to do it with Singletons?
PDA
Class Loading: How to do it with Singletons?
Apothem
12-24-2011, 11:48 PM
Simply put, I want to dynamically load singletons.
i.e. Say I have:
public class Singleton {
private static Singleton instance;
private Singleton() {}
public static Singleton getInstance() {
if(instance == null) { instance = new Singleton(); }
return instance;
}
}
From what I have learned, you would do something like this if it wasn't a singleton:
MainClass.class.getClassLoader().loadClass("myClass").newInstance();
But I don't this will be allowed. Would I need another layer of indirection? For example, do I need to do:
public class SingletonLoader {
public Singleton getInstance() { return Singleton.getInstance(); }
}
and from there invoke the getInstance method? Or is there a more direct solution?
Fou-Lu
12-25-2011, 05:33 AM
Singleton is designed for the instance of that class. I think that the call against a .newInstance off the class loader would chain to the constructor, so a private or protected constructor will throw an exception.
To load, its a simple call to Singleton.getInstance();. There is really no way to do this dynamically since you cannot stop an class with a public constructor from instantiating a new record. Any class to be a singleton has to be an instance of a Singleton first. You can call it against a dynamically loaded class though, that's just a simple try/catch and attempt to invoke the Method of getInstance on the class or cast to a Singleton type.
So if I got what you are looking for, your dynamically loaded classes implement singleton. You can load them as so:
try
{
Method getInstance = class.getClassLoader().loadClass("MyClass").getMethod("getInstance");
Object instance = getInstance.invoke();
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
Methinks that will work.
Apothem
12-25-2011, 07:32 AM
Well, after digging around I found out I was supposed to do something like:
Class<?> c = Class.forName("MySingleton");
Method m = c.getDeclaredMethod("getInstance", new Class[0]);
Object obj = m.invoke(null, new Object[0]);
But I'm getting the following exception:
java.lang.NoSuchMethodException: MySingleton.getInstance()
at java.lang.Class.getDeclaredMethod(Class.java:1954)
at myProg.main(myProg.java:21)
Really strange because that class does in fact have a getInstance() method... as such:
/**
* Gets single instance of the site
* @return the site
*/
public static MySingleton getInstance() {
if(instance == null) {
instance = new MySingleton();
}
return instance;
}
Note: I replaced the real singleton class name with "MySingleton".
Woops my bad, it seems that I was editing the wrong "MySingleton" file. It works. Thanks.
renegadeandy
12-25-2011, 05:12 PM
I am interested in why you want to do this at all?
Apothem
12-25-2011, 07:20 PM
The project I am currently working on makes use of the ability to dynamically load classes. Why? I want to allow other developers to develop their own subsystem based on a set of interfaces I already have, and allow users to benefit from it.
I can technically make things very simple for myself and complicated for others, but I do not believe that is the way to go. And though it may sound hypocritical to say this, I would like to uphold certain invariant so that there is design. These invariant might cause the developer to do a LITTLE more work, but it is for the "greater good" so that recompiling the entire source is not required.
renegadeandy
12-25-2011, 07:29 PM
Ahhhh right I see - so the main goal is to make setting up easy so you dont need to recompile, hence why you need to deal with the classloader, gotcha, nice work! :thumbsup:
albert.chiu
12-30-2011, 08:33 AM
You can use spring framework to do this.
EZ Archive Ads Plugin for
vBulletin
Computer Help Forum
vBulletin® v3.8.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.
|
http://www.codingforums.com/archive/index.php/t-247093.html
|
CC-MAIN-2013-48
|
refinedweb
| 653
| 56.76
|
With the boom in the number of online buyers and the simultaneous influx of reviews, understanding user experience is becoming an increasingly challenging task. Reviews talk volumes about a product, the seller and local partners. However, scraping such a myriad of customer feedback can be a tricky task. This tutorial helps you understand better ways of retrieving and structuring reviews of products to draw powerful insights.
For our use case here, we will be using reviews of Amazon Echo.
Let’s get started
Before we get started with the program, let’s make sure we have all the necessary tools and libraries.
The program below is written for Python 3. Install Python3 and PIP by following this guide.
Install the required libraries using the command below:
pip3 install pandas nltk gensim pyLdavis
Load the libraries
We are going to need quite a few libraries. Let’s load them.
import re # We clean text using regex import csv # To read the csv from collections import defaultdict # For accumlating values from nltk.corpus import stopwords # To remove stopwords from gensim import corpora # To create corpus and dictionary for the LDA model from gensim.models import LdaModel # To use the LDA model import pyLDAvis.gensim # To visualise LDA model effectively import pandas as pd
If you are using NLTK stopwords for the first time, you might have to download it first.
import nltk nltk.download('stopwords')
Here is a sample dataset for Amazon Echo reviews.
Download Sample Dataset here
This is how your sample data would look:
fileContents = defaultdict(list) with open('reviews_sample.csv', 'r') as f: reader = csv.DictReader(f) for row in reader: # read a row as {column1: value1, column2: value2,...} for (k,v) in row.items(): # go over each column name and value fileContents[k].append(v) # append the value into the appropriate list
Extract just reviews to a list using
reviews = fileContents['review_body']
Cleaning Up The Data
Punctuation
Let’s remove all punctuations
reviews = [re.sub(r'[^\w\s]','',str(item)) for item in reviews]
Stop-words
The reviews we have contains a lot of words that aren’t really necessary for our study. These are called stopwords. We will remove them from our text while converting our reviews to tokens.
We use the NLTK stopwords.
stopwords = set(stopwords.words('english'))
Let’s remove those stopwords while converting the reviews list to a list of reviews which are split into words that matter. The list would look like this: [[word 1 of review1, word2 of review1…],[word1 of review 2, word2 of review2..],…].
texts = [[word for word in document.lower().split() if word not in stopwords] for document in reviews]
Taking out the less frequent words
One of the easiest markers of how important a certain word is in a text (stopwords are exceptions) is how many times it has occurred. If it has occurred just once, then it must be rather irrelevant in the context of topic modeling. Let’s remove those words out.
frequency = defaultdict(int) for text in texts: for token in text: frequency[token] += 1 texts = [[token for token in text if frequency[token] > 1] for text in texts]
Begin processing
Turning our text to dictionary
A dictionary in the context of machine learning is a mapping between words and their integer ids. We know that a machine can’t understand words and documents as they are. So we split and vectorize them. As well written here,
In this representation, each document is represented by one vector where each vector element represents a question-answer pair, in the style of:
It is advantageous to represent the questions only by their (integer) ids. The mapping between the questions and ids is called a dictionary. You can refer this link to know more
dictionary = corpora.Dictionary(texts)
If you try printing the dictionary, you can see the number of unique tokens in the same.
print(dictionary)
Dictionary(13320 unique tokens: ['warmth', 'exclusively', 'orchestral', 'techy', 'formal']...)
This also means that each document will now be represented by a 28054-D vector. To actually convert tokenized documents to vectors,
corpus = [dictionary.doc2bow(text) for text in texts]
doc2bow counts the number of occurrences of each distinct word, converts the word to its integer word id and returns the result as a sparse vector. So it would have lists of tuples which goes [(word id no, occurred this many times), … ]
So if corpus reads [(0,1),(1,4)] it means Word with ID no ‘0’ occurred one time and word with id number ‘1’ occurred 4 times in the document. Now that we have our reviews in a language the machine could understand, let’s get to finding topics in them.
What is an LDA Model?
Topic modeling is a type of statistical modeling for discovering the abstract “topics” that occur in a collection of documents. LDA expands to Latent Dirichlet Allocation (LDA) is an example of a model which is used to classify text in a document to a particular topic. It builds a topic per document model and words per topic model, modeled as Dirichlet distributions.
Let’s go with nine topics for now. The number of topics you give is largely a guess/arbitrary. The model assumes the document contains that many topics. You may use Coherence model to find an optimum number of topics.
NUM_TOPICS = 9 # This is an assumption. ldamodel = LdaModel(corpus, num_topics = NUM_TOPICS, id2word=dictionary, passes=15)#This might take some time.
There you go, you have your model built! Explaining the algorithm behind LDA is beyond the scope of this tutorial. This has a good explanation of the same.
Insights
Extracting Topics from your model
Let’s see the topics. Note that you might not receive the exact result as shown here. The objective function for LDA is non-convex, making it a multimodal problem. In layman’s terms, LDA topic modeling won’t give you one single best solution, it’s an optimization problem. It gives locally optimal solutions; you cannot expect that any given run would outperform some other run from different starting points. To know more, check out this discussion on Stack Exchange.
topics = ldamodel.show_topics() for topic in topics: print(topic)
(0, '0.229*"love" + 0.049*"alexa" + 0.040*"gift" + 0.027*"loves" + 0.026*"christmas" + 0.023*"family" + 0.023*"bought" + 0.023*"awesome" + 0.017*"best" + 0.016*"absolutely"') (1, '0.017*"amazon" + 0.017*"app" + 0.012*"device" + 0.010*"alexa" + 0.010*"work" + 0.010*"wifi" + 0.009*"phone" + 0.008*"time" + 0.008*"set" + 0.008*"get"') (2, '0.037*"home" + 0.034*"smart" + 0.029*"lights" + 0.028*"music" + 0.025*"turn" + 0.021*"control" + 0.021*"amazon" + 0.020*"alexa" + 0.016*"devices" + 0.014*"use"') (3, '0.042*"music" + 0.033*"alexa" + 0.022*"weather" + 0.020*"play" + 0.020*"questions" + 0.020*"use" + 0.018*"ask" + 0.015*"things" + 0.012*"list" + 0.012*"news"') (4, '0.035*"like" + 0.031*"alexa" + 0.029*"dont" + 0.022*"doesnt" + 0.020*"would" + 0.019*"know" + 0.017*"say" + 0.015*"get" + 0.015*"cant" + 0.014*"really"') (5, '0.091*"one" + 0.020*"bought" + 0.017*"got" + 0.016*"im" + 0.015*"another" + 0.014*"buy" + 0.013*"get" + 0.013*"day" + 0.012*"first" + 0.012*"would"') (6, '0.155*"echo" + 0.145*"dot" + 0.039*"love" + 0.024*"room" + 0.019*"bedroom" + 0.018*"dots" + 0.016*"house" + 0.015*"use" + 0.013*"music" + 0.012*"great"') (7, '0.061*"speaker" + 0.039*"sound" + 0.031*"good" + 0.027*"bluetooth" + 0.021*"better" + 0.020*"speakers" + 0.020*"quality" + 0.018*"echo" + 0.016*"great" + 0.015*"small"') (8, '0.145*"great" + 0.068*"works" + 0.062*"product" + 0.054*"easy" + 0.052*"fun" + 0.041*"use" + 0.026*"set" + 0.023*"device" + 0.022*"little" + 0.020*"well"')
word_dict = {}; for i in range(NUM_TOPICS): words = ldamodel.show_topic(i, topn = 20) word_dict['Topic # ' + '{:02d}'.format(i+1)] = [i[0] for i in words] pd.DataFrame(word_dict)
You get,
Observing the words, we could make the below initial insights. Tweaking number of passes and topics might yield better topics and results.
Topic 1 – Alexa makes a great Christmas gift among families. Kids and adults like it alike.
Topic 2 – There is some noise around wifi connectivity, likely negative since ‘problem’ is one of the top 8 contributors to the topic.
Topic 3 – Users are talking about how Amazon echo interacts with elements at home like music, radio, lights etc turning homes into a smart home.
Topic 4 – Amazon Echo reviewed on everyday tasks like playing music or telling about the weather, news etc. Some discussion on Bluetooth connectivity too
Topic 5 – Amazon Echo when compared with Google Home cannot answer a lot of questions.
Topic 6 – Amazon Echo is recommended, positive reviews.
Topic 7 – Users are talking about their experience with the Echo in their bedrooms and living rooms, likely positive.
Topic 8 – Reviews on speaker sound quality and Bluetooth connectivity.
Topic 9 – In spite of the price, Echo is recommended. General positive reviews.
Visualization using PyLDAvis
PyLDAvis is designed to help users interpret the topics in a topic model that has been fit to a corpus of text data, by showing them visually. Let’s see ours.
lda_display = pyLDAvis.gensim.prepare(ldamodel, corpus, dictionary, sort_topics=False) pyLDAvis.display(lda_display)
Which gives us, the below visualization.
To interact with the result, click here. This will helps us infer even more from our data.
Some insights from topic modeling are:
- We observe that Topics 4 and 5 have some reviews in common. Reviews that talk about how Amazon Echo involves in everyday tasks seem to frequently compare Echo with Google Home.
- A small interaction between Topics 2 and 5 indicate Echo was compared with Google Home on issues with Wi-Fi connectivity too.
- The interaction between Topics 2 and 3 supports that few of the top problems that customers complain and compare on are Wi-Fi connectivity, answering simple questions and helping users in everyday tasks.
- ‘Good’ is the third biggest contributor to Topic 8. This shows that speaker sound quality is a strong point and could be used as a positive point in advertising.
- Topic 1 suggests that the Echo makes great gifts, especially during the Christmas season. Increased attention to advertising with this perspective is suggested during the Christmas season.
You can get better keywords if you perform stemming or lemmatizing on your text. Tweak your number of topics and passes to see what gives you the best results to study from. You can also try using Coherence model to compute the optimum model, though this might give you very generic topics.
We can help with your data or automation needs
Turn the Internet into meaningful, structured and usable data
|
https://www.scrapehero.com/how-to-analyse-product-reviews-using-lda-topic-modelling/
|
CC-MAIN-2018-51
|
refinedweb
| 1,802
| 56.86
|
Project description
Introduction
Since Plone 4.0 you can configure Plone to allow users to login with their email address, using a setting in the Security control panel. This works fine out of the box. Some improvements would be useful though that need some more careful consideration before being added to core Plone. That is where this package comes in.
This is a temporary package with some fixes for when you want to use the email address of a user as login name in Plone 4. It also introduces a few hooks for determining the user id and login name of a new user.
Plone version
This package is tested with Plone 4.1, 4.2 and 4.3. It will not work in 4.0.
For Plone 3, you must use the collective.emaillogin package.
Dependencies
We need a newer version of Products.PluggableAuthService than is available currently in the latest Plone versions. Assuming you are using buildout for your Plone site, you need to add a line to a versions section:
Products.PluggableAuthService = 1.10.0
Any version newer than this is fine as well. If your Plone version already has this version or a newer one pinned, then you do not need to add this line.
What does this package do?
Clearer separation between user id and login name
The validation of the register browser view uses two methods to get a user id and login name:
# Generate a nice user id and store that in the data. user_id = self.generate_user_id(data) # Generate a nice login name and store that in the data. login_name = self.generate_login_name(data)
After this, the data dictionary will have keys user_id and login_name set accordingly.
We avoid as much as possible the use of username as a variable, because no one ever knows if that is meant as a user id or as a login name. In standard Plone this is always the same, but this need not be true, especially when using the email address as login name.
These changes are intended to be merged to plone.app.users.
Control over user ids
An IUserIdGenerator interface is defined. This is used in the new generate_user_id method of the register browser view (also used when adding a new user as admin). Two sample implementations:
def uuid_userid_generator(data=None): # Return a uuid, independent of the data. # This is available in utils.py in the plone.app.users patches. from zope.component import getUtility from plone.uuid.interfaces import IUUIDGenerator generator = getUtility(IUUIDGenerator) return generator() def login_name_as_userid_generator(data): # We like to keep it simple. return data.get('username')
In generate_user_id we try a few options for coming up with a good user id:
We query a utility, so integrators can register a hook to generate a user id using their own logic:
generator = queryUtility(IUserIdGenerator) if generator: userid = generator(data) if userid: data['user_id'] = userid return userid
If use_uuid_as_userid is set in the site_properties, we generate a uuid. This is a new property introduced by this package and can be set in the Security control panel.
If a username is given and we do not use email as login, then we simply return that username as the user id.
We create a user id based on the full name, if that is passed. This may result in an id like bob-jones-2.
When the email address is used as login name, we originally used the email address as user id as well. This has a few possible downsides, which are the main reasons for the new, pluggable approach:
- It does not work for some valid email addresses.
- Exposing the email address in this way may not be wanted.
- When the user later changes his email address, the user id will still be his old address. It works, but may be confusing.
Another possibility would be to simply generate a uuid, but that is ugly. We could certainly try that though: the big plus here would be that you then cannot create a new user with the same user id as a previously existing user if this ever gets removed. If you would get the same id, this new user would get the same global and local roles, if those have not been cleaned up.
When a user id is chosen, the user_id key of the data gets set and the user id is returned.
These changes are intended to be merged to plone.app.users.
Control over login names
Similarly, an ILoginNameGenerator interface is defined.
Usually the login name and user id are the same, but this is not necessarily true. When using the email address as login name, we may have a different user id, generated by calling the generate_user_id method.
We try a few options for coming up with a good login name:
We query a utility, so integrators can register a hook to generate a login name using their own logic:
pas = getToolByName(self.context, 'acl_users') generator = queryUtility(ILoginNameGenerator) if generator: login_name = generator(data) if login_name: login_name = pas.applyTransform(login_name) data['login_name'] = login_name return login_name
If a username is given and we do not use email as login, then we simply return that username as the login name.
When using email as login, we use the email address.
In all cases, we call PAS.applyTransform on the login name, if that is defined. This is a recent addition to PAS, currently under development.
When a login name is chosen, the login_name key of the data gets set and the login name is returned.
These changes are intended to be merged to plone.app.users.
Lowercase login names
We store login names as lowercase. The email addresses themselves can actually be mixed case, though that is not really by design, more a (happy) circumstance.
This needs branch maurits-login-transform of Products.PluggableAuthService. That branch introduces a property login_transform. Setting this to lower the lower method of PAS is called whenever a login name is given.
All relevant places in plone.app.users have been changed to take this new property into account, using code like this:
login_name = pas.loginTransform(login_name)
In the security panel of plone.app.controlpanel we change the set_use_email_as_login method to set login_transform to lower case when switching on email as login name. For safety, we never change this back to the default empty string. This is fine for normal non-email login names as well.
Note that when login_transform is lower, the end user can login with upper case JOE and he will then be logged in with login name joe, as long as the password is correct of course. If you somehow still have an upper or mixed case login name, you cannot login.
Setting the login_transform to a non empty string will automatically apply this transform to all existing logins in your database.
Note: when this is merged to core Plone, login names will not be transformed to lowercase by default. The option will simply be available if the site admin wants it. Switching on email as login will also switch on lowercase login names.
Updating login names
We have a patch for the ZODBMutablePropertyProvider of Products.PlonePAS that adds two new but empty methods required by the changed IUserEnumerationPlugin interface of PAS:
def updateUser(self, user_id, login_name): pass def updateEveryLoginName(self, quit_on_first_error=True): pass
This has been merged to Products.PlonePAS.
Control panels
Switching email as login name on or off in the security panel now automatically updates existing login names. It may fail when there are duplicates.
The updating of existing users used to be done in the @@migrate-to-emaillogin view (class EmailView) from plone.app.controlpanel. We have simplified this page to only search for duplicate login names. You can search for duplicate email addresses or duplicate user ids, always lower case.
The security panel now has an option Use UUID user ids, by default switched off.
Set own login name
The Products.CMFPlone.utils.set_own_login_name method is simplified, with much of the former code being moved to PAS itself:
def set_own_login_name(member, loginname): """Allow the user to set his/her own login name. If you have the Manage Users permission, you can update the login name of another member too, though the name of this function is a bit weird then. Historical accident. """ pas = getToolByName(member, 'acl_users') mt = getToolByName(member, 'portal_membership') if member.getId() == mt.getAuthenticatedMember().getId(): pas.updateOwnLoginName(loginname) return secman = getSecurityManager() if not secman.checkPermission(ManageUsers, member): raise Unauthorized('You can only change your OWN login name.') pas.updateLoginName(member.getId(), loginname)
Installation
When installing this add-on in the Add-ons control panel, the following is done.
- It adds the use_uuid_as_userid site property, by default False.
- If email as login is already used in the site, we set login_transform to lower. This could give an error and quit the installation. Maybe we want to catch this and just log a warning.
- It explicitly enables email as login name. This would not be done when merging this package back to core Plone.
Changelog
1.3 (2013-02-19)
- Depend on Products.PluggableAuthService >= 1.10.0 which has been released recently. [maurits]
1.2 (2013-01-23)
- Make sure user ids are strings, not unicode. [maurits]
1.1 (2013-01-23)
- Make sure the Manage Users permission is checked in set_own_login_name. [maurits]
1.0 (2013-01-22)
- Initial release
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|
https://pypi.org/project/collective.emaillogin4/
|
CC-MAIN-2018-39
|
refinedweb
| 1,588
| 56.55
|
Traversing a tree means visiting every node in the tree. You might for instance want to add all the values in the tree or find the largest one. For all these operations, you will need to visit each node of the tree.
Linear data structures like arrays, stacks, queues and linked list have only one way to read the data. But a hierarchical data structure like a tree can be traversed in different ways.
Let's think about how we can read the elements of the tree in the image shown above.
Starting from top, Left to right
1 -> 12 -> 5 -> 6 -> 9
Starting from bottom, Left to right
5 -> 6 -> 12 -> 9 -> 1
Although this process is somewhat easy, it doesn't respect the hierarchy of the tree, only the depth of the nodes.
Instead, we use traversal methods that take into account the basic structure of a tree i.e.
struct node { int data; struct node* left; struct node* right; }
The struct node pointed to by left and right might have other left and right children so we should think of them as sub-trees instead of sub-nodes.
According to this structure, every tree is a combination of
- A node carrying data
- Two subtrees
Remember that our goal is to visit each node, so we need to visit all the nodes in the subtree, visit the root node and visit all the nodes in the right subtree as well.
Depending on the order in which we do this, there can be three types of traversal.
Inorder traversal
- First, visit all the nodes in the left subtree
- Then the root node
- Visit all the nodes in the right subtree
inorder(root->left) display(root->data) inorder(root->right)
Preorder traversal
- Visit root node
- Visit all the nodes in the left subtree
- Visit all the nodes in the right subtree
display(root->data) preorder(root->left) preorder(root->right)
Postorder traversal
- Visit all the nodes in the left subtree
- Visit all the nodes in the right subtree
- Visit the root node
postorder(root->left) postorder(root->right) display(root->data)
Let's visualize in-order traversal. We start from the root node.
We traverse the left subtree first. We also need to remember to visit the root node and the right subtree when this tree is done.
Let's put all this in a stack so that we remember.
Now we traverse to the subtree pointed on the TOP of the stack.
Again, we follow the same rule of inorder
Left subtree -> root -> right subtree
After traversing the left subtree, we are left with
Since the node "5" doesn't have any subtrees, we print it directly. After that we print its parent "12" and then the right child "6".
Putting everything on a stack was helpful because now that the left-subtree of the root node has been traversed, we can print it and go to the right subtree.
After going through all the elements, we get the inorder traversal as
5 -> 12 -> 6 -> 1 -> 9
We don't have to create the stack ourselves because recursion maintains the correct order for us.
The complete code for inorder, preorder and postorder in C programming language is posted below:
#include <stdio.h> #include <stdlib.h> struct node { int data; struct node* left; struct node* right; }; void inorder(struct node* root){ if(root == NULL) return; inorder(root->left); printf("%d ->", root->data); inorder(root->right); } void preorder(struct node* root){ if(root == NULL) return; printf("%d ->", root->data); preorder(root->left); preorder(root->right); } void postorder(struct node* root) { if(root == NULL) return; postorder(root->left); postorder(root->right); printf("%d ->", root->data); } struct node* createNode(value){ struct node* newNode = malloc(sizeof(struct node)); newNode->data = value; newNode->left = NULL; newNode->right = NULL; return newNode; } struct node* insertLeft(struct node *root, int value) { root->left = createNode(value); return root->left; } struct node* insertRight(struct node *root, int value){ root->right = createNode(value); return root->right; } int main(){ struct node* root = createNode(1); insertLeft(root, 12); insertRight(root, 9); insertLeft(root->left, 5); insertRight(root->left, 6); printf("Inorder traversal \n"); inorder(root); printf("\nPreorder traversal \n"); preorder(root); printf("\nPostorder traversal \n"); postorder(root); }
The output of the code will be
Inorder traversal 5 ->12 ->6 ->1 ->9 -> Preorder traversal 1 ->12 ->5 ->6 ->9 -> Postorder traversal 5 ->6 ->12 ->9 ->1 ->
|
https://www.programiz.com/dsa/tree-traversal
|
CC-MAIN-2020-16
|
refinedweb
| 732
| 52.43
|
I’m not sure if this has been figured out and posted elsewhere, but I’ve looked for a solution and haven’t found exactly what I was looking for.
I’ve been building a dashboard for drilling down into data and I wanted to sync the options for all the multiselect components such that you don’t see options that aren’t available. Meaning, when you select value from one multiselect, the options for the other multiselects update.
I found this post: Dynamic multiselect options tied to presence in a list/dataframe, which handles syncing options, but only downstream.
I made a solution that seems to work pretty well. It’s not exactly simple, but it does what I need to do.
Basically, you store each component’s value in session state and use that to generate new options each time the app refreshes.
import streamlit as st import pandas as pd from vega_datasets import data df = data.cars() df['Year'] = df['Year'].dt.year # The components like to update and choose new values when you apply these methods. # Each time the dashboard updates, you need to set the reset the value and options for each component. # To do that, store each components value in st.session_state. # if there is a value in st.session_state for years if "years" in st.session_state and st.session_state['years']: # get the selected value. Use this to set the value of the year slider later years = st.session_state['years'] # filter the dataframe for the selected years and grab the indices year_idx = df[(df['Year'] >= years[0]) & (df['Year'] <= years[1])].index # if no value is selected or "years" hasn't been added to the session_state yet, set default values else: years = [min(df['Year']), max(df['Year'])] year_idx = df['Year'].index # Do the same for names if 'name' in st.session_state and st.session_state['name']: names = st.session_state['name'] name_value = names name_idx = df[df['Name'].isin(names)].index.unique() else: name_value = [] name_idx = df.index # Do the same for Origin if 'origin' in st.session_state and st.session_state['origin']: origins = st.session_state['origin'] origin_value = origins origin_idx = df[df['Origin'].isin(origins)].index.unique() else: origin_value = [] origin_idx = df.index # Find the interseciton of all the filtered indices. idx = list(set(year_idx).intersection(set(name_idx), set(origin_idx))) # Filter the dataframe dff = df.loc[idx] # Make the year slider years = st.slider("Years", min_value=min(df['Year']), max_value=max(df['Year']), value=years, key="years") # Get the filtered origin options origin_options = df.loc[list(set(year_idx).intersection(set(name_idx)))]['Origin'].sort_values().unique() # Make the origin multiselect origins = st.multiselect("Origin", origin_options, default=origin_value, key="origin") # Show the number of Origin options (just sanity check that it updated) st.write(len(dff['Origin'].unique())) # Get the filtered name options name_options = df.loc[list(set(year_idx).intersection(set(origin_idx)))]['Name'].sort_values().unique() # Make the name multiselect names = st.multiselect("Name", name_options, default=name_value, key="name") # Show the number of Name options (just sanity check that it updated) st.write(len(dff['Name'].unique())) # Show the filtered dataframe st.write(dff)
I don’t know if this is the easiest or fastest way to do this, but it’s a solution that seems to work. It’s a bit cumbersome if you have a lot of components you want synced, but worth it in my opinion.
|
https://discuss.streamlit.io/t/syncing-component-options-using-session-state/27696
|
CC-MAIN-2022-33
|
refinedweb
| 556
| 52.15
|
Install GSAP via NPM:
npm install gsap
As of GSAP 2.0, ES modules are used by default (CommonJS/UMD are still available; scroll down for more info). (see below) which can be easily resolved by referencing any plugins you're using.
Tree shaking
Some bundlers like Webpack offer a convenient feature called "tree shaking" that attempts to identify modules that you're not referencing anywhere in your code, and drops them from the bundle to reduce file size. Sounds great, but GSAP plugins (like CSSPlugin) aren't typically referenced anywhere directly by users, so they're ripe for getting accidentally plucked by tree shaking. That can break your animations. The solution? Simply reference the plugin somewhere in your code, like:
import { TimelineLite, CSSPlugin, AttrPlugin } from "gsap/all"; //without this line, CSSPlugin and AttrPlugin may get dropped by your bundler... const plugins = [ CSSPlugin, AttrPlugin ]; var tl = new TimelineLite(); tl.to(".myClass", 1, {x:100, attr:{width:300}});Note: To maximize backward compatibility and avoid tree shaking issues, the main TweenMax file automatically activates all the classes that were historically bundled with it (like CSSPlugin, BezierPlugin, AttrPlugin, etc.). That affects bundle size accordingly, of course. If you prefer to ONLY pull in the base TweenMax class (without auto-activating the others), you can use the
TweenMaxBasefile (as of 2.0.0), like:
//skips auto-activing the other plugins/classes import { TweenMax } from "gsap/TweenMaxBase";
To get tree shaking to work in Webpack, you may need to set
{modules:false} in your babel config file. Here are some links that may be useful:
-
-
- will contain a "bonus-files-for-npm-users" folder that has just the bonus plugins/tools. Then you can drop the bonus files into the /node_modules/gsap/ folder if you prefer, but most people don't like doing that because it makes things less portable/updatable.
If you're not a Club GreenSock member yet, check it out!
CDN: still a great optionYou certainly don't NEED to use GSAP via NPM or a build system - you can simply load the JS file(s) from the CDN in
<script>tags like:
<script src=""></script>That way, you'll get the benefit of the ubiquitous caching. Over 4,000,000 sites use GSAP, so tapping the CDN can improve speed.
Why can't I just import any class from "gsap"?Because historically "gsap" pointed to TweenMax (before we moved to ES modules) and we didn't want to break existing projects or suddenly cause them to get much bigger in build systems that didn't leverage tree shaking. We take backward compatibility very seriously. But when we move to version 3.0.0, our goal is to clean things up a bit.
TypescriptWe don't have any official TypeScript definition files (sorry), but there are two that might fit your needs: @types/greensock or @types/gsap. Please contact the authors of those repos if you encounter any problems. Also, in some environments (ones that aren't friendly to ES modules) it's best to import the UMD files in a slightly different way, like:
import * as Draggable from "gsap/umd/Draggable"; import * as TweenMax from "gsap/umd/TweenMax";
|
https://greensock.com/docs/NPMUsage
|
CC-MAIN-2019-39
|
refinedweb
| 528
| 52.19
|
Tax
Have a Tax Question? Ask a Tax Expert
I lost my Emerald Card and that is what I got to get my tax refund bank on. What will happen?
Thank you for coming to Just Answer and allowing us to help you with your question. About your Emerald Card, you need to call HR Block Bank at 1-***-***-**** and report the card as lost. The customer service people will help you get a replacement card and transfer the money from the old card account to your new card account. There may be a $10 fee for the new card, depending on the circumstances.
About the economic stimulus rebate, you should get a rebate if you made more than $3000, you didn't file as someone else's dependent, everyone listed on you return (you, your spouse, and dependents, if any) had a valid Social Security Number, and you don't owe any money to the government. If you paid your tax preparation fees in full at the time you had your return prepared, then the IRS will put your rebate on your old Emerald card and it will be transferred to your new card when you get the replacement card. If you had your tax preparation fees taken from your refund, then you will receive a paper check from the IRS mailed to the address on your tax return.
If you go to and click on the economic stimulus button near the top of the page, you will be able to find the schedule for direct deposits and paper checks and a calculator you can use to figure out how much money you will get, as well as answers to frequently asked questions. You will need your copy of the 2007 1040 form (whichever version you used: 1040EZ, 1040A, or 1040) to calculate the exact amount. Good luck. I hope this information answers all your questions. Let me know if you need more information.
|
http://www.justanswer.com/tax/17o0e-lost-emerald-card-thats-wat-tax-refund.html
|
CC-MAIN-2017-22
|
refinedweb
| 325
| 73.51
|
Contents
- 1 Frequently Asked Questions
- 1.1 General
- 1.2 C++
- 1.3 Python
- 1.4 COM
- 1.5 Items
- 1.6 Channels
- 1.6.1 Q: How do I read the transform channels for a locator type item?
- 1.6.2 Q: How do I read an item's channel value?
- 1.6.3 Q: How do I read a string channel?
- 1.6.4 Q: How do I set the default value of a string channel?
- 1.6.5 Q: How do I write a value to an item's channel?
- 1.6.6 Q: How do I read a gradient channel?
- Configs and Kits
Frequently Asked Questions
General
Q: What time is it?
A: Actually this is a fairly complex question. As a user the answer is simple -- the current time is shown on the time slider and you scrub it to change time. But when writing plug-ins you have to realize that nexus takes a much more holistic view of time and simple linear thinking can cause problems.
For commands that perform edits, or items that draw themselves in 3D, the current global time can generally be used. This is maintained as part of the selection system along with all the other user-controlled state that affects UI interaction.
CLxUser_SelectionService selSrv;
time = selSrv.GetTime ();
selSrv = lx.service.Selection()
time = selSrv.GetTime()
When evaluating the scene graph, however, time is not universal.
Q: How do I know when the current time changes?
A: Getting notified of global state changes is done though a Global Listener Object. This is an object that you create and export to modo, and your methods will be called when events happen. The easiest way to create a one-off object of this type is to use a Singleton Polymorph. The selevent_Time() method will be called with the new time as the user scrubs the timeline.
class CTimeChangeTracker : public CLxImpl_SelectionListener, public CLxSingletonPolymorph { public: LXxSINGLETON_METHOD; CTimeChangeTracker () { AddInterface (new CLxIfc_SelectionListener<CTimeChangeTracker>); } void selevent_Time ( double time) LXx_OVERRIDE { current_time = time; } };
Since this is a singleton you'd store it as global state in your plug-in.
static CTimeChangeTracker *time_tracker = 0;
The first time you need to start tracking time you create the object and register it with the ListenerService. Do not do this in your initialize() function since that may be too soon.
CLxUser_ListenerService ls; time_tracker = new CTimeChangeTracker; ls.AddListener (*time_tracker);
When you are done tracking time changes you should unregister your listener.
CLxUser_ListenerService ls; ls.RemoveListener (*time_tracker); delete time_tracker;
Q: How do I write to the log?
A: Writing to the event log viewport can be done by deriving from the CLxLogMessage utility class (or the CLxLuxologyLogMessage class, which just adds a Lux copyright). This is done by objio.cpp to report load warnings and errors. See Writing to the Event Log for more detail.
The spikey tool sample uses a log block to display tool feedback. The current value is formatted into the block and displayed as part of the tool info viewport.
Writing to the debug output on stdout is possible using one of the variants of LogService::DebugOut(), as shown in the Hello World sample. You have to specify a level, and the default level for release builds is 'error' I think. Lower-level messages are filtered out. If you want to see all the debug output, start modo with the "-debug:verbose" command line switch.
Q: How do I: How do I create a new XCode project for a modo plugin, from scratch?
A:.
The easiest way to see how to setup the project files is to start with the sample plugins. There are both Xcode and Visual Studio projects included.: Just declare it, and it is ready to go:
CLxUser_SceneService srv_scene;
srv_scene.ItemTypeLookup ("SomeItemType", ¬MyType);
srv_Scene = lx.service.Scene() ();
Q: How do I get my C++ implementation from a COM handle?
A: If you have an interface handle and you know the type of the C++ object that's implementing it, you can unwrap the COM object and get at the meaty C++ object inside. If this is one of your servers, then you just have to call lx::CastServer() with the server name:
CMyClass * Extract ( ILxUnknownID from) { CMyClass *mine; lx::CastServer (SERVER_NAME, from, mine); return mine; }
If the COM object comes from a spawner then you need to use the Cast() method on the spawner:
CMyClass * Extract ( ILxUnknownID from) { CLxSpawner<CMyClass> spawn ("myClass"); return spawn.Cast (from); }: What does cannot allocate an object of abstract type mean?
A: This means you have inherited from a superclass which has pure virtual methods, and you have failed to provide an implementation for one or more of those methods. In the context of the SDK, the most likely cause is that you're using an implementation class with required methods. For example, suppose your package instance inherits from the ChannelModItem Interface. It's not enough to simply inherit from the implementation.
class CInstance : public CLxImpl_PackageInstance, public CLxImpl_ChannelModItem { ... };
If you attempt to initialize a polymorph based on this class it will fail with the abstract type error. That's because the cmod_Flags() method is pure virtual and must be implemented by your class. Of course, for the channel modifier to do anything you need a flags method, so this isn't really a hardship. It's just something to be aware of when starting the implementation for your SDK objects.
Q: Is it possible to create COM wrappers for other languages?
Items);
A: Packages are servers, so you can access them through the HostService Interface as a Factory Object. This function returns the value for any server tag given the server class, the name of the server, and the tag key.
const char * ServerTag ( const char *className, const char *serverName, const char *tagKey) { CLxUser_HostService hostSrv; CLxUser_Factory factory; const char *value; hostSrv.Lookup (fac, className, serverName); if (LXx_OK (fac.InfoTag (tagKey, &value)) return value; return 0; }
In order to use this function to read server tag for item types (packages), you just need to find the package name from the item type.
bool IsMask ( CLxUser_Item &item) { CLxUser_SceneService scnSrv; const char *pkgName; scnSrv.ItemTypeName (item.Type (), &pkgName); return (ServerTag (LXa_PACKAGE, pkgName, LXsPKG_IS_MASK) != 0); })
Q: How do I read an item's channel value?
A: It depends on the context. Mostly you use a ChannelRead Interface, unless you are in a modifier of some kind, in which case a different API should be used.
The normal case also has two forms. The first allows you to access channel values stored in the base (edit) action. Given a scene, an item in the scene and the channel index, you can get a channel read object from the scene and use that to access the value of channels in the action.ICHAN_TEXTURELAYER_ENABLE)
The other form is for reading evaluated channels, like the various matricies which are computed from the transform channels. In that case you provide the time for the evaluation rather than the action name:
CLxUser_ChannelRead chan_read;
CLxUser_Matrix xfrm;
chan_read.from (item, 0.0);
chan_read.Object (item, index, xfrm);
Q: How do I write a value to an item's channel?
A: Get a ChannelWrite Object, initialize it and set the channel's value. The channel argument can be the channel index or the channel name: C++ will pick the right method for you. value can be integer, float or string.
CLxUser_ChannelWrite chan; chan.from (item); chan.Set (item, channel, value);
Q: How do I
Q: How do I get a CLxUser_Mesh from a mesh item?
A: There are two meshes you can get. If you want the base mesh -- the mesh that the user edits -- then you need to use the form of GetChannels which specifies the action layer, and use LXs_ACTIONLAYER_EDIT. This allows you to read the mesh channel from the action directly:
unsigned index;
CLxUser_Scene scene;
CLxUser_ChannelRead rchan;
CLxUser_Mesh umesh;
if (LXx_OK(item.ChannelLookup (LXsICHAN_MESH_MESH, &index))) {
item.GetContext (scene);
scene.GetChannels (rchan, LXs_ACTIONLAYER_EDIT); // this version is crucial here!!!
if (rchan.Object (itm, index, umesh))
np = umesh.NPoints ();
}()
If you want to access the mesh after deformation, then you want to read from the evaluated mesh channel. This is done by specifying the time at which you want to evaluate. You can then read the channel as a MeshFilter Interface which can be evaluated:
unsigned index;
CLxUser_Scene scene;
CLxUser_ChannelRead rchan;
CLxUser_MeshFilter mfilt;
CLxUser_Mesh umesh;
if (LXx_OK(item.ChannelLookup (LXsICHAN_MESH_MESH, &index))) {
scene.from (item);
scene.GetChannels (rchan, 0.0); // read the deformed mesh at time zero
if (rchan.Object (itm, index, mfilt)) {
if (mfilt.GetMesh (umesh))
np = umesh.NPoints ();
}
}()
Note that the channel is a Mesh Object in one case and a EvaluationStack Object in the other. You have to know the source of your ChannelRead Object to know which one you will get. Alternately you could query for the different interface types to probe the object as runtime.
The MeshFilter is also what you get from a modifier. You'd specify the mesh channel as an input and store its attribute index. During evaluation you'd read the channel as a MeshFilter:
CLxUser_MeshFilter mfilt; CLxUser_Mesh mesh; if (m_attr.ObjectRO (i_mesh, mfilt)) { if (mfilt.GetMesh (mesh)) np = mesh.NPoints (); }
Q:.
Modifiers
Q: My plugin has a modifier and an item instance with an item drawing interface. How can I get the modifier object inside the instance's methods?
A: Read the modifier object from the appropriate item channel, and convert:
CLxUser_ValueReference ref; LXtObjectID obj; chan.Object (m_item, "myModifierObjectChannelName", ref); ref.GetObject (&obj); CLxSpawner<MyModifierClass> spawner ("myModSpawnName"); MyModifierClass *mod; mod = spawner.Cast ((ILxUnknownID)obj); // Do stuff to draw modifier here lx::ObjRelease (obj);
Q: How can my channel modifier read inputs at different times?
A: This is done by using methods on the Evaluation Interface. You need to cache this interface as part of your member data in your Allocate() method.
LxResult CTimeOffset::cmod_Allocate ( ILxUnknownID cmod, ILxUnknownID eval, ILxUnknownID item, void **ppvData) { m_eval.set (eval); ... }
Then in the Evaluate() method you read the channels you want at the current time first (in this case the current time and an offset time value), then set the evaluation for an alternate time and read other inputs.
LxResult CTimeOffset::cmod_Evaluate ( ILxUnknownID cmod, ILxUnknownID attr, void *data) { CLxLoc_ChannelModifier chanMod (cmod); double time, dt, value; chanMod.ReadInputFloat (attr, INDEX_TIME, &time); chanMod.ReadInputFloat (attr, INDEX_OFFSET, &dt); if (dt) m_eval.SetAlternateTime (time + dt); chanMod.ReadInputFloat (attr, INDEX_INPUT, &value); ... }
Q: Can my modifier read from the setup action?
A: Yes. It's the same process as in the previous answer, but using Evaluation::SetAlternateSetup().
m_eval.SetAlternateSetup ();
If you want to clear the alternate and read from the current time and action again, use ClearAlternate().
m_eval.ClearAlternate ();
Q: Why won't my channel modifier write a matrix?
If you're trying to write a matrix in a channel modifier, you might try something like this:
chanMod.WriteOutputVal (attr, 0, (void **)(&outMatrixPtr)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { (*outMatrixPtr)[i][j] = m[i][j]; } }
which wouldn't work. For whatever reason, if you want to write to matrix outputs, you need to write to every link individually. So your code would need to look like this:
chanMod.OutputCount (0, &outCount); for (unsigned idx = 0; idx < outCount; idx++) { chanMod.WriteOutputValByIndex (attr, 0, idx, (void **)(&outMatrixPtr)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { (*outMatrixPtr)[i][j] = m[i][j]; } } }
A: You need a notifier. Command notifiers send change flags on specific events to indicate that some aspect of the command's state may have changed. Flags can indicate the enable/disable state, the label, the value, or the datatype.
- Notifiers can be added to a basic command by implementing basic_Notifier() which returns the name and arguments for each notifier by index.
- Common notifiers for selection changes, mesh edits, etc, can be found in the notifier docs.
- Changes to plug-in state can trigger notifications by declaring a notifier server. These are created by inheriting from CLxCommandNotifier.
Q: How do I open a file dialog from my command?
A: Normally this is done in your Interact() method, something like this:
void CMyLoadCommand::cmd_Interact () { /* * Open the dialog using the "dialog.*" sub-commands. Works here * because they are non-model, non-undoable commands. */ fire ("dialog.setup fileOpen"); fire ("dialog.title {Load Animation}"); fire ("dialog.fileTypeCustom {Quicktime Movie} {*.mov;*.mp4} mov"); fire ("dialog.open"); /* * Query the result, getting a list of filenames. */ CLxUser_Command resCmd; CLxUser_ValueArray va; LXtObjectID obj; unsigned int n; check ( srv_cmd.NewCommand (resCmd, "dialog.result") ); check ( srv_cmd.QueryIndex (resCmd, 0, va), LXe_FAILED ); /* * Although it's a list, there's only one filename (since this was * a single-file dialog). We'll set our filename argument to the * first one in the list. */ n = va.Count (); if (!n) return; std::string filename; check ( va.String (0, filename) ); check ( attr_SetString (0, filename.c_str ()) ); }
The fire().
Configs and Kits
Q: Why are my Kit's Python files ignored when running under linux?
Linux is case sensitive. Ensure the names and extensions of the config files in your kit are lowercase.
|
https://modosdk.foundry.com/index.php?title=FAQ&oldid=23372
|
CC-MAIN-2020-45
|
refinedweb
| 2,171
| 58.69
|
During a reconnaissance mission gone wrong, R2D2 was attacked by Stormtroopers, leaving his executive control unit disconnected from his motor control unit. Luckily, R2D2’s motor control unit can still access his 9G-capable network card. He just needs you to SSH into his motor control unit and guide him to the rendezvous with C3PO and Luke, but time is of the essence, so you must use A* search to get him there as fast as possible. He just needs you to program and run the A* search algorithm and integrate motor controls via his motor control unit API.
In this assignment, you’ll learn the differences between “uninformed” search algorithms like BFS and DFS, and “informed” search algorithms like A*. You will use both types of algorithms to solve multi-dimensional mazes and see how their performance compares (and save R2D2!).
A skeleton file r2d2_hw.
Since this is an extra credit assignment, late submissions will not be accepted (you cannot use late days on this assignment).
In order to solve a maze, we first need to create a representation of a maze to run our algorithms on. We will implement our maze as a graph, where each vertex represents a grid cell, and an edge between vertices represents the ability to traverse between those grid cells.
There are many different ways we can implement a graph, and these design decisions will impact the running time of our algorithms. For this assignment, we will implement a directed, unweighted graph with its edges stored as an adjacency list.
Implement a graph with the following interface:
class Graph: def __init__(self, V, E): # TODO: implement def neighbors(self, u): # TODO: implement def dist_between(self, u, v): # TODO: implement
[2 points]
Graph(V, E) should take in a list of vertices
V = [v_1, v_2, ...] and a list of edges
E = [(v_1, v_2), (v_3, v_4), ...]. You should convert the list of edges into an adjacency list representation.
[8.
[2 points]
dist_between(u, v) should take in two vertices
u and
v and return 1 if there is an edge between
u and
v, otherwise it should return None.
For example, for this 2x2 graph,
>>> V = [(0, 0), (0, 1), (1, 0), (1, 1)] >>> E = [((0,0), (0,1)), ((0,1), (1,1)), ((1,1), (1,0))] >>> G = Graph(V, E) >>> G.neighbors((0,0)) [(0, 1)] >>> G.dist_between((0,0), (0,1)) 1.0 >>> G.dist_between((0,0), (1,0)) None
You could use the provided
generate_map and
printmap functions to test your graphs. The
generate_map(row, cols, barriers) takes in the number of the rows and columns of your desired map and
barriers is a list of edges you want to remove from the fully connected map (with no barrier). Note that in this function, each edge in the barriers, along with its interpositional edge will all be removed.
printmap(G) is a visualization function that display the grid world. An example is shown below:
>>> vertics, edges = generate_map(3, 3, []) >>> G = Graph(vertics, edges) >>> printmap(G) ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐ >>> vertics, edges = generate_map(3, 3, [((0, 0), (0, 1)), ((1, 1), (1, 2)), ((1, 1), (0, 1))]) >>> G = Graph(vertics, edges) >>> printmap(G) ☐ | ☐ ☐ === ☐ ☐ | ☐ ☐ ☐ ☐
BFS and DFS, two algorithms that you will revisit again and again in this course, are two of the most primitive graph algorithms. Using pseudocode from here and here and the lecture slides, implement both of them from the skeleton code below:
def BFS(G, start, goal): ''' path -- a list of tuples node-visited -- a list of tuples ''' return path, node_visited def DFS(G, start, goal): ''' path -- a list of tuples node-visited -- a list of tuples ''' return path, node_visited
Outputs of the test cases are shown below, note that your results may be different because of the different order of neighbors to explore. Feel free to use your own implementations, we will not grade on the lenght of your dfs path:
>>> vertics, edges = generate_map(3, 3, []) >>> G = Graph(vertics, edges) >>> solution_BFS = BFS(G, (0, 0), (2, 2))[0] [(0, 0), (1, 0), (2, 0), (2, 1), (2, 2)] >>> solution_DFS = DFS(G, (0, 0), (2, 2))[0] [(0, 0), (1, 0), (2, 0), (2, 1), (1, 1), (0, 1), (0, 2), (1, 2), (2, 2)]
You could use the provided
printpath(G, start, goal, path) function to visualize your solution. The
☑ represents the start node and path nodes and
☒ represents the goal node.
>>> printpath(G, (0,0), (2,2), solution_BFS) ☑ ☐ ☐ ☑ ☐ ☐ ☑ ☑ ☒ >>> printpath(G, (0,0), (2,2), solution_DFS) ☑ ☑ ☑ ☑ ☑ ☑ ☑ ☑ ☒
[20 points] Using the pseudocode here and the lecture slides, implement A* search by finish the following function:
def A_star(G, start, goal): ''' find solution using A* search ''' return path, node_visited
Several example test cases:
>>> vertics, edges = generate_map(3, 3, []) >>> G = Graph(vertics, edges) >>> solution_A_star = A_star(G, (0, 0), (2, 2))[0] [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2)] >>> printpath(G, (0,0), (2,2), solution_A_star) ☑ ☑ ☑ ☐ ☐ ☑ ☐ ☐ ☒ >>> >>> solution_A_star = A_star(G, (1, 1), (3, 3)) [(1, 1), (0, 1), (0, 2), (0, 3), (1, 3), (2, 3), (3, 3)][0] >>> printpath(G, (1, 1), (3, 3), solution_A_star) ☐ ☑ ☑ ☑ ☐ ☑ ☐ | ☑ ☐ ☐ ☐ | ☑ === === ☐ ☐ ☐ ☒
[20 points] Try to apply Traveling Sales Person (TSP) algorithm to solve a search problem with multiple goals.
tsp(G, start, goals) function shown below calls the A star you implemented above and return the shortest path which visites all the goal nodes (note that your path should begin with the start node). You could use
itertools to generate all the combinations of two target nodes and use A star to calculate the cost of each combination, then find the optimal order that has the shortest total cost.
def tsp(G, start, goals): ''' return the optimal order of nodes and shortest path that passes all the goals output format: (order, path) ''' return optimal_order, path
An example is shown as follows:
>>> >>> optimal_order, shortest_path = tsp(G, (0, 0), [(2, 2), (3, 3), (3, 0)]) >>> optimal_order ((0, 0), (2, 2), (3, 0), (3, 3)) >>> shortest_path [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2), (2, 1), (2, 0), (3, 0), (3, 1), (3, 2), (3, 3)] >>> printtsp(G, (0, 0), [(2, 2), (3, 3), (3, 0)], shortest_path) ☑ ☑ ☑ ☐ ☐ ☐ ☑ | ☐ ☑ ☑ ☒ | ☐ === === ☒ ☑ ☑ ☒
If you finish all the steps above, you are able to use the provided GUI to display your solutions. You could choose different methods(dfs, bfs, A*) in the GUI and compare the results of them. The nodes that visited in your algorithm will be colored and you could find the difference between these method through it.
python3 r2d2_navigation_gui.py rows cols
Type in the above command in terminal and it will generate a random graph which has the size of rows cols that you just insert. Left click to set the start position and right click to set the goal position, choose your method in the pull-down menu on the right side and click find path to display your solution. If you choose ‘tsp’ as your method, you coule do multiple right clicks to set more than one goals and then click find path, it will show the number of order on each goal. Some examples of GUI are shown below.
In this step, you will convert your navigation solution to the commands for your R2D2 to play in a game. Click here to watch a demo of how R2D2 rolling in the real maze.
[8 points]
path2move(path) take in your finded path and return a list of tuples which uses directions(‘north’, ‘west’, ‘south’, ‘east’) as the first element and the distance to move as the second element. The output should look like this:
>>> vertics, edges = generate_map(3, 3, []) >>> G = Graph(vertics, edges) >>> solution_A_star = A_star(G, (0, 0), (2, 2))[0] [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2)] >>> path2move(solution_A_star) [('east', 2), ('south', 2)] >>> vertics, edges = generate_map(4, 4, [((1, 2), (1, 3)), ((2, 2), (2, 3)), ((2, 2), (3, 2)), ((2, 1), (3, 1))]) >>> G = Graph(vertics, edges) >>> solution_A_star = A_star(G, (1, 1), (3, 3))[0] >>> path2move(solution_A_star) >>> [('north', 1), ('east', 2), ('south', 3)]
[0 points]
r2d2_action(movement, droid, speed, time_for_moving_one_step) transfers the movement generated above to the commands for robot. This fuction also takes in the droid object as input, the speed and time will be used in
droid.roll(speed, direction, time) function. The speed and time may varies according to the size of real world map. The direction range from 0 - 360 and it is decided by the key in the
movement and the initial direction of the robot.
def r2d2_action(movement, droid, speed, time) ''' convert movemnts to the commands for R2D2 ''' pass
|
http://artificial-intelligence-class.org/r2d2_assignments/hw2/homework2.html
|
CC-MAIN-2020-05
|
refinedweb
| 1,420
| 58.96
|
Yes. From Java 8 onwards, we can do so using method references.
Method references help to point to methods by their names. A method reference is described using "::" symbol. A method reference can be used to point the following types of methods −
Static methods
Instance methods
Constructors using new operator (TreeSet::new)
Create the following Java program using any editor of your choice in, say, C:\> JAVA.
Java8Tester.java
import java.util.List; import java.util.ArrayList; public class Java8Tester { public static void main(String args[]) { List names = new ArrayList(); names.add("Mahesh"); names.add("Suresh"); names.add("Ramesh"); names.add("Naresh"); names.add("Kalpesh"); names.forEach(System.out::println); } }
Here we have passed System.out::println method as a static method reference.
Verify the Result
Compile the class using javac compiler as follows −
C:\JAVA>javac Java8Tester.java
Now run the Java8Tester as follows −
C:\JAVA>java Java8Tester
It should produce the following output −
Mahesh Suresh Ramesh Naresh Kalpesh
|
https://www.tutorialspoint.com/How-to-pass-a-function-as-a-parameter-in-Java
|
CC-MAIN-2021-31
|
refinedweb
| 160
| 50.84
|
Usage: (make-header-guard name)
This function will create a
#ifndef/
#define
sequence for protecting a header from multiple evaluation.
It will also set the Scheme variable
header-file
to the name of the file being protected and it will set
header-guard to the name of the
#define being
used to protect it. It is expected that this will be used
as follows:
The
#define name is composed as follows:
_GUARD".
The final
#define name is stored in an SCM symbol named
header-guard. Consequently, the concluding
#endif for the
file should read something like:
The name of the header file (the current output file) is also stored
in an SCM symbol,
header-file. Therefore, if you are also
generating a C file that uses the previously generated header file,
you can put this into that generated file:
Obviously, if you are going to produce more than one header file from a particular template, you will need to be careful how these SCM symbols get handled.
Arguments:
name - header group name
This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.
|
https://www.gnu.org/software/autogen/manual/html_node/SCM-make_002dheader_002dguard.html
|
CC-MAIN-2016-30
|
refinedweb
| 187
| 53.85
|
Talk:Key:healthcare
Contents
- 1 Med research lab
- 2 "replaces"
- 3 name: Can we include Dr in it?
- 4 JOSM preset
- 5 healthcare: hospice and other nursing facilities
- 6 Differentiation between therapeutic and caring facilities
- 7 new values that are in use
- 8 migrate legacy from amenities
- 9 What about travel medicine?
- 10 Another healthcare:speciality value for healthcare=clinic
Med research lab.
- In Germany, the title is part of the name, and depends on having a PhD or not. As there are now quite a lot physicians that have not done the PhD, it cannot be included universally. --Polarbear w (talk) 15:47, 15 June 2018 (UTC)
JOSM preset
Hi, I started an draft to add this tags to the JOSM editor: --!i!
07:41, 11 November 2017 (UTC)
- you could naturally not reinvent the wheel and use what has already been done for SimonPoole (talk) 09:33, 11 November 2017 (UTC)
- This is not about reinventing the wheel. As we discussed at the forum your presets are pretty nice , but not listed within JOSM, nor found by google nor mentioned at the JOSM healthcare ticket. It's good to know, that there are different approaches to extend JOSM, but in the end we all want to encourage other mappers to make use of this schema. Just another tool, doesn't hurt anybody :) --!i!
17:06, 11 November 2017 (UTC)
- Naturally they are found by google (in the top 10 results) and in the diaries and weekly OSM and twitter and .... SimonPoole (talk) 18:12, 11 November 2017 (UTC)
healthcare: hospice and other nursing facilities
Hi, could you please give some more detailes on your recent edit on the voted healthcare=* page? --!i!
21:40, 24 November 2017 (UTC)
- If you look closely, the approved proposal from 2010 did not contain hospice, thus this value was not voted on. It was inserted on 19 May 2017 by Jotam. I checked and found that there was no discussion about it on this talk page, and I am not aware of any discussion on the tagging list. As all other values for the healthcare key are therapeutic approaches, hospice does not fit. Also regular nursing homes would not fit. As documented, there is a better approach for hospices under the social_facilities category. --Polarbear w (talk) 23:56, 24 November 2017 (UTC)
- Thank you for this explanation. To avoid any conflicts, I recommend to remove this entry completely and ref to this disc at the edit comment.
- We already linked to social facilities at the template and See also section, as both topics are closely related :) --!i!
09:06, 25 November 2017 (UTC)
- Will do. I might also write a differentiation section, similar to this one.--Polarbear w (talk) 10:05, 25 November 2017 (UTC)
Differentiation between therapeutic and caring facilities
Following the discussion about hospices, I propose to add a clear differentiation that the healthcare key, as it was approved, focuses on the therapeutic professions, and excludes nursing care. While of course a nursing home is visited by a general physician (healthcare=doctor), and a hospice by a physician specialised in palliative medicine (healthcare:speciality=palliative), the purpose of the facility is caring. In some countries there is a legal distinction for therapeutic professions (e.g. Germany: Heilberuf on Wikipedia), thus this key should follow this distinction. For the care facilities, there is an established tagging scheme as amenity=social_facility + social_facility=nursing_home or social_facility=hospice.--Polarbear w (talk) 10:37, 25 November 2017 (UTC)
new values that are in use
Hi, as the years are passing by, the community makes use of the healthcare namespace and invented new values. Taginfo lists for example:
While I'm personally pretty ok to add this values to get an unified+more complete schema (like power=*), I'm not sure how others think about this extensions? If the values are used significantly in the wild, does we need any further discussion? Are there conflicts with other schemas? --!i!
18:23, 27 November 2017 (UTC)
- Adding values is a natural thing in OSM, however the definition should limit the scope so it does not get diluted. Laboratory and pharmacy fit in the therapeutic scope as said in the section above, so in my opinion that would be a good bracket. --Polarbear w (talk) 19:07, 27 November 2017 (UTC)
migrate legacy from amenities
Hello, to come the goal of an unfied namespace closer step-by-step, I would like to ask, how we deal with legacy values currently and in mid-term. My idea is to softly migrate to healthcare like this steps:
- editor presets with new tags (and old legacy tags parallel)
- osm.org map style extension to render healthcare=* objects
- flag amenity=doctors, dentist, clinic, hospital, ... as legacy within QA checks
- ask community to manually remove legacy task in local areas
I'm not sure if this is the right way and how long this might take (I guess def. more than one year). Are there any other ideas how to push the acceptance of this schema? --!i!
18:24, 27 November 2017 (UTC)
What about travel medicine?
I couldn't find an entry about travel medicine:
In Germany, there are special doctors, who have extra programs for traveller, mostly general doctors, but at least not every general doctor.
So I think a new entry "healthcare:speciality=travel" is needed. Regards (15 June 2018 by Hsimpson)
- Sounds plausible. I was thinking about travel or travellers, but travel seems better.--Polarbear w (talk) 15:44, 15 June 2018 (UTC)
Another healthcare:speciality value for healthcare=clinic
I propose adding the following to Key:healthcare#Specialities_for_healthcare.3Dclinic:
These are quite common in the UK and are often aimed at young people. The wiki page summarises the typical services that they offer. --Lakedistrict (talk) 08:41, 1 July 2018 (UTC)
|
https://wiki.openstreetmap.org/wiki/Talk:Key:healthcare
|
CC-MAIN-2019-09
|
refinedweb
| 973
| 60.75
|
I’m trying to create a python script with one integer input and one boolean output. The idea is to change the output boolean state for 1 second if the input integer is changed. Like to simulate a button click.
Why don’t you simply add a timer to the component you wish to update every second?
Because he doesnt want to update every second. He wants to change a bool for a second each time the integer changes, then change back, like a button click.
@Michael_Pryor, I’m sorry but I do not understand your comment. This IS the easiest/simpler way to make that. If you don’t want to code the timer yourself.
It is absolutely not a timer in any way. For instance, let’s say I have a script running over a bunch of panels and I say I want this thing to trigger false, then back to true, to do something like reset the loop or run something else, if my panel size is 5m2 (5 being the trigger in this case). How is that a timer problem? It’s a button condition.
being it
button is irrelevant since he just need the bool, but I’ll add one more simpler solution
import time
Again. How is timer doing the following.
-Detecting that the input changed.
-Outputting true
-Then switching back to Outputting false
And doing this ONLY when the input changes. Timers are constant. What I would do is the following.
-Test if the input changed
-if true output true
-pause the script for 1 second (not a timer, a pause)
-switch the output to false
-end the script
The behavior is exactly that of a button but with input change rather than button click.
how would you do that without a timer?
or
import time
You would never do it with a timer, we are not measuring any constant interval across time for this, we are measuring an input change unrelated to time. You can use the import time with time.sleep(1). A pause is not a “timer”. It is a pause, and we only need it one time when an input is changed, we do not need intervals of it. Please show me how you would do that with a timer component and not code.
Also to track that change to output I believe some output may need to be out of the solve instance.
Well I didn’t say there will be no code involved
Btw, wouldn’t time.sleep(1) lock the python engine for 1 sec? You may need this 1 second for the other calculations happening meanwhile.
Now, I think there’s one more way to do that trick, using datadam
Btw, wouldn’t time.sleep(1) lock the python engine for 1 sec? You may need this 1 second for the other calculations happening meanwhile.
That’s why the output needs to be out of the solve instance so you can still output the change while it’s paused and so you can output before the script is finished. When the pause is finished the output will switch back.
Man, Grasshopper really doesn’t like code generated timers. It locks everything for the duration of the timer. It doesn’t even pass the outputs properly. It doesn’t matter if it is Time.Sleep() or counting with Time.Time().
Here’s a dirty solution:
toggle_for_a_second.gh (6.4 KB)
btw @Michael_Pryor, my original idea with the timer was: if you modify the
toggler function such that it will count up. Remove the
time_trigger and hook up the timer-component.
Set it to 1 millisecond and while the value of the
toggler is less than 1000 it will change the value of
a
I believe (not tested it) that at least this way you will actually get the toggled value of a during the counting. Unfortunately you can’t be sure that 1 grasshopper second is equal to 1 real life second. As a matter of fact most certainly it will not be true.
And this is how it’s done with timer component:
timer_before_bool.gh (4.7 KB)
No lockup. In my opinion this is the better solution even though not real time seconds.
It’s not a really direct solution, it should be like how anemones trigger works, keeping time seems a bit excessive for this problem. I’ll script something when I get a chance but it won’t be in python.
Thank you @Michael_Pryor and @ivelin.peychev for the discussion. Michael perfectly described the issue that I have.
This script doesn’t really do the trick. In the recorded data each time I change the input x there should be both True and False values consecutively coming out from ‘a’ with a slight lag. As you can see we are getting only one value now.
The trick works but GH has a problem when launching other apps (in this case the python interpreter). GH locks, waiting for the interpreter to finish all its tasks (in this case the waiting). This is a known issue (at least I consider it an issue). I think GH and Rhino and the Python Engine should all run on separate processes transmitting data between them. Currently everything runs in a single process. So in order for plugins to transfer data between each other, they have to lock themselves.
check the second script I have added. adjust the script for 20 milliseconds or so. Then you will see it True and false.
There’s one more solution but then you will need additional component. It cannot happen with just one component. Unless that component is compiled and written in c# I guess. To run natively inside grasshopper. And one more solution is if you implement the updating (expiring) mechanism from inside the python component by running it in SDK mode.
@DavidRutten, what does this mean?
Thank you Ivelin. This one seems to be the one I need. Could you please upload the script? I want to test it inside the algorithm.
|
https://discourse.mcneel.com/t/simulate-a-button-click-with-python/81819
|
CC-MAIN-2021-43
|
refinedweb
| 1,013
| 83.86
|
How To Compute Arbitrary Precision Transcendental Numbers
Transcendental numbers are probably the most useful tools in Mathematics. They are irrational numbers that cannot be expressed using a finite formula.
For example, the Euler’s identity is considered the most beautiful Mathematical formula (perhaps I’m gonna explore it in the future):
It exposes a relation between the two most important transcendental numbers, the complex numbers, the unit and the null / zero. It’s used mostly in rotation over real 𝑣𝑠 imaginary axes, on complex exponential, roots, and other useful operations.
Yet, it’s useless if one doesn’t know how to get 𝑒 and π in the required precision.
Euler’s constant
The Euler’s constant or Euler’s number, 𝑒 for short, is the ratio describing any constant growth. It’s defined as:
It’s about 2.71828…. 𝑒 is kinda magical number, poping up in a lot of Mathematical problems, offering good and easy solutions, since complex number operations to logarithm, exponential, and other kinds of growth behaviour.
But how to get to the desired precision?
One can take this formula and compute greater and greater 𝑛 values, until it reaches the required precision. Nevertheless, the exponent can be quite intimidating, leading to an undesired weak performance – similar or worst than the π computation below. Yet, it’s hard to say how long it must go to getta the desired precision.
Fortunately another Euler’s formula gives us a better solution:
This formula is very convenient, ’cause it increases the precision every step in an easly predictable way:
- 1/0! = 1/1 = 1
- 1 + 1/1! = 1 + 1/1 = 2
- 2 + 1/2! = 2 + 1/2 = 2.5
- 2.5 + 1/3! = 2.5 + 1/6 ≈ 2.6667
- 2.6667 + 1/4! ≈ 2.6666 + 1/24 ≈ 2.7083
- 2.7083 + 1/5! ≈ 2.7083 + 1/120 ≈ 2.7167
- 2.7167 + 1/6! ≈ 2.7177 + 1/720 ≈ 2.7180
- ⋱
- prev. + 1/∞! = 𝑒
It’s easly predictable ’cause the precision equals to log₁₀(n!):
- n = 0 → log₁₀(0!) = log₁₀(1) = 0
- n = 1 → log₁₀(1!) = log₁₀(1) = 0
- n = 2 → log₁₀(2!) = log₁₀(2) ≈ 0.3010
- n = 3 → log₁₀(3!) = log₁₀(6) ≈ 0.7782
- n = 4 → log₁₀(4!) = log₁₀(24) ≈ 1.3802
- n = 5 → log₁₀(5!) = log₁₀(120) ≈ 2.0792
- ⋱
- n = 1000 → log₁₀(1000!) ≈ 2567.60461
It gets big very quickly.
More everyday case
Image one needs to calculate 𝑒 to the 80-bit precision. That doesn’t differ from before. Bits are binary digits, i.e, 2-base numbers. So, instead of log₁₀, one must use log₂:
- log₂(n!) ≈ 80
- 2log₂(n!) ≈ 280
- n! ≈ 2⁸⁰
- 25! < 2⁸⁰ < 26!
So, 26 steps are good enough.
Let’s implement it using Python:
from numbers import Integral, Rational from typing import Callable # Lazy factorial implementation fact: Callable[[Integral], Integral] = lambda n: prod(range(1, n+1)) # An LRU cached version, if you prefer: # # from functools import lru_cache # # fact: Callable[[Integral], Integral] = lambda n: lru_cache( # 1 if n <= 0 else (n * fact(n - 1)) # ) def steps(prec: Integral) -> Integral: res = 1 while fact(res) >> prec == 0: res += 1 return res
The right shift (
>>) returns zero as long as the value‘s less bit wide than the precision.
Now let’s compute 𝑒 itself:
compute_e: Callable[[Integral], Rational] = lambda prec: sum( 1./fact(x) for x in range(prec) )
The solutions coming out from it is:
>>> calculate_e(steps(64)) # Python uses 64-bit floats 2.7182818284590455 >>> math.e 2.718281828459045
Not bad at all. In fact, we reach the 64-bit precision with only 18 iterations.
Performance
We’re not worried about performance here, it’s not this post’s scope. We’re just showing how it works and how you can implement and use it.
What about π?
π is the ratio of any circle’s perimeter (circumference) to its diameter. That’s π very definition.
However, it’s a transcendental number and needs an infinity serie to be computed. Leibniz gave us a neat solution:
The process is quite the same used for 𝑒, take the formula:
Then get the precision:
compute_pi: Callable[[Integral], Rational] = lambda prec: 4. * sum( (1./(4*n+1) - 1./(4*n+3)) for n in range(prec) )
Tip: the precision is log₂(4n), so n = 2prec-2, which one can get by left shifting. Note that we got exactly the inverse of the previous calculation: here the necessary steps amount grows very fast with small gain.
So you may get disappointed when running:
>>> compute_pi(1 << (64 - 2))
This computation is way more inefficient than the previous one – Python isn’t that good in dealing with floating-point operation and it’s necessary a humongous amount of steps to getta the target. I recomend 5M steps:
>>> compute_pi(5000000) 3.141592553588895 >>> math.pi 3.141592653589793
To this task, one’s gonna need a tougher tool, as C and multithreading. Again performance is not this post’s scope. Probably it requires using some C cast spells in order to optimise the computation.
Or you can go down through the Wolfram MathWorld’s or Wolfram Alpha’s π page references in search of better formulæ. I did it, and I can ensure they are, including serie representations.
Originally published on kodumaro.cacilhas
|
https://www.works-hub.com/learn/how-to-compute-arbitrary-precision-transcendental-numbers-3c1bc
|
CC-MAIN-2021-21
|
refinedweb
| 871
| 66.54
|
.
Try to use "Undirect" Chrome extension.
It removes this tracking and redirection from google search results. Supports using google over both HTTP and HTTPS.
It removes this tracking and redirection from google search results. Supports using google over both HTTP and HTTPS. );
If you are using Firefox, you are lucky as the following answer applies to you. If you are using Chrome, you are much less lucky, see the bottom of this answer.
Greasemonkey fires the user scripts once the DOM is loaded, thus you don't need to implement a "DOM ready" listener.
Also you are on Firefox, so you can use some modern candy: for...of, let.
for...of
let
Here is the resulting Greasemonkey script:
// ==UserScript==
// @name Remove Google redirects
// @namespace google
// @description Remove redirects from Google Search result links.
// @include.*/*
// @version 1
// @grant none
// ==/UserScript==
for (let element of document.querySelectorAll('h3.r > a')) {
element.removeAttribute('onmousedown');
}
Thanks to the let there are no local declarations, therefore you don't need to enclose the above code in an IIFE.
For the unfortunate Chrome (Tampermonkey) users:
document.readyState === 'complete'
Finally, you end up with:
// ==UserScript==
// @name Remove Google redirects
// @namespace google
// @description Remove redirects from Google Search result links.
// @include.*/*
// @version 1
// @grant none
// ==/UserScript==
(function removeGoogleRedirects() {
var links = document.querySelectorAll('h3.r > a');
if (links.length === 0) {
setTimeout(removeGoogleRedirects, 100);
return;
}
for (var i = 0, l = links.length; i < l; ++i) {
links[i].removeAttribute('onmousedown');
}
})();
By posting your answer, you agree to the privacy policy and terms of service.
asked
4 years ago
viewed
6195 times
active
1 month ago
|
http://superuser.com/questions/328271/how-to-disable-google-search-result-link-redirect-on-right-click-in-chrome/392883
|
CC-MAIN-2015-48
|
refinedweb
| 264
| 59.6
|
.TH LD 1 "October 28, 2002" "Apple Computer, Inc." .SH NAME ld \- Mach object file link editor .SH SYNOPSIS .B ld [ .I "option \&..." ] [ .I "file \&..." ] .SH DESCRIPTION The .I ld command combines several Mach-O (Mach object) files into one by combining like sections in like segments from all the object files, resolving external references, and searching libraries. In the simplest case several object .I files are given, and .I ld combines them, producing an object file which can either be executed or become the input for a further .I ld run. (In the latter case, the .B \-r option must be given to preserve the relocation information.) Unless an output file is specified, .I ld produces a file named .BR a.out . This file is made executable only if no errors occurred during the link editing and there are no undefined symbols. .SH "FAT FILE SUPPORT" The link editor accepts ``fat'' (multiple-architecture) input files, but always creates a ``thin'' (single-architecture), standard Mach-O output file. The architecture is specified using the .B \-arch .I " arch_type" option. If this option is not used, .IR ld (1) attempts to determine the output architecture by examining the first object file encountered on the command line. If it is a ``thin'' file, its architecture determines that of the output file. If the first input file is a ``fat'' file, the ``best'' architecture for the host is used. (See the explanation of the .B \-arch option, below.) .PP The compiler driver .IR cc (1) handles creating fat executables by calling .IR ld (1) multiple times and using .IR lipo (1) to create a ``fat'' file from the results of the .IR ld (1) executions. .SH "OUTPUT FILE LAYOUT" .PP The object files are loaded in the order in which they are specified on the command line. The segments and the sections in those segments will appear in the output file in the order they are encountered in the object files being linked. All zero fill sections will appear after all non-zero fill sections in their segments. .PP Sections created from files with the .B \-sectcreate option will appear in the output file last. Section names for sections created from files are not allowed to overlap with a section name in the same segment as a section coming from an object file. Sections created from files may be in a segment which has sections from object files and if so will be loaded at the end of the non-zero fill sections for that segment. .PP If the option .B \-seglinkedit is specified, the segment it creates is the last segment in the output file. .PP The address of each segment can be specified with .B \-segaddr, which takes the segment's name as an argument. The address of the first segment can alternatively be specified using .B \-seg1addr, in which case a segment name is not used. Segments that do not have a specified address will be assigned addresses in the order in which they appear in the output file. A segment's address will be assigned based on the ending address of the previous segment. If the address of the first segment has not been specified by name, its assigned address will be the specified (via .BR \-seg1addr ) or default first segment address. If neither flag is used to specify the first segment's address, its default address is zero for all formats except the demand-paged executable format .SM (MH_EXECUTE), in which case the default first address is the value of the segment alignment. .PP For demand-paged executable format .SM (MH_EXECUTE) output files, if none of the segments' addresses covers address zero through the value of the segment alignment, a segment with no access protection will be created to cover those addresses. This segment, named .SM "``_\|_PAGEZERO''," is created so that any attempt to dereference a NULL pointer will cause a memory exception. .PP The entry point of the output file is the beginning of the first section in the first segment (unless the .B \-e option is specified). .SH STATIC ARCHIVE LIBRARIES .PP .I ld supports two types of libraries: static archive libraries and dynamic shared libraries. Searching for undefined symbols is performed differently for dynamic shared libraries than it is for static archive libraries. The searching of dynamic shared libraries is described later. .PP When a static archive library is specified as an argument to .IR ld , it is searched exactly once, at the point it is encountered in the argument list. Only those members defining an unresolved external reference, as defined by the static archive library's table of contents, are loaded. To produce the table of contents, all static archive libraries must be processed by .IR ranlib (1). .PP Generally, a static archive library does not have multiple members that define the same symbol. For these types of libraries, the order of the members is not important, so the table of contents can be sorted for faster link editing using the .B \-s option to .IR ranlib (1). The first member of the static archive library is named .SM "``\_\^\_.SYMDEF SORTED''," which is understood to be a sorted table of contents. .PP If the static archive library does have multiple members that define the same symbol, the table of contents that .IR ranlib (1) produces can't be sorted. Instead, it follows the order in which the members appear in the static archive library. The link editor searches the table of contents iteratively, loading members until no further references are satisfied. In the unsorted case, the first member of the static archive library is named .SM "``\_\^\_.SYMDEF''," which is understood to be a table of contents in the order of the archive members. .PP Static archive library members can also be loaded in response to the .B \-ObjC and .B \-all_load flags. See their descriptions below. .SH DYNAMIC SHARED LIBRARIES .PP When a dynamic shared library or an object file that was linked against a dynamic shared library is specified as an argument to .IR ld , that library is placed in the dynamic shared library search list. The order of the search list is always the same order the libraries were encountered on the command line. All dynamic libraries libraries that the dynamic libraries are dependent upon are added to the end of the search list. .PP Once the search list is constructed, the static link editor checks for undefined symbols by simulating the way the dynamic linker will search for undefined symbols at runtime. For each undefined symbol, the static link editor searches each library in the search list until it finds a module that defines the symbol. With each undefined symbol, the search starts with the first library in the list. This is different than for static archive libraries, where each library is searched exactly once for all undefined symbols. .PP The static link editor simulates dynamic linking as if all the undefined symbols are to be bound at program launch time. The dynamic linker actually binds undefined symbols as they are encountered during execution instead of at program launch. However, the static link editor always produces the same linking as the dynamic linker as long as none of the dynamic shared libraries define the same symbol. Different linking can occur only when there is more than one definition of a symbol and the library modules that contain the definitions for that symbol do not define and reference exactly the same symbols. In this case, even different executions of the same program can produce different linking because the dynamic linker binds undefined functions as they are called, and this affects the order in which undefined symbols are bound. Because it can produce different dynamic linking, using dynamic shared libraries that define the same symbols in the same program is strongly discouraged. .PP If a static archive library appears after a dynamic shared library on the command line, the static library is placed in the dynamic library search list and is searched as a dynamic library. In this way, when a dynamic library has undefined symbols, it will cause the appropriate members of the static libraries to be loaded into the output. Searching static libraries as dynamic libraries can cause problems if the dynamic library later changes to reference symbols from the static library that it did not previously reference. In this case when the program runs, the dynamic linker will report these symbols as undefined because the members for these symbols were not loaded into the output. .SH TWO-LEVEL AND FLAT NAMESPACES .PP Two-level and flat namespaces refer to how references to symbols in dynamic libraries are resolved to a definition in specific dynamic library. For two-level namespace that resolution is done at static link time when each image (program, bundle and shared library) is built. When a program is using images built with two-level namespace there may be different global symbols with the same name being used by different images in the program (this is now the default). When a program is using all flat namespace images then only one global symbol for each global symbol name is used by all images of the program (this was the default in MacOS X 10.0). .PP When creating a output file with the static link editor that links against dynamic libraries, the references to symbols in those libraries can be recorded at static link time to bind to a specific library definition (two-level namespace) or left to be bound at execution time to the first library in the search order of the program (flat namespace). A program, its dynamic libraries and its bundles may each be either two-level or flat namespace images. The dynamic linker will bind each image according to how it was built. .PP When creating a output file with the static link editor when .B \-twolevel_namespace is in effect (now the default) all undefined references must be satisfied at static link time. The flags to allow undefined references, .BI \-U symbol_name, .BI \-undefined " warning" and .BI \-undefined " suppress" can't be used. The specific library definition recorded for each reference is the first library that has a definition as listed on the link line. Listing an umbrella framework implies all of its sub-frameworks, sub-umbrellas and sub-libraries. For any reference to a definition found in an umbrella framework's sub-framework, sub-umbrella or sub-library will be recorded as coming from the umbrella framework. Then at execution time the dynamic linker will search that umbrella framework's sub-frameworks, sub-umbrellas and sub-libraries for those references. Also when two-level namespace is in effect only those frameworks listed on the link line (and sub-frameworks, sub-umbrellas and sub-libraries of umbrella frameworks) are searched. Other dependent libraries which are not sub-frameworks, sub-umbrellas or sub-libraries of umbrella frameworks are not searched. .RS If a two-level namespace static link references a symbol from an indirectly referenced dynamic library not listed on the link line the following error message will result: .RS ld: .I object_file illegal reference to symbol: .I symbol defined in indirectly referenced dynamic library: .I library .RE To correct the link error the user should add .I library to the link line in the order he wants the .I library to be searched. .RE .PP When creating bundles (MH_BUNDLE outputs) with the static link editor when two-level namespace is in effect (now the default) and the bundle has references to symbols expected to be defined in the program loading the bundle, then the .BI \-bundle_loader " executable" must be used. .PP When creating a output file with the static link editor when .B \-flat_namespace is in effect (the MacOS X 10.0 default) all undefined references must be satisfied at static link time when .BI \-undefined " error" (the default) is used. The static link editor checks the undefined references by searching all the libraries listed on the link line then all dependent libraries. The undefined symbols in the created output file are left to be resolved at execution time by the dynamic link editor in the dynamic libraries in the search order of the program. .SH MULTIPLY DEFINED SYMBOLS .PP If there are multiply defined symbols in the object files being linked into the output file being created this always results in a multiply defined symbol error. .PP When the static link editor links symbols in from a dynamic library that result in multiply defined symbols the handling depends on the type of name space of output file being created and possibly the type of name space of the dynamic library. .PP When the static link editor is creating a two-level namespace image and a there is a multiply defined symbol from dynamic library then that generates a multiply defined symbol warning (by default), where the treatment of this warning can be changed with the .B \-multiply_defined flag. .PP When the static link editor is creating a flat namespace image and a there is a multiply defined symbol from dynamic library, if the library is a flat namespace image then that generates a multiply defined symbol error. If the library is a two-level namespace image then that generates a multiply defined symbol warning (by default), where the treatment of this warning can be changed with the .B \-multiply_defined flag. .SH "USING THE DYNAMIC LINK EDITOR AND DYNAMIC SHARED LIBRARIES" .PP The option .B \-dynamic must be specified in order to use dynamic shared libraries (and any of the features used to implement them) and/or the dynamic link editor. To make sure that the output is not using any features that would require the dynamic link editor, the flag .B \-static can be specified. Only one of these flags can be specified. .SH "LINK EDITOR DEFINED SYMBOLS" .PP There is a group of link editor defined symbols for the .SM MH_EXECUTE, .SM MH_DYLIB and .SM MH_PRELOAD file types (see the header file <mach-o/ldsyms.h>). Link editor symbols are reserved; it is an error if an input object file defines such a symbol. Only those link editor symbols that are referenced by the object file appear in the output file's symbol table. .PP The link editor defined symbol `\_\^\_mh_execute_header' (`\_mh_execute_header' in C) is reserved when the output file format is .SM MH_EXECUTE. This symbol is the address of the Mach header in a Mach-O executable (a file of type .SM MH_EXECUTE). It does not appear in any other Mach-O file type. It can be used to get to the addresses and sizes of all the segments and sections in the executable. This can be done by parsing the headers and load commands (see .IR Mach-O (5)). .PP The link editor defined symbol `\_\^\_mh_dylib_header' (`\_mh_dylib_header' in C) is reserved when the output file format is .SM MH_DYLIB. This symbol is the address of the Mach header in a Mach-O dynamic shared library (a file of type .SM MH_DYLIB) and is a private external symbol. It does not appear in any other Mach-O file type. It can be used to get to the addresses and sizes of all the segments and sections in a dynamic shared library. The addresses, however, must have the value .IR _dyld_get_image_vmaddr_slide (3) added to them. .PP The .SM MH_PRELOAD file type has link editor defined symbols for the beginning and ending of each segment, and for the beginning and ending of each section within a segment. These names are provided for use in a Mach-O preloaded file, since it does not have its headers loaded as part of the first segment. The names of the symbols for a segment's beginning and end have the form: \_\^\_SEGNAME\_\^\_begin and \_\^\_SEGNAME\_\^\_end, where \_\^\_SEGNAME is the name of the segment. Similarly, the symbols for a section have the form: \_\^\_SEGNAME\_\^\_sectname\_\^\_begin and \_\^\_SEGNAME\_\^\_sectname\_\^\_end, where \_\^\_sectname is the name of the section in the segment \_\^\_SEGNAME. These symbols' types are those of the section that the names refer to. (A symbol that refers to the end of a section actually has, as its value, the beginning address of the next section, but the symbol's type is still that of the section mentioned in the symbol's name.) .SH OPTIONS .PP .I Ld understands several options. Filenames and options that refer to libraries (such as .B \-l and .BR \-framework ), as well as options that create symbols (such as .B \-u and .BR \-i ), are position-dependent: They define the load order and affect what gets loaded from libraries. Some .I ld options overlap with compiler options. If the compiler driver .IR cc (1) is used to invoke .I ld , it maybe necessary to pass the .IR ld (1) options to .IR cc (1) using .BR \-Wl,\-option,argument1,argument2 . The most common option is: .TP .BI \-o " name" The output file is named .IR name , instead of .BR a.out . .PP The following flags are related to architectures: .TP .BI \-arch " arch_type" Specifies the architecture, .I arch_type, for the output file. ``Fat'' input files that do not contain this specified architecture are ignored. Only one .BI \-arch " arch_type" can be specified. See .IR arch (3) for the currently known .IR arch_type s. If .I " arch_type" specifies a certain implementation of an architecture (such as .BI \-arch " m68040" or .BI \-arch " i486" ), the resulting object file has that specific CPU subtype, and it is an error if any input file has a CPU subtype that will not combine to the CPU subtype for .IR " arch_type" . .IP The default output file architecture is determined by the first object file to be linked. If it is a ``thin'' (standard Mach-O) file, or a ``fat'' file that contains only one architecture, the output file will have the same architecture. Otherwise, if it is a ``fat'' file containing an architecture that would execute on the host, then the ``best'' architecture is used, as defined by what the kernel exec(2) would select. Otherwise, it is an error, and a .BI \-arch " arch_type" must be specified. .TP .B \-arch_multiple This flag is used by the .IR cc (1) driver program when it is run with multiple .BI \-arch " arch_type" flags. It instructs programs like .IR ld (1) to precede any displayed message with a line stating the program name, in this case .IR ld , and the architecture (from the .BI \-arch " arch_type" flag). This helps distinguish which architecture the error messages refer to. .TP .BI \-force_cpusubtype_ALL The .B \-force_cpusubtype_ALL flag causes the CPU subtype to remain the .SM ALL CPU subtype and not to be combined or changed. This flag has precedence over any .BI \-arch " arch_type" flag for a specific implementation. .PP The following flags are related to using the dynamic link editor and/or dynamic shared libraries (and any of the features used to implement them): .TP .B \-dynamic Allows use of the features associated with dynamic link editor. The default is .B \-dynamic. .TP .B \-static Causes those features associated with dynamic link editor to be treated as an error. (The description for the options that will cause an error if you use them in conjunction with .B \-static are marked with the statement "when .B \-dynamic is used"). .TP .BI \-read_only_relocs " treatment" Specifies how relocation entries in read-only sections are to be treated when .B \-dynamic is used. To get the best possible sharing, the read-only sections should not have any relocation entries. If they do, the dynamic linker will write on the section. Having relocation entries appear in read-only sections is normally avoided by compiling with the option .B \-dynamic. But in such cases non-converted assembly code or objects not compiled with .B \-dynamic relocation entries will appear in read-only sections. The .I treatment can be: .I error, .I warning, or .I suppress. Which cause the treatment of relocation entries in read-only sections as either, errors, warnings, or suppressed messages. The default is to treat these as errors. .TP .BI \-sect_diff_relocs " treatment" Specifies how section difference relocation enries are to be treated when .B \-dynamic and .B \-execute are used. To get the best possible code generation the compiler should not generate code for executables (MH_EXECUTE format outputs) that have any section difference relocation entries. The .IR gcc (1) compiler has the .B \-mdynamic-no-pic flag for generating code for executables. The default treatment is .I suppress, where no message is printed. The other treatments are .I error or .I warning. This option can also be specified by setting the environment variable .SM LD_SECT_DIFF_RELOCS to the treatment values. .TP .BI \-weak_reference_mismatches " treatment" Specifies how to treat mismatches of symbol references in the the object files being linked. Normally the all the undefined symbol references of the object files being linked should be consistent for each undefined symbol. That is all undefined symbols should either be weak or non-weak references. The default treatment is .I error, where the link fails with an error message. The other treatments are .I weak or .I non-weak, which makes mismatched undefined symbol references either weak or non-weak respectfully in the output. Care must be taken when using the treatment .I weak as the use of the non-weak symbol references in an object file may cause the program to crash when the symbol is not present at execution time. .TP .B \-prebind Have the static linker, .IR ld (1), prebind an executable's or dynamic shared library's undefined symbols to the addresses of the dynamic libraries it is being linked with. This optimization can only be done if the libraries don't overlap and no symbols are overridden. When the resulting program is run and the same libraries are used to run the program as when the program was linked, the dynamic linker can use the prebound addresses. If not, the dynamic linker undoes the prebinding and binds normally. This option can also be specified by setting the environment variable .SM LD_PREBIND. If the environment variable .SM LD_FORCE_NO_PREBIND is set both the option .B \-prebind .SM LD_PREBIND environment variable are ignore and the output is not prebound. and the .TP .B \-noprebind Do not have the static linker, .IR ld (1), prebind the output. If this is specified the environment variable .SM LD_PREBIND is ignored. .TP .B \-prebind_allow_overlap Have the static linker, .IR ld (1), prebind the output even if the addresses of the dynamic libraries it uses overlap. The resulting output can then have .IR redo_prebinding (1) run on it to fix up the prebinding after the overlapping dynamic libraries have been rebuilt. This option can also be specified by setting the environment variable .SM LD_PREBIND_ALLOW_OVERLAP. .TP .B \-prebind_all_twolevel_modules Have the static linker, .IR ld (1), mark all modules from prebound two-level namespace dynamic libraries as used by the program even if they are not statically referenced. This can provide improved launch time for programs like Objective-C programs that use symbols indirectly through NIB files. This option can also be specified by setting the environment variable .SM LD_PREBIND_ALL_TWOLEVEL_MODULES. .TP .B \-nofixprebinding Have the static linker, .IR ld (1), mark the executable so that the dynamic linker will never notify the prebinding agent if this launched and its prebinding is out of date. This is used when building the prebinding agent itself. .PP The following flags are related to libraries: .TP .BI \-l x This option is an abbreviation for the library name .RI `lib x .a', where .I x is a string. If .B \-dynamic is specified the abbreviation for the library name is first search as .RI `lib x .dylib' and then .RI `lib x .a' is searched for. .I ld searches for libraries first in any directories specified with .B \-L options, then in the standard directories .BR /lib , .BR /usr/lib , and .BR "/usr/local/lib" . A library is searched when its name is encountered, so the placement of the .B \-l flag is significant. If string .I x is of the form .IR x .o, then that file is searched for in the same places, but without prepending `lib' or appending `.a' or `.dylib' to the filename. .TP .BI \-L dir Add .I dir to the list of directories in which to search for libraries. Directories specified with .B \-L are searched before the standard directories. .TP .B \-Z Do not search the standard directories when searching for libraries. .TP .BI "\-framework " name[,suffix] Specifies a framework to link against. Frameworks are dynamic shared libraries, but they are stored in different locations, and therefore must be searched for differently. When this option is specified, .I ld searches for framework `\fIname\fR.framework/\fIname\fR' first in any directories specified with the .B \-F option, then in the standard framework directories .BR /Library/Frameworks , .BR /Network/Library/Frameworks , and .BR "/System/Library/Frameworks" . The placement of the .B \-framework option is significant, as it determines when and how the framework is searched. If the optional suffix is specified the framework is first searched for the name with the suffix and then without. .TP .BI \-F dir Add .I dir to the list of directories in which to search for frameworks. Directories specified with .B \-F are searched before the standard framework directories. .TP .B \-ObjC Loads all members of static archive libraries that define an Objective C class or a category. This option does not apply to dynamic shared libraries. .TP .B \-all_load Loads all members of static archive libraries. This option does not apply to dynamic shared libraries. .TP .BI \-dylib_file " install_name:file_name" Specifies that a dynamic shared library is in a different location than its standard location. Use this option when you link with a library that is dependent on a dynamic library, and the dynamic library is in a location other than its default location. .I install_name specifies the path where the library normally resides. .I file_name specifies the path of the library you want to use instead. For example, if you link to a library that depends upon the dynamic library libsys and you have libsys installed in a nondefault location, you would use this option: \fB\-dylib_file /lib/libsys_s.A.dylib:/me/lib/libsys_s.A.dylib\fR. .PP The following options specify the output file format (the file type): .TP .B "\-execute" Produce a Mach-O demand-paged executable format file. The headers are placed in the first segment, and all segments are padded to the segment alignment. This has a file type of .SM MH_EXECUTE. This is the default. If no segment address is specified at address zero, a segment with no protection (no read, write, or execute permission) is created at address zero. This segment, whose size is that of the segment alignment, is named .SM ``_\|_PAGEZERO''. This option was previously named .BR "\-Mach" , which will continue to be recognized. .TP .B "\-object" Produce a Mach-O file in the relocatable object file format that is intended for execution. This differs from using the .B \-r option in that it defines common symbols, does not allow undefined symbols and does not preserve relocation entries. This has a file type of .SM MH_OBJECT. In this format all sections are placed in one unnamed segment with all protections (read, write, execute) allowed on that segment. This is intended for extremely small programs that would otherwise be large due to segment padding. In this format, and all .SM non-MH_EXECUTE formats, the link editor defined symbol ``\_\^\_mh_execute_header'' is not defined since the headers are not part of the segment. This format file can't be use with the dynamic linker. .TP .B "\-preload" Produce a Mach-O preloaded executable format file. The headers are not placed in any segment. All sections are placed in their proper segments and they are padded to the segment alignment. This has a file type of .SM MH_PRELOAD. This option was previously .BR "\-p" , which will continue to be recognized. .TP .B "\-dylib" Produce a Mach-O dynamically linked shared library format file. The headers are placed in the first segment. All sections are placed in their proper segments and they are padded to the segment alignment. This has a file type of .SM MH_DYLIB. This option is used by .IR libtool (1) when its .B \-dynamic option is specified. .TP .B "\-bundle" Produce a Mach-O bundle format file. The headers are placed in the first segment. All sections are placed in their proper segments and they are padded to the segment alignment. This has a file type of .SM MH_BUNDLE. .TP .B "\-dylinker" Produces a Mach-O dynamic link editor format file. The headers are placed in the first segment. All sections are placed in their proper segments, and they are padded to the segment alignment. This has a file type of .SM MH_DYLINKER. .TP .B "\-fvmlib" Produce a Mach-O fixed VM shared library format file. The headers are placed in the first segment but the first section in that segment will be placed on the next segment alignment boundary in that segment. All sections are placed in their proper segments and they are padded to the segment alignment. This has a file type of .SM MH_FVMLIB. .PP The following flags affect the contents of the output file: .TP .B \-r Save the relocation information in the output file so that it can be the subject of another .I ld run. The resulting file type is a Mach-O relocatable file .SM (MH_OBJECT) if not otherwise specified. This flag also prevents final definitions from being given to common symbols, and suppresses the `undefined symbol' diagnostics. .TP .B \-d Force definition of common storage even if the .B \-r option is present. This option also forces link editor defined symbols to be defined. This option is assumed when there is a dynamic link editor load command in the input and .B \-r is not specified. .PP The following flags support segment specifications: .TP .BI "\-segalign" " value" Specifies the segment alignment. .I value is a hexadecimal number that must be an integral power of 2. The default is the target pagesize (currently 1000 hex for the PowerPC and 2000 hex for i386). .TP .BI "\-seg1addr" " addr" Specifies the starting address of the first segment in the output file. .I addr is a hexadecimal number and must be a multiple of the segment alignment. This option can also be specified as .B "\-image_base." .TP .BI "\-segaddr" " name addr" Specifies the starting address of the segment named .I name to be .I addr. The address must be a hexadecimal number that is a multiple of the segment alignment. .TP .BI "\-segs_read_only_addr" " addr" Specifies the starting address of the read-only segments in a dynamic shared library. When this option is used the dynamic shared library is built such that the read-only and read-write segments are split into separate address ranges. By default the read-write segments are 256meg (0x10000000) after the read-only segments. .I addr is a hexadecimal number and must be a multiple of the segment alignment. .TP .BI "\-segs_read_write_addr" " addr" Specifies the starting address of the read-write segments in a dynamic shared library. When this option is used the .B \-segs_read_only_addr must also be used (see above). .I addr is a hexadecimal number and must be a multiple of the segment alignment. .TP .BI "\-seg_addr_table" " filename" For dynamic shared libraries the .B "\-seg1addr" or the pair of .B "\-segs_read_only_addr" and .B "\-segs_read_write_addr" are specified by an entry in the segment address table in .I filename that matches the install name of the library. The entries in the table are lines containing either a single hex address and an install name or two hex addresses and an install name. In the first form the single hex address is used as the .B "\-seg1addr". In the second form the first address is used as the .B "\-segs_read_only_addr" address and the second address is used as the .B "\-segs_read_write_addr" address. This option can also be specified by setting the environment variable .SM LD_SEG_ADDR_TABLE. If the environment variable is set then any .BR "\-seg1addr" , .BR "\-segs_read_only_addr" , .B "\-segs_read_write_addr" and .B "\-seg_addr_table" options are ignored and a warning is printed. .TP .BI "\-seg_addr_table_filename" " pathname" Use .B pathname instead of the install name of the library for matching an entry in the segment address table. .TP .BI "\-segprot" " name max init" Specifies the maximum and initial virtual memory protection of the named segment, .I name, to be .I max and .I init respectfully. The values for .I max and .I init are any combination of the characters `r' (for read), `w' (for write), `x' (for execute) and '\-' (no access). The default is `rwx' for the maximum protection for all segments. The default for the initial protection for all segments is `rw' unless the segment contains a section which contains some machine instructions, in which case the default for the initial protection is `rwx'. The default for the initial protection for the .SM "``_\|_TEXT''" segment is `rx' (not writable). .TP .B "\-seglinkedit" Create the link edit segment, named .SM "``_\|_LINKEDIT''" (this is the default). This segment contains all the link edit information (relocation information, symbol table, string table, etc.) in the object file. If the segment protection for this segment is not specified, the initial protection is not writable. This can only be specified when the output file type is not .SM MH_OBJECT and .SM MH_PRELOAD output file types. To get at the contents of this section, the Mach header and load commands must be parsed from the link editor defined symbols like `\_\^\_mh_execute_header' (see .IR Mach-O (5)). .TP .B "\-noseglinkedit" Do not create the link edit segment (see .B \-seglinkedit above). .TP .BI "\-pagezero_size" " value" Specifies the segment size of _\|_PAGEZERO to be of size .IR value , where .I value is a hexadecimal number rounded to the segment alignment. The default is the target pagesize (currently, 1000 hexadecimal for the PowerPC and 2000 hexadecimal for i386). .TP .BI "\-stack_addr" " value" Specifies the initial address of the stack pointer .IR value , where .I value is a hexadecimal number rounded to the segment alignment. The default segment alignment is the target pagesize (currently, 1000 hexadecimal for the PowerPC and 2000 hexadecimal for i386). If .B \-stack_size is specified and . .TP .BI "\-stack_size" " value" Specifies the size of the stack segment .IR value , where .I value is a hexadecimal number rounded to the segment alignment. The default segment alignment is the target pagesize (currently, 1000 hexadecimal for the PowerPC and 2000 hexadecimal for i386). If .B \-stack_addr is specified and .B \-stack_size is not, a default stack size specific for the architecture being linked will be used and its value printed as a warning message. This creates a segment named _\|_UNIXSTACK . .PP The following flags support section specifications: .TP .BI "\-sectcreate" " segname sectname file" The section .I sectname in the segment .I segname is created from the contents of .I file. The combination of .I segname and .I sectname must be unique; there cannot already be a section .I (segname,sectname) in any input object file. This option was previously called .BR "\-segcreate" , which will continue to be recognized. .TP .BI "\-sectalign" " segname sectname value" The section named .I sectname in the segment .I segname will have its alignment set to .IR value , where .I value is a hexadecimal number that must be an integral power of 2. This can be used to set the alignment of a section created from a file, or to increase the alignment of a section from an object file, or to set the maximum alignment of the .SM (_\|_DATA,_\|_common) section, where common symbols are defined by the link editor. Setting the alignment of a literal section causes the individual literals to be aligned on that boundary. If the section alignment is not specified by a section header in an object file or on the command line, it defaults to 10 (hex), indicating 16-byte alignment. .TP .BI "\-sectorder" " segname sectname orderfile" The section .I sectname in the segment .I segname of the input files will be broken up into blocks associated with symbols in the section. The output section will be created by ordering the blocks as specified by the lines in the .I orderfile. These blocks are aligned to the output file's section alignment for this section. Any section can be ordered in the output file except symbol pointer and symbol stub sections. .IP For non-literal sections, each line of the .I orderfile contains an object name and a symbol name, separated by a single colon (':'). If the object file is in an archive, the archive name, followed by a single colon, must precede the object file name. The object file names and archive names should be exactly the names as seen by the link editor, but if not, the link editor attempts to match up the names the best it can. For non-literal sections, the easiest way to generate an order file is with the ``\f3\-jonls +\f2segname sectname\f1'' options to .IR nm (1). .IP The format of the .I orderfile for literal sections is specific to each type of literal section. For C string literal sections, each line of the order file contains one literal C string, which may include ANSI C escape sequences. For four-byte literal sections, the order file format is one 32-bit hex number with a leading 0x per line, with the rest of the line treated as a comment. For eight-byte literal sections, the order file has two 32-bit hex numbers per line; each number has a leading 0x, the two numbers are separated by white space, and the rest of the line is treated as a comment. For literal pointer sections, the lines in the order file represent pointers, one per line. A literal pointer is represented by the name of the segment that contains the literal being pointed to, followed by the section name, followed by the literal. These three strings are separated by colons with no extra white space. For all the literal sections, each line in the the order file is simply entered into the literal section and will appear in the output file in the same order as in the order file. There is no check to see whether the literal is present in the loaded objects. For literal sections, the easiest way to generate an order file is with the ``\f3\-X \-v \-s \f2segname sectname\f1'' options to .IR otool (1). .TP .B \-sectorder_detail When using the .B \-sectorder option, any pairs of object file names and symbol names that are found in the loaded objects, but not specified in the .IR orderfile , are placed last in the output file's section. These pairs are ordered by object file (as the filenames appear on the command line), with the different symbols from a given object file being ordered by increasing symbol address (that is, the order in which the symbols occurred in the object file, not their order in the symbol table). By default, the link editor displays a summary that simply shows the number of symbol names found in the loaded objects but not in the .IR orderfile , as well as the number of symbol names listed in the .I orderfile but not found in the loaded objects. (The summary is omitted if both values are zero.) To instead produce a detailed list of these symbols, use the .B \-sectorder_detail flag. If an object file-symbol name pair is listed multiple times, a warning is generated, and the first occurrence is used. .TP .BI "\-sectobjectsymbols" " segname sectname" This causes the link editor to generate local symbols in the section .I sectname in the segment .IR segname . Each object file that has one of these sections will have a local symbol created whose name is that of the object file, or of the member of the archive. The symbol's value will be the first address where that object file's section was loaded. The symbol has the type N_SECT and its section number is the the same as that of the section .I (segname,sectname) in the output file. This symbol will placed in the symbol table just before all other local symbols for the object file. This feature is typically used where the section is .SM (\_\^\_TEXT,\_\^\_text), in order to help the debugger debug object files produced by old versions of the compiler or by non-Apple compilers. .PP The following flags are related to name spaces: .TP .B \-twolevel_namespace Specifies the output to be built as a two-level namespace image. This option can also be specified by setting the environment variable .SM LD_TWOLEVEL_NAMESPACE. This is the default. .TP .B \-flat_namespace Specifies the output to be built as a flat namespace image. This is not the default (but was the default in MacOS X 10.0). .TP .B \-force_flat_namespace Specifies the executable output to be built and executed treating all its dynamic libraries as flat namespace images. This marks the executable so that the dynamic link editor know to treat all dynamic libraries as flat namespace images when the program is executed. .TP .BI \-bundle_loader " executable" This specifies the .I executable that will be loading the bundle output file being linked. Undefined symbols from the bundle are checked against the specified executable like it was one of the dynamic libraries the bundle was linked with. If the bundle being created with .B \-twolevel_namespace in effect then the searching of the executable for symbols is based on the placement of the .B \-bundle_loader flag relative to the dynamic libraries. If the the bundle being created with .B \-flat_namespace then the searching of the executable is done before all dynamic libraries. .TP .B \-private_bundle This allows symbols defined in the output to also be defined in executable in the .B \-bundle_loader argument when .B \-flat_namespace is in effect. This implies that the bundle output file being created is going to be loaded by the executable with the .B NSLINKMODULE_OPTION_PRIVATE option to .IR NSLinkModule (3). .TP .B \-twolevel_namespace_hints Specifies to create the output with the two-level namespace hints table to be used by the dynamic linker. This is the default except when the .B \-bundle flag is specified. If this is used when the .B \-bundle flag is specified the bundle will fail to load on a MacOS X 10.0 system with a malformed object error. .SM NSLINKMODULE_OPTION_PRIVATE option to .IR NSLinkModule (3) and that the symbols in the executable are not to cause multiply defined symbol errors. .TP .BI \-multiply_defined " treatment" Specifies how multiply defined symbols in dynamic libraries when .B \-twolevel_namespace is in effect are to be treated. .I treatment can be: .I error, .I warning, or .I suppress. Which cause the treatment of multiply defined symbols in dynamic libraries as either, errors, warnings, or suppresses the checking of multiply symbols from dynamic libraries when .B \-twolevel_namespace is in effect. The default is to treat multiply defined symbols in dynamic libraries as warnings when .B \-twolevel_namespace is in effect. .TP .BI \-multiply_defined_unused " treatment" Specifies how unused multiply defined symbols in dynamic libraries when .B \-twolevel_namespace is in effect are to be treated. An unused multiply defined symbol is one when there is a symbol defined in the output that is also defined in the dynamic libraries the output is linked with but the symbol in the dynamic library is not used by any reference in the output. .I treatment can be: .I error, .I warning, or .I suppress. The default for unused multiply defined symbols is to suppress these messages. .TP .B -nomultidefs specifying this flag marks the umbrella being created such that the dynamic linker is guaranteed that no multiple definitions of symbols in the umbrella's sub-images will ever exist. This allows the dynamic linker to always use the two-level namespace lookup hints even if the timestamps of the sub-images do not match. This flag implies .BI \-multiply_defined " error". .PP The following flags are related to symbols. These flags' arguments are external symbols whose names have `_' prepended to the C, .SM FORTRAN, or Pascal variable name. .TP .BI \-y sym Display each file in which .I sym appears, its type, and whether the file defines or references it. Any multiply defined symbols are automatically traced. Like most of the other symbol-related flags, .B \-y takes only one argument; the flag may be specified more than once in the command line to trace more than one symbol. .TP .BI \-Y " number" For the first .I number undefined symbols, displays each file in which the symbol appears, its type and whether the file defines or references it (that is, the same style of output produced by the .B \-y option). To keep the output manageable, this option displays at most .I number references. .TP .B \-keep_private_externs Don't turn private external symbols into static symbols, but rather leave them as private external in the resulting output file. .TP .B \-m Don't treat multiply defined symbols from the linked objects as a hard error; instead, simply print a warning. The first linked object defining such a symbol is used for linking; its value is used for the symbol in the symbol table. The code and data for all such symbols are copied into the output. The duplicate symbols other than the first symbol may still end up being used in the resulting output file through local references. This can still produce a resulting output file that is in error. This flag's use is strongly discouraged! .TP .B \-whyload Indicate why each member of a library is loaded. In other words, indicate which currently undefined symbol is being resolved, causing that member to be loaded. This in combination with the above .BI \-y sym flag can help determine exactly why a link edit is failing due to multiply defined symbols. .B .TP .BI \-u " sym" Enter the argument .I sym into the symbol table as an undefined symbol. This is useful for loading wholly from a library, since initially the symbol table is empty and an unresolved reference is needed to force the loading of the first object file. .TP .BI \-e " sym" The argument .I sym is taken to be the symbol name of the entry point of the resulting file. By default, the entry point is the address of the first section in the first segment. .TP .BI \-i definition:indirect Create an indirect symbol for the symbol name .I definition which is defined to be the same as the symbol name .I indirect (which is taken to be undefined). When a definition of the symbol named .I indirect is linked, both symbols will take on the defined type and value. .IP This option overlaps with a compiler option. If you use the compiler driver .IR cc (1) to invoke \fIld\fR, invoke this option in this way: .BI \-Wl,\-i definition:indirect. .TP .BI \-undefined " treatment" Specifies how undefined symbols are to be treated. .I treatment can be: .I error, .I warning, or .I suppress. Which cause the treatment of undefined symbols as either, errors, warnings, or suppresses the checking of undefined symbols. The default is to treat undefined symbols as errors. .TP .BI \-U " sym" Allow the symbol .I sym to be undefined, even if the .B \-r flag is not given. Produce an executable file if the only undefined symbols are those specified with .BR \-U. .IP This option overlaps with a compiler option. If you use the compiler driver .IR cc (1) to invoke \fIld\fR, invoke this option in this way: .BI \-Wl,\-U, sym. .TP .B \-bind_at_load Causes the output file to be marked such that the dynamic linker will bind all undefined references when the file is loaded or launched. .PP The following flags are related to stripping link edit information. This information can also be removed by .IR strip (1), which uses the same options. (The exception is the .B \-s flag below, but this is the same as .IR strip (1) with no arguments.) The following flags are listed in decreasing level of stripping. .TP .B \-s Completely strip the output; that is, remove the symbol table and relocation information. .TP .B \-x Strips the non-global symbols; only saves external symbols. .IP This option overlaps with a compiler option. If you use the compiler driver .IR cc (1) to invoke \fIld\fR, invoke this option in this way: .B \-Wl,\-x. .TP .B \-S Strip debugging symbols; only save local and global symbols. .TP .B \-X Strip local symbols whose names begin with `L'; save all other symbols. (The compiler and assembler currently strip these internally-generated labels by default, so they generally do not appear in object files seen by the link editor.) .TP .B \-Si Strip duplicate debugging symbols from include files. This is the default. .TP .B \-b Strip the base file's symbols from the output file. (The base file is given as the argument to the .B \-A option.) .IP This option overlaps with a compiler option. If you use the compiler driver .IR cc (1) to invoke \fIld\fR, invoke this option in this way: .B \-Wl,\-b. .TP .B \-Sn Don't strip any symbols. .TP .BI \-exported_symbols_list " filename" The specified .I filename contains lists of global symbol names that will remain as global symbols in the output file. All other global. .TP .BI \-unexported_symbols_list " filename" The specified .I filename contains lists of global symbol names that will not remain as global symbols in the output file. The. .PP The remaining options are infrequently used: .TP .B \-w Suppresses all warning messages. .TP .B \-no_arch_warnings Suppresses warning messages about files that have the wrong architecture for the .B \-arch flag. .TP .B \-arch_errors_fatal Cause the errors having to do with files that have the wrong architecture to be fatal and stop the link editor. .TP .B \-M Produce a load map, listing all the segments and sections. The list includes the address where each input file's section appears in the output file, as well as the section's size. .IP This option overlaps with a compiler option. If you use the compiler driver .IR cc (1) to invoke \fIld\fR, invoke this option in this way: .B \-Wl,\-M. .TP .B \-whatsloaded Display a single line listing each object file that is loaded. Names of objects in archives have the form libfoo.a(bar.o). .TP .BI \-filelist " listfile[,dirname]" Specifies that the linker should link the files listed in .I listfile . This is an alternative to listing the files on the command line. The file names are listed one per line separated only by newlines. (Spaces and tabs are assumed to be part of the file name.) If the optional directory name, .I dirname is specified, it is prepended to each name in the list file. .TP .BI "\-headerpad" " value" Specifies the minimum amount of space ("padding") following the headers for the .SM MH_EXECUTE format and all output file types with the dynamic linker. .I value is a hexadecimal number. When a segment's size is rounded up to the segment alignment, there is extra space left over, which is placed between the headers and the sections, rather than at the end of the segment. The .B headerpad option specifies the minimum size of this padding, which can be useful if the headers will be altered later. The default value is the 2 * sizeof(struct section) so the program /usr/bin/objcunique can always add two section headers. The actual amount of pad will be as large as the amount of the first segment's round-off. (That is, take the total size of the first segments' headers and non-zerofill sections, round this size up to the segment alignment, and use the difference between the rounded and unrounded sizes as the minimum amount of padding.) .TP .B \-headerpad_max_install_names Add to the header padding enough space to allow changing all dynamic shared library paths recorded in the output file to be changed to MAXPATHLEN in length. .TP .B \-t Trace the progress of the link editor; display the name of each file that is loaded as it is processed in the first and second pass of the link editor. .TP .BI \-A " basefile" Incremental loading: linking is to be done in a manner that lets the resulting object be read into an already executing program, the .IR basefile . .I basefile is the name of a file whose symbol table will be taken as a basis on which to define additional symbols. Only newly linked material will be entered into the .BR a.out file, but the new symbol table will reflect every symbol defined in the base file and the newly linked files. Option(s) to specify the addresses of the segments are typically needed, since the default addresses tend to overlap with the .I basefile. The default format of the object file is .SM MH_OBJECT. Note: It is strongly recommended that this option NOT be used, because the dyld package described in .IR dyld (3) is a much easier alternative. .TP .BI \-dylib_install_name " name" For dynamic shared library files, specifies the name of the file the library will be installed in for programs that use it. If this is not specified, the name specified in the .BI \-o " name" option will be used. This option is used as the .IR libtool (1) .BI \-install_name " name" option when its .B \-dynamic option is specified. .TP .BI \-umbrella " framework_name" Specifies this is a subframework where .I framework_name is the name of the umbrella framework this subframework is a part of. Where .I framework_name is the same as the argument to the .BI \-framework " framework_name" option. This subframework can then only be linked into the umbrella framework with the same .I framework_name or another subframework with the same umbrella framework name. Any other attempt to statically link this subframework directly will result in an error stating to link with the umbrella framework instead. When building the umbrella framework that uses this subframework no additional options are required. However the install name of the umbrella framework, required to be specified with .BR \-dylib_install_name , must have the proper format for an install name of a framework for the .I framework_name of the umbrella framework to be determined. .TP .BI \-allowable_client " client_name" Specifies that for this subframework the .I client_name can link with this subframework without error even though it is not part of the umbrella framework that this subframework is part of. The .I client_name can be another framework name or a name used by bundles (see the .BI \-client_name " client_name" option below). .TP .BI \-client_name " client_name" Specifies the .I client_name of a bundle for checking of allowable clients of subframeworks (see the .BI \-allowable_client " client_name" option above). .TP .BI \-sub_umbrella " framework_name" Specifies that the .I framework_name being linked by a dynamic library is to be treated as it one of the subframeworks with respect to twolevel namespace. .TP .BI \-sub_library " library_name" Specifies that the .I library_name being linked by a dynamic library is to be treated as it one of the sublibraries with respect to twolevel namespace. For example the .I library_name for .I /usr/lib/libobjc_profile.A.dylib would be .I libobjc. .TP .BI \-init " sym" The argument .I sym is taken to be the symbol name of the dynamic shared library initialization routine. If any module is used from the dynamic library the library initialization routine is called before any symbol is used from the library including C++ static initializers (and #pragma CALL_ON_LOAD routines). .TP .BI \-run_init_lazily This option is obsolete. .TP .BI \-dylib_compatibility_version " number" For dynamic shared library files, this specifies the compatibility version number of the library. When a library is used by a program, the compatibility version is checked and if the program's version is greater that the library's version, it is an error. compatibility version number is not specified, it has a value of 0 and no checking is done when the library is used. This option is used as the .IR libtool (1) .BI \-compatibility_version " number" option when its .B \-dynamic option is set. .TP .BI \-dylib_current_version " number" For dynamic shared library files, specifies the current version number of the library. The current version of the library can be obtained programmatically by the user of the library so it version number is not specified, it has a value of 0. This option is used as the .IR libtool (1) .BI \-current_version " number" option when its .B \-dynamic option is set. .TP .BI \-single_module When building a dynamic library build the library so that it contains only one module. .TP .BI \-multi_module When building a dynamic library build the library so that it contains one module for each object file linked in. This is the default. .TP .BI \-dylinker_install_name " name" For dynamic link editor files, specifies the name of the file the dynamic link editor will be installed in for programs that use it. .PP The following environment variable is used to control the use of incompatible features in the output with respect to Mac OS X releases. .TP .B MACOSX_DEPLOYMENT_TARGET This is set to indicate the oldest Mac OS X version that that the output is to be used on. When this is set to a release that is older that the current release features that are incompatible with that release will be disabled. If a feature is seen in the input that can't be in the output due to this setting a warning is issued. The current allowable values for this are .B 10.1 and .B 10.2 with the default being .B 10.1. .PP The following environment variables are used by Apple's Build and Integration team: .TP .B RC_TRACE_ARCHIVES When this is set it causes a message of the form ``[Logging for Build & Integration] Used static archive: .I filename'' for each static archive that has members linked into the output. .TP .B RC_TRACE_DYLIBS When this is set it causes a message of the form ``[Logging for Build & Integration] Used dynamic library: .I filename'' for each dynamic library linked into the output. .TP .B RC_TRACE_PREBINDING_DISABLED When this is set it causes a message of the form ``[Logging for Build & Integration] prebinding disabled for .I filename because .I reason''. Where .I filename is the value of the .B \-final_output argument if specified or the value of the .B \-o argument. .TP .BI \-final_output " filename" The argument .I filename is used in the above message when RC_TRACE_PREBINDING_DISABLED is set. .PP Options available in early versions of the Mach-O link editor may no longer be supported. .SH FILES .ta \w'/Network/Library/Frameworks/*.framework/*\ \ 'u /lib/lib*.{a,dylib} libraries .br /usr/lib/lib*.{a,dylib} .br /usr/local/lib/lib*.{a,dylib} .br /Library/Frameworks/*.framework/* framework libraries .br /Network/Library/Frameworks/*.framework/* framework libraries .br /System/Library/Frameworks/*.framework/* framework libraries .br a.out output file .SH "SEE ALSO" as(1), ar(1), cc(1), libtool(1), ranlib(1), atom(1), nm(1), otool(1) lipo(1), arch(3), dyld(3), Mach-O(5), strip(1), redo_prebinding(1)
|
http://opensource.apple.com/source/cctools/cctools-446.1/man/ld.1
|
CC-MAIN-2016-30
|
refinedweb
| 9,939
| 66.94
|
You have already been taught that MongoDB is schemaless. However, in
practice, we have a kind of "schema", and that is the object space of the
object, whose relations a MongoDB database represents. With the ceveat that
Ruby is my go-to language, and that I make no claims about exhaustiveness
of this answer, I recommend to try two pieces of software:
1. ActiveRecord (part of Rails)
2. Mongoid (standalone MongoDB "schema", or rather, object persistence
system in Ruby)
Expect a learning curve, though. I hope that others will point you to
solutions in other great languages outside my expertise, such as Python.
I would suggest to store notes as you described and additionally store all
used tags in user document. Remember that data redundancy is acceptable in
MongoDB and very often is the best way to go since you should design your
schema for reads, not for writes.
Then on the Java side you just store tags in Set as a property of User
class so you can be sure to store unique data there.
MongoDB does not enforce a schema. You can easily restore your old
documents into the same collection as your new ones. You can write your
application to expect old-style or new-style documents when you query them.
Or you could use update with operators like set or rename to update the
old-style documents and make them conform to the new schema.
A finer answer to your question would involve explaining things that make
up the database. Not every database (not necessarily relational) has the
features mentioned below
Eventual consistency
Referential integrity
Linking between objects
Metadata attached to data objects
In-built Sharding through hashing
Transaction isloation
... and so on
An application should use a database that best helps it perform its raison
d'etre. There is no single database that can fit the bill for all use
cases. In fact certain no-sql stores do not even have a concept of
'transactions'..
I got!
I created 3 colletions:
accumulated_stats: :_id, :photos, :documents
monthly_stats: :_id, date, :counts {:photos, :documents}, accumulated
{:photos, :documents}
daily_stats: :_id, date, :counts {:photos, :documents}, accumulated
{:photos, :documents}
Now, for each action, i will increment accumulated_stats, get the results
and increment daily and monthly stats. it works as well!
But for showing the data.. i won't have all date time.. for instance:
2013-09-10
2013-09-11 ( do not have )
2013-09-12
2013-09-13
I'm looking for a way to construct the perfect date range. For instance, i
don't have the day 11 on my collection, how can i bring it with the last
existent values? any ideas?
Thanks,
Diego
There are two ways you can go. One, like you have indicated, is called
"Denormalization" where you save the category information (the name in each
language) in the Product document itself. That way, when you load a
Product, you already have the name in each language. You could model a
Product like this:
{
_id: ObjectId(""),
name: "MyProduct",
category: {
Catid: ObjectId(""),
names: {
en: "MyCategory",
es: "...",
}
}
}
The other option, if the category name changes too much or you add
languages regularly, is to not save the names on the category names on the
product, but to rather do a query on the Category collection for the
Category when you need it.
The java driver reads and writes documents as BasicBSONObjects, which
implement and are used as Map<String, Object>. Your application code
is then responsible for reading this map and casting the values to the
appropriate types.
A mapping framework like Morphia or Spring MongoDB can help you to convert
BSONObject to your classes and vice versa.
When you want to do this yourself, you could use a Factory method which
takes a BasicBSONObject, checks which keys and values it has, uses this
information to create an object of the appropriate class and returns it.
Obviously the second schema example is much better for your task (of
course, if lan field is unique as you mentioned, that seems true to me
also).
Getting element from dictionary/associated
array/mapping/whatever_it_is_called_in_your_language is much cheaper than
scanning whole array of values (and in current case it's also much
efficient from the storage size point of view (remember that all fields are
stored in MongoDB as-is, so every record holds the whole key name for json
field, not it's representation or index or whatever).
My experience shows that MongoDB is mature enough to be used as a main
storage for your application, even on high-loads (whatever it means ;) ),
and the main problem is how you fight database-level locks (well, we'll
wait for promised table-level locks, it'll fa
Since the orders collection represents a single restaurant would it not
instead contain a record of all orders, with each document looking like:
{
_id:{}
waiter: 'Sammaye',
table: 9,
items: [
{id:9,qty:1,cooked:false}
],
billed: false
}
And all waiters who need to know about orders waiting to go out will just
get all order documents from this collection which have billed false.
This should be fine enough if you place an index on billed.
Using the other method you said could cause problems, for example it is one
document in a collection storing all orders. I could imagine in time that
document could get quite large.
Using in memory operators ($push,$pull etc) could make operations on the
document slow.
It could also create fragmentation within the dat
Unless your using employee groups (Accounting, HR, etc) You'll probably be
fine adding the employee name, mongo Object ID, and any other information
unique to that manager / employee relationship as a sub document to the
managers document.
With that in place you could probably do your reporting on these
relationships through a simple aggregation.
This is all IMHO, and begs the question; Is simple aggregation another
oxymoron like military intelligence?
Instead of using actual hours, rather store your time as 0 - 1440, each
number being an increment of a minute. Then you'll be able to use $gte and
$lte.
So you'd have:
hours: {
mon: {open: 570, close: 1080 },
tue: {open: 570, close: 1050 },
...
}
That's the strategy that I'm using in my app. Of course there are slightly
more efficient ways, like storing all the hours for the week in a single
array, but your approach is still good.
}
]
}
Having different writers is a key downside of embedding documents in my
opinion. You might want to take a look at this discussion that presents
different solutions. I'd try to avoid different writers to one document and
use a separate Comments collection instead, where each comment is owned by
its author. You can fetch all comments on a post by an indexed field postId
reasonably fast. Then the comments simply have a regular _id field. It
makes sense to use an ObjectId because that automatically stores the time
the comment was created, and it's a monotonic index by default.
create a "lastModified" timestamp on the parent document, and only save
the edit if nothing has changed on the document.
This is called 'optimistic locking' and it's generally not good if there is
a high probabilit
Actually I figured it out by changing the for loop in handle_CHAT. As I
want the program to send the message to the specific user, a "talkwith"
string can be added to the class and this string can hold that specific
user's name. Then this change turns the program from public to private
chatting.
msg = "<%s> %s" % (self.name,msg)
for name,protocol in self.users.iteritems():
if name == self.talkwith:
protocol.sendLine(msg)
Just remove the static keyword from private static UDPCS1 chat = new
UDPCS1(); and no more chat windows will be there...
Hoping it helped...
Helped in my case i was doing something too,...
You need to define a syntax for your commands yourself. For example /ban
<username> for a ban.
First you check whether the message begins with a slash. If so it is a
command.
Now search for the first space, everything after the slash and in front of
the space is the command name.
Pass everything after the first space to the command. In this case the
username. The command handles the parameters on it's own.
It could look like this:
$message = '/ban TimWolla';
if (substr($message, 0, 1) === '/') {
// $message is a command
$firstSpace = strpos($message, ' ');
$command = substr($message, 1, $firstSpace);
$parameters = substr($message, $firstSpace + 1);
if (!hasPermission($command)) error('Permission denied');
switch ($command) {
case 'ban':
For a real-world implementation, I wouldn't consider either one of these a
good option, but it definitely could be fun to play with. Using files isn't
going to scale as well as the db,well... as easily. But really, I'd look
into just setting up a jabber server and play with that. Or maybe look into
node.js.
I hacked it. If you save the compare, you can add this to the file:
<PropertyElementName>
<Name>Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchema</Name>
<Value>ExcludedType</Value>
</PropertyElementName>
You'll see where when you open it. This setting is not in the UI, but is
apparently supported.
There are two obvious differences:
in PHP you're using SoapServer instead of SoapClient
in Python your URL is different than in PHP - you add some userid or
something like that /wsdl& + str(uuid.uuid1()) vs. /wsdl
Well according to me you can try and load the xml using "LoadXml" method of
XmlDocument object (just as you have mentioned in your question) and put it
in try..catch block. If the xml is not in correct format it will throw an
exception.
You can check the following link
Others might have a better solution though.
Regards,
Samar
Nice question!
Several points should be made:
First, as I guess you already know (though some readers of the question and
this answer may not), your schema document 1 is already legal as it sits.
So you don't need to modify the schema for schema documents in order to
make it legal. If I understand you correctly, however, you want it not
just to be valid; you want the variant of it in which element declarations
occur without xs:documentation elements, or without ds:added and
ds:last_modified attributes, to be invalid.
Second, it is possible to modify the XSD schema for XSD schema documents in
the way you describe, and it is in principle possible to validate your
schema documents against the modified schema for schema documents.
But schema validators are allowed to have built-in k
Having worked with large data systems in various database technologies, I
would recommend not using XML for the task.
The good news is that SQL Server of course supports the XML data type and
you can actually run quite complex queries on XML in TSQL. So you don't
even need to suck the XML out into your application to make a stored
procedure as an example.
The problems I've seen with storing serialized data as XML in a relational
data store:
It is slow. Run some tests with the XML data type in SQL Server and you'll
see that examining it in TSQL is quite a bit slower than just bringing back
"regular" data.
It is too verbose. The size of XML is quite a bit larger than a format like
JSON. You'll lose the ability to query the data in TSQL going with JSON,
but when objects get big, it's nice
Web sockets tends to be the way to go for chat applications, in your case
it sounds like server sent events could be perfect (as from what it sounds
you're only receiving events, for two way communication you'll be good
using web sockets), both lack support in older browser. So if you need to
support older browsers you can go with long polling which out of your
choices has the least load on the server as it's one request for every
response.
See this post: What are Long-Polling, Websockets, Server-Sent Events (SSE)
and Comet? for more info on the specific technologies
So it looks like your app is working locally and on AppFog, but as you say
the issue is a validation error in Eclipse. Are you using the Spring Tool
Suite plugin? What should actually happen here is that the schema should be
found within the Spring Jar file (the source is on Github)
- I guess there should be a way of telling Eclipse to resolve it there, and
I suspect that STS would actually know how to resolve it.
First of all, <xs:import> is not supposed to include some piece of
XSD into another XSD.
It is meant to let the XSD processor know that this particular schema may
use components
from another (imported) namespace.
If you want to reuse some XSD definitions across different schemas (all of
which target the same namespace), you should use <xs:include> or
<xs:redefine> (<xs:redefine> allows you to change on the fly a
few things defined in the included piece).
But both <xs:include> and <xs:redefine> can be specified only
as direct children of
<xs:schema> and only at its beginning.
The fact that <xs:schema> is nested in <wsdl:types> doesn't
change anything here.
There are many ways to store this.
Remember, the schema is not rigid. Different rows can follow different
patterns. Suppose you have an incident with several comments. Entries might
look like this:
rowID, cf:cq, v
===============
incident|<uuid1>, poc:fullname, bob jones
comment|<uuid2>, incident:key, incident|<uuid1>
comment|<uuid3>, incident:key, incident|<uuid1>
But that approach above would require you to index the comments separately
so that you can quickly find all comments belonging to a particular
incident. Another approach would be to add a column qualifier to the
incident row for each comment.
rowID, cf:cq, v
===============
incident|<uuid1>, comment|<uuid2>:text, my comment
incident|<uuid1>, comment|<uuid3>:text, my
The import is enough to import the element. Then it just depends what you
want to do with it. If you want to make it part of the content model of a
complex type, then include an element particle that refers to it, for
example <element ref="mon:heartBeatresp"/>, or if you want to add an
element to its substitution group, use
substitutionGroup="mon:heartBeatresp".
A schema collection should permit you to have different versions of the XML
data without having to ignore validation.
Have a look at XML Schema Collections to start with.
In your T-SQL code, you'd have something like this (this code is sourced
from Bob Beauchemin of SQLskills.com):
-- Load XML schema from file
DECLARE @x XML
SET @x = (
SELECT * FROM OPENROWSET(
BULK 'C:invoice.xsd',
SINGLE_BLOB
) AS x
)
-- And use it to create an XML schema collection
CREATE XML SCHEMA COLLECTION InvoiceType AS @x
Now you create a table which maps the column to the schema collection:
CREATE TABLE invoice_docs (
invoiceid INTEGER PRIMARY KEY IDENTITY,
invoice XML(document InvoiceType)
)
Now when your schema changes, you modify the schema collection by adding in
the new vers
If you're interested in a deep dive, you can review a diff between the two
drafts on the IETF site.
However, if you're looking for a simpler summary of changes, Geraint Luff
and Francis Galiegue created a changelog page on the project's github wiki
that lists the changes, additions, and removals.
If you are launching your client by running the ClientTest class then you
need to update it to use the server IP. In your current ClientTest code you
are connecting to the server using the localhost IP:
charlie = new Client("127.0.0.1");
Update it to use the server IP:
charlie = new Client("use server IP");
server IP is the IP address of the machine where you are running your
Server class.
Don't guess, use a function made for the job:
HTTPUtility.HTMLEncode
Instead of removing "unsafe" strings, encode any character that might be
parsed as HTML into an HTML Entity.
If this isn't a web-app, the similar functions can be found in WebUtility.
|
http://www.w3hello.com/questions/MongoDB-Chat-Schema
|
CC-MAIN-2018-17
|
refinedweb
| 2,711
| 59.74
|
)
Kishore Chowdary(6)
Mahender Pal(4)
Jignesh Trivedi(3)
Satyaprakash Samantaray(3)
John Kocer(3)
Ramees )
Jasminder Singh(2)
Yogi S(2)
Akshay Phadke(2)
Nakkeeran Nataraj)
Manpreet Singh(1)
Hemanth Kumar(1)
Prashant Kumar(1)
Allen O'neill(1)
Vithal Wadje(1)
Prasham Sabadra(1)
Sachin Kalia(1)
Priyaranjan K S(1)
Resources
No resource found
C# 7.2 - "In" Parameter Method Overloading Tiebreaker
Jan 14, 2018.
This article explains the “in” parameter method overloading with Visual Studio 2017 Version 15.6. Preview.
Passing Data Between Components
Nov 28, 2017.
Article explains 2 Methods of communication between the components .
Generate Python Wrapper For C# Methods Using Reflection
Nov 27, 2017.
In this article, we will generate a Python wrapper around C# methods using reflection methods of .NET framework..
ASP.NET Core 2.0 Session State
Oct 09, 2017.
Using an empty project from a previous post, amend Startup class ConfigureServicee() method, and add services for session and its backing store..
Custom Extension Method In C#
Aug 23, 2017.
Here, I am going to explain how to create and use the extension method. Your Own Container Images
Aug 04, 2017.
Here, we will be building our own container images. For doing this we have two different ways, namely manual method and automated method. Let us see both ways...
Delegates, Anonymous Method, And Lambda Expression In C#
Jan 25, 2017.
This article discusses Delegates, Anonymous Methods, and Lambda Expression in C#.
Setting Anonymous User Policy On Applications In SharePoint 2013 Central Admin
Jan 19, 2017.
In this article, you will learn how to set anonymous policies on web applications in SharePoint 2013 Central Administration..
C# Tutorial Part 2 - The First Error In Your Application
Dec 28, 2016.
This article gives an introduction to namespace, class, and methods used when an error occurs.
Cloning Objects In .NET Framework
Dec 26, 2016.
In this article, we will show the ways to clone objects in .NET Framework. We will analyze the pros and cons for each cloning method.
How To Grant Anonymous Access To Site Collection Or Site Page At SharePoint Online
Dec 13, 2016.
In this article, you will learn how to grant anonymous access to site collection or site page at SharePoint online.
Practical Approach To ASP.NET Web Services - Part Four - Web Method Attribute Properties
Dec 06, 2016.
In this article, you will learn about Web Method Attribute Properties in ASP.NET Web Services.
Practical Approach To ASP.NET Web Services - Part Five - Web Method Overloading
Dec 06, 2016.
In this article, you will learn about Web Method Overloading.
Audit Trail And Data Versioning With C# And MVC
Nov 29, 2016.
Method for implementing an audit trail.
Publishing ASP.NET Web API REST Service Using File System Method
Nov 22, 2016.
In this article, we will learn how to publish ASP.NET Web API REST Service, using file system method.
Calchistogram Method In Cognitive Service Academic Knowledge API
Nov 11, 2016.
In this article, you will learn how to do calchistogram method in Universal Windows apps development with Azure, XAML and Visual()'.".
Interpret Method Output Value To Evaluate Method Expression In Cognitive Service Academic Knowledge API
Nov 10, 2016.
In this article, you will learn how to interpret Method Output value to evaluate Method Expression in Cognitive Service Academic Knowledge API.
Cognitive Service Academic Knowledge API - Evaluate Method Using UWP With Azure, XAML And C#
Nov 09, 2016.
In this article, you will learn Cognitive Service Academic Knowledge API - evaluate method, using UWP with Azure, XAML and C#
Creating Wiki Page On SharePoint Online Using PnP Core CSOM Library
Oct 27, 2016.
In this article, you will learn how to create a Wiki page on SharePoint online site, using PnP Core CSOM library with various methods.
Developing Book My Seat Application In AngularJS And ASP.NET - WebAPI Methods - Part Two
Oct 13, 2016.
In this article, you will learn how to develop Book My Seat Application in AngularJS and ASP.NET - WebAPi Methods.
Enable Anonymous Access, SharePoint Server 2016
Oct 11, 2016.
In this article, you will learn how to enable anonymous access in SharePoint Server 2016.
About Anonymous-Methods
NA
File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!
|
http://www.c-sharpcorner.com/tags/Anonymous-Methods
|
CC-MAIN-2018-05
|
refinedweb
| 720
| 67.45
|
Here's a fairly efficient Python (2.5) and well-documented implementation of the Rabin-Miller primality test, based on section 33.8 in CLR's Introduction to Algorithms. Due to Python's built-in arbitrary precision arithmetic, this works for numbers of any size.
from random import randint def _bits_of_n(n): """ Return the list of the bits in the binary representation of n, from LSB to MSB """ bits = [] while n: bits.append(n % 2) n /= 2 return bits def _MR_composite_witness(a, n): """ Witness functions for the Miller-Rabin test. If 'a' can be used to prove that 'n' is composite, return True. If False is returned, there's high (though < 1) probability that 'n' is prime. """ rem = 1 # Computes a^(n-1) mod n, using modular # exponentation by repeative squaring. # for b in reversed(_bits_of_n(n - 1)): x = rem rem = (rem * rem) % n if rem == 1 and x != 1 and x != n - 1: return True if b == 1: rem = (rem * a) % n if rem != 1: return True return False def isprime_MR(n, trials=6): """ Determine whether n is prime using the probabilistic Miller-Rabin test. Follows the procedure described in section 33.8 in CLR's Introduction to Algorithms trials: The amount of trials of the test. A larger amount of trials increases the chances of a correct answer. 6 is safe enough for all practical purposes. """ if n < 2: return False for ntrial in xrange(trials): if _MR_composite_witness(randint(1, n - 1), n): return False return True
The function you should call is isprime_MR.
Although this test is probabilistic, the chances of it erring are extremely low. According to Bruce Schneier in "Applied Cryptography", the chances of error for a 256-bit number with 6 trials are less than one in
- this is very low.
Therefore, you should always use this method instead of the naive one (trying do divide by all primes up to
), because it's much faster.
|
http://eli.thegreenplace.net/2009/02/21/rabin-miller-primality-test-implementation/
|
CC-MAIN-2014-42
|
refinedweb
| 322
| 65.73
|
Control conditions are the basic building blocks of C programming language. In this tutorial, we will cover the control conditions through some easy to understand examples.
There are two types of conditions :
- Decision making condition statement
- Selection condition statement
Let’s understand these two types with the help of examples.
Decision making condition statement
Conditions like ‘if’, “if-else”, “if-else-if”, “nested if”, ternary conditions etc fall under this category.
1. If Condition
This is basic most condition in C – ‘if’ condition. If programmer wants to execute some statements only when any condition is passed, then this single ‘if’ condition statement can be used. Basic syntax for ‘if’ condition is given below:
if (expression) { Statement 1; Statement 1; .. .. }
Now, we should have working program on ‘if’ condition.
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("Can not execute, command line argument expected by Program\n"); exit(0); } return 0; }
Output for above program is given below.
$ ./if_cond Can not execute, command line argument expected by Program
In above program, programmer wanted to exit from program if two command line arguments are not passed to program. We can see if program executable is run without any argument, message is displayed on console and program exited.
2. If-Else Condition
This is two-way condition in C – ‘if-else’ condition. If programmer wants to execute one set of statements on success case of one condition and another set of statements in all other cases, then ‘if-else’ condition is used. Either ‘if’ case statements are executed or ‘else’ case statements are executed. Basic syntax for ‘if-else’ condition is given below:
if (expression1) { Statements; } else { Statements; }
Now, given below is very basic program that has been made for checking number is even or odd, it is for understanding usage of ‘if-else’ condition.
#include <stdio.h> int main(int argc, char *argv[]) { int num; printf("\nEnter any number to check even or odd :"); scanf("%d", &num); if (num%2 == 0) { printf("%d is EVEN\n", num); } else { printf("%d is ODD\n", num); } return 0; }
Output:
$ ./if-else_cond Enter any number to check even or odd :23 23 is ODD
$ ./if-else_cond Enter any number to check even or odd :24 24 is EVEN
In above program, programmer wanted user to enter number which is checked in condition whether it is divisible by 2. If condition is true, number is displayed “EVEN”, otherwise number is displayed “ODD”.
3. Ternary Operator
There is alternative to ‘if-else’ condition which is ternary operator that is different syntax but provides functionality of ‘if-else’ condition. Basic syntax of ternary operator is given below:
Condition expression ? if condition TRUE, return value1 : Otherwise, return value2;
For example,
#include <stdio.h> int main(int argc, char *argv[]) { int num; printf("\nEnter any number to check even or odd :"); scanf("%d", &num); (num%2==0) ? printf("%d is EVEN\n", num) : printf("%d is ODD\n", num); return 0; }
Output:
$ ./a.out Enter any number to check even or odd :24 24 is EVEN $ ./a.out Enter any number to check even or odd :23 23 is ODD
4. If-Else-If condition
This is multi-way condition in C – ‘if-else-if’ condition. If programmer wants to execute different statements in different conditions and execution of single condition out of multiple conditions at one time, then this ‘if-else-if’ condition statement can be used. Once any condition is matched, ‘if-else-if’ condition is terminated. Basic syntax for ‘if-else-if’ condition is given below:
if (expression1) { Statements; } else if (expression2) { Statements; } else { Statements; }
Now, given below is very basic program that has been made for mapping user-input color with fruit, it is for understanding usage of ‘if-else-if’ condition.
#include <stdio.h> int main(int argc, char *argv[]) { char input_color[100] = {0}; printf("\nEnter color [red/green/yellow] to map with fruit :"); scanf("%s", input_color); if (strncmp(input_color, "red", sizeof(input_color)) == 0) { printf("%s is mapped to APPLE\n", input_color); } else if (strncmp(input_color, "green", sizeof(input_color)) == 0) { printf("%s is mapped to GRAPES\n", input_color); } else if (strncmp(input_color, "yellow", sizeof(input_color)) == 0) { printf("%s is mapped to BANANA\n", input_color); } else { printf("\nInvalid color entered :%s", input_color); } return 0; }
Output:
$ ./if-else-if_cond Enter color [red/green/yellow] to map with fruit :green green is mapped to GRAPES $ ./if-else-if_cond Enter color [red/green/yellow] to map with fruit :yellow yellow is mapped to BANANA $ ./if-else-if_cond Enter color [red/green/yellow] to map with fruit :testcolor Invalid color entered :testcolor
In above program, programmer wanted user to enter color (out of red/green/yellow as indicated), then input color is compared first with red in ‘if condition’, then compared with ‘else-if’ conditions. Here, it is noted that once any condition is matched, ‘if-else-if’ condition terminates. Here, if no ‘if’ or ‘else if’ is matched, then at last ‘else’ condition is executed which we can see in above output when invalid color is input.
5. Nested-If conditions
This is nested if or if-else or if-else-if conditions in C. Basic syntax for nested ‘if’ or ‘if-else’ condition is given below:
if (expression1) { Statements; if (expression2) { Statements; } else { Statements; } } Given below is basic program using nested if conditions.
#include <stdio.h> int main(int argc, char *argv[]) { int i = 5; int *ptr = &i; int **double_ptr = &ptr; if (double_ptr != NULL) { if (ptr != NULL) { printf ("Now safe to access pointer, ptr contains %d", *ptr); } } return 0; }
Output:
$ ./a.out Now safe to access pointer, ptr contains 5
In above program, nested if conditions are used. It is always safer to have NULL check on pointer before accessing it (More on C pointers here).
In the above code snippet, example is taken for double pointer. The first ‘if’ condition is to check double pointer (i.e. ** double_ptr) is non-NULL, then only, move ahead to access inner pointer (i.e. ptr). If double pointer is non-NULL, then only nested ‘if’ condition is checked whether inner pointer is NULL or not. If nested ‘if’ condition is OK, then it is safe to access value at pointer.
Selection condition statement
6. Switch case conditions
Switch case is clean alternative of ‘if-else-if’ condition. Here, several conditions are given in cases that facilitates user to select case as per input entered. Basic syntax for using switch case statement is given below.
switch(expression) { case constant expression1: statements1; break; case constant expression2: statements1; break; .. .. default : statementsN; }
It is noted that any statement between switch statement and first case statement is dead code which is never executed. For understanding ‘switch’ case, basic program is created in which basic arithmetic operation on two numbers is done as per input entered by user. Several cases of arithmetic operations are handled in switch cases. Basic program using ‘switch case’ is given below.
#include <stdio.h> int main(int argc, char *argv[]) { char ch; int num1, num2; printf("\nBasic operation:"); printf("\nAdd [a]"); printf("\nSubtract [s]"); printf("\nMultiply [m]"); printf("\nDivide [d]"); printf("\nEnter character for operation:"); scanf("%c", &ch); printf("\nEnter two numbers for operation:"); printf("\nEnter num1="); scanf("%d", &num1); printf("\nEnter num2="); scanf("%d", &num2); switch (ch) { case 'a': printf("\nAddition of num1 and num2=%d", (num1+num2)); break; case 's': printf("\nSubtraction of num1 and num2=%d", (num1-num2)); break; case 'm': printf("\nMultiplication of num1 and num2=%d", (num1*num2)); break; case 'd': printf("\nDivision of num1 and num2=%d", (num1/num2)); break; case 'x': printf ("\nTest switch case1"); case 'y': printf ("\nTest switch case2"); default: printf("\nInvalid value eneterd"); break; } printf("\n"); return 0; }
Output:
$ ./a.out Basic operation: Add [a] Subtract [s] Multiply [m] Divide [d] Enter character for operation:a Enter two numbers for operation: Enter num1=10 Enter num2=5 Addition of num1 and num2=15 $ ./a.out Basic operation: Add [a] Subtract [s] Multiply [m] Divide [d] Enter character for operation:d Enter two numbers for operation: Enter num1=10 Enter num2=5 Division of num1 and num2=2 $ ./a.out Basic operation: Add [a] Subtract [s] Multiply [m] Divide [d] Enter character for operation:G Enter two numbers for operation: Enter num1=10 Enter num2=5 Invalid value entered
In above program, user is given basic menu with operations allowed in program. User is asked to enter initial character of displayed operations. User is asked to enter two numbers also on which selected arithmetic operation would be performed. After all input from user, program checks input with switch cases and executes statements under matched switch case; since break statement is there so only statements under matched case are executed.
Note that if break statement is not given in cases and any case is matched, then statements of below cases would also get executed even though below cases condition is not matched. We can understand this in given below output. Here, as per code, if ‘x’ is entered, then case ‘x’ is executed and there is no break statement so all cases below case ‘x’ are executed without any condition check on below cases.
$ ./a.out Basic operation: Add [a] Subtract [s] Multiply [m] Divide [d] Enter character for operation:x Enter two numbers for operation: Enter num1=10 Enter num2=5 Test switch case1 Test switch case2 Invalid value entered
Get the Linux Sysadmin Course Now!
{ 7 comments… read them below or add one }
Your example for the ternary operator:
(num%2==0) ? printf(“%d is EVEN\n”, num) : printf(“%d is ODD\n”, num);
Could be rewritten in the following manner:
printf( “%d is %s\n”, num, ((num%2==0)?”EVEN”:”ODD”) );
To show the flexibility of the Ternary operator. As you showed it it is a mere syntactically different way to do the same thing, however the example above show some code re-use (one printf instead of 2, and using the return value of the ternary operator as a parameter to that printf)
Simply rewriting and IF-ELSE in the ternary operator syntax creates code that can be harder to read, whereas the rewritten example I included demonstrates the added functionality that the (?:) operator brings to the table that is not available from an IF-ELSE.
Two questions, I have seen that You try to be complete.
Now I have two questions. First is about ternary operator, cold yo have more of them in C, like in C++, and do you need the break thing all the time..
If not clear from abouve:
(a>b)? c=’p': (a<0) c='z' : c='m';
and, swithch dos not need the break all the time.
sorry I missed one ?, in the code above, my bad.
Could You find where Have I ommit the one ? in the code above….
I’m not sure I understand your question but…
The ternary operator means: THREE OPERANDS
So the syntax is:
?:
So you can’t just create one that has more than two actions. There is only a true action and a false action.
You can nest ternary operators, but there are potential typing problems with that.
Te Question is> Why You don’t make same chalanges, and some quiz just to see how people do understand.
Some more difficull samples….
Ok
When to use If-else if-else over switch statments and vice versa [duplicate]
|
http://www.thegeekstuff.com/2013/01/control-conditions-in-c/
|
CC-MAIN-2014-52
|
refinedweb
| 1,899
| 52.29
|
Difference between revisions of "Calico Myro"
Revision as of 12:14, 28 September 2013
Myro is an interface for programming robots. It is implemented in many languages and designed for use in Introductory Computing courses. It is being developed by the Institute for Personal Robots in Education.
This page describes the Calico Python interface. To find out more about using Myro with robots, see Using Calico with Robots.
If you were familiar with the previous version of Python Myro, please see Calico Differences.
Contents
- 1 Getting Started
- 2 Output Functions
- 3 Input Functions
- 4 Movement Functions
- 5 Reading Sensors
- 6 Setting Values
- 7 Advanced 1
- 8 Advanced 2
- 9 Advanced 3
- 10 Advanced 4
- 11 Flow of Control
- 12 Image processing
- 13 Graphics Objects Interface
- 14 Miscellaneous commands
- 15 Audio
- 16 Gamepad
- 17 Controlling Multiple Robots
Getting Started
Robots
There are currently 7 robots (described below) you can use with Myro:
- Scribbler - described on this page
- SimScribbler
- NxtRobot
- Finch
- Hummingbird
- Arduino
- ARDrone
Scribbler
Before using Myro with your robot, you need to connect to it via Bluetooth. Follow the instructions here Calico Download#Optional: Using Calico with Robots. Once you have the connection, then you can start
- Turn on the robot.
- Enter: from Myro import *
- Enter init("COM4") or init("/dev/tty.scribbler") (for Macs, where tty.scribbler might be different depending on what you named it).
When using the scribbler robot, the code
init() is usually used. But you can also use the more general interface which works with all robots:
from Myro import * makeRobot("Scribbler", "COM5")
Simulation
Calico comes with a simulator, so you can do most of the robot activities without a real robot. See Calico Simulator for more details.
Briefly, you can start the simulator with:
from Myro import * init("sim")
or
from Myro import * makeSimulation(calico, "water.py")
There are a number of predefined worlds, including "indoor.py", "outdoor.py", and "water.py". You can create your own worlds. You can copy one of Calico/modules/Myro/Robots/Worlds/ to you own folder.
NxtRobot
You can use:
robot = makeRobot("NxtRobot")
to have access to Nxt-specific functionality.
Finch
You can use the #Advanced 2 commands for the Finch. See Finch for details on the Finch.
Hummingbird
You can use the #Advanced 2 commands for the Hummingbird. See Hummingbird for details on the Hummingbird robot kit.
ARDrone
You can use the #Advanced 3 commands for the ARDrone Quad-Copter. See examples for more information.
Arduino
You can use the #Advanced 4 commands for the Arduino. See examples for more information.
Testing
To test that everything is working, try:
python> from Myro import *
If you have a gamepad:
python> gamepad()
Otherwise:
python> joystick()
Manual Drive
joystick(): opens a joystick window; click and drag to move robot.
gamepad(): control robot with a gamepad.
NOTE: you must plug in the USB-based gamepad before importing Myro.
Pad Action ------ ------- Left/Right turnLeft() and turnRight() Up/Down forward() and backward() Button Action ------ ------- 1 stop() 2 takePicture() 3 beep(.25, 523) 4 beep(.25, 587) 5 beep(.25, 659) 6 speak('Hello. My name is Scribby.') 7 speak('Ouch! I'm a sensitive robot.') 8 speak('I'm hungry. Do you have any batteries?') Gamepad is now running... Press button 1 to stop.
Output Functions
beep(duration, frequency, frequency2 = None): make a tone. If two tones are given, the robot will combine them.
speak(message) - text-to-speech, turns message into spoken words (waits to finish speaking)
speakNoWait(message) - text-to-speech, turns message into spoken words (doesn't wait to finish)
speak(message, async = 0) - text-to-speech, turns message into spoken words (asynchronous flag, 0=blocks, 1=continues)
getVoice() - get the voice of the current speaker
getVoices() - get a list of all of the possible voices
getVoiceNames() - get a list of all of the possible voice names
setVoice(name) - set the voice to a known voice by name
setVoiceName(name) - set the voice to a known voice by name
Phonemes
The eSpeak system, which comes with Calico for Windows and Mac, and can be installed for Linux, offers the ability to turn words into text:
Myro.speak("Hello world!")
But you can also use it to pronounce Phonemes. Phoneme mnemonics can be used directly in the text input to speak. They are enclosed within double square brackets. Spaces are used to separate words, and all stressed syllables must be marked explicitly. For example:
Myro.speak("[[D,Is Iz sVm f@n'EtIk t'Ekst 'InpUt]]")
Each of the language's phonemes is represented by a mnemonic of 1, 2, 3, or 4 characters. Together with a number of utility codes (eg. stress marks and pauses). The utility 'phonemes' are:
' primary stress , secondary stress % unstressed syllable = put the primary stress on the preceding syllable _: short pause _ a shorter pause || indicates a word boundary within a phoneme string | can be used to separate two adjacent characters, to prevent them from being considered as a multi-character phoneme mnemonic
For more details see:
-
- (not all phonemes are encoded)
Input Functions
ask(item) - will ask one time for item(s)
python> ask("Name") (window pops up, user enters Sarah, presses Ok button) 'Sarah'
input(prompt) - will prompt user for input. Identical to ask. This always returns a string.
python> input("How old are you? ") How old are you? 19 '19'
Note that input() and ask() both return strings. You can use the eval() function to turn strings into values. For example:
python> eval(input("How old are you? ")) How old are you? 19 19
This gives you the number 19, rather than the string '19'. Also:
python> eval(input("Enter x,y: ")) Enter x,y: 34, 56 (34, 56)
In this example, eval will turn the string '34, 56' into the tuple of numbers (34, 56).
askQuestion(question, [answerList]) - prompt a question and return answer.
python> askQuestion("Are you ready?") (window pops up, users selects Yes) 'Yes' python> askQuestion("How many lumps would you like?", ["One", "Two", "Three"]) (window pops up, user selects Three) 'Three'
yesno("Are you ready?") - asks a yes/no question and provides two buttons, "Yes" and "No". Returns "Yes" or "No". Same as askQuestion() with no answerList.
python> yesno("Are you ready?") (window pops up, users selects Yes) 'Yes'
Movement Functions
forward(amount, seconds): move forward, stop any rotation, for number of seconds
python> forward(1, .5)
backward(amount, seconds): move backward, stop any rotation, for number of seconds
python> backward(.9, 2)
turnLeft(amount, seconds): turn left, stop any forward movement, for number of seconds
python> turnLeft(.4, 1)
turnRight(amount, seconds): turn right, stop any forward movement, for number of seconds
python> turnRight(.5, 1)
stop(): stop all movement
python> stop()
translate(amount): move forward and backwards. 0 to 1 moves forward; 0 to -1 moves backwards rotate(amount): turn left or right. 0 to 1 turns left, 0 to -1 turns right
NOTE: translate and rotate are independent, although they may both effect each the wheel. That means that a translate() and a rotate() will blend into a meaningful combination.
python> translate(1) # full speed ahead python> translate(-1) # full speed backwards python> translate(0) # stop in the translate direction python> rotate(.5) # half-speed to the left python> rotate(-1) # full speed to the right
move(translate, rotate): rotate and translate
python> move(0, 1) # turn full speed to left python> move(0, -1) # turn full speed to right python> move(1, 1) # turn full speed to left while moving full speed ahead python> move(.5, 0) # go forward half speed
motors(left, right): control the left and right motors
motors(left, right, time): control the left and right motors for a given time (seconds), and then stop.
Reading Sensors
getLight(pos): read a light sensor on the scribbler; defaults to "all"
getIR("left" | "right" | 0 | 1 | "all"): read an IR sensor on the scribbler; defaults to "all"
getLine(pos): read line sensor on the scribbler; defaults to "all"
getStall(): read stall sensor on the scribbler
NOTE: Every time you issue a move command, the stall sensor resets, and it needs to wait a short time to see whether the motors are stalled. This means that the sensor won’t give accurate results if you test it too soon after the robot starts to move.
getName(): read the robot's name
getPassword(): read the robot's password
getAll(): read all positions of all of the major sensors; returns a dictionary
getVolume(): returns 0 or 1
getData(): get some bytes stored in the robots memory
getInfo(): retrieve information about the robot
getBright("left" | "middle" | "center" | "right" | 0 | 1 | 2): read one of the Fluke's virtual light sensors. The Fluke's virtual light sensors report the total intensity in the left, center, and right sides of the Fluke's camera.
getObstacle("left" | "middle"| "center" | "right" | 0 | 1 | 2): read one of the Fluke's IR obstacle sensors (see setIRPower below). Higher values mean that IR light is being reflected (e.g an obstacle is detected), a low value means IR is not being reflected and there seems to be open space in that direction. The value ranges from 0 to 6400.
getBattery() gets the voltage of the battery (note: If the battery drops below ~6.1V the Fluke's back LED will flash to alert you to change or preferably recharge your batteries)
get(sensor): read the sensor "stall"; or get all readings of "ir", "light", or "line"; or get "all" which is all of those. Also can get "config".
get("config"): returns meta data about the robot's hardware
get(sensor, pos): read any of the following sensors or items by name and position
python> get("stall") 0 python> get("light", 0) 128 python> get("line") [0, 0] python> get("all") {'light': [235, 13], 'line': [1, 0], 'ir': [0, 0], 'stall': 0} python> get("all") # using a fluke {'battery': 6.2436550642715174, 'light': [13176, 3058, 1848], 'ir': [1, 1], 'obstacle': [0, 0, 0], 'bright': [193536, 193536, 193536], 'stall': 0, 'blob': (0, 0, 0), 'line': [1, 1]}
senses() - show all of the sensor readings in a window.
Setting Values
setLED(position, value): set a LED
python> setLED("left", "on") python> setLED("right", "off")
setName(name): set the robot's name (limit of 16 characters)
python> setName("Howie")
setVolume(level): set the speaker's volume (0/"off" or 1/"on")
python> setVolume("off") python> setVolume(0) python> setVolume("on") python> setVolume(1)
setData(position, value): set a byte of data in the robot's memory to a value between 0 and 255.
setLEDFront(value): turn on the led on the front of the Fluke (0 for off and or 1 for on)
python> setLEDFront(1) # turn on the Fluke's front LED python> setLEDFront(0) # turn off the Fluke's front LED python> set("led", "front", 0) # turn off the Fluke's front LED
setLEDBack(value): turn on the LED on the back of the Fluke. The brightness of this LED is configurable between 0-1.
python> setLEDBack(0.5) # turn on the Fluke's back LED at 1/2 brightness python> setLEDBack(1.0) # turn on the Fluke's back LED at full brightness python> set("led", "back", 0) #turn off the Fluke's back LED
setIRPower(power): set the output power of the Fluke's IR obstacle sensors (defaults to 135). If getObstacle() always reports high values try lowering the IR output power. If you always receive a zero value, try increasing the power. The power value should be between 0 and 255.
python> setIRPower(135) python> setIRPower(140)
darkenCamera(level): turn off the camera's auto-exposure, auto-gain, and lower the gain to "level:. This is useful when using the getBright() virtual light sensors.
manualCamera(gain=0, brightness=128, exposure=65): turn off the camera's auto-exposure, auto-gain, and auto-white balance, and set the gain (integer in the range 0-63), brightness (integer in the range 0-255), and exposure manually (integer in the range 0-255). (In version 2.8.3 of Myro)
autoCamera(): turn on the auto-exposure, auto-gain, and auto-color-balance.
set(item, value): set a value (for "name", and "volume")
set(item, position, value): set a value (for "led")
python> set("name", "Duckman") python> set("led", "center", "off") python> set("volume", "off")
Advanced 1
The following are new functions added to the Scribbler2 (red Scribbler). The firmware for using these functions is now available (Feb 23, 2012) and is the default when you upgrade (see Firmware Upgrade). In Jigsaw they appear in the Advanced 1 tab when you Use the Myro module (menu -> Edit -> Use a Module -> Myro).
getEncoders(): reads and returns the left and right encoders
getEncoders(bool): if passed True the encoder count is reset
getDistance(): returns a number between 0-100 correlated roughly with distance from S2 IR sensors
setS2Volume(): set volume 0-100
beep(0, frequency): beeps frequency until you tell it not to.
getMicrophone(): returns a sample of the microphone correlated to ambient sound level (i.e. how loud)
The following Advanced commands are currently being tested. They work with the Scribbler2 real robot.
moveTo(x, y, "mm" | "s2"): move to position x, y in global coordinates (defaults to mm)
moveBy(x, y, "mm" | "s2"): move by x, y in global coordinates (defaults to mm)
turnTo(angle, "deg" | "s2"): move to angle (defaults to degrees)
turnBy(angle, "deg" | "s2"): move by angle (defaults to degrees)
arcTo(x, y, radius, "mm" | "s2"): arc to position x,y with radius (defaults to mm)
arcBy(x, y, radius, "mm" | "s2"): arc by position x,y with radius (defaults to mm)
arc(degrees, radius): move so many degrees along an arc (radius in mm). Negative degrees make the robot move forward and to the right, positive degrees make the robot move backward to the right. - does not update position and angle, yet
getPosition(): the position (in mm) used by turnTo, turnBy, moveTo, moveBy, arcTo, and arcBy
getAngle(): the angle (in degrees) used by turnTo, turnBy, moveTo, moveBy, arcTo, and arcBy
setPosition(x, y): set the current position (in mm) used by turnTo, turnBy, moveTo, moveBy, arcTo, and arcBy
setAngle(angle): set the current angle (in degrees) used by turnTo, turnBy, moveTo, moveBy, arcTo, and arcBy
Advanced 2
The following functions will work on the Finch robot. In Jigsaw they appear in the Advanced 2 tab when you Use the Myro module (menu -> Edit -> Use a Module -> Myro).
getTemperature(): get the current temperature
getAccelerometer(dimension): get the movement on the "x", "y", or "z" dimension
Advanced 3
The following functions will work on the quad-copter ARDrone robot. In Jigsaw they appear in the Advanced 3 tab when you Use the Myro module (menu -> Edit -> Use a Module -> Myro).
- takeoff()
- land()
- left(power, [duration])
- right(power, [duration])
- up(power, [duration])
- down(power, [duration])
- getLocation()
Advanced 4
The following functions will work on the Arduino robot. In Jigsaw they appear in the Advanced 4 tab when you Use the Myro module (menu -> Edit -> Use a Module -> Myro).
- analogRead(port)
- digitalRead(port)
- analogWrite(port, value)
- digitalWrite(port, value)
- pinMode(port, mode)
- makeInput(port)
- makeDigitalOutput(port)
- makePWMOutput(port)
- makeServoOutput(port)
NOTE: port is an integer.
Flow of Control
If you wished to perform a loop for 5 seconds, you could use the following idiom:
for seconds in timer(5): print "running for", seconds, "..."
Parallel Code
Myro allows running functions in parallel, at the same time. For example, this allows you to write programs that control multiple robots in synchronicity.
There are 5 variations, but they largely follow the same pattern:
python>>> doTogether(functions(s), argument(s))
-
These allow running either multiple functions with no arguments or with one, or running the same function on multiple arguments.
If you want to run different arguments for different functions, this does not work:
python>>> doTogether( f1(a1, a2), f2(a3, a4) )
Why? Well, Python will call the funtions f1 and f2, and pass the resulting values to doTogether(). Rather, we want to call and run the functions at the same time. To do that, we pass in the function and arguments which will be called in the appropriate manner. To allow this, we pass in the function and arguments as a list:
4. doTogether([f1, arg1, ...], [f2, arg2, ...], ...): will run f1(arg1), f2(arg2) at the same time and return their results in a list
Finally, there is a variation of #1 which allows you to leave out the list:
5. doTogether(f1, f2, ...): will run f1(), f2() at the same time and return their results in a list
Image processing
The following objects and functions are related to the camera functions on the Scribbler. There are two different interfaces: the Multimedia interface (largely based on Mark Guzdial's introductory book), and the Graphics Object interface (largely based on John Zelle's introductory book). These are independent; however, there are methods to move between the two. The first library is built on the second.
Creating a picture, manually, from a file, or from the robot:
picture = takePicture("color" | "gray" | "blob") # gets image from robot picture = makePicture(filename) # reads in a image file, examples: PNG, JPG, GIF picture = makePicture(columns, rows) # creates a blank picture picture = makePicture(columns, rows, array) # creates a new picture from an array (a column-major sequence of 0-255 values that represent Red, Green, Blue (in that order)) picture = makePicture(columns, rows, array, mode)# creates a new picture from an array, where mode = "color", or "gray" pictureCopy = copyPicture(picture) # creates a copy of picture
Output:
show(picture) savePicture(picture, filename) savePicture([picture, picture, ...], filename) # creates an animated GIF savePicture([picture, picture, ...], filename, duration) # creates an animated GIF, with duration between frames savePicture([picture, picture, ...], filename, duration, repeat) # creates an animated GIF, repeat the loop?
The show(picture) function has a couple of mouse functions. You can click with the left mouse on a pixel and you can see "(x,y): (r,g,b)" in the window's status bar. If you click and drag a rectangle in the window, you will set the blob-tracking colors to the ranges of colors inside the bounding box.
show() can also take an optional name:
show(pic2, "name2")
so that you can show more than one image at a time.
Image dimensions:
int_value = getWidth(picture) int_value = getHeight(picture)
Creating and manipulating color objects:
color = makeColor(r, g, b) color = makeColor("name") color = makeColor("#hexcode") color = pickAColor() color = getColor(pixel) setColor(pixel, color)
Pixel manipulation:
pixel = getPixel(picture, x, y) pixels = getPixels(picture) int_value = getRed(pixel) int_value = getGreen(pixel) int_value = getBlue(pixel) int_value = setRed(pixel, color) int_value = setGreen(pixel, color) int_value = setBlue(pixel, color) int_value = getX(pixel) int_value = getY(pixel) r, g, b = getRGB([color | pixel])
Red, green, and blue int_values are between 0 and 255, inclusive.
The getPixels() function is designed to be used with a for-statement, like so:
for pixel in getPixels(picture): # do something with each pixel
getPixels() returns a generator object. To get a pixel by index, you could first turn it into a list:
mylist = list(getPixels(picture))
You can also save any picture to a file:
savePicture(picture, filename) # does the same as above, but has intuitive name
copyPicture() is effectively defined as:
def copyPicture(picture): newPicture = makePicture(getWidth(picture), getHeight(picture)) for x in range(getWidth(picture)): for y in range(getHeight(picture)): setColor(getPixel(newPicture, x, y), getColor(getPixel(picture, x, y))) return newPicture
Examples
Processing by rows and cols:
from Myro import * picture = makePicture(pickAFile()) show(picture) for i in range(getWidth(picture)): for j in range(getHeight(picture)): pixel = getPixel(picture, i, j) setGreen(pixel, 255)
Processing by each pixel:
from Myro import * picture = makePicture(pickAFile()) show(picture) for pixel in getPixels(picture): setGreen(pixel, 255)
Advanced Vision Functions
The Fluke can not only take images, but it can do some very simple image processing. In particular, a simple form of on-board image segmentation. If you want to track something in an image based on its color or brightness, the on-board color segmentation can be very useful since its faster than doing it in python. By default, the Fluke is set to track pink objects. You can also graphically select an object in the image to track. First use the show(picture) function and then drag a box around the object you want to track, the software will automatically determine the color bounding box.
We can use the Fluke's computer vision in two ways. First, we can grab a "blob" image from the Fluke. This image is a black and white image with the white pixels being part of the object of interest. Blob images can be transmitted faster than a full color picture.
p = takePicture() show(p) # select object in the image b = takePicture("blob") show(b)
For instance, here we see two images of a dog and her toy. The first is a regular color picture and the second is a blob image with the pink dog toy selected.
Another useful function is getBlob() that will return three items, the total number of pixels that fell inside the bounding box, and the average x and y locations of those pixels.
pixel_count, average_x, average_y = getBlob()
Rather than using the mouse to select the bounding box for segmentation, you can manually configure the Fluke using the configureBlob() function call:
configureBlob(y_low = 0, y_high = 255, u_low = 0, u_high = 255, v_low = 0, v_high = 255)
The parameters to configureBlob() create a bounding box in YUV space. Instead of using RGB which stands for Red/Green/Blue, YUV is an alternate way to describe color. The Y component contains the brightness or intensity information of the pixel, the U/V components contain the color.
Finally, you can also use getBlob() to locate bright pixels. We do this by segmenting bright pixels, meaning the Y components of the pixels are large :
configureBlob(y_low=100, y_high=255) b = takePicture('blob') show(b) pxs, avg_x, avg_y = getBlob()
Graphics Objects Interface
The object oriented graph window can be used to create your own drawings:
win = Window(title, width, height) # Alternately Window(title) or Window() win.setBackground(color) win.close() win.getMouse() # Returns a Point object of where the mouse is clicked
To get additional functionality, you will need to:
from Graphics import *
Then you can do the following graphics examples.
Once you have a graph window created you can draw the following Graph Objects on it with their .draw() or .drawAt() method:
Line(point1, point2) Circle(centerPoint, radius) Rectangle(topLeftPoint, bottomRightPoint) Oval(centerPoint, xradius, yradius) Polygon(point1, point2, point3, ...) Text(centerPoint, string) Picture(width, height[, color]) Arrow(centerPoint) Curve(p1, p2, p3, p4) SpeechBubble(p1, p2, text, p3) - p1, p2 form bounding box; p3 is point of origin
See the Calico Graphics for more details.
Example
Using the graphics window to draw:
from Myro import * from Graphics import *
win = Window("My Window", 500, 500) # Window(string, width, height) color = Color(100, 200, 50) # red, green, and blue are values from 0 to 255 win.setBackground(color) # sets background color of window to the color we created point = Point(100,25) # creates a point referencing location (100,25) message = Text(point, "Click on window") # creates message "Click on window" anchored at location (100,25) message.draw(win) # puts the message on the graph window click = win.getMouse() # Waits for user's mouse click and returns as a Point object message.undraw() # erases message from the graph window text = Text(click, "Some Text") # creates text "Some Text" anchored at location you clicked text.draw(win) # adds the text to the graph window p = Point(150,150) # creates the point for top left corner of the oval's bounding box xradius = 50 yradius = 20 oval = Oval(p, xradius, yradius) # creates the oval redColor = Color(255,0,0) # defines the color red oval.fill = redColor # colors the oval red oval.draw(win) # draws the oval to the graph window wait(3) # Window will close in 3 seconds
Miscellaneous commands
wait(seconds) - Pause for the given amount of seconds. Seconds can be a decimal number.
python> wait(5) [5 seconds go by] Ok python>
currentTime() - the current time, in seconds from an arbitrary starting point in time, many years ago. Can you figure out the date of the start time?
python> currentTime() 1164956956.2690001
odd(n) - returns True if n is odd
even(n) - returns True if n is even
Random decisions
flipCoin() - Returns "heads" or "tails" randomly.
python> flipCoin() 'tails' python> flipCoin() 'tails' python> flipCoin() 'heads'
heads() - returns True 50% of the time
tails() - returns True 50% of the time
pickOne(value) or pickOne(value1, value2, ...) - Returns a number or element randomly. New in Myro 1.0.2
python> pickOne(5) 0 # randomly returns 0 through 4 evenly over time python> pickOne(2, 4, 6, 8) 6 # randomly returns 2, 4, 6, or 8 evenly over time python> pickOne("red", "white", "blue", "green") 6 # randomly returns "red", "white", "blue", or "green" evenly over time
randomNumber() - Returns a random number between 0 (inclusive) and 1 (exclusive).
python> randomNumber() 0.65218366496862357
File and Folder Functions
pickAFolder() - allows you to select a folder
python> pickAFolder() 'C:/Python24'
pickAFile() - allows you to select a file
python> pickAFile() 'C:/Python24/README.txt'
Media Functions
readSong(filename) - reads a file in the Song File Format and returns a list of tuples.
makeSong(text) - make a song in the Song File Format where lines are separated by semicolons.
python> makeSong("c 1; g 1/4; a 1/2; e 3/4;") [(523.29999999999995, 1.0), (784.0, 0.25), (880.0, 0.5), (659.29999999999995, 0.75)] python> singsong = makeSong("c 1; g 1/4; a 1/2; e 3/4;")
saveSong(text or song, filename) - saves a song in tuple format, or in text format
Audio
Using Myro, you can add sounds to your programs. The easiest way is to just play a file:
Myro.playUntilDone(filename) Myro.play(filename)
These play .wav, .ogg, .mp3, .mod or .mid files.
There are some additional commands for controlling the sound. These commands also return a channel for additional control (see below).
channel = Myro.playUntilDone(filename) channel = Myro.play(filename) channel = Myro.play(filename, loop_forever) channel = Myro.play(filename, loop) channel = Myro.play(filename, loop, seconds)
The rest of this section uses a sound object to have more control.
sound = Myro.makeSound(filename)
Loads a .wav, .ogg, .mp3, .mod or .mid file into memory.
bytes = sound.Array()
Returns sound as an array of bytes.
channel = sound.Play()
Plays the sound.
channel = sound.Play(loops)
Plays the sound for a desired number of loops.
channel = sound.Play(loopIndefinitely)
Plays the sound.
channel = sound.Play(loops, milliseconds)
Plays a sound for a desired number of milliseconds or loops.
channel = sound.FadeIn(milliseconds)
Fades in a sample once using the first available channel.
channel = sound.FadeIn(milliseconds, loops)
Fades in a sample the specified number of times using the first available channel.
channel = sound.FadeInTimed(milliseconds, ticks)
Fades in a sample once using the first available channel, stopping after the specified number of ms.
channel = sound.FadeInTimed(milliseconds, loops, ticks)
Fades in a sample the specified number of times using the first available channel, stopping after the specified number of ms.
sound.Stop()
Stops the sound sample. (Note that this does not actually work right now, and a workaround is to use sound.Volume=0 )
sound.Fadeout(fadeoutTime)
Fades out the sound sample.
Tones
Myro.beep(duration, frequency) Myro.beep(duration, frequency1, frequency2)
Plays a tone for a given amount of time. If duration is zero, then it plays until you stop it.
Myro.play(duration, function)
Plays the wave form generated by function. function is a function that takes an array and an index. It then fills the array with bytes (0 to 255) which represent the wave form.
Example:
import Myro import Graphics import math def makeTone(freq1, freq2, freq3): """ Make a function that is based on the given frequencies. """ # Each time slice is 1/playbackfreq of 2pi slice = (1/44100 * 360 * math.pi/180) # time in radians def wave(array, position): """ The actual function that will compute the wave. """ # Fill the array with bytes (unsigned 8-bit values) for i in range(len(array)): angle1 = position * slice * freq1 angle2 = position * slice * freq2 angle3 = position * slice * freq3 array[i] = ((127 + math.cos(angle1) * 127) + (127 + math.sin(angle2) * math.sin(angle1) * 127) + (127 + math.cos(angle3) * 127))/3 position += 1 return wave def plotSound(function, width=500): win = Myro.Window("Sound Plot", width, 255) array = [0] * width function(array, 0) prev = (0, 255) for i in range(width): Graphics.Line(prev, (i, array[i])).draw(win) prev = (i, array[i]) tone = makeTone(440, 440, 220) plotSound(tone) Myro.play(2, tone)
Advanced Sound Control
As Myro sound and audio is built on top of SDL (the same system that pygame and other languages use) we also have access to fine-grain control of sound. For more information, please see:
Gamepad
There is a pre-programmed gamepad() function for immediately driving the robot:
python> gamepad()
This will show a menua of options (depending on the type of gamepad your have). Allows speaking, moving the robot, and playing tones.
Also, one can write quick gamepad utilities with:
python> gamepad({"button": function, ...})
where "button" is one of the names of items that a gamepad can return, and function is a function that takes the button values as a list. For example:
def buttonHandler(args): # args is a list of values of the item being handled .... def axisHandler(args): # args is a list of values of the item being handled .... gamepad({"button": buttonHandler, "axis": axisHandler})
Whenever a axis or button is pressed or released, then the handlers will be called.
There are two additional commands: getGamepad() and getGamepadNow()
- getGamepad() waits for an event before returning (ie, is blocking),
- getGamepadNow() will immediately return the current state of the gamepad.
Gamepad Examples
python> getGamepad("count") 2 python> getGamepad("button") # waits till you press at least one button [0, 0, 1, 0, 1, 0, 0, 0] python> getGamepad(1, "button") # waits till ID 1 presses at least one button [1, 0, 0, 0, 0, 0, 0, 0] python> getGamepad(range(getGamepad("count")), "button") # waits till someone presses a button [[0, [1, 0, 0, 0, 0, 0, 0, 0]], [1, [0, 0, 0, 0, 0, 0, 0, 0]]] python> getGamepad(["button", "axis"]) {"button": [1, 0, 0, 0, 0, 0, 0, 0], "axis": [-0.999969482421875, 0.0]} (sometimes axis doesn't return exactly 1 or -1).
Here is a short, useful program:
python> while 1: move(*getGamepad("robot"))
Here is a more functional one:
done = False while not done: results = getGamepad(["button", "robot"]) move(*results["robot"]) if results["button"][1]: beep(.5, 440) if results["button"][2]: beep(.5, 880) done = (results["button"][0] == 1):
- python> getGamepad([0, 1], ["button", "axis"])
- [{'button': [0, 0, 0, 0, 0, 0, 0, 0], 'axis': [0.0, 1.0]}, {'button': [1, 1, 0, 0, 0, 0, 0, 0], 'axis': [-1.0, -1.0]}]
- python> getGamepad([0, 1], "axis")
- [[0.0, 1.0], [-1.0, -1.0]]
ITEM can be:
- "count" - returns (immediately) number of gamepads plugged in
- "robot" - returns axis values (floats) ready to be used by move() Myro command as [translate, rotate]
- empty - if nothing is passed in, it returns all of the following as a dictionary
- "name" - name of gamepad, as string
- "axis" - returns values of axis controller in a list (as floats)
- "ball" - returns values of ball controller in a list
- "button" - returns values of buttons in a list (as integers)
- "hat" - returns values of hat in a list
Here is a short little demo of how you could write a multi-player "game" where each player has a gamepad controller and appears as a circle on the screen.
from Myro import * from Graphics import * # imports Circle, and Point def game(): win = Window("My Game!", 500, 500) numplayers = getGamepad("count") colors = ['red', 'blue', 'green', 'yellow', 'orange'] players = [] # Create the players: for p in range(numplayers): circle = Circle(Point(randomNumber() * 500, randomNumber() * 500), 10) circle.fill = Color(colors[p]) players.append(circle) players[-1].draw(win) # Let's play! speak("Red is it! Don't let red touch you!") while True: for data in getGamepadNow(range(numplayers), ["axis","button"]): for id in range(numplayers): players[id].move(data[id]["axis"][0] * 20, data[id]["axis"][1] * 20) if data[id]["button"][0]: # fire a missile speak("Fire!") wait(.1)
The window produced with the show(picture) command allows mouse clicks.
Robot's Orientation
If you are using a bluetooth-serial adapter or a serial cable to control your robot, then the scribbler's normal forward direction is used. When using the Fluke the forward direction is flipped. "Forward" is in the direction of the Fluke's camera. However, the orientation of the scribbler can be manually changed using the setForwardness() function. This is particularly useful if you want to use the Scribbler's IR and light sensors.
setForwardness(orientation): orientation can be 0/"scribbler-forward" or 1/"fluke-forward"
getForwardness(): Returns the orientation of the robot "scribbler-forward" or "fluke-forward"
Controlling Multiple Robots
You can control multiple robots (say, on COM5, COM6, and COM7) with:
robot1 = makeRobot("Scribbler", "COM5") robot2 = makeRobot("Scribbler", "COM6") robot3 = makeRobot("Scribbler", "COM7")
The robots can be controlled individually using commands like robot1.forward(1, 1). You can control each robot by making robot objects and then telling each robot object what you want it to do using the standard robot commands as methods on the objects:
#Connect to two different robots on different com ports r1 = makeRobot("Scribbler", "COM4") r2 = makeRobot("Scribbler", "COM8") #tell both robots to start moving forward r1.forward(1) r2.forward(1) #Tell both robots to beep for one second. #Note that robot 1 beeps first, followed by robot 2 #because the beep method is blocking, so the robots #travel for a total of 2 seconds r1.beep(1,800) r2.beep(2,1400) #Tell both robots to stop. r1.stop() r2.stop()
|
http://wiki.roboteducation.org/index.php?title=Calico_Myro&diff=prev&oldid=15222
|
CC-MAIN-2019-51
|
refinedweb
| 5,664
| 52.29
|
.
PHP has a built-in server
It’s for testing use only (it’s single-threaded), but if you want to give a PHP web application a whirl, you don’t need to configure a new vhost or anything else. You can simply start PHP from the command line with the -S switch and it will serve from the local directory as its webroot.
php -S localhost:8080
With this running, you see the logs in your terminal and you can request to see the application. I’d recommend using a
php.ini file with it (use the
-c switch); PHP ships with a good
php.ini-recommended that you can use and it’s much less weird than just letting it fall back to the language defaults. Other tricks you can play with this tool:
- specify a webroot in a different directory: this is useful if you’re running the server under supervisord or otherwise from a different location
- add a routing file that can be used to do the job of an apache
.htaccessfile
- bind to 0.0.0.0:8080 to make your application visible to other people on your network, I find this useful for letting managers take things for a spin
Personally I use this tool when I’m working with one-off scripts for a book chapter or conference talk. I also use it as a migration tool. When upgrading to a new version of PHP, I compile my target version without installing it as the main PHP on my machine, then use this server to try my application on the new version of PHP. It’s a good first step on an upgrade path (second step — I lint check first!) to knowing how much work there is between you and your application running faster and more securely on a newer version of PHP.
PHP has dependency management
This is long overdue in PHP but it’s here and it’s fabulous. PHP’s dependency management tool is called Composer and it’s a standard ingredient in all modern web applications. When PHP finally acquired namespaces (way back in version 5.3), it became much easier to pick and mix code from a variety of frameworks and libraries in a single application. Now our ecosystem looks much more like you’d expect with many small tools building on one another and end-user applications that specify what they need and automatically pull that all in on each platform.
I once wrote that PHP was the land of a thousand frameworks and those days are long gone. Now we have an open market for great library providers and far less duplication between them all, Drupal uses elements from Symfony, and we’re all one big happy family again.
PHP 7 will ship this year
Current stable PHP is 5.6, so the next version is obviously… PHP 7! Actually there was once a PHP 6 that never made it to stable (most of it ended up in PHP 5.3), but is so different from our future that we decided the naming clash was hopelessly confusing. So like all good scripting languages, we’ll never release a version 6, but PHP 7 will be coming late in 2015.
What’s in PHP 7? Great question! So far all I’ve managed to find is a lot of people gibbering about how much faster it is, which given the huge improvements in performance in recent versions of PHP, is pretty exciting in and of itself. As for the features, plenty of ideas are in the mix — look out for more news as we start to release alpha and beta versions later in the year.
Editor’s note: If you’re excited about where PHP is heading and would like to get beyond the basics or update your current PHP skills, check out Lorna Jane Mitchell’s Intermediate PHP video training course.
This post is part of our ongoing exploration into the explosion of web tools and approaches.
|
https://www.oreilly.com/ideas/4-things-that-happened-in-php-while-you-werent-looking
|
CC-MAIN-2017-26
|
refinedweb
| 671
| 66.88
|
In Python was possible to run the scripts in interpreter before you create an SIS.
In C++ can also run the file before you make them a SIS?
In Python was possible to run the scripts in interpreter before you create an SIS.
In C++ can also run the file before you make them a SIS?
Sorry,
i mean to "Emulator".
Hello.
I'm new in C + + - I've had here who learned that after the partial Python.
I'd be happy if you can explain to me how many things:
1) need to install any SDK files on the computer? ...
So by what I realized until now C++ good many of Python.
What do you recommend?
Before I start to learn the language intensively, should I switch to C++?
I think I just will focos on build application itself.
until then, I hope the project will be easy to use.
Incidentally also in C++ is like that?
Thank you very much for your help:)
Tried to bringing the other way, but could not find anything related to it downloads.
Can you navigate me to a place where you can download this package?
Yea!
But the application is installed in the same drive.
Second, when I will send that software to a friend (for example), and have no "Python interpreter" installed the his device - how he can...
Sorry I was sleeping thread up (just open a new thread is spam, so it is better to have here).
After i've created an SIS & install in moblie, tried to run it - but straight to him is that I want...
If you pay attention, to run the following code you need to download the following package:
And add it to folder of emulator.
I want to know when I...
Thank you.
If you pay attention to, to use through dialogue that needs to add the files to the computer model.
When I create a file to the SIS I need to add any files?
Or is it automatically...
I get it.
By the way,
Such functions can be performed on PyS60?:
...
did you read the book?
That I want to know whether this way you learn the language well
Hello.
Tried to insert the following code into Define(Def):
#add-ons downloads
def dwn_plug():
url = ''
redirectfilepath =...
Yea
I mean to this thing.
I try to insert this script to my code, but is dosen't work.
Hello.
I wanted to know how you can view the files, by browsing on drives of the device.
See an example of one case:
import httplib, urllib
import base64, os.path
def imageToURL(...
I thought about it.
And I wanted to know whether you can create a PHP file and application server receives data about the file version.
I mean, I somehow latent software with a version connect to...
Okay.
Soon I'll get the book.
Meantime, I will try to practice writing the correct code and implementation.
I changed the code this code:
import urllib
import appuifw
from appuifw import *
import e32
import os
Look, now appears to me an error that variable:
"down_update"
No Defined.
It seems to me that because of that Ordinance IF following code (which makes "down_update" to be null).
The incorrect...
Thank you!
I added the line, but now appears to me an error on line 61.
This is the part where the error (marked red line specific):
def write_version():
global updatefile
if...
Thank you very much for your help, you are very good man.
To the subject - I'm not interested in adding menu, because this file is a separate himself from the menu (see post:...
Thanks for the fix.
But what can be done to order operations DEF?
In the event, the matter that I want him to perform the following actions:
1) download the latest version from the server. ...
I managed to create this code:
import urllib
import appuifw
from appuifw import *
import e32
Exactly!
I meant it :)
Thank you for your help: P
The opposite!
I mean that when the user installs the application, it appears to authorize the use of connections only.
I would like, it will show him all the capabilities of the software, there are...
|
http://developer.nokia.com/community/discussion/search.php?s=b8a3f6214f4717bb16e7d28d7583cf92&searchid=2410448
|
CC-MAIN-2014-23
|
refinedweb
| 702
| 83.36
|
Recently I discussed some of the changes in the Base OS MP version 6.0.6958.0
OpsMgr- MP Update- New Base OS MP 6.0.6958.0 adds Cluster Shared Volume monitoring, BPA, new rep
One of the changes in this newer version of the MP is the addition of a new datasource module, which runs a script to output the Network Adapter Utilization. The name of the datasource is “Microsoft.Windows.Server.2008.NetworkAdapter.BandwidthUsed.ModuleType”. This datasource module uses the timed script property bag provider, along with a generic mapper condition detection. The script name is: “Microsoft.Windows.Server.NetwokAdapter.BandwidthUsed.ModuleType.vbs”
There are 3 rules, and 3 monitors for each OS (2003 and 2008), which utilize this datasource:
- Rules:
- 2008
- Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedReads.Collection (Percent Bandwidth Used Read)
- Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedWrites.Collection (Percent Bandwidth Used Write)
- Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedTotal.Collection (Percent Bandwidth Used Total)
- 2003
- Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedReads.Collection (Percent Bandwidth Used Read)
- Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedWrites.Collection (Percent Bandwidth Used Write)
- Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedTotal.Collection (Percent Bandwidth Used Total)
- Monitors:
- 2008
- Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedReads (Percent Bandwidth Used Read)
- Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedWrites (Percent Bandwidth Used Write)
- Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedTotal (Percent Bandwidth Used Total)
- 2003
- Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedReads (Percent Bandwidth Used Read)
- Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedWrites (Percent Bandwidth Used Write)
- Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedTotal (Percent Bandwidth Used Total)
Only the “Total” rules and monitors are enabled by default, the Read/Write workflows are disabled out of the box by design.
The good:
This new functionality is cool because it allows us to monitor the total utilization based on the network bandwidth as a percentage of the “total pipe”, report on this, and view the data in the console:
The issue:
Since there is no direct perfmon data to collect this, the information must be collected via script. I wrote about how to write this yourself HERE.
There are 4 known issues with this script in the current Base OS MP, which can cause problems in some environments:
1. When the script executes – it consumes a high amount of CPU (WMIPrvse.exe process) for a few seconds.
2. The script does not support cookdown, so it runs a cscript.exe process and an instance of the script for EACH and every network adapter in your system (physical or virtual). This makes the CPU consumption even higher, especially for systems with a large number of network adapters (such as Hyper-V servers).
3. The script does not support teamed network adapters very well, as they are manufacturer/driver dependent, and are often missing the WMI classes expected by the script, so you will see errors on each script execution, about “invalid class”
4. On some Windows 2003 servers, people have reported this script eventually causes a fault in netman.dll, and this can subsequently cause some additional critical services to fault/stop.
Event Type: Error
Event Source: Application Error
Event Category: (100)
Event ID: 1000
Date: 16/10/2011
Time: 4:41:09 AM
User: N/A
Computer: WSMSG7104C02
Description:
Faulting application svchost.exe, version 5.2.3790.3959, faulting module netman.dll, version 5.2.3790.3959, fault address 0x0000000000008d4f.
From a CPU perspective – below is an example Hyper-V server with multiple NIC’s. I set the rule and monitor which use this script to run every 30 seconds for demonstration purposes (they run every 5 minutes by default).
You can see WMI (and the total CPU) spiking every 30 seconds.
After disabling all the rules and monitors which utilize this data source, we see the following from the same server:
Based on these issues, I’d probably recommend disabling these rules AND monitors for Windows 2003 and Windows 2008. They seem to create a bit more impact than the usefulness of the data they provide.
To disable these monitor and rules:
Open the Authoring pane of the console.
Highlight “Monitors” in the left pane.
In the top line – click “Scope” until you see the “Scope Management Pack Object” pop up:
In the Look For box – type “Network”:
Tick the boxes next to “Windows Server 2003 Network Adapter” and “Windows Server 2008 Network Adapter” and click OK.
Now you will see a scoped view of only the monitors that target the windows server network adapter classes. Expand Windows Server 2003 Network Adapter > Entity Health > Performance:
You can see that Read and Write monitors are already disabled out of the box. You need to add a new override to disable the “Total” monitor. Set enabled = false and save it to your Base OS Override MP for Windows 2003.
Now, repeat this for the Server 2008 monitor for “Percent Bandwidth Used Total”.
After disabling the two monitors that run this script – we also need to disable the rules that also share this script. Highlight Rules in the left pane.
Again – the read/write rules are disabled out of the box, so you need to create two overrides for each rule, one for Server 2003 Percent Bandwidth Used Total, and then the same that targets Server 2008:
Peter – it is being evaluated for the next Base OS MP, but I dont have any timeline details. I disagree with you, however – disabling this SPECIFIC monitor and rules IS a valid workaround – as this is a new monitor that just showed up in this version, it was not present in any previous versions, so there was no customer dependencies on this monitoring. It was simply a value add monitor…. as are many additions to the base OS MP or any other MP over time. Keep in mind sometimes these issues require hotfixes for Windows as they arent always an OpsMgr issue – sometimes they are a core WMI namespace issue and the fix is up to the Windows team. I dont know for sure in this case.
@servergeek –
No – you don’t want to disable the rule that generates alerts when a script fails! You want to FIND the workflow called out in that alert, and disable/resolve that. In this case, you did not disable all the rules/monitors for the 2003 script for bandwidth….
or the agent has not received the override… or the override is not scoped properly.
The High CPU issue was fixed in a recent Base OS MP for Server 2008 and 2008R2. We still recommend leaving it disabled for Windows Server 2003.
The script error you are seeing is something different. This has always been a challenge gathering perfmon data for teamed NIC's because the teamed NIC is a virtual NIC and the driver instantiates the data into perfmon and WMI – and it may or may not match our discovered properties. Therefore – if you see these script failures for teamed NIC's – you should disable it for all teamed NIC's. You will notice that MOST perf data collections has always failed in SCOM for teamed NIC's…. we need to change how we discover teamed NIC's or get HP, Broadcomm etc… to use a standard. Microsoft now offers NIC teaming as part of the OS in Windows Server 2012 – so I imagine we will get that one right. 🙂
I have disabled the rules/monitors for 2003/2008 Bandwidth totals as described, but now I get alert Rule: Workflow Runtime: Failed to run a process or script Workflow name: Microsoft.Windows.Server.2003.NetworkAdapter.PercentBandwidthUsedTotal.Collection
This is a rule for health servive….so I don’t want to override a health service rule just because I did an override for total bandwidth…do I?
@JB – because BOTH rules and monitors run the script. If you dont turn everything off, the script will run and the potential impact will occur.
@Gary – feel free to come back and comment on your ticket outcome, or shoot me the details in email. I'm interested.
@Steve G: What version of the OS Management pack are you running? I will check.
What specific errors are you getting?
Hi
we have still the same problem. can anyone explain how to disable the script since i am new in SCOM!
Thanks
I’m not sure if this is the same issue or not, but I’m getting warnings from the bandwidthused module. The interesting error is this one
The class name ‘Win32_PerfFormattedData_Tcpip_NetworkAdapter Where Name =’vmxnet3 Ethernet Adapter” did not return any valid instances. Please check to see if this is a valid WMI class name.. Invalid class
I’m not getting this on all my servers, but the one that is throwing it is 2012 r2. running wbemtest and searching for that class yields nothing, as does using get-wmiobject.
That adapter is in fact installed
ServiceName : vmxnet3ndis6
MACAddress : 00:50:56:AA:BB:CC
AdapterType : Ethernet 802.3
DeviceID : 10
Name : vmxnet3 Ethernet Adapter
NetworkAddresses :
Speed : 10000000000
when I look in device manager I don’t see a hidden network adapter listed.
looking at my installed mp’s it looks as though i’m running version 6.0.7061.0 of the windows operating system library 2008, 2012 and 2012r2 as well.
Hey Kevin!
Is this problem still under investigation and is there a timeline for a fix? As Warren mentioned disabling monitoring is not a real solution.
Best Regards
Hi Kevin,
Is this issue still exist in BaseOS MP version 6.0.6972.0? (SCOM 2012)
Best Regards,
Gemmy
@GemmySit –
No. This is fixed in 6.0.6972.0 and is stated in the MP guide for the new MP and here: blogs.technet.com/…/opsmgr-mpupdate-new-base-os-mp-6-0-6972-0-adds-new-cluster-disks-changes-free-space-monitoring-other-fixes.aspx
Thx very much Kevin.
Why do u have to disable Rules AND Monitors? (Why not just the Rules?)
Cheers,
John Bradshaw
Kevin, saw your comment on the other blog. Greatly appreciate you looking in to this. I will keep the 2003 rules/monitors disabled and also disable the ones for 2008 as well so we hopefully alleviate the issue on those servers, even though I haven't seen it on any 2008 servers yet.
I've got a ticket open at the moment in regards to this issue so I will point them towards this post and see what they say.
Kevin, great article and very timely……those rules were definitely causing problems for a lot of my servers….especially on our Citrix servers…..I'd be interested to know what Microsoft plans to do to fix this….
We too are seeing similar impact on our servers with the associated service crashes. I have had a case open for some time with extra debugging on the netman.dll but to no avail – each server we have the debugging on we see no more crashes 🙁
The only solution for us will be to disable the rules and monitors. It absolutely looks like the SCOM agents are exposing a netman.dll bug but it's something we can't nail down here. I'll be interested if anyone else ever gets a real solution, other than disabling monitoring.
Kevin, apparently this monitor/rule is still causing issues with NIC Teaming and complaining about invalid VMI class: I went ahead and disabled these Monitors/Rules anyway, but was wondering based on your last comment if in fact this was/is fixed in the latest base OS MP?
Log Name: Operations Manager
Source: Health Service Script
Date: 10/9/2012 9:47:01 AM
Event ID: 4001
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: WEB06.prod.local
Description:
Microsoft.Windows.Server.NetwokAdapter.BandwidthUsed.ModuleType.vbs : The class name 'Win32_PerfFormattedData_Tcpip_NetworkInterface Where Name ='Internal:HP Network Team _1'' did not return any valid instances. Please check to see if this is a valid WMI class name.. Invalid class
Event Xml:
<Event xmlns="schemas.microsoft.com/…/event">
<System>
<Provider Name="Health Service Script" />
<EventID Qualifiers="0">4001</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2012-10-09T14:47:01.000000000Z" />
<EventRecordID>55675</EventRecordID>
<Channel>Operations Manager</Channel>
<Computer>WEB06.prod.local</Computer>
<Security />
</System>
<EventData>
<Data>Microsoft.Windows.Server.NetwokAdapter.BandwidthUsed.ModuleType.vbs</Data>
<Data>The class name 'Win32_PerfFormattedData_Tcpip_NetworkInterface Where Name ='Internal:HP Network Team _1'' did not return any valid instances. Please check to see if this is a valid WMI class name.. Invalid class </Data>
</EventData>
</Event>
Hello,
Is it still current to disable the rules for Windows Server 2003 with OS MP 6.0.7061.
Any other updates? SCOM 2007 so far
Thanks,
Dom
bump
currently have both rules and monitors disabled for 2003, 2008 and 2012 adapters and still getting errors on teamed nics with mp 7061. Is there any new rule/monitor in place in this version that also runs this silly script?
Kevin, we’re seeing this on 2012 r2 servers but there’s no mention of this covering 2012 servers?
should we be looking at disabling them for those too?
thanks
Kevin,
As you said the issue got fixed with the OS version 6.0.6972.0. But we have the OS MP base version is 6.0.7296.0 but still the alerts got generated. Is there a way to fix this issue instead of disable a rule/monitors for 2008.
Thanks.
@Vijay – what alerts are you speaking of?
I am talking about the below error:
Operations Manager failed to start a process
The process started in 8:04:49 could not create System.PropertyBagData. No errors detected in the output. The process ended with 0
Run the command: "C: Windows system32 cscript.exe" / nologo "Microsoft.Windows.Server.NetwokAdapter.BandwidthUsed.ModuleType.vbs" xxxxx true
Working directory: C: Program Files Microsoft Monitoring Agent Agent Health Service State Monitoring Host Temporary Files 2717 7992
One or more workflows affected by this.
Workflow name: Microsoft.Windows.Server.2008.NetworkAdapter.PercentBandwidthUsedTotal
If it is happening often on a lot of agents – it is a systemic issue and the only resolution would be to raise a bug with MS, disable it, or modify the script yourself. If this is localized to a small number of agents, then likely they are unhealthy, such
as problems with WMI, or resources.
Thanks for your info. i will get back to you if in case of anything.
Hi Kevin,
I have disabled the both rule and monitor but still CPU usage is 30
|
https://blogs.technet.microsoft.com/kevinholman/2011/12/12/opsmgr-network-utilization-scripts-in-baseos-mp-version-6-0-6958-0-may-cause-high-cpu-utilization-and-service-crashes-on-server-2003/?replytocom=2058
|
CC-MAIN-2018-47
|
refinedweb
| 2,415
| 64.71
|
Tutorial
How To Create a Laravel Contact Form and Send Emails with SendGrid easier for your visitors to contact you directly. For your contact form to work correctly and send out emails, you need an SMTP server. This tutorial will use SendGrid and their free SMTP service to deliver the emails sent out from the website contact form to an email inbox.
In this tutorial, you’ll add a contact form to an existing Laravel application and configure it to send emails via SMTP using SendGrid.
Prerequisites
If you don’t already have a Laravel application set up, you will need the following:
- Access to an Ubuntu 20.04 server as a non-root user with sudo privileges, and an active firewall installed on your server. To set these up, please refer to our Initial Server Setup Guide for Ubuntu 20.04.
- The LEMP stack installed on your server by following the How to Install Nginx, MySQL and PHP on Ubuntu 20.04.
- Composer to install Laravel and its dependencies. You can install Composer by following our guide on How to Install Composer on Ubuntu 20.04.
- Laravel installed and configured on your server. If you don’t have Laravel already installed, you can follow our How To Install and Configure Laravel with Nginx on Ubuntu 20.04 tutorial.
After you have set up your Laravel application, you’ll also need the following:
- A SendGrid account. You can visit the SendGrid registration page to sign up for a free SendGrid account.
- A fully registered domain name pointed to your server. This tutorial will use — Creating the Sender Identity
SendGrid requires you to verify the ownership of your domain name before allowing you to start sending emails. In order to verify your domain name, go to your SendGrid account, then go to the Dashboard and click on Authenticate your Domain.
This will take you to a page where you will need to specify your DNS host and choose if you would like to brand the links for your domain. Email link branding allows you to set all of the links used for click-tracking in your emails to your domain instead of from
sendgrid.net.
Then click Next and on the next page, specify your domain name.
Finally, you will need to add the DNS records provided by SendGrid to complete their verification process. For more information on how to manage your DNS records, you can read this tutorial on How to Create, Edit, and Delete DNS Records.
Once you have added the DNS records to your DNS zone, go back to SendGrid and hit the Verify button.
With your SendGrid Identity verified, you need to generate an API key, which you will use in your Laravel
.env file.
From the menu on the left, click on API Keys and then click on the Create API Key button. For security, set the API Key Permissions to Restricted Access.
After that, scroll down and add the Mail Send permissions.
Finally, click on the Create & View button to get your API key. The API key will only be visible once, so be sure to take note of it in a secure place.
Now that you’ve configured your domain with SendGrid and generated your API key, you’ll configure the SMTP details for your Laravel application.
Step 2 — Configuring the SMTP Details
The
.env file in Laravel is used to store various configuration options for your application environment. Since there is usually some sensitive information in the
.env file, like your database connection details, you should not commit the
.env file to source control.
If you completed the prerequisite tutorial, you’ll need to be in the
/var/www/travellist directory to access your
.env file:
- cd /var/www/travellist
After that, use your favorite text editor open the
.env file:
- nano .env
There are many configuration variables in the
.env file—in this tutorial you’ll only change the
To do so, find the
MAIL_ settings and configure the variables as following, adding in your copied API key to
sendgrid_api_key and updating the other highlighted fields as necessary:
. . . MAIL_MAILER=smtp MAIL_HOST=smtp.sendgrid.net MAIL_PORT=587 MAIL_USERNAME=apikey MAIL_PASSWORD=sendgrid_api_key MAIL_ENCRYPTION=tls . . .
The following list contains an overview of the variables that have to be updated in order for your Laravel application to start using the SendGrid SMTP server:
MAIL_HOST: The SendGrid SMTP hostname, which will be used for sending out emails.
MAIL_PORT: The SendGrid secure TLS SMTP port.
MAIL_USERNAME: Your SendGrid username. By default, it is
apikeyfor all accounts.
MAIL_PASSWORD: Your SendGrid API Key.
MAIL_ENCRYPTION: The mail encryption protocol. In this case you will use TLS as it secures the email content during the transfer between the servers.
Save and exit the file.
With your SMTP settings in place, you are ready to proceed and configure your contact controller.
Step 3 — Creating the Controller
Next you’ll create a controller that will handle your
GET requests for your contact form page.
You’ll use the
GET route to return the HTML page containing your contact form, and the
POST route will handle the contact form submissions.
In order to create a controller called
ContactController in Laravel, use the following
artisan command:
- php artisan make:controller ContactController
After running the command, you will get the following output:
OutputController created successfully.
This command will create a new controller at
app/Http/Controllers/ContactController.php.
Run the following to edit the
ContactController.php file:
- nano app/Http/Controllers/ContactController.php
First, you’ll include the Laravel
To include the Laravel
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Mail; . . .
Then add the method that will handle your
GET requests and return the contact page view:
. . . class ContactController extends Controller { public function contact(){ return view('contact'); } }
Finally, let’s add a method that will handle the
POST requests and send out the emails:
...!'); } }
Within the highlighted lines, you’ll need to change some of the variables, like so:
$message->from('youremail@your_domain');: Change the
youremail@your_domainwith your actual email address.
$message->to('youremail@your_domain', 'Your Name'): The
$message->toand the
$message->fromdo not necessarily need to match. You can also change the
$message->tovalue with another email address to which you would like to receive all of your contact form inquiries.
subject('Your Website Contact Form');: You can also change the email subject by editing the message inside the
subjectmethod.
Note: the
$message->from('youremail@your_domain'); address needs to match the domain name that you used with SendGrid.
Once you’ve finished these edits, the following will be your full
ContactController.php file:
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Mail;!'); } }
Save and exit your file once you’ve finished your edits.
Your Contact Controller has two methods:
contact(): This method returns your contact Blade view template, which will hold your HTML page that has the HTML layout for your contact form. Blade is the templating engine that comes with Laravel. In your Blade template views, you can add your HTML structure along with PHP code and Blade syntax.
contactPost(): This method handles all of the contact form submissions—where you handle the input validation and send out the emails.
You handle the validation inside the
contactPost() method with the
$this->validate() method. Inside the validation method, you specify that the
name,
comment are required. That way, your users will not be able to submit empty or incomplete contact form inquiries. For more information on how the Laravel validation works, take a look at the official Laravel Validation documentation.
When validation is successful, the
Mail::send() method constructs your email body and subject and then sends out the email.
Finally, if the email was sent successfully, you return a success message that displays to your users.
You’ve set up your contact controller and can now move on to
GET and
POST routes.
Step 4 — Creating the Routes
Laravel routes allow you to create SEO-friendly URLs for your application. By using Laravel routes, you can route your application requests to specific controllers, where you handle your application logic.
You’ll create two routes in your
routes/web.php file to use the methods you set up in the previous step.
You will first create a
GET route that maps to your
contact method in your
ContactController. This method only returns your
contact Blade view. Open
routes/web.php with the following command:
- nano routes/web.php
Add the
GET route at the bottom of the file:
Note: If you followed the prerequisites, you’ll have different content in you
routes/web.php file. You can add your routes to the end of this file as per the instructions in this tutorial.
<');
You’ll now add a
POST route and map it to your
contactPost method, which will handle your user contact form submissions:
<'); Route::post('/contact', 'ContactController@contactPost')->name('contactPost');
Once you have your Controller and Route ready, you can save and exit your file then proceed to the next step where you will prepare your Blade views.
Step 5 — Creating the Blade Views
In this step you will start by creating a view in the application that will hold your HTML contact form. It will have three input fields:
- Input field with type text for the email address of the user
- Input field with type text for the name of the user
- Text area for the comment
Create a file called
resources/views/contact.blade.php:
- nano resources/views/contact.blade.php
Then add the following content:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Contact Form with Laravel and SendGrid<> <div class="container"> @if(session('success')) <div class="alert alert-success"> {{ session('success') }} </div> @endif <form method="POST" action="/contact"> @csrf <div class="form-group {{ $errors->has('name') ? 'has-error' : '' }}"> <label for="email">Email address</label> <input name="email" type="email" class="form-control" id="email" aria- <span class="text-danger">{{ $errors->first('email') }}</span> </div> <div class="form-group {{ $errors->has('name') ? 'has-error' : '' }}"> <label for="name">Name</label> <input name="name" type="text" class="form-control" id="name" aria- <span class="text-danger">{{ $errors->first('name') }}</span> </div> <div class="form-group {{ $errors->has('name') ? 'has-error' : '' }}"> <label for="exampleInputPassword1">Comment</label> <textarea name="comment" class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea> <span class="text-danger">{{ $errors->first('comment') }}</span> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> </body> </html>
This is an HTML form with a
POST method to the
/contact route. When someone fills out the contact form, it’ll be handled by your
contactPost method.
The
<link> tag inside the
<head> tag is used to include Bootstrap. You’re using some styling for the HTML form. You can change the style of the form so that it matches the design of your website. For more information on how to style your website, you can take a look at our CSS resources page.
The form is wrapped up in different
<div> tags with classes from Bootstrap. You’re using the
<div> tags to create the structure of the contact form. For more information on how the
<div> tags work, check out the How To Use a <div>, the HTML Content Division Element tutorial.
Save and exit this file.
The next view that you’ll create is your email view.
Open the
resources/views/email.blade.php file:
- nano resources/views/email.blade.php
Then add the following content:
Inquiry from: {{ $name }} <p> Email: {{ $email }} </p> <p> Message: {{ $comment }} </p>
This contains the email content that will be sent to users that complete your contact form. Save and exit the file.
With the styling and views complete, you’re ready to go ahead and test the contact form.
Step 6 — Testing the Contact Form
To test the contact form, visit via your browser.
You’ll see the Bootstrap HTML form that you created in the previous step.
Complete all of the required fields and hit the Submit button. You will receive a green notification that the message was sent successfully.
You can test the form by submitting it without filling any of the fields. The validation that you added in your controller will catch that and it’ll inform you that the fields must not be empty.
Finally, you can check your email account and make sure that you’ve received the test email and you can see it in your inbox.
Conclusion
You have now successfully added a contact form to your existing Laravel website.
You can also find more information in the official Laravel documentation.
To make sure that your contact form is secure, you can install an SSL certificate for your website by following our guide on How To Secure Nginx with Let’s Encrypt.
To learn more about Laravel, check out our collection of Laravel resources.
|
https://www.digitalocean.com/community/tutorials/how-to-create-a-laravel-contact-form-and-send-emails-with-sendgrid
|
CC-MAIN-2021-31
|
refinedweb
| 2,155
| 63.9
|
GenSON is a powerful, user-friendly JSON Schema generator built in Python.
(Note: This is not to be confused with the Java Genson library. If you are coming from Java and looking for a Python equivalent, this is not it. You should instead look into Python’s builtin json library.)
Its power comes from the ability to generate a single schema from multiple objects. You can also throw existing schemas into the mix. Basically, you can feed it as many schemas and objects as you want and it will spit out one, unified schema for them all.
The generator follows these three rules:
GenSON is a Draft 4 generator.
It is important to note that the generator uses only a small subset of JSON Schema’s capabilities. This is mainly because the generator doesn’t know the specifics of your data model, and it doesn’t try to guess them. Its purpose is to generate the basic structure so that you can skip the boilerplate and focus on the details of the schema.
This means that headers and most keywords aren’t dealt with. Specifically, the generator only deals with 4 keywords: "type", "items", "properties" and "required". You should be aware that this limited vocabulary could cause the generator to violate rules 1 and 2. If you feed it schemas with advanced keywords, it will just blindly pass them on to the final schema.
The package includes a genson executable that allows you to access this functionality from the command line. For usage info, run with --help:
$ genson --help
usage: genson [-h] [-a] [-d DELIM] [-i SPACES] [-s SCHEMA] ... Generate one, unified JSON Schema from one or more JSON objects and/or JSON Schemas. (uses Draft 4 -) positional arguments: object files containing JSON objects (defaults to stdin if no arguments are passed and the -s option is not present) optional arguments: -h, --help show this help message and exit -a, --no-merge-arrays generate a different subschema for each element in an array rather than merging them all into one -d DELIM, --delimiter DELIM set a delimiter - Use this option if the input files contain multiple JSON objects/schemas. You can pass any string. A few cases ('newline', 'tab', 'space') will get converted to a whitespace character, and if empty string ('') is passed, the parser will try to auto-detect where the boundary is. -i SPACES, --indent SPACES pretty-print the output, indenting SPACES spaces -s SCHEMA, --schema SCHEMA file containing a JSON Schema (can be specified mutliple times to merge schemas)
Schema is the basic schema generator class. Schema objects can be loaded up with existing schemas and objects before being serialized.
import genson s = genson.Schema() s.add_schema({"type": "object", "properties": {}}) s.add_object({"hi": "there"}) s.add_object({"hi": 5}) s.to_dict() #=> {"type": "object", "properties": {"hi": {"type": ["integer", "string"]}}} s.to_json() #=> "{\"type\": \"object\", \"properties\": {\"hi\": {\"type\": [\"integer\", \"string\"]}}}"
Builds a schema generator object.
arguments:
Merges in an existing schema. Take care here because there is no schema validation. If you pass in a bad schema, you’ll get back a bad schema.
arguments:
Modify the schema to accommodate an object.
arguments:
Convert the current schema to a dict.
Convert the current schema directly to serialized JSON.
Schema objects can also interact with each other:
import genson s1 = genson.Schema() s1.add_schema({"type": "object", "properties": {"hi": {"type": "string"}}}) s2 = genson.Schema() s2.add_schema({"type": "object", "properties": {"hi": {"type": "integer"}}}) s1 == s2 #=> False s1.add_schema(s2) s2.add_schema(s1) s1 == s2 #=> True s1.to_dict() #=> {"type": "object", "properties": {"hi": {"type": ["integer", "string"]}}}
GenSON has been tested and verified using the following versions of Python:
When contributing, please follow these steps:
Tests are written in unittest. You can run them all easily with the included executable bin/test.py.
$ bin/test.py
You can also invoke individual test suites:
$ bin/test.py --test-suite test.test_gen_single
GenSON is written and maintained by Jon Wolver.
|
https://pypi.org/project/genson/
|
CC-MAIN-2016-44
|
refinedweb
| 651
| 57.37
|
java.util.Map, but,
mapas in map-reduce or map as in
scala.List.map. Of course all of us know what
mapis and
mapdoes, and how this powerful concept has been used in all functional languages that we use on a regular basis. I will talk maps in the context of its implementation, as we find in all the languages, which brings out some of the important principles of using tail recursion.
A couple of months back, there was a thread in the Erlang discussion list, where someone wondered why the implementation of map in Erlang stdlib Lists.erl is NOT tail recursive. Here it is, faithfully copied from Erlang stdlib ..
map(F, [H|T]) ->
[F(H)|map(F, T)];
map(F, []) when is_function(F, 1) -> [].
Clearly not a tail recursive one ..
The thread of discussion explains the rationale behind such implementation. And it has a lot to do with the compiler optimizations that have been done in R12B. Here is a quote from the Erlang efficiency guide, which explains the myth that tail-recursive functions are ALWAYS much faster than body-recursive ones ..
"In R12B, there is a new."
Since a tail recursive map needs to do a
reverse..
- the incremental space that it needs to keep both the lists makes it equally space consuming with the body-recursive version
- it puts pressure on the garbage collector, since the space used by the temporary list cannot be reclaimed immediately
The general advice is that you need to measure the timings of your use case and then decide whether to tail recurse or not.
I was curious enough to check what the Scala library does for
mapimplementation. Here is the snippet from
scala.List..
final override def map[B](f: A => B): List[B] = {
val b = new ListBuffer[B]
var these = this
while (!these.isEmpty) {
b += f(these.head)
these = these.tail
}
b.toList
}
It is not a functional implementation at all. In fact it adopts a clever use of localized mutation to achieve performance. Using mutation locally is a perfectly valid technique and a definite area where hybrid non-pure languages score over the purer ones. The contract for map is purely functional, does not have any side-effect, yet it uses localized side-effects for performance. This would not have been possible in Erlang. Neat!
Just for fun, I cooked up a tail recursive version of
mapin Scala, as a standalone function ..
def tr_map[B](f: A => B, l: List[A]): List[B] = {
def iter_map(curr: List[B], l: List[A]): List[B] = l match {
case Nil => curr.reverse
case _ => iter_map(f(l.head) :: curr, l.tail)
}
iter_map(Nil, l)
}
It performed very slow compared to the native librray version.
Scala also offers a
reverseMapfunction which does not need the additional
reverse, which the tail-recursive
mapwould require. And not surprisingly, the implementation is based on tail recursion and pattern matching ..
def reverseMap[B](f: A => B): List[B] = {
def loop(l: List[A], res: List[B]): List[B] = l match {
case Nil => res
case head :: tail => loop(tail, f(head) :: res)
}
loop(this, Nil)
}
So, how does the story end ? Well, as usual, benchmark hard, and then decide ..
13 comments:
If tail call optimisation could be efficiently done in the JVM, Clojure would have it.
Does the Scala compiler optimize for tail recursion? Because if it doesn't, using recursion may not be a good idea actually
The Scala compiler optimises out tail recursion if it's a tail call to the same method. Most other cases are unsafe because of separate compilation, so JVM support for it is important.
>It is not a functional implementation at all. In fact it adopts a clever use of localized
> mutation to achieve performance. Using mutation locally is a perfectly valid technique and a
> definite area where hybrid non-pure languages score over the purer ones.
All pure languages have generally ways to do that too. For instance Haskell allows you to do mutation and local state within the ST monad, a clever use of the type system ensure that the result is always externally pure (contrary to non-pure language where the proof of that is left for the developer). If you need to do really unsavory stuff, you can always revert to unsafe IO to have unrestricted side-effect (of course in this case you have to prove the external purity of your code by yourself).
It could also be noted that the map in Haskell isn't written in tail-recursive style but still execute in constant stack space thanks to the evaluation model (lazy evaluation). This is true of a lot of other interesting functions.
"All pure languages have generally ways to do that too."
Sure .. but it does not feel idiomatic to do side-effected programming in purer languages like Haskell. OTOH in non-pure languages like Scala, you don't feel out of the way to do localized mutation, as Scala.List does for most of its functions.
"map in Haskell isn't written in tail-recursive style but still execute in constant stack space thanks to the evaluation model (lazy evaluation)."
In Scala we have scala.Stream, which is a lzy List implementation. But Scala, unlike Haskell, is NOT lazy, by default.
"but it does not feel idiomatic to do side-effected programming in purer languages like Haskell."
Sure, that's the point !! We want to encourage keeping your style pure.
That said, I think you're overestimating the cost of using something like ST monad : it's just a matter of putting "runST" before monadic code that looks very much like imperative code in a traditional language.
There are some algorithms that are best written with mutable state, but they mostly use localized state that can be restricted to a ST function properly, getting the performance benefits without compromising the purity of the rest of your code.
"But Scala, unlike Haskell, is NOT lazy, by default."
I didn't say anything about the lazyness of Scala, just that one other way to get the same memory performance as tail-recursion in situation where you can't use tail-recursion can be lazy evaluation without the need for local mutation.
Don't you prefer this version of map to the first Scala version :
map f [] = []
map f (x:xs) = f x : map f xs
"I think you're overestimating the cost of using something like ST monad"
I think it is more of a mental setup working with Haskell - I have seen purists in Haskell world, frowning upon monad usage. But I do realize that the implementation cost is not much, and is statically verifiable.
"Don't you prefer this version of map to the first Scala version"
Sure I do and I like the terseness. Here is the corresponding Stream.map in Scala, not as terse, but still enough:
def map[B](f: A => B): Stream[B] =
if (isEmpty) Stream.empty
else Stream.cons(f(head), tail map f)
From my observation, only poor Haskell programmers frown at monadic code. That said, when there's no benefit from writing the imperative version, there's no benefit from writing the imperative version.
"when there's no benefit from writing the imperative version"
Sure .. for Scala implementation, there were 2 forces at play :
1. JVM is not the best of the platforms for functional programming (at least not yet .. tail recursion .. will it come with Java 7 ?)
2. Extracting the max of performance with the container classes, for which they had to go the imperative way.
In that process however, they have lost on the concurrency issue. Functional implementations are more easily parallelized, e.g. pmap implementation of Joe in Erlang. Mutating ones are not. List.map in Scala uses ListBuffer - hence u cannot parallelize map easily in Scala.
As a parallel map will do things in a different order than a sequential map, it's not generally safe to take a possibly-side-effecting mapping and make it work in parallel.
Also, the fact that List.map uses a ListBuffer has no bearing on what ParallelList.map (or List.parallelMap) might use.
"As a parallel map will do things in a different order than a sequential map, it's not generally safe to take a possibly-side-effecting mapping and make it work in parallel."
Are you talking about the input function of map being a side-effected one ? I think it is not a common practice - the function which you use in a map is strongly recommended to be side-effect-free. Otherwise map-reduce will not work.
"Also, the fact that List.map uses a ListBuffer has no bearing on what ParallelList.map (or List.parallelMap) might use."
The point I was trying to make is that had the implementation been functional (without any mutating data structure), I could have forked the function over the collection elements in parallel, possibly using actors. And then reduced them to a new collection. Refer to pmap implementation in Erlang. In the standard Scala List.map it is not possible, since it uses ListBuffer. It could have been possible if we used an Array instead, but in that case we would lose out on the performance, since Array.toList is O(n), as opposed to ListBuffer.toList, which is O(1).
From what I can gather, you can already do that forking. Unless the side effect escapes the implementation of map, it's quite safe to run it in parallel, i.e., it's reentrant.
Ricky -
Only one point .. map is an order preserving transformation, i.e. the result collection needs to preserve the order of elements according to the original collection. With Scala library List.map implementation that uses ListBuffer, you cannot guarantee this order efficiently during the gathering phase of the parallel map implementation. This can be done more efficiently using Arrays. I had blogged on this before.
|
https://debasishg.blogspot.com/2008/10/to-tail-recurse-or-not.html
|
CC-MAIN-2018-05
|
refinedweb
| 1,657
| 65.52
|
roho has asked for the wisdom of the Perl Monks concerning the following question:
C:\>ppm install Catalyst-Runtime
Downloading ActiveState Package Repository packlist...not modified
ppm install failed: Can't find any package that provides namespace::cl
+ean version 0.13 for Catalyst-Runtime
[download]
I verified that namespace::clean version 0.13 is installed. Not sure what this message means and what it's looking for. Has anyone run into this in the past? TIA
"Its not how hard you work, its how much you get done."
I verified that namespace::clean version 0.13 is installed.
How? cause ppm seems to think it's not, which probably means Perl thinks it's not. What does the following output?
perl -e"use namespace::clean 99"
[download]
Here's what I get, which is what I expected:
C:\>perl -e"use namespace::clean 99"
namespace::clean version 99 required--this is only version 0.13 at -e
+line 1.
BEGIN failed--compilation aborted at -e line 1.
[download]
That's weird.
I can't install namespace::clean (t/07-debugger.t fails), but it seems you managed to install a number of modules not available via the usual ppm (as far as I know). Why can't you use the same method to install Catalyst-Runtime?
This link shows an alternate way to solve the windows installation failed issue.
Lottery numbers
Sports results
Stock quotes
Election results
Health metrics (blood sugar/weight etc)
Social media ranking
Number of open source contributions
Number of books I've read
Other
Results (70 votes). Check out past polls.
|
https://www.perlmonks.org/index.pl/?node_id=828364
|
CC-MAIN-2020-10
|
refinedweb
| 266
| 68.77
|
Hello, I am having an issue with writing into into the register SPI_CR(for that matter any register). I cannot write into the register. I am new to Atmel and i dont how it works in this controller. Here is my code
#include "sam.h" //ptr = (unsigned int *)(0x40008000); unsigned int *ptr; unsigned int data; int main(void) { /* Initialize the SAM system */ SystemInit(); ptr = (unsigned int *) REG_SPI_CR; *ptr = 0x0000FFFF; data =*ptr; /* Replace with your application code */ }
Any help will be apreciated. Thanks
If you really need a pointer to the register it would be
(hint: don't cast, make the ptr a type that makes you program compile without warnings).
But normally you just write
or
BTW the value 0xFFFF does not make any sense for this register and it is a write only register.
/Lars
Top
- Log in or register to post comments
|
https://www.avrfreaks.net/forum/atsam4s-xplained-pro
|
CC-MAIN-2020-40
|
refinedweb
| 144
| 70.63
|
"lambda" is the 11th letter of the Greek alphabet.
upper case form, Λ
lower case form, λ :
\lambda x . * x x (in lambda calculus, assuming * has been
defined)
(lambda (x) (* x x)) (in Lisp and scheme)
\ x -> (x * x) (in haskell).
fn x => (x * x)
Also, it is the inspiration for the chain of gay book stores, Lambda Rising.
Λ is used in Computer Science as the null string in regular expression syntax. This led to its use for "free" edges in non-deterministic transition graphs.1
1: This leds to the evils of Λ-loops and Λ-circuits which are allowed in favour of rule simplicity but can be removed without changing the behaviour of the transition graph.
closure = lambda {|x| x + x}
closure = Proc.new {|x| x + x}
lambda {|x| x + x}.call 2 would return 4
def my_lambda(&block)
raise ArgumentError, "tried to create Procedure-Object without a block" if !block_given?
block
end
Lamb"da (?), n. [NL., fr. Gr. .]
1.
The name of the Greek letter
2. Anat.
The point of junction of the sagittal and lambdoid sutures of the skull.
Lambda moth Zool., a moth so called from a mark on its wings, resembling the Greek letter lambda (
© Webster 1913.
Log in or registerto write something here or to contact authors.
Need help? accounthelp@everything2.com
|
http://everything2.com/title/lambda
|
CC-MAIN-2017-04
|
refinedweb
| 220
| 75.1
|
Data Indexing and Selection
In Chapter 2,¶.
import pandas as pd data = pd.Series([0.25, 0.5, 0.75, 1.0], index=['a', 'b', 'c', 'd']) data
a 0.25 b 0.50 c 0.75 d 1.00 dtype: float64
data['b']
0.5
We can also use dictionary-like Python expressions and methods to examine the keys/indices and values:
'a' in data
True
data.keys()
Index(['a', 'b', 'c', 'd'], dtype='object')
list(data.items())
[('a', 0.25), ('b', 0.5), ('c', 0.75), ('d', 1.0)]
Series objects can even be modified with a dictionary-like syntax.
Just as you can extend a dictionary by assigning to a new key, you can extend a
Series by assigning to a new index value:
data['e'] = 1.25 data
a 0.25 b 0.50 c 0.75 d 1.00 e 1.25 dtype: float64
This easy mutability of the objects is a convenient feature: under the hood, Pandas is making decisions about memory layout and data copying that might need to take place; the user generally does not need to worry about these issues.
A
Series builds on this dictionary-like interface and provides array-style item selection via the same basic mechanisms as NumPy arrays – that is, slices, masking, and fancy indexing.
Examples of these are as follows:
# slicing by explicit index data['a':'c']
a 0.25 b 0.50 c 0.75 dtype: float64
# slicing by implicit integer index data[0:2]
a 0.25 b 0.50 dtype: float64
# masking data[(data > 0.3) & (data < 0.8)]
b 0.50 c 0.75 dtype: float64
# fancy indexing data[['a', 'e']]
a 0.25 e 1.25 dtype: float64¶
These slicing and indexing conventions
1 a 3 b 5 c dtype: object
# explicit index when indexing data[1]
'a'
# implicit index when slicing data[1:3]
3 b 5 c dtype: object
Because of this potential confusion in the case of integer indexes, Pandas provides some special indexer attributes that explicitly expose certain indexing schemes.
These are not functional methods, but attributes that expose a particular slicing interface to the data in the
Series.
First, the
loc attribute allows indexing and slicing that always references the explicit index:
data.loc[1]
'a'
data.loc[1:3]
1 a 3 b dtype: object
The
iloc attribute allows indexing and slicing that always references the implicit Python-style index:
data.iloc[1]
'b'
data.iloc[1:3]
3 b 5 c dtype: object
A third indexing attribute,
ix, is a hybrid of the two, and for
Series objects is equivalent to standard
[]-based indexing.
The purpose of the
ix indexer will become more apparent in the context of
DataFrame objects, which we will discuss in a moment.
One guiding principle of Python code that make up the columns of the
DataFrame can be accessed via dictionary-style indexing of the column name:
data['area']
California 423967 Florida 170312 Illinois 149995 New York 141297 Texas 695662 Name: area, dtype: int64
Equivalently, we can use attribute-style access with column names that are strings:
data.area
California 423967 Florida 170312 Illinois 149995 New York 141297 Texas 695662 Name: area, dtype: int64
This attribute-style column access actually accesses the exact same object as the dictionary-style access:
data.area is data['area']
True']
False
In particular, you should avoid the temptation to try column assignment via attribute (i.e., use
data['pop'] = z rather than
data.pop = z).
Like with the
Series objects discussed earlier, this dictionary-style syntax can also be used to modify the object, in this case adding a new column:
data['density'] = data['pop'] / data['area'] data
This shows a preview of the straightforward syntax of element-by-element arithmetic between
Series objects; we'll dig into this further in Operating on Data in Pandas.
data.values
array([[ 4.23967000e+05, 3.83325210e+07, 9.04139261e+01], [ 1.70312000e+05, 1.95528600e+07, 1.14806121e+02], [ 1.49995000e+05, 1.28821350e+07, 8.58837628e+01], [ 1.41297000e+05, 1.96511270e+07, 1.39076746e+02], [ 6.95662000e+05, 2.64481930e+07, 3.80187404e+01]])
With this picture in mind, many familiar array-like observations can be done on the
DataFrame itself.
For example, we can transpose the full
DataFrame to swap rows and columns:
data.T]
array([ 4.23967000e+05, 3.83325210e+07, 9.04139261e+01])
and passing a single "index" to a
DataFrame accesses a column:
data['area']
California 423967 Florida 170312 Illinois 149995 New York 141297 Texas 695662 Name: area, dtype: int64
Thus for array-style indexing, we need another convention.
Here Pandas again uses the
loc,
iloc, and
ix indexers mentioned earlier..
Any of the familiar NumPy-style data access patterns can be used within these indexers.
For example, in the
loc indexer we can combine masking and fancy indexing as in the following:
data.loc[data.density > 100, ['pop', 'density']]
Any of these indexing conventions may also be used to set or modify values; this is done in the standard way that you might be accustomed to from working with NumPy:
data.iloc[0, 2] = 90 data
To build up your fluency in Pandas data manipulation, I suggest spending some time with a simple
DataFrame and exploring the types of indexing, slicing, masking, and fancy indexing that are allowed by these various indexing approaches.
data['Florida':'Illinois']
Such slices can also refer to rows by number rather than by index:
data[1:3]
Similarly, direct masking operations are also interpreted row-wise rather than column-wise:
data[data.density > 100]
These two conventions are syntactically similar to those on a NumPy array, and while these may not precisely fit the mold of the Pandas conventions, they are nevertheless quite useful in practice.
|
https://jakevdp.github.io/PythonDataScienceHandbook/03.02-data-indexing-and-selection.html
|
CC-MAIN-2019-18
|
refinedweb
| 963
| 65.52
|
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Saving Multiple Settings in Single Array10:50 with Zac Gordon
In this video we look at how to save all of our options as a single array to save them in the database more efficiently.
- 0:00
When we create individual settings for each option that we have,
- 0:04
we also create new individual rows in the WP options table.
- 0:10
A more efficient approach to this is to store all of our options
- 0:14
as a single entry in the database, and combine the values as an array.
- 0:19
Let's take a look at how we would modify our code to take this slightly
- 0:23
better approach.
- 0:26
So far in this course, we've added three new settings.
- 0:29
What we wanna look at now is instead of adding three settings,
- 0:32
let's condense that down into one setting.
- 0:36
And we'll start off with the show slide show.
- 0:39
Instead of having this save as show_slideshow,
- 0:43
we're gonna change it to a common name of wpt_settings, plural.
- 0:48
Then we'll come down to where we have our callback function for
- 0:51
when we first start working with this settings field.
- 0:57
So the first thing is that instead of pulling in a single option,
- 1:00
what we're going to be doing is pulling in an array of options.
- 1:04
And we now have the name wpt_settings.
- 1:09
So now that we have this, we have to update where we are calling.
- 1:14
Option over here, we now have to call this options.
- 1:18
And we're going to save it, or we're going to access it as show slideshow.
- 1:24
The other update we need to make is right here where we have the name.
- 1:29
This is where we're actually going to tell WordPress that we're going to save this.
- 1:33
As an array, and we'll do it like this.
- 1:34
We'll say, WPT settings, and then inside of that show slide show.
- 1:44
So, what we've done now is we're going to be accepting an array of options,
- 1:49
and then checking for a single value within that.
- 1:54
And then when we save it, make sure that we're saving it as the main settings name,
- 1:58
and then the index of the array or
- 2:00
the specific value that we want to save this with.
- 2:04
So let's come back into our theme settings and let's see.
- 2:08
We have no show_slideshow offset for this options parameter.
- 2:15
So what this is saying is because this hasn't been saved yet,
- 2:18
if we just try to call get_option this on its own and nothing is there and
- 2:23
we try to reference it, that's fine because it's empty.
- 2:27
However, what we have to check is if options.
- 2:38
Show slideshow is not yet set.
- 2:44
Then we're going to need to set it, and we'll just give it a default value
- 2:48
equal to zero or we could say no, and that it should be false.
- 2:54
So when we refresh our page now, we can see, okay, this is default.
- 2:58
To know, we save it.
- 2:59
We should be able to uncheck it.
- 3:03
However, when we come onto the front end of our site,
- 3:07
this code is no longer working because when we uncheck this.
- 3:12
Our slideshow placeholder is still showing.
- 3:15
So let's come into our index file, and where we had show_slideshow
- 3:20
is now equal to, or was equal to get_option, this particular one.
- 3:24
We're going to change this a little bit.
- 3:26
[NOISE].
- 3:30
Do it like that.
- 3:33
And then, we can say, if option's, show,
- 3:38
wide show.
- 3:41
However, we can't just tech, check to see if it's true,
- 3:44
we also have to set, to check to see if it is set.
- 3:48
So, if is set.
- 3:50
[BLANK_AUDIO].
- 3:55
As well as, if it's equal to true, so
- 3:58
this is going to be that we have a value saved, and that value is equal to true,
- 4:03
because otherwise it's going to throw an error like we saw in the back end.
- 4:09
If there is no value for this set at all.
- 4:13
So when we refresh this, now we can see it's unchecked.
- 4:16
We check it.
- 4:18
Okay, back in business here.
- 4:21
Now what we need to do is come back into our functions.php, and
- 4:25
go through our other callback functions, and do some similar tests and
- 4:29
things like that, and updates.
- 4:31
So we'll update this now to instead of wpt_input_test,
- 4:36
we're going to save this as wpt_settings, and
- 4:42
for name we're going to call this similar to what we did up above.
- 4:49
And we'll do WPT settings, and
- 4:53
then we don't need to namespace the actual value since it's within the array.
- 4:58
Excuse me other way around.
- 5:00
Oh, I'm sorry, there are no quotation marks, single or double in this case.
- 5:04
So, it's not how you would write a normal PHP value because it's inside of the.
- 5:10
Name attribute you can't pass those extra distinguishing things,
- 5:14
however it will know when you pass this to save it as an array.
- 5:19
And then of course the value here we have is no longer going to be option,
- 5:24
but we'll make this plural.
- 5:25
[BLANK_AUDIO].
- 5:29
And then drill down into that array of input, test.
- 5:34
Now we don't have to run the same conditional statements here although if we
- 5:39
don't have this set we will run into an error so.
- 5:45
You could do something similar to this.
- 5:51
Another to approach to this is you could actually set default values.
- 5:56
When you create your options page.
- 5:57
Page where you create your plug in you can see,
- 6:00
hey are these things set in the database.
- 6:02
And if they're not, go ahead and create these default values.
- 6:05
And we're not going to get into that, but if you wanted to simplify your code
- 6:09
a little bit and not have as many of these checks in it, then you could just set
- 6:13
default values and then you'll always know that something is saved in there.
- 6:18
However, all we're gonna do is say,
- 6:21
if input test is not set, then we can just set that equal to empty.
- 6:27
Now let's take a look at this now in the back end.
- 6:29
Test, testing.
- 6:36
[BLANK_AUDIO].
- 6:39
And then just a quick test on the front end,
- 6:41
we're not gonna write all the conditionally code.
- 6:44
I'm just going to simply come down here and say, php echo
- 6:49
options test input.
- 6:55
And because I know I just saved a value here.
- 6:59
I could trust that it's gonna output.
- 7:02
Options, so we're pulling in options there.
- 7:07
We have our input call back.
- 7:13
We updated our name.
- 7:16
[BLANK_AUDIO].
- 7:19
Wonder if it is automatically saving it as this.
- 7:28
Now if we come to the front and we could see it's not echoing out.
- 7:34
So I'm gonna check this again, options test input.
- 7:37
If I come in to my field, it actually looks like we saved it as input test.
- 7:43
So let me just switch that around.
- 7:45
Testing, okay, so that's working as well.
- 7:48
I'm not going to leave this in because it has no conditional checks, and
- 7:51
we don't really need to access this, this value now.
- 7:54
We're just looking at how we would combine these into
- 7:57
a single setting in the data base.
- 7:59
So now, we're going to do the same thing, once again.
- 8:03
We can copy this code, here.
- 8:08
Write some sort of conditional logic.
- 8:13
And we'll call this one, option select test.
- 8:17
We can just set it equal to.
- 8:20
If there's nothing set, we'll just set it equal to,
- 8:22
one in this case because we know that, that's one of the default values.
- 8:28
And then when we have our name here, we need to change this to wpt_settings,
- 8:35
and using this format to say, select.
- 8:39
Test.
- 8:42
And then we're going to write this as options select_test as well.
- 8:49
We'll copy that s as well.
- 8:56
And then we paste that in.
- 8:59
And we should be good to check this on the front end as well.
- 9:03
You can see, let's save it as 1, saved as 1, we save it as 2, save
- 9:11
it as 2, it remembers that it's 2.
- 9:14
If we try to access it on the front end of the site.
- 9:18
[SOUND]
- 9:21
Two, three,
- 9:29
updated.
- 9:35
All right, at this point, you should have the basic,
- 9:39
fundamental skills you need in order to keep going with adding theme options.
- 9:46
We've shown how to create the different options,
- 9:50
how to access them on the front end of the site.
- 9:52
I'm going to delete this, by the way.
- 9:56
And finally, on how to save all of them as a single value in the database,
- 10:01
so now I can come back and delete these other register settings.
- 10:06
Because it will all be saved as a single wpt settings.
- 10:12
So this is a slightly more efficient way to go about this.
- 10:16
So before we wrap up the course, we want to take a quick look at how would we go
- 10:20
about adding in a setting to an existing admin area page and section.
- 10:26
As well as, how would we go about setting up some settings and
- 10:30
a page if we're trying to build a plugin, rather than a theme, and
- 10:34
don't need a theme options page.
- 10:37
So, in the next little section.
- 10:38
Let's go ahead and take a look at how to implement these two things quickly.
- 10:42
We won't be getting into more about the settings themselves.
- 10:45
But rather, different places that you could be adding these settings.
|
https://teamtreehouse.com/library/wordpress-settings-api/creating-multiple-setting-fields/saving-multiple-settings-in-single-array
|
CC-MAIN-2016-50
|
refinedweb
| 1,946
| 88.67
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.