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
|
|---|---|---|---|---|---|
Using iText's PdfPageEventHelper with ColdFusion
Update 11/05/2009:
A Better PdfPageEventHandler with JavaLoader's CFCDynamicProxy
A poster named Lemonhead recently mentioned using an iText helper class called PdfPageEventHelper from ColdFusion. If you are not familiar with it, PdfPageEventHelper is a java class that you can extend, and use to perform tasks like adding headers and footers to a PDF file.
I had never used this class with ColdFusion before, so I created a very simple example to show how it works. You can find a full java example on the iText site.
Due to the way PdfPageEventHelper is designed, I could not just call it from ColdFusion. I had to delve into some java and create my own class that extends it. The same way you extend a cfcomponent. So I opened Eclipse and created a new java project. (I love the fact that I can use Eclipse for both ColdFusion and Java projects!). Then I added the iText jar (version 2.0.7) to my project. Other versions should work as well, as long as they are new enough to contain the PdfPageEventHelper class. The built in version that ships with ColdFusion 8 does not.
Next I created a java class that extends PdfPageEventHelper. Then I overwrote the onEndPage method. The onEndPage method is trigged just before iText adds a new page. So it is the recommended spot for placing code that adds headers, footers, etcetera. I placed a few lines of code inside onEndPage that will add a given string (and page number), to the footer of each page. Nothing fancy. Finally, I compiled the class and exported it as a jar file that I could use from ColdFusion. That was it for the java side of things.
Since the PdfPageEventHelper class is not included in the ColdFusion 8 iText jars, I had to use the JavaLoader.cfc to load a newer version of iText, and the jar I created in Eclipse. If you run the CF example below, it will generate a simple PDF file with a silly reddish-pink footer on each page ;)
Well, that is all she wrote. A special thanks to Lemonhead for introducing me to something new! As this is my first foray into using the PdfPageEventHelper with ColdFusion, comments / corrections / suggestions are welcome!
See also Prerequisites / Detailed instructions
Java Code
package itextutil;
import java.awt.Color;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.ExceptionConverter;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPageEventHelper;
import com.lowagie.text.pdf.PdfWriter;
public class MyPageEvent extends PdfPageEventHelper {
private String footerText;
private Color textColor;
private float textSize;
protected BaseFont textFont;
public static void main(String[] args) {
String outFile = args[0];
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outFile));
writer.setPageEvent(new MyPageEvent("Testing Footer stuff", 6, new Color(255, 80, 180)));
document.open();
for (int i = 0; i < 10; i++) {
document.add(new Phrase("The best way to be boring is to leave nothing out. "));
if (i < 10) {
document.newPage();
}
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (DocumentException e) {
e.printStackTrace();
}
document.close();
System.out.println("Done creating file " + outFile);
}
public MyPageEvent() {
this("Page ", 6, new Color(0, 0, 0));
}
public MyPageEvent(String footerText, float textSize, Color textColor) {
this.footerText = footerText;
this.textSize = textSize;
this.textColor = textColor;
}
public void onOpenDocument(PdfWriter writer, Document document) {
try {
this.textFont = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
}
catch (DocumentException e) {
throw new ExceptionConverter(e);
}
catch (IOException e) {
throw new ExceptionConverter(e);
}
}
public void onEndPage(PdfWriter writer, Document document) {
PdfContentByte cb = writer.getDirectContent();
cb.saveState();
String text = footerText + " " + writer.getPageNumber();
cb.beginText();
cb.setColorFill(textColor);
cb.setFontAndSize(textFont, textSize);
cb.setTextMatrix(document.left(), document.bottom() - 10);
cb.showText(text);
cb.endText();
cb.restoreState();
}
}
ColdFusion Code
<h1>PdfPageEventHelper example</h1>
<cfscript>
savedErrorMessage = "";
// all file paths are relative to the current directory
fullPathToOutputFile = ExpandPath("./PageEventHelperResult.pdf");
// settings used for dynamic footer text
Color = createObject("java", "java.awt.Color");
footerText = "BOREDOM ALERT! BOREDOM ALERT! Page number ";
footerTextColor = Color.decode("##cc0000");
footerFontSize = 12;
// get instance of javaLoader stored in the server scope
javaLoader = server[MyUniqueKeyForJavaLoader];
// step 1: create a new document-object. uses U.S. letter size pages
document = javaLoader.create("com.lowagie.text.Document").init();
try {
// step: create an instance of our custom page event
// class and add it to the PdfWriter
pageEvent = javaLoader.create("itextutil.MyPageEvent").init(
footerText,
javacast("float", footerFontSize),
footerTextColor
);
writer.setPageEvent( pageEvent );
// step 4: open the document and add a few sample pages
phrase = javaLoader.create("com.lowagie.text.Phrase");
totalPages = 10;
document.open();
for (i = 1; i LTE totalPages; i = i + 1) {
document.add( phrase.init("The best way to be boring is to leave nothing out. ") );
document.add( phrase.init("The best way to be boring is to leave nothing out. ") );
document.add( phrase.init("The best way to be boring is to leave nothing out. ") );
if (i LT totalPages) {
document.newPage();
}
}
}
catch (Exception e) {
savedErrorMessage = e;
}
// close document and output stream objects
if ( structKeyExists(variables, "document") ) {
document.close();
}
if ( structKeyExists(variables, "outStream") ) {
outStream.close();
}
WriteOutput("Done!");
</cfscript>
<!--- show any errors --->
<cfif len(savedErrorMessage) gt 0>
Error. Unable to create file
<cfdump var="#savedErrorMessage#">
</cfif>
7 comments:
Hi,
Thanks again for your blog - I have found lots of useful stuff here.
I have been experimenting with the page helper technique outlined in this post and have that working well.
I can get a reasonable amount of flexibility by passing the style info in a similar way to your example.
However, it occurs to me that an improvement would be if you could get the onPageEnd listener in the java to call a CF function that you plugged in, and then do all the end page stuff in CF rather than java. For example, you could define what your header and footer looks like dynamically and on a pdf by pdf case instead of having to recompile the java whenever you wanted a different type of header / footer that wasnt covered by the style data you pass in.
Something like:
pageEvent = javaLoader.create("itextutil.MyPageEvent").init( myCF_onEndPageFunc);
I am only a java dabbler at this stage so I dont know if that could be done. Do you know if you can pass cf functions to java so that you can tell the onEndPage method in the java class to call the cf function?
Thanks,
Murray
@Murray,
Interesting idea. Since CF functions are classes themselves it is probably possible.
I have not thought through all of the ramifications. But the first one that comes to mind is that the "function" class is internal to CF (ie undocumented). So its usage incurs the usual risk of the application breaking if anything changes in a future version.
@Murray,
Since you peaked my interest, I will put together an example later. Just to see how the idea plays out ;-)
Cool, I look forward to what you discover.
Thanks,
Murray
because if that works, it opens the way to creating a generic pageEvent jar for onStartPage, onCloseDocument etc. That would be cool!
@Murray,
What do you know? It works. I still do not know if there are other issues, aside from the undocumented part. But it is a pretty cool concept.
I will clean up the code an post it tomorrow. (It needs a little explanation).
(Now if only I could spell "piqued" ;)
@Murray,
I posted Part 1. I will post the second half tomorrow.
Thanks again for the idea!
|
http://cfsearching.blogspot.com/2008/03/using-itexts-pdfpageeventhelper-with.html
|
CC-MAIN-2017-39
|
refinedweb
| 1,267
| 51.14
|
This has to do with ThreadSafe Components. The error is the assumption that
there will never be more than one Component that implements a class if it
is ThreadSafe. This is not true. The case and point is that there are
now three components whose role implement CocoonComponentSelector which is
by definition ThreadSafe. This means that the three needed instances with
very different Configurations are never generated. It is always the same
instance.
If the "markup-languages" is processed first (as currently the case), you
can find all of it's components. If the "programming-languages" is processed
second (as is currently the case), you cannot find any of it's components.
What's worse, the ComponentSelector is kind of a "namespace" for identical
Components--if we came up with a markup-language named "java" and all instances
of ComponentSelector were merged, it would conflict with the programming-language
named "java".
I am correcting this issue now.
|
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200101.mbox/%3C3A65E1E5.7090509@apache.org%3E
|
CC-MAIN-2016-40
|
refinedweb
| 157
| 56.35
|
The
__import__() dunder method is useful when importing modules dynamically. In other words, It can be used to import modules when you aren’t sure what needs to be imported ahead of time. This lesson will show you how to use
__import__() , how to use Python strings to initialize imports as well as how dynamic imports affect scope.
Dynamic Imports With __import__
The
00:00 Another thing with that particular import style, what it allows you to do is something like this. Let’s quickly just get out of here real fast. Let’s go back in.
00:08
We’re going to go
import sys, and then we’re going to go
foo is equal to a string called
'delorean',
00:16
and then we’re going to go
delorean is equal to
__import__(foo).
00:25
So when we go
dir(), we have
'delorean', so we can go
delorean.Delorean(),
00:33
and that’ll give us the object that we asked for. Now, the thing that you need to notice there is that…
'foo' you can ignore here because we’re in an interpreter, so anything that gets put here—it’s in our scope, so that makes sense.
00:45 But what the interesting thing here is that we use the string to initialize the import. This is kind of useful for things when you need to dynamically import things, and you’re not particularly sure what needs to be imported.
00:56
So you could have, like, a dictionary of various objects, like so. You could have
'foo' and that is equal to
'delorean', and then you can have some type of lookup when doing imports.
01:08
And that’s the real use of that type of import. There’s another way to do it in
importlib, which I think is called
import_module(). It provides the same functionality, which I would suggest that you use, but that is another talk altogether.
01:22
Another thing to note, with the
from syntax, if you do something like this… We’re going to go back into the Python interpreter. We’re going to go
from delorean import Delorean.
01:35
So when you do your
dir(), there is no
'delorean' object there, so when you do anything like this, you know that the module is not in scope either, so that’s the whole difference now. So you’d have to do something like this, and then you’d call, and the object is no longer there.
Become a Member to join the conversation.
|
https://realpython.com/lessons/dynamic-imports/
|
CC-MAIN-2021-17
|
refinedweb
| 428
| 78.48
|
so for my test result it generating 3 reports and the one that has both of the test is blank though and the other 2 have the individual test results. Is there a way to have results appear in just one report? Or atleast have the results appear in one html file.
This is what I have in the Test Suite:
Code:
import random
import shutil
import os
import xlrd
import BidsAndOffersModule
from SubmittingOffer
from SubmittingOffer
#from ddt import ddt, data,unpack
import utils
import HTMLTestRunner
import unittest
outfile = open("RunMultip
runner = HTMLTestRunner.
loader = unittest.
suite1 = loader.
suite2 = loader.
all_suite = unittest.
runner.
I tried to replace (in the individual tests)
suite = unittest.
outfile = open("Submittin
myrunner = HTMLTestRunner.
with this
if __name__ == '__main__':
unittest.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
-
- Last reply:
-
|
https://answers.launchpad.net/sikuli/+question/696217
|
CC-MAIN-2021-39
|
refinedweb
| 144
| 53.61
|
Details
Description
I don't know how difficult this would be to implement, but it would be handy to
have a user-definable set of "default" project settings that cascade into the
setting for real projects. Real project can override the cascaded properties as
they see fit.
For example, almost every one of my projects uses the Sventon repository
browser. When it is enabled they all point to the same URL and the same
repository instance. When I start a new project I have to set up Sventon with
these properties (with out typos). It would be easier to have the project
automatically aquire these setting from the cascade.
If at some later date I was to move Sventon to a new location I would like to be
able to change the settings in one place (the top of the cascade) and have all
the projects pick up the change. Currently I would have to edit all of the
projects individually (with out making mistakes).
In the few cases where I do not need the cascaded setting I would like to be
able to override them in the individual projects.
I've used Sventon in my examples, but in practice I always publish JavaDocs and
Junit reports to the same location (relative to the project). I always pick up
the Cobertura coverage report from the same location. I poll the source
repository at the same time schedule. I use the same project-based security for
most of my projects (there are a couple of projects where I need to give
people less access rights).
More importantly I always want the "Trigger even if build is unstable" setting
to be turned on for all projects (I want to see how unstable builds effect down
stream projects). However, we only get this option when we assign the first down
stream project and it's default is off. Since I'm usually concerned with
configuring the down stream project at this point it's easy to forget to set
this flag.
Issue Links
- is duplicated by
JENKINS-3314 <import file="..."/> to inherit portions of configurations
JENKINS-2419 Central configuration, overrides for specific job
JENKINS-2971 Allow for global trigger confiuration in mail-ext plugin
JENKINS-4516 Allowing job-configuration on group-level
- is related to
JENKINS-14185 Provide global configuration of settings
Activity
The template-project plugin can do part of this.
It doesn't do repository browsers yet, but that certainly is a reasonable
extension. Have a look at it, see if it meets your needs and feel free to raise
specific feature request against that plugin.
What I'm suggesting is more then a template (although that would be a good
start). The important difference is that the project doesn't copy the default
values, it references back to them. If the values in the template are changed
then they are reflected in all projects that have already been derived from
them. I can see a couple of uses for this:
1) Migrating resources such as the Sventon URLs.
2) Updating e-mail notification lists if a project leader were to leave.
Ok, these are reasonably trivial to change by editing the raw XML, but something
like a global change to the project security settings or code coverage
requirements is no so easy to implement by editing raw html.
From a GUI POV I had though that setting up the cascade would be just like
editing a regular project. The user would be able to set values exactly as they
do now.
To use the cascade the project would have an extra property to say which cascade
they are taking values from. Then the project would be given an extra option to
use cascaded value for each of the setting or over ride it with a specific
value. This could be done with a check box to enable or disable the options. It
would probably be a good idea if the cascade were the default.
I don't think it would be a good idea to allow user to change the cascade while
editing the derived project though. That would be far to complex for GUI, and
probably the user as well.
An interesting question would be how many levels of cascade would be allowed
(can you define a cascade based upon a another cascade?). Personally I think
that would be over kill.
Anyway that's just my two cent.
We have created a disabled project called ProjectTemplate and any new projects
created are copies of that rather than new ones in their own right.
But as we are increasing our usage of Hudson then we are looking to turn on
things like Cobertura or Checkstyle report publishing, and applying that to all
the projects is a pain.
Perhaps one approach would be to have a configuration set that can be applied to
a project. Configuration sets would then be a centrally managed config that can
be edited in one place and applied rather than implementing a hierarchy. I
suppose this is analogous to the config in CruiseControl where you can define a
project template in the XML, and changes made to that are applied to all the
projects for that definition.
- Issue 2419 has been marked as a duplicate of this issue. ***
Copied discussion from issue 2419
I think that normally, companies define certain quality goals and use Hudson's
plugins to achieve them. However, defining the same configuration over and over
again for every job is something that IMHO needs to be fixed.
One possible solution would be a "master" job which is configured once. All
dependent jobs can then override any configuration, if they want to.
As far as I can see (being new to Hudson), this has been requested on the
mailing list before, but I didn't find any enhancement request in here.
------- Additional comments from cristalp Fri Nov 14 12:19:50 +0000 2008 -------
See also the discussion on
------- Additional comments from jeffjensen Sun Feb 8 18:12:51 +0000 2009 -------
I agree. We should be able to specify defaults for all project and plugin
settings, and only need to change them per project configuration as necessary.
This saves on initial setup and maintenance time.
- Issue 3314 has been marked as a duplicate of this issue. ***
i have copied from #3314.
It is probably not the best solution - not GUI based. But probably easier to
implement because it exists in ANT and CC.
I was thinking about storing common configuration in common_config.xml and then
import it into the config.xml of the specific project. So it could look like:
<project>
<property name="projectname" value="version"/>...
<import file="../common_config.xml"/>
</project>
When the common_config.xml can be something like:
<project>
....
<customWorkspace>C:\Ivy\apache-ivy-2.0.0\src\example\multi-
project\projects\${projectname}</customWorkspace>
<project/>
So it actually comes down to 2 things
Importing XML files
custom properties support
Does it makes sense?
- Issue 2971 has been marked as a duplicate of this issue. ***
- Issue 346 has been marked as a duplicate of this issue. ***
- Issue 4516 has been marked as a duplicate of this issue. ***
I helped implementing the templating feature in CruiseControl.
I've not looked at the hudson's internal enough but maybe something similar could be implemented in hudson?
The constraint for Hudson is getting the UI right. In contrast to CruiseControl, Hudson users never need to edit XML files when setting up jobs - all configuration is done through the web UI. This is a feature we want to maintain going forward.
As a matter of interest, is there some thing wrong with the suggestion for the GUI I described on 27/Feb/09? Basically:
1) Setting up cascade would be done with exactly the same GUI we currently currently use for defining a project
2) When creating a new project we get an extra option to create from cascade. Hudson will could provide a list of available cascades in a drop down
3) When filling in a cascaded project there could be a check box on the left hand side to enable/disable the cascade for each setting. If the cascade is enabled the GUI widgets to the right will show the cascaded values, but will be greyed out. If the cascade is disabled for that setting, the GUI widgets are available for the user to modify.
The important thing in step 3 is that the greyed out values are always the current cascade settings, and not the values when the project was created. That is we reference the current values, rather then copy them
Thanks
+1 to stormcloud's description
+1 to stormcloud's description as well. I would love this feature!
Maybe a similar behavior could be achieved by extending the "Configuration Slicing" plugin. Right now you can propagate some configurations like "Time trigger" and disabling a job, but it would be great to set / modify one or more parameters.
It would really help me if you cascade the "Invoke Ant" part of the "Build" section of the configuration.
This has been implemented in Hudson:
Any chance of porting this feature to jenkins?
For the projects I'm working this feature would be exceptionally useful, for many different builds were there are just slight tweaks to the build & test cycle to cover all variants.
We should decide between Hudson and Jenkins and we extremely need this feature. So I'd like to ask that will this feature implemented in the near future in Jenkins? Thanks for your answer!
I rely on this in my Hudson installation. Looks like I can't upgrade to Jenkins as a "drop in replacement" for Hudson according to
Is this ever going to be ported from Hudson to Jenkins?
I really need this feature. I have nearly 200 jobs and I can't manage to update specific cobertura threshold, defined at the company level and recently updated. And this is only an example of planned modifications.
Any updates on this one?
Do you plan to merge this feature from Hudson?
Seeing this issue has been opened and unassigned for more than 4 years
, I highly doubt that the cascading project feature added by Oracle in Hudson will ever be ported to the Jenkins core or as a free plugin.
In fact, an equivalent feature has been available since 2011 as part of the Jenkins Enterprise offering by Cloudbees, and is known as the 'Jenkins Enterprise Templates plugin':
See
This commercial offering also benefits from the complementary 'Folders' and 'Role based access security' plugins that greatly simplify the administration of large Jenkins installations with hundreds or more jobs.
What really is a pity is that, although the 'Folders' plugin is now available with a free licence (see), the 'Templates' plugin is not.
With a templating/cascading configuration feature being such a basic requirement of a CI server, IMHO it really should be included in the core Jenkins, along with the Folders plugin as well for that matter, and possibly the Role-based access plugin too ...
I mean, if you look at good old Apache Continuum, it's been featuring Project groups, Build definitions and common build schedules, and project-based security from the beginning...
The "Inheritance Plugin" is not perfect but seems to mostly solve this problem.
Unfortunately creating a GUI to edit heritable settings can be tricky.
|
https://issues.jenkins-ci.org/browse/JENKINS-3157?focusedCommentId=140885&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
|
CC-MAIN-2015-14
|
refinedweb
| 1,895
| 61.36
|
US Consumer Bureau Opens Online Credit Card Complaint DB
timothy posted more than 2 years ago | from the about-those-jerks-at-citibank dept.
?!?!?!?! (4, Insightful)
zero.kalvin (1231372) | more than 2 years ago | (#40369841)
Re:Seriously ?!?!?!?! (2)
SydShamino (547793) | more than 2 years ago | (#40371325)
Next time you vote, remember which party created this bureau and which keeps try to block it or defund it. Despite what a big pile of slashdot users regularly say, there are still differences between the major parties.
Banamex / MasterCard (3, Informative)
John Bokma (834313) | more than 2 years ago | (#40371705)
I live in Mexico for nearly 9 years now. Last November my Banamex bankcard got stolen. This was reported in less than an hour at a nearby "sucursal" of Banamex (in the same shopping mall). A few days later my wife and I discovered that about 27,000 MXN (about 2,000 USD) had been withdrawn in two shops in the time between the cards got stolen and reported.
So we went to the bank to report this. We talked to the bank manager (or supervisor), since we had talked to him earlier how to get money. Once your card is blocked you can only get money in the bank with identification, a copy of your contract (which they had on electronic file), and max. 3000 MXN (about 219 USD) for "security reasons" (right). Anyway, he couldn't care less, or that was our impression, but we ended up with a nice lady who really wanted to help us out, but was powerless against the unbelievable crappy way Banamex deals with customers in cases like this.
There are two ways to report incidents like this: the "fast" way: reporting it by phone. And the slow way (or in my current experience the "forget about it" way) by paper. We were allowed to use the bank's phone, so we called Banamex. And called. And were put on hold. And when finally someone who could speak English was found -- I don't speak Spanish very well -- I was put on hold, or got disconnected (again). After 4 (!!!) hours of this we had to leave the bank since they really wanted to close down.
We also went to one of the places they had shopped: Sam's Club. While we asked how it could happen that people could shop with my card the guy told us happily about how cards are cloned. I got the impression he was more into how cool this all was and what not instead of how "cool" is was for us, just before Christmas. Anyway, we learnt that 2 iPads had been bought at Sam's.
The next day we went to the bank building I had opened my account with. After 2 hours of more of the same, and worse; at one point I talked to someone in English who plainly stated she couldn't help me after it had taken nearly 20 minutes to get transferred to her, we decided to take the slower paper route. We filled in a form, I signed it, and hoped for the best. This was the 2nd of December
Right now? Still no money back. Even in Mexico the banks are insured for fraud (Banamex for 72 hrs after theft, if I understand correctly). We have contacted Banamex in every possible way, even via Facebook. I have contacted MasterCard, it's their shiny logo that's on my bankcard, but while they told they would escalate things with Banamex so far nothing has happened... Last resort seems to be CONDUSEF, but this being Mexico I don't have a good feeling about this (I do have some experience with PROFECO; an organizations that seems to "protect" consumer's rights).
What surprises me is the piss-poor "security" of bank cards. They are cloned in seconds, and it wouldn't surprise me if the data is transferred via the Internet to a different location; the trip from the mall were the card was stolen to Sam's Club, where the iPads were bought, takes probably 10+ minutes and what I recall from the time stamps they got there unbelievable fast.
A lot of companies get away with a lot. I don't understand why MasterCard can't put more pressure on Banamex; it's their logo on the card that got stolen. Is this logo just a meaningless shiny sticker? And I don't understand by Banamex behaves this piss poor; they are insured.
well damn (2)
Tmann72 (2473512) | more than 2 years ago | (#40369913)
Re:well damn (1)
NevarMore (248971) | more than 2 years ago | (#40369949)
Why do you have to complain to some board? Can't you just cancel the account, get a new card from a new company, and transfer the balance?
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370025)
dont cancel the card, just pay it off and stop using it. The amount of open credit and the length of time you have had that credit card affect your credit score.
Re:well damn (1)
FictionPimp (712802) | more than 2 years ago | (#40370145)
I've never understood the reasoning with why closing a 0 balance credit card should lower a credit score.
You would think the credit tracking companies would look at you closing a high interest, high limit, card as a good thing. It's like saying paying off a mortgage should lower your credit score.
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40370251)
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370353)
" 5 years of no significant credit looks way better than 1 year. "
Really? To me it looks like a bad customer who doesn't add anything to our coffers.
Re:well damn (1)
a90Tj2P7 (1533853) | more than 2 years ago | (#40370383)
I've never understood the reasoning with why closing a 0 balance credit card should lower a credit score.
...It's like saying paying off a mortgage should lower your credit score.
Because [that part of it] is about how much unused credit you've got, how low your debt:credit ratio is. They're looking at how you use revolving credit, not how fast you pay off a debt like a mortgage.
Re:well damn (1)
fuzzyfuzzyfungus (1223518) | more than 2 years ago | (#40370393)...
Re:well damn (2)
Loki_1929 (550940) | more than 2 years ago | (#40371639)
If you think of your credit rating as a metric of your utility as a customer for credit services, rather than as a metric of how good you are at paying off debts, it sometimes makes a bit more sense.
But that's wrong. It only makes sense when you look at the credit score for what it is: a measure of how likely you are to keep to the terms of credit extended to you at a given time. Anything else is hogwash and won't make sense when you know what goes into the score. People with middle-of-the-road credit are the best customers for credit services. They pay higher fees, higher interest rates, and often make a late payment or two (which adds even more fees and higher interest rates). People with very high credit scores often give creditors very little actual profit. You have to offer them super low rates with no fees and they generally aren't going to give you any further opportunities to get more out of them. They're a reliable source of very, very little income for creditors. As such, the credit score is a rating of how likely it is you'll stick to the letter of the agreement between you and the creditor for the life of the account (as of the moment when the score is pulled)....
Now this isn't entirely right either. Certain lenders deal only in certain arenas. Some have a niche dealing with bad-credit customers. They work in fees and rates that build in what basically amounts to default insurance for the company. They're willing to put up with x% defaulting because they have so much profit coming in from the people who are actually paying that it all balances out and they can make good money. You also have broad-base lenders (Honda's credit arm is actually one of these) who'll lend to just about everyone, letting everyone cover each other's risk via volume and slightly higher (but still pretty good) rates and fees. I've hardly ever seen a creditor operating exclusively at the high end. Those who do often serve the high rollers with outstanding credit and charge huge (relative to what I make) fees for crazy levels of service. Most creditors would rather have a mix of mid and high credit scoring customers. It allows them to balance risk and show a decently safe and stable balance sheet....
Actually, any unreliable behavior (30 day late, etc) knocks your score down in a hurry. Someone with a score approaching 800 might see a 30+ point drop from being 30 days late on any one given account. The problem with being perfect all the time is that any sign of weakness makes it look as though you may have a house of cards about to come falling down. Still, from a consumer's point of view, having that high score is always the best for you. Over about 760 or so (780 for some lenders), you'll have access to virtually free credit for nearly anything you want to buy. You still have to be smart about what you do and not assume you'll get perfect rates to match your perfect score. Your first offer typically won't reflect your score; you need to shop around to find the truly gorgeous offers.
Re:well damn (4, Informative)
Loki_1929 (550940) | more than 2 years ago | (#40370853)
I've never understood the reasoning with why closing a 0 balance credit card should lower a credit score.
It doesn't necessarily; at least not immediately. Closing a revolving credit account with a zero balance changes your debt:total credit ratio among your revolving accounts. If you have a $0 balance on a $10,000 limit card and a $750 balance on a $1,000 limit card, and you then close the account for the $10,000 limit card, your total revolving credit utilization has gone from 7% (which is actually better than 0% usage) to 75%. Using 75% of your revolving credit is a major red flag that says you're over-extended and may be getting into trouble. FICO scoring has no memory when it comes to revolving account balances. It doesn't give you credit for going from 80% utilization to 10% utilization in a month; it merely gives you one score based on the 80% and one score based on the 10%. Likewise, it does not penalize you for going from 10% to 80% (though you'll take a hit just for being at 80% usage).
The other part of that comes in later. A fairly sizable chunk of your credit score comes from the average age of your credit accounts. Closing a high-interest revolving credit account won't affect your score today in terms of AAoA, but in a few years when that old, closed account drops off your report? Well now your average just got smaller and your score may have just taken a hit. The more accounts you have, the less losing one will matter. At the very least, it will likely eventually cost you a few points years later. However, if it drastically affects your utilization, you could see a big hit today, and if you don't have many accounts, you could also see a big hit years later when the closed account disappears.
You would think the credit tracking companies would look at you closing a high interest, high limit, card as a good thing.
Your credit report is a snapshot of where you are at the moment someone checks the report. The terms of your revolving accounts don't factor into the equation in terms of a basic credit score. They may for one of the niche scores (there are dozens and virtually nothing is known about them since consumers don't have regular access to them), but your basic FICO score has no idea whether a given card has great terms or bad terms. In terms of things like credit cards, it's looking for your debt:credit ratio on that account, your debt:credit ratio across your revolving accounts, and the age of that account (to factor into AAoA). It's also looking for any delinquencies on the account (30 days late, etc) and how recent they are. That's about it.
It's like saying paying off a mortgage should lower your credit score.
Paying off your mortgage has the effect of reducing the variety of credit accounts you have open. It's treated as a type of installment loan. If you have others (like an auto loan, student loans, etc), the impact will be pretty small.
In the end, what you need to understand is that the FICO score isn't about how smart you are, but about how likely it is you'll keep to the terms of credit extended to you at any given time. If you hold a mortgage, car loan, and several (very old) revolving accounts which are all in use and in good standing, you'll have a stellar credit score. If you've got collections, late payments, judgements, etc, then you're showing an inability or unwillingness to pay debts and your score will suffer. The area in between is basically left to showing how able you are to juggle a lot of different credit accounts and how responsible you are about not over-extending yourself just so you can have that dream vacation/new boat/etc. It's also important to remember that things like debt:income ratios, where you live, etc are NOT in your credit score. Your credit score is strictly a snapshot based on your current credit report and does nothing but measure the chances of you sticking to the terms of credit extended to you at that moment.
If you want to know more, you should visit the MyFico.com forums. The people there make a hobby out of understanding how all this stuff works.
Re:well damn (1)
SydShamino (547793) | more than 2 years ago | (#40371387)
This is why I still have my first credit card, from like 14 years ago. I charge something on it periodically so they don't cancel the account, and pay off the balance immediately. I'd prefer to have fewer cards but would rather have my credit score.
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40371973)
Very smart practice. What I do to keep all my old accounts active is actually put a small recurring bill or two (Netflix, season passes, etc) on each one. I pay it off right away, but it keeps regular activity going through them.
Another thing you can do is to call them every so often and ask for better terms. Target number one should be any annual fees. No reason to stick free money in their pockets. Depending on the issuer, they'll usually be more willing to work with an old customer who isn't using the card as much in the hopes of enticing them to start using it again.
Re:well damn (1)
Verteiron (224042) | more than 2 years ago | (#40370889)
You're mistaking the purpose of credit cards. They exist to make the issuing banks money. Why would seeing you close a high-interest card encourage me to offer you credit. You're not willing to be scammed by high interest rates, which means I won't be able to make money off of you.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40371165)
In large part, your credit is a ratio of debt to credit. If you have lots of credit and little debt, in relation to your income, you are very credit worthy. If you currently have say 50% of your credit used, and you close an account (which was your other 50%, yet owed nothing on it), you now have 100% of your credit in use. Thusly making you statistically a less credit worthy person as it implies you are already living at your means to pay back your creditors.
Never close an account.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370321)
The amount of credit you have available affects your ability to get new credit (presumably with a lower interest). It's not as simple as slashdot posters think it is.
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40370027)
Re:well damn (1)
TheSpoom (715771) | more than 2 years ago | (#40370141)
I'm curious though, have you called and asked Chase if they'll give you a lower interest rate? I had a 19% APR on a card, got it lowered to a permanent 12% just by calling the bank and switching to their "low rate" option (no "perks" like reward points, but in the long run they mean much less anyway). I even did this while holding a balance on the card. This was with a Canadian bank though, so things may be different here.
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40370237)
Re:well damn (1)
h4rr4r (612664) | more than 2 years ago | (#40370439)
Just pay it in full each month. Then you never pay the interest no matter what it is.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370563)
That's fine until you have a large medical bill and have a big deductible before insurance kicks it, assuming you actually have health cover.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370671)
Re:well damn (0)
SydShamino (547793) | more than 2 years ago | (#40371413)
It's painful, but after you finish paying off your card, keep paying the same amount into a savings account for six-to-twelve additional months to build a reserve. This way, next time you won't have to rely on high-interest credit for emergencies.
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40371827)
This is why you maintain an FSA or an HSA. Those cover your deductibles and other out of pocket expenses. The money going into them comes out tax-free. Any medical expenses too big to pay off all at once, you call them and work out an installment plan. Most places will take $25 or $50 a month; often even less. If you make very little money and that's going to be a problem, most places will knock off a huge chunk of your bill (if not the whole thing) and work out ridiculously flexible terms. They just want to get paid what they can get paid. They'll get the rest from insurance companies (which is why my premiums are higher than they should be).
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40371761)
I had a 19% APR on a card, got it lowered to a permanent 12% just by calling the bank and switching to their "low rate" option (no "perks" like reward points, but in the long run they mean much less anyway).
This depends on how you're using the card. If you're carrying a balance on the card (particularly a large balance that you can't pay off), then lower interest makes sense. If you have no balance on the card, then having the rewards makes more sense (regardless of the interest rate). They can charge you a 99% APR, but you won't pay a dime in interest so long as you pay the balance in full prior to the end of the grace period each month (typically around 24 - 28 days after the transaction). In the case of someone who's not carrying a balance, getting 1 or 2% cash back = free money. If you run all your purchases through your rewards card and pay it off within the grace period, you're getting cash back and losing nothing to interest. At that point, it's like getting a 1 or 2% raise in pay.
The banks still make all the money they need from retailer fees. You won't be their favorite customer, but I've never heard a credible account of a bank shutting down an active account in good standing. The typical thing that happens is someone "sock-drawers" a card (puts it away and doesn't use it) for several years and find that the bank comes back and basically says "since you basically aren't a customer at this point anyway, we thought we'd go ahead and make it official".
Re:well damn (1)
TheSpoom (715771) | more than 2 years ago | (#40371935)
Yeah, I mentally inserted a "for me" at the end of your quote as I often do but I probably should have put it in there. Hopefully I won't have a balance for too much longer and then the cash back strategy will make sense (though even then you usually have an annual fee for a cash back card, so there's some balancing to do).
Re:well damn (1)
vlm (69642) | more than 2 years ago | (#40370147)
You should read up on how credit works or one day you might end up in trouble.
You might not be able to become a debt serf, oh noes!
Re:well damn (1)
blackraven14250 (902843) | more than 2 years ago | (#40370747)
Re:well damn (1)
The Mister Purple (2525152) | more than 2 years ago | (#40371199)
Automatically? No.
Probably? Yes.
Re:well damn (2)
Loki_1929 (550940) | more than 2 years ago | (#40371891)
Whether you're the master over your credit or your credit's the master over you depends entirely on your responsibility, self-control, planning, credit education, and decision making. I've been on both sides of that game. Educating yourself is the first step to taking control and keeping it. Making smart decisions means you'll have access to lots of money (relative to what you're making) at very little cost.
Re:well damn (2)
Loki_1929 (550940) | more than 2 years ago | (#40370963)
My high credit score has enabled me to keep float about $13,000 at 0% over the past 3 years (it's all being paid off as I'm comfortable doing) while giving me an average of 2% extra cash in hand from my rewards card's cash-back feature. Further, it has me a car loan that'll cost me a whopping $400 in interest over the life of the loan. I've been able to do what I want, when I want, and I'm (literally) being paid money for the privilege.
There are people who let themselves become a slave to creditors and there are people who make creditors their bitch. Play the game right and you're golden. Have backup plans for your backup plans. Have contacts at the ready if anything goes wrong. Have reserves and make damn sure you can very easily afford what you're doing.
Re:well damn (1)
SydShamino (547793) | more than 2 years ago | (#40371451)
We're taking a family vacation this fall courtesy of starpoints. The price of everything everyone buys covers the cost of cash back and points programs, so people that don't use them are effectively funding those of us who do.
Re:well damn (4, Informative)
rgbrenner (317308) | more than 2 years ago | (#40370351)
hard inquiries affect your score by 1 to 5 points. FICO also groups inquires -- so if you shop for a mortgage during a period of a month or so, all of those will be grouped together (and will affect your score the same as 1 inquiry) [bankrate.com]
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40370391)
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40370979)
How much a given hard inquiry will affect your score varies with the information in the account (things like how many hard inquiries are already on there). If someone already has 9 hard inquiries, they almost certainly aren't getting away with a 1 point hit.
Re:well damn (1)
rgbrenner (317308) | more than 2 years ago | (#40371835)
It's all a big guessing game anyway. FICO does not release the actual formula, and even though you can see the score from TransUnion/Experian/Equifax, the banks do not use the score from those agencies. They calculate it themselves, and they can use a different weighting in the formula.
Also, FICO is not the only scoring company. VantageScore, NextGen, BEACON, and EMPIRICA.. to name a few.. and your bank can use any of those for your account.
So even if you know your credit score... you don't really know your credit score.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370037)
Or just pay them off (presumably this is possible with a 720 credit score).
This is a good thing (1)
mu51c10rd (187182) | more than 2 years ago | (#40370065)
Why? Because the poster wants to ensure that others do not repeat his experience. For example, when I am shopping, I always check reviews. I realize there may be some bad reviews, but if the majority of even half the reviews are bad, I will not go with the product. This site now helps people report their experience with card companies. Now, if you see overwhelming numbers reporting high APR's with Chase Freedom cards, you know that is a card to stay away from. Sure, you can simply cancel and walk away, but knowledge is power, and it is nicer for consumers to share imformation about businesses out there.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370077)
Or.. if you think having a high credit rating is something to be proud of that it somehow makes you a better person financially, why not get rid of credit cards all together? Having a high credit score is like having a level 80 WoW character. It just means you are a bigger sucker. A high credit score isn't winning, its losing.
That said... I keep two cards, never pay any interest (in fact I don't know what they are). My magic trick? Pay them off entirely every time. I see a credit card as a sorta buffer. A nice monthly statement of everything I bought or someone tried to buy pretending to be me. When all checks out, one check is written and paid, done.
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40370213)
Re:well damn (1)
DogDude (805747) | more than 2 years ago | (#40370339)
Re:well damn (2)
Tmann72 (2473512) | more than 2 years ago | (#40370421)
Re:well damn (2)
a90Tj2P7 (1533853) | more than 2 years ago | (#40370469)
Re:well damn (1)
DogDude (805747) | more than 2 years ago | (#40371359)
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40371465)
Re:well damn (1)
a90Tj2P7 (1533853) | more than 2 years ago | (#40371775)
But even ignoring all of that, going into debt your way is the result of using credit irresponsibly. You might have needed credit as a factor, but it wasn't the direct and inherent cause of going into debt any more than you smashing your own thumb with a hammer was caused by the fact that you owned one. It's misuse and carelessness.
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40371051)
You're buying a house with no credit? A nice car?
I've floated many thousands of dollars at 0% interest while getting an average of 2% cash back on all my purchases (basically a 2% raise) for several years. Meanwhile, I bought a nice car and I'll pay a total of about $400 interest over the life of the loan. I'm literally being paid for buying what I want, when I want, within the limits of what I can actually afford. They're paying me.
If slavery is having someone else float you free money and paying you to take it, sign me up. I'm in.
Re:well damn (1)
DogDude (805747) | more than 2 years ago | (#40371327)
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40372043)
3%? What is this, 1995? Nobody's paying 3% anymore except -maybe- for AmEx. And that, friends, is why nobody wants to take AmEx.
Anyway, if some retailers actually are raising prices slightly (maybe 1, 1.5%), I'm still ahead of the game and able to float a lot of money for less than free. Also, I don't know where you live, but gas stations around the US were giving cash discounts back when gasoline prices shot way up. I don't recall any mass shutdowns for law violations.
Re:well damn (1)
Bengie (1121981) | more than 2 years ago | (#40371479)
If I rent, in 30 years I will have nothing to show for
If I get a mortgage and purchase a house, in 30 years I will have a $100k house.
Re:well damn (1)
mcb (5109) | more than 2 years ago | (#40371887)
Invest the money you save by renting and in most cases you'll come out ahead (who stays in 1 house for 30 years anymore?)
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40371857)
No, you're wrong. Having no credit is a good thing. That means that you're a free person, in debt to nobody.
Sorry, you are wrong. It means you will be paying much higher insurance premiums. The insurance companies are basing rates off credit score now, and most have been for years. They don't want you to know this, but it doesn't change that they are indeed doing it.
I used to be a Dave Ramsey fan too. I paid off my house (19 years early), paid cash for my Murano, paid off and closed credit cards... and then paid $2000 extra each year. I don't want to have to have credit open, but it costs more to not have it than to keep it.
Re:well damn (1)
EzInKy (115248) | more than 2 years ago | (#40370055)
If you discipline yourself to use a credit card correctly the interest rate should be of no matter to you. Never use it to make a purchase you can't cover with cash you have in the bank, and make it a rule to pay the balance in full each and every statement. Do this, and you will never have to pay a cent in interest ever.
Re:well damn (1)
vlm (69642) | more than 2 years ago | (#40370185)
I've found out the hard way, that merely leads to $50 / $75 / $100 annual fees which are waived for debt serfs. They'll get $50 to $100
/yr out of you, one way or another.
Re:well damn (1)
EzInKy (115248) | more than 2 years ago | (#40370467)
They make money off the fees they charge retailers, which are enough apparently to allow me to collect a couple of hundred in "reward" points every few months.
Re:well damn (1)
infaustus (936456) | more than 2 years ago | (#40370523)
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370577)
Amazon Visa card -- 3% on all amazon purchases, 2% on gas/food, and 1% on everything else. No fees and the points are redeemable at amazon.com, so effectively as good as cash.
re: using a credit card correctly? (1)
King_TJ (85913) | more than 2 years ago | (#40370399)
Yeah.... unfortunately, that's NOT the correct way to use a credit card, in the lenders' viewpoint. And guess who makes the rules? (Hint: Not you.)
If you repeatedly pay off a credit card in full, you're just an expense on their balance sheet. (They have to keep lending you money for as long as 25-30 days at a time without making a penny of interest on it -- not to mention maintaining your account with them, printing up fresh cards for you every so often, etc. etc.)
Sure, it shows you're fiscally responsible, but not in a way that benefits them. What they're really after (and reward with a higher credit score) are people who actually carry a balance, but always make payments on time AND keep that balance somewhere under 50% of the total limit you're allowed to borrow.
If you're really going to make sure you never carry a balance on your credit cards, you're better off not having them at all. Just save up money in an interest-earning checking account that includes a debit card and use it instead. As another poster said, the alternative eventually becomes the card issuer charging you some sort of annual fee to keep the card active. That really stinks, because it's like you're paying them interest except without even getting to borrow the money first.
Re: using a credit card correctly? (1)
EzInKy (115248) | more than 2 years ago | (#40370505)
Then I must be an exception then. No annual fees, never paid interest, and take the cash option whenever I redeem my reward points.
re: exception? (1)
King_TJ (85913) | more than 2 years ago | (#40370657)
It's possible
... but I doubt that #1, your credit score is as high as they'd rank it if you did things the way I described, and #2, you can go on with that strategy indefinitely without eventually having the terms and conditions of your card changed on you.
The credit card issuers are NOT really vigilant about what's going on with all the cards out there.... Many years ago, I went through a Chapter 7 and one of the cards I was able to keep (and keep using) for many months after the fact was a Home Depot card, issued by one of the creditors I filed against. They should have immediately cancelled that card (even though I paid it off on-time and didn't have a balance on it). They finally realized their error and cancelled it, but not for close to a year.
If you don't do something that gets their attention (like failing to make a payment), they only review your account every so often. And when they do, and see that you don't owe anything? They may be betting for a while that you'll eventually use the card for some major purchase or emergency situation, and carry a balance for a while when that happens. If that never materializes though, *eventually*, they'll decide you're just not a profitable customer for them....
Re: exception? (1)
EzInKy (115248) | more than 2 years ago | (#40370851)
If that day ever comes then I'll simply use the cash in my accounts to make my purchases instead and they'll lose the fees they earn from the retailers. Admittedly though, I'll miss cashing in my reward points as well.
Re: exception? (1)
SydShamino (547793) | more than 2 years ago | (#40371543)
I do it the way the parent describes, and my credit score could not get that much higher. Because I'm getting points or cash back on everything, I run -everything- I can through a credit card. Thus they make more in merchant charges off me than they do off a typical person who pays cash or check for somethings. That's where they get their profit off me, from the higher prices all merchants charge everyone for everything to cover the costs of credit card fees. (But merchants would charge those costs whether I paid cash or check or credit, so the best I can do is use credit and skim the cash back and reward points.)
Re: using a credit card correctly? (1)
tbannist (230135) | more than 2 years ago | (#40371063)
You don't actually understand how credit cards work. Every time you buy something from a store with a credit card, the credit card company gets something like $1 + 3% of what you purchased. That's right, if the store is making a 10% profit on your purchase, almost a third of it goes to VISA or Mastercard. Before 2008, the credit card companies were looking for debt slaves. They loved the people who carried near the maximum balances and made near the minimum payment. However, after the economy tanked they were reminded of how risky that is. Apparently, post 2008 they started seeking out the no-balance people who buy lots of stuff and pay it off every month. They were the new targeted group. I'm not sure if the credit card companies are still actively targeting the no balance people but they are very lucrative for the credit card companies.
Now if you credit card company decides to force you to pay a fee to carry your card, cancel it. They'll eventually learn not to do that. You have to remember corporations are like evil little children. If you don't rap their knuckles every time they get into mischief they'll rob you blind while mocking you for it. See the shackle shoes [thestar.com] , for example. It's amazing that a company could reasonably despise it's customer that much.
Re: using a credit card correctly? (1)
tlhIngan (30335) | more than 2 years ago | (#40371373)
I've had a high-interest-rate credit card for ages. I've also only paid like $5 in interest the 15 years I had it (for the one time the statement got lost in the mail).
First, credit cards are a competitive business - your bank will have at least a dozen, half of which are no annual fees. And while bank credit cards (or credit union ones) won't be as full of perks or other stuff like nonbank cards, they will still extend them to you.
And no, if you're using the card, the bank still makes money off you - each transaction costs the merchant 3-5% (though it also means the merchant doesn't have the cost of handling cash). What costs the bank is if you have a $0 balance card and don't use it - in which case they have to keep the account open and you're not making transactions.
And while carrying a balance certainly is profitable, the card issuer has to balance that with your ability to pay. Just because you have a card with a $10,000 credit limit doesn't mean you have the ability to pay it - you could always default on the loan or go bankrupt, in which case the issuer loses out (a credit card is unsecured).
And while paying with cash or debit is great, there are still some advantages to credit. First, you have a history (which is necessary unless you rent a house forever or are rich enough to pay it off in cash). Plus, there are legal protections on credit that some issuers may extend to debit but they don't have to. And there are rewards - most debit cards don't have it.
It can also help with financial planning - the death by 1,000 cuts thing. E.g., if you're paying off stuff like $10 here and there, you can spend a lot more money because most people write it off as "it's a tiny amount" over say, spending $100. Having it consolidated on a bill with a total does show even the little charges add up rather than find your account drained one day because you made 100 $10 transactions that you forgot all about versus that one $1000 transaction for something.
Re:well damn (1)
vlm (69642) | more than 2 years ago | (#40370119)
With a credit rating of 720 there is no excuse for me to have a 23.9% APR.
That low? I'm in the low 800s last time I checked (yes, I'm old) and all my CC are the legal max of 29.9%. I'm sure the only dependency is which state you live in.
Personally I think they're pissed off that I don't carry a higher balance... gotta make $100/yr off me somehow.
One funny thing is I used to have multiple cards just in case and also the worlds crudest budgeting system, but due to endless too-big-to-fail mergers I'm down to BoA and Citibank, both with multiple cards.
Re:well damn (1)
Tmann72 (2473512) | more than 2 years ago | (#40370271)
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40370519)
Definitely. I'm just below 800 and most of my cards are between 8.99% and 9.24%. Are you sure you didn't pay a bill late? They hijack your rate if that happens.
Re:well damn (1)
operagost (62405) | more than 2 years ago | (#40370817)
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40371265)
With a rating above 720, you can easily join any credit union with which you have eligibility (and most have back doors to get in) and get a credit card with no annual fee and a ~10% interest rate or lower. Word to the wise: save yourself a hard inquiry and sign up for every account you need when you sign up with the credit union. Most of them seem to want to hit your report every time you add something new.
Re:well damn (1)
Loki_1929 (550940) | more than 2 years ago | (#40371201)
You don't get to sit in judgement of anyone else who uses credit properly just because you don't have a clue what you're doing. If all your credit cards are at 30% interest, you don't know what you're doing. My gf's cards aren't near that high and her credit's terrible.
I suspect:
* 1. You're lying about your score to prove a point
* 2. You're lying about your interest rates to prove a point
* 3. You aren't telling us the whole story
* 4. You've gotten scores from somewhere other than MyFico.com (and thus, almost certainly aren't giving us FICO scores)
Also, simply pay off the cards prior to the grace period expiration and they won't charge you a dime; regardless of the APR. Learn to use credit; don't let it use you.
Re:well damn (1)
noc007 (633443) | more than 2 years ago | (#40370457)
As long as you pay what's on that billing cycle on time, you don't get charged any interest. Treat it like your check card and you won't have any problems.
Using only 1/3rd of your credit limit and paying it off each cycle can do wonders to your credit score as well.
Re:well damn (2)
operagost (62405) | more than 2 years ago | (#40370689)
It's existed for decades: the BBB. I successfully had my APR reduced from 19.99 to 9.99 with Chase. When I was out of work, they jacked it up before I could close the account at a lower rate. My complaint with the BBB motivated them to restore good faith with me. They are still pretty low on my list of potential lenders, but they're not on the bottom. The BBB won't be able to fix everything, but let's be frank: neither will any government agency.
Re:well damn (0)
Anonymous Coward | more than 2 years ago | (#40371599)
Any small business that joins the BBB can have complaints against them wiped out. It has no credibility in my eyes.
"Tenets" not "Tenants" (1)
stevegee58 (1179505) | more than 2 years ago | (#40369961)
Re:"Tenets" not "Tenants" (0)
Anonymous Coward | more than 2 years ago | (#40370061)
you are the worst kind of person...
Re:"Tenets" not "Tenants" (0)
Anonymous Coward | more than 2 years ago | (#40370327)
Q: Why couldn't either of the tepees get to sleep?
A: They were two tenants.
...er, or something like that.
Fantastic News (1)
ohnocitizen (1951674) | more than 2 years ago | (#40369969)
"In these difficult times, if you miss a payment, you just get a late fee, not a bump in your rate that will take years to reduce."
"Need help? We're easy to reach by phone or email."
"Our rates don't change. Sign up at one APR, stay at that APR."
Please add PayPal (0)
Anonymous Coward | more than 2 years ago | (#40369991)
They need regulating too.
Re:Please add PayPal (1)
AngryDeuce (2205124) | more than 2 years ago | (#40370035)
Re:Please add PayPal (1)
tlhIngan (30335) | more than 2 years ago | (#40371035)
She could always do what a good majority of businesses do - get a merchant account and accept credit cards directly rather than through Paypal. Her website will probably need to use one of those third party providers that can do it all so she doesn't have to worry about PCI-DSS, but it's certainly doable.
Depending on how she qualifies, though, the merchant account may not be better than paypal (it can be worse or more onerous). And if she's worried about "familiarity" she can offer both Paypal and direct credit card.
Though, on the downside - if you think Paypal is horrible, a merchant account can be worse (Paypal's horribleness stems from that - and that most people don't actually know what it takes to actually accept credit cards).
As a buyer, sometimes a merchant has forced me to use Paypal - either they don't accept different billing/shipping addresses, or in one case earlier this year... they wanted me to jump through hoops. As in "please scan in your credit card and email it to us".
Of course, what rubbed me was they claimed it was "for my protection" when they wanted me to send them two scans of my credit card (Front, back) via email. (If any business asks for this - it's not for your (the cardholder's) protection, it's for the business's. You're still protected by the law from fraudulent purchases.). They claimed they need to do additional verification and refused to offer anything in return (like say, expedited shipping - I'm saving them money by preventing a chargeback and keeping their merchant account rates low, after all). I had to make the purchase, so I cancelled and paid via Paypal. Paypal's protections for buyers is worse, but at least it's still there. Plus they had no guarantees or anything that the card data would be kept safe.
And finally - note that most cardholder security precautions prohibit the activity as you can lose control of your card. Perhaps the next time they do this, I'll file a complaint with my bank.
Re:Please add PayPal (1)
King_TJ (85913) | more than 2 years ago | (#40370525)
Yep! I'm not a big fan of govt. regulation (your basic libertarian-minded type here), but PayPal managed to skirt a lot of control that everyone else in the banking industry seems to be held to, and I never quite understood how they were granted an exception.
For example, the eBay/PayPal merger certainly seems questionable, if nothing else? eBay purchases PayPal and immediately proceeds to make it the ONLY form of payment allowed for auctions on their system. I'm not even allowed to pay with CASH (supposedly legal tender for "all debts, public and private")? Before that, you could use several forms of e-payment on eBay.... I forget the name of the business, but I know there was a service allowing you to issue a check to the seller, which they used to explicitly support, integrated into their site. I paid someone using that method at least once before.
Even THAT wouldn't be as irritating if PayPal didn't charge any fees for the eBay transactions, but they do! You have to pay eBay a listing fee and a percentage of what the item sells for when sold
... but the person paying with PayPal is still subject to any transaction fees PayPal charges!
Re:Please add PayPal (1)
the eric conspiracy (20178) | more than 2 years ago | (#40370649)
PayPal is not the only payment option on EBay. However many sellers accept only PayPal because it is the easiest way to manage things. [ebay.com]
And Paypal has never charged me as a buyer a transaction fee. As a seller, yes, and outrageously so, but not as a buyer.
Re:Please add PayPal (1)
SydShamino (547793) | more than 2 years ago | (#40371629)
You neglect to mention that every seller is required to accept Paypal. It's the easiest way to manage things only because having one payment system is easier than multiple systems, and if you go with one system, that one system has to be Paypal.
Epic fail (4, Interesting)
vlm (69642) | more than 2 years ago | (#40369997))
Re:Epic fail (1)
Fast Thick Pants (1081517) | more than 2 years ago | (#40370305)
I hate being called a consumer. The article is about modern day debt-serfs anyway, not consumers. I want to be a citizen, you know, with like rights and stuff.
The Consumer Financial Protection Bureau deals with consumer financial services, as opposed to services aimed at, say, governments or corporations. Whether or not you're a citizen isn't their concern. Their mission is to protect the end-users of consumer credit from pervasive illegal bullshit. If the word "consumer" offends you, eh, too bad.
complain and everyone on the net can hear about it, but all of your personal data will be on a torrent site within hours, so you better not complain in public after all, serf.
Oh for the love of
... nevermind ...
Re:Epic fail (1)
dkleinsc (563838) | more than 2 years ago | (#40370567)
I hate being called a consumer. The article is about modern day debt-serfs anyway, not consumers.
I do too, but in this case I understand why:
1. The phrase "consumer finance" does in fact refer to the kinds of things the CFPB is supposed to be dealing with: bank accounts, credit cards, and personal loans.
2. From the point of view of the banking industry, loans, accounts, cards, etc are their products, which you are purchasing with fees and/or interest payments.
Re:Epic fail (2)
SydShamino (547793) | more than 2 years ago | (#40371661)
The real complaint is they paid billions to elect these guys, and look what happens. My suspicion is within days / weeks this will be defanged.
If Republicans win this fall, expect the consumer bureau to be gutted then eliminated. It's not like they haven't already been trying to block or defund it.
Re:Epic fail (1)
Impy the Impiuos Imp (442658) | more than 2 years ago | (#40371831)
You are partly correct but not for he reason you think.
Good, kind-hearted government isn't releasing this information to benefit the consumer by embarrassing companies (beliefs of low-level government functionaries, AKA "useful idiots", aside).
It was done in an election year to panic banks by stirring up outrage in the hoi polloi such that banks would be afraid Congress would be driven to act.
This will have the intended effect (by the "useful idiots'" bosses) that the bosses will get lots of donations.
Your error, as many make, is in the assumption this feedback loop between government and business is driven by business thwarting Good Stewardship for cackling, nefarious reasons rather than that politicians seek this power so they can get in the way and thus get paid to get back out of the way.
This has much better predictive and explanatory power than the "evil business thwarts good politicians" theory -- more evidence? Sure. Look at most other countries around he world where he desired jobs [i]are government jobs[/i] and this is raised to a hih art form.
This is why the big banks hate the CFPB (2)
dkleinsc (563838) | more than 2 years ago | (#40370007)
The last thing the larger financial companies want is clear documentation of exactly how they screw their customers. Just by sharing this kind of information, they start making the market compete better - now that customers are basically talking to each other, they know that Capital One is a bad deal, which will hurt Capital One in the marketplace.
Of course, I know that there are some who's head will explode when they encounter a government program that is quite cheap, effective, mostly non-coercive, and improves market functioning, but that's what this is.
Re:This is why the big banks hate the CFPB (3, Insightful)
vlm (69642) | more than 2 years ago | (#40370281).
God Forbid (2)
AngryDeuce (2205124) | more than 2 years ago | (#40370009)
The horror of an informed populace...
Funny, they can submit information to credit agencies that are applied to every adult in this country, but turn around and give the people an outlet to do the same thing in return and now they're sobbing into their cereal. Boo fucking hoo.
Tomorrow's headline: (1)
Iniamyen (2440798) | more than 2 years ago | (#40370021)
Tenants, eh? (1)
RabidReindeer (2625839) | more than 2 years ago | (#40370127)
I didn't know Transparency was a "tenant" of the Free Market. I do hope he (she?) pays the rent on time.
Then again, I don't know how transparency is supposed to apply here anyway. There's no "free market" in credit reporting, just a triumvirate, which has itself in a win-win-win situation. They're not competing on price, as far as I know, which would be the only place where transparency would be a market factor, since they're all selling basically the same commodity and not uncommonly all 3 to the same customers.
On the other hand, having transparency on how they operate is a big benefit, "Free Market" or not. Considering that up to now, they've had free rein (sic) to bad-mouth people indelibly, it's only appropriate that the favor be returnable. Even their customers benefit, since they can see both sides of the argument for a change.
Interesting but... (2)
PerfectionLost (1004287) | more than 2 years ago | (#40370161)
There only seems to be around 100 complaints in their database. That couldn't possibly be right could it? Or have I been wrong about how terrible the banks can be.
Here's a quick query I threw together:
Complaints by Company
1 TD BANK
1 Zions First National Bank
1 USAA Savings
5 Barclays
6 Amex
7 Wells Fargo
8 Discover
9 GE Capital Retail
15 Bank of America
24 JPMorgan Chase
27 Citibank
33 Capital One
Re:Interesting but... (1)
Thud457 (234763) | more than 2 years ago | (#40370515)
33 Capital One
"Who's in your wallet" always struck me as a bit of an ominous warning.
Re:Interesting but... (1)
Bengie (1121981) | more than 2 years ago | (#40371921)
Re:Interesting but... (0)
Anonymous Coward | more than 2 years ago | (#40370603)
What would really be interesting is which (Visa / Mastercard / etc) the bank cards are associated with... and how many complaints are relative to the big name brands...
Re:Interesting but... (1)
a90Tj2P7 (1533853) | more than 2 years ago | (#40371401)
|
http://beta.slashdot.org/story/170623
|
CC-MAIN-2014-41
|
refinedweb
| 9,287
| 76.96
|
Levene’s Test is used to determine whether two or more groups have equal variances. It is commonly used because many statistical tests make the assumption that groups have equal variances and Levene’s Test allows you to determine if this assumption is satisified.
This tutorial explains how to perform Levene’s Test in Python.
Example: Levene Levene’s Test in Python to determine whether or not the three groups have equal variances.
Step 1: Input the data.
First, we’ll create three arrays to hold the data values:
group1 = [7, 14, 14, 13, 12, 9, 6, 14, 12, 8] group2 = [15, 17, 13, 15, 15, 13, 9, 12, 10, 8] group3 = [6, 8, 8, 9, 5, 14, 13, 8, 10, 9]
Step 2: Perform Levene’s Test.
Next, we’ll perform Levene’s Test using the levene() function from the SciPy library, which uses the following syntax:
levene(sample1, sample2, …, center=’median’)
where:
- sample1, sample2, etc: Names of the samples.
- center: Method to use for Levene’s test. The default is ‘median’, but other choices include ‘mean’ and ‘trimmed.’
As mentioned in the documentation, there are actually three different variations of Levene’s test you can use. The recommended usages are as follows:
- ‘median’: recommended for skewed distributions.
- ‘mean’: recommended for symmetric, moderate-tailed distributions.
- ‘trimmed’: recommended for heavy-tailed distributions.
The following code illustrates how to perform Levene’s test using both the mean and the median as the center:
import scipy.stats as stats #Levene's test centered at the median stats.levene(group1, group2, group3, center='median') (statistic=0.1798, pvalue=0.8364) #Levene's test centered at the mean stats.levene(group1, group2, group3, center='mean') (statistic=0.5357, pvalue=0.5914)
In both methods, the p-value is not less than .05. This means in both cases we would.
|
https://www.statology.org/levenes-test-python/
|
CC-MAIN-2022-21
|
refinedweb
| 305
| 57.67
|
std::uncaught_exception, std::uncaught_exceptions
From cppreference.com
1) Detects if the current thread has a live exception object, that is, an exception has been thrown or rethrown and not yet entered a matching catch clause, std::terminate or std::unexpected. In other words,
std::uncaught_exceptiondetects if stack unwinding is currently in progress.
2) Detects how many exceptions in the current thread have been thrown or rethrown and not yet entered their matching catch clauses.
Sometimes it's safe to throw an exception even while std::uncaught_exception() == true. For example, if stack unwinding causes an object to be destructed, the destructor for that object could run code that throws an exception as long as the exception is caught by some catch block before escaping the destructor.
[edit] Parameters
(none)
[edit] Return value
1) true if stack unwinding is currently in progress in this thread.
2) The number of uncaught exception objects in the current thread.
Run this code
#include <iostream> #include <exception> #include <stdexcept> struct Foo { int count = std::uncaught_exceptions(); ~Foo() { std::cout << (count == std::uncaught_exceptions() ? "~Foo() called normally\n" : "~Foo() called during stack unwinding\n"); } }; int main() { Foo f; try { Foo f; std::cout << "Exception thrown\n"; throw std::runtime_error("test exception"); } catch (const std::exception& e) { std::cout << "Exception caught: " << e.what() << '\n'; } }
Output:
Exception thrown ~Foo() called during stack unwinding Exception caught: test exception ~Foo() called normally
|
https://en.cppreference.com/w/cpp/error/uncaught_exception
|
CC-MAIN-2020-50
|
refinedweb
| 229
| 52.19
|
oemolstreambase¶
class oemolstreambase
The
oemolstreambase is the abstract base class for
reading and writing molecules.
- The following classes derive from this class:
ClearCSVHeader¶
void ClearCSVHeader()
Clears out the
OECSVHeader object owned by this
stream allowing an alternative set of column names to be
initialized.
GetCSVHeader¶
OECSVHeader &GetCSVHeader()
Returns a reference to the
OECSVHeader object
owned by this stream. The first molecule read or written to this
stream will initialize the
OECSVHeader object
to the set of SD data tags and the order in which to read or
write them.
GetFileName¶
const std::string &GetFileName() const
Returns the file name used in the previous call to
oemolstreambase::open. An empty string is
returned if
oemolstreambase::open has not been
called yet or
oemolstreambase::close has been
called.
GetFlavor¶
unsigned int GetFlavor(unsigned int format)
Returns the file flavor associated with the format for the
oemolstreambase object.
The set of valid formats are defined in the
OEFormat namespace.
The set of valid bitmasks flavors of input streams are defined in the
OEIFlavor namespace.
The set of valid bitmasks flavors of output streams are defined in the
OEOFlavor namespace.
The flavor for any format can be set using the
oemolstreambase::SetFlavor method.
The default flavors are automatically set by the
oemolstreambase constructors.
GetFormat¶
unsigned int GetFormat() const
Returns the file format associated with the output
oemolstreambase object.
The set of valid formats are defined in the
OEFormat namespace.
By default, when writing to standard output or when reading from
standard input the associated file format is
OEFormat::SMI.
The file format property can be set using the
oemolstreambase::SetFormat method.
Note
The file format property is also set automatically by
oemolstreambase::open based upon the file
extension of the specified filename.
Getgz¶
bool Getgz()
Returns whether the stream is writing to or reading from a gzip
compressed
oemolstreambase.
SetFlavor¶
bool SetFlavor(unsigned int format, unsigned int flavor)=0
This pure virtual method is designed to set the flavor for a given format associated with an input/output molstream.
SetFormat¶
bool SetFormat(unsigned int format)=0
This pure virtual method is designed to set the format associated with an input/output molstream.
See also
Note
Setting the molstream format to .gz or .oez when it was previously a different (or default) format re-initializes the OEB handlers in the molstream. This means, any explicit changes to the OEB handlers for the stream should be made after setting the format.
void close()
This method clears the
OECSVHeader object owned
by this stream, and resets the file name returned by
oemolstreambase::GetFileName back to an empty
string. It is expected that the user will not need to call this
method directly, but rely on the following subclass methods to
call this function:
open¶
bool open()
The input molstreams (
oemolistream,
oemolithread) read from to standard input.
The output molstreams (
oemolostream,
oemolothread) write to standard input.
The default file format for both input and output molstreams are
OEFormat::SMI.
Calling
oemolstreambase::open (no arguments)
on input or output molstreams will force the stream format to
the default
OEFormat::SMI and the
gzip compression property to false.
bool open(const char *fname) bool open(const std::string &fname)
In case of an input molstream (
oemolistream,
oemolithread), this method opens a file ,
specified by its filename (‘fname’) for reading.
The file format property of the input molstream is set based
upon the extension of the given filename.
If the file extension isn’t recognized, a warning is issued and
the existing file format is unchanged.
If the filename is appended with
.gz, the input
molstream will decompress the file on-the-fly when reading.
If only a file extension is used as the filename
(
.oeb.gz), then the standard input is opened with the
format specified by the given extensions.
In case of an output molstream
(
oemolostream,
oemolothread),
this method creates (or overwrite) a file , specified by its
filename (‘fname’) for writing.
The file format property of the output molstream is set based
upon the extension of the given filename.
If the filename is appended with
.gz, the output
molstream will compress the file on-the-fly when writing.
If the file extension isn’t recognized, a warning is issued and
the existing file format is unchanged.
If only a file extension is used as the filename
(
.oeb.gz), then the standard output is opened with the
format specified by the given extensions.
In case of both input and output molstream, the filename based
file format may be overridden by calling
oemolstreambase::SetFormat explicitly with
the desired file format.
|
https://docs.eyesopen.com/toolkits/cpp/oechemtk/OEChemClasses/oemolstreambase.html
|
CC-MAIN-2021-31
|
refinedweb
| 759
| 54.32
|
Having fun with ooc
Unfortunately, the ooc language could have better documentation. In the meantime, I'd like to blog about about some features that might not be very well-known.
Nested functions
Here's a program that prints
1, 3, 5, 7, 9:
ooc
import structs/ArrayList main: func { list := ArrayList<Int> new() addIfOdd := func (i: Int) { if (i % 2 != 0) list add(i) } for (i in 0..10) { addIfOdd(i) } list map(|i| i toString()) join(", ") println() }
If you're doing something repeatedly, and it won't be too readable with a closure, you can simply declare a nested function! Note that we don't make use of the GNUC extension here, the ooc compiler unwraps it as a proper closure, with a context and all.
Filter, map, join, backslash line continuations
That program prints exactly the same thing, but it does it in fewer lines:
ooc
import structs/ArrayList main: func { list := ArrayList<Int> new() for (i in 0..10) list add(i) list filter(|i| i % 2 != 0) \ map(|i| i toString()) \ join(", ") \ println() }
As in most languages, you can call the
filter (only retain element if the condition
is true) and
map (create a new list with elements returned by the function) methods on
lists.
join also works on List
Int to
String before
calling it.
Extending classes and covers
Always with the same output, this program is a bit more convoluted:
ooc
import structs/[ArrayList, List] extend Range { list: func -> ArrayList<Int> { list := ArrayList<Int> new() for (i in min..max) list add(i) list } } extend List<Int> { filterEven: func -> List<T> { filter(|i| i as Int % 2 != 0) } println: func { map(|i| i as Int toString()) join(", ") println() } } main: func { (0..10) list() filterEven() println() }
The point of this example is to show that even though ooc is a static language,
and even if you use types defined in external libraries, you can add methods to it.
They'll only be accessible from modules where you import the module containing
the
extends, and they aren't overloadable by subclasses, etc. etc.
They're basically syntactic sugar! Sweet, sweet syntactic sugar.
Note that in that example, we extend both a cover, ie.
Range, and a generic
class, ie.
List<T>. As a reminder, covers are by-value, and they usually have
a 1-1 mapping with underlying C types (e.g. Int, Float, Double are all covers),
or they define a structure (like Range, in this case).
As you can see, extending a cover works quite well, but for generic classes,
the compiler ignores the
Int in
extend List<Int>, so within
filterEven
and
println we have to cast i to Int ourselves. Not very clean if you
ask me, but it does work.
Conclusion
You've seen three ways to have fun with ooc. It doesn't stop there of course, I might continue blogging about fun features you can benefit from in your ooc programs.
If you liked this article, please support my work on Patreon!
|
https://fasterthanli.me/articles/ooc-tips
|
CC-MAIN-2021-25
|
refinedweb
| 504
| 70.23
|
Samba-3.0.22
In #3084 was postet about gconv_db.c:232.
My system is x86 Kernel-2.6.16, GLIBC-2.4, GCC-4.0.3
When I running smbstatus or smbclient or smbd -D, I get (for example):
#smbstatus -v
using configfile = /etc/samba3/smb.conf
smbstatus: gconv_db.c:232: __gconv_release_step: Assertion `step->__end_fct == ((void *)0)' failed.
This bug appear after compiling new version glibc (glibc-2.4), before was run glibc-2.3.6
Jeremy, Looks like LOCALE changes on glibc 2.4. Here's a potion
of output from an IRC chat. Just running 'smbclient' with no args
fails.
(16:51:51) NyB: Attempting to register new charset ASCII
(16:51:51) NyB: Registered charset ASCII
(16:51:51) NyB: Attempting to register new charset 646
(16:51:51) NyB: Registered charset 646
(16:51:51) NyB: Attempting to register new charset ISO-8859-1
(16:51:51) NyB: Registered charset ISO-8859-1
(16:51:53) NyB: Attempting to register new charset UCS2-HEX
(16:51:55) NyB: Registered charset UCS2-HEX
(16:51:57) NyB: Substituting charset 'ISO-8859-7' for LOCALE
(16:51:59) NyB: Substituting charset 'ISO-8859-7' for LOCALE
(16:52:01) NyB: smbclient: gconv_db.c:232: __gconv_release_step: Assertion `step->__end_fct == ((void *)0)' failed.
Backtrace in gdb (smbclient with debug symbols).
(16:56:33) NyB: Program received signal SIGABRT, Aborted.
(16:56:35) NyB: 0xffffe410 in __kernel_vsyscall ()
(16:56:35) NyB: (gdb) bt
(16:56:35) NyB: #0 0xffffe410 in __kernel_vsyscall ()
(16:56:35) NyB: #1 0xb7b397a1 in ?? ()
(16:56:35) NyB: #2 0xb7c3fff4 in ?? ()
(16:56:35) NyB: #3 0xb7af89b0 in ?? ()
(16:56:37) NyB: #4 0xbf893630 in ?? ()
(16:56:39) NyB: #5 0xb7b3b0e9 in ?? ()
(16:56:41) NyB: #6 0x00000006 in ?? ()
(16:56:43) NyB: #7 0xbf893514 in ?? ()
(16:56:45) NyB: #8 0x00000000 in ?? ()
Teh IRC logs were from a former Mandrake 10.0 system manually
upgraded to glibc 2.4 (local compile). Samba, OpenLDAP, krb5
have all be recompiled. Don't know if this would just be easier to
get a gilb 2.4 box ourselves and reproruce the error.
Looks like a problem upgrading glibc on this system to me. Not a generic problem in glibc 2.4 as shown by SuSE 10.1.
Jeremy.
looks to be a local problem with the glibc C build. SuSE 10.1
is runnign on glibc 2.4 and exhibits no problems.
(In reply to comment #5)
> looks to be a local problem with the glibc C build. SuSE 10.1
> is runnign on glibc 2.4 and exhibits no problems.
>
Ah, setting LC_CTYPE to en_US seems to work around this problem. But since I live in Greece (el_GR), I can't make this a permanent setting. I think, though, that this is a clear indicative that this is a glibc bug. I tried several other LC_CTYPE settings from various languages, with mixed results. I noticed however that the UTF-8 locales do not have this problem, so it would not show up on any distro that uses utf8 by default. I'll be forwarding this to the glibc people...
According to this is a samba-only problem. All other occurences where related to the program been linked against libsmbclient.
I need a good backtrace from smbclient. I mean a backtrace with real symbols going all the way up to main :-).
Thanks,
Jeremy.
Ok, maybe it's a glibc thing after all (this whole story reminds me of a tennis match...). The following reproduces the problem:
#include <iconv.h>
int main() {
iconv_t cd0, cd1;
cd0 = iconv_open("ISO-8859-7", "UTF-16LE");
cd1 = iconv_open("ISO-8859-7", "UTF-16LE");
iconv_close(cd0);
iconv_close(cd1);
return 0;
}
much simpler than samba code, eh ?
|
https://bugzilla.samba.org/show_bug.cgi?id=3655
|
CC-MAIN-2021-31
|
refinedweb
| 622
| 78.04
|
> Why can't we modify whatever PEP to simply mark namespace package > with '__init__.pyp' or some other special file? That file name would not work, as then portions of the namespace would all install the same file, which causes conflicts in platform packaging tools (if the portions get installed into the same sys.path entry). > Why rename directories, > introduce ugly suffixes, deal with all the weirdness of importing > just plain directories and guessing that they are namespace packages, > ignoring content in __init__.py etc, instead of plain simple file > marker? Hence the current PEP doesn't propose to rename directories, and does not introduce ugly suffixes. As for the weirdness of importing just plain directories: yes, it does that. > With PEP 382, the migration path is: > 1. delete all __init__.py files from namespace package portions > 2. rename the directories for all namespace package portions to append > the ".pyp" extension Please understand that an earlier version of the PEP did indeed propose to use marker files instead of directories. You are, of course, free to reiterate four years of discussion in a single week, but please do familiarize yourself with the matter first. After that, you likely have to write a PEP if you want your idea to be seriously considered. Regards, Martin
|
https://mail.python.org/pipermail/import-sig/2012-May/000557.html
|
CC-MAIN-2016-44
|
refinedweb
| 214
| 64.81
|
Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.65 is the most recent stable version of Flux.
The
strings.trimRight() function removes trailing characters specified in the
cutset from a string.
Output data type: String
import "strings" strings.trimRight(v: ".abc.", cutset: ".") // returns "abc."
Parameters
v
String to remove characters from.
Data type: String
cutset
The trailing characters to trim from the string.
Only characters that match the
cutset string exactly are trimmed.
Data type: String
Examples
Trim trailing periods from all values in a column
import "strings" data |> map(fn: (r) => ({ r with variables: strings.trimRight(v: r.variables, cutset: ".") }) )
|
https://docs.influxdata.com/flux/v0.50/stdlib/strings/trimright/
|
CC-MAIN-2020-29
|
refinedweb
| 110
| 58.48
|
[2.6 patch] wrong firmware location in IPW2100 Kconfig entry
- From: Adrian Bunk <bunk@xxxxxxxxx>
- Date: Tue, 31 Jan 2006 17:11:24 +0100
From: Jesper Juhl <jesper.juhl@xxxxxxxxx>
Firmware should go into /lib/firmware, not /etc/firmware.
Found by Alejandro Bonilla.
Signed-off-by: Jesper Juhl <jesper.juhl@xxxxxxxxx>
Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>
---" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at
- Prev by Date: Re: [PATCH 1/5] pid: Implement task references.
- Next by Date: Re: [RFC/RFT] finally solve "swsusp fails with mysqld" problem
- Previous by thread: Dont use num_processors as index to generate logical cpu# in x86_64
- Next by thread: Re: [PATCH 8/12] generic hweight{32,16,8}()
- Index(es):
Relevant Pages
- Re: [PATCH] Small kfree cleanup, save a local variable.
... Jesper Juhl wrote: ... > Patch also removes an extra space a little
further down in the file. ... send the line "unsubscribe linux-kernel" in ... More
majordomo info at ... (Linux-Kernel)
- Re: 2.6.14.5 to 2.6.15 patch
... On Wednesday 04 January 2006 17:18, Jesper Juhl wrote: ... > What you do
is you first revert the 2.6.14.5 patch so you are left ... then you apply the 2.6.15 patch.
... More majordomo info at ... (Linux-Kernel)
- Re: [PATCH] clarify message and give support contact for non-GPL modules
... The author of the second module ... So here is another attempt at the patch.
... send the line "unsubscribe linux-kernel" in ... More majordomo info at ... (Linux-Kernel)
- Re: [PATCH 2.6.24-rc3-mm1] IPC: make struct ipc_ids static in ipc_namespace
... With the patch sent at the beginning of this thread we have: ... struct
ipc_namespace { ... We can put all sysctl related values together, in one cacheline and
keep ipc_ids ... More majordomo info at ...
(Linux-Kernel)
- Re: [PATCH 4/6][RESEND] Emulex FC HBA driver: fix overflow of statically allocated array
... accept this patch - ACK. ... Jesper Juhl wrote: ... The fix
is contained in our 8.2.2 sources recently posted and pushed by James ... (Linux-Kernel)
|
http://linux.derkeiler.com/Mailing-Lists/Kernel/2006-01/msg11456.html
|
crawl-001
|
refinedweb
| 346
| 70.5
|
Timedelta
Timedelta class represent not any particular date or time, but it represents a span of time. This class will be helpful when you need to run some math on date and time. Say what will be this day on after few weeks or what will be this day in future year.
Following example will make it clear
from datetime import date from datetime import timedelta print(f'todays date {date.today()} after 1 year will be {date.today()+ timedelta(days=365)}') Output todays date 2020-06-27 after 1 year will be 2021-06-27
Here I used the f.string to construct the message , the timedelta represent one year, 365 days. You can find what will be the date before few weeks back using date -timedelta(weeks=4)
|
https://developerm.dev/2020/06/27/python-library-tips-timedelta/
|
CC-MAIN-2021-17
|
refinedweb
| 130
| 82.04
|
1.07 2014-02-06 - Added a hack to get this module working on Android. RT #92671. 1.06 2013-12-31 - DateTime's attempt to generate infinity by calculating 9**9**9 actually got a number on some platforms, like powerpcspe. Reported by Gregor Hermann. RT #91696. 1.05 2013-12-22 - Added a new CLDR ZZZZZ specifier, which is like ZZZ but inserts a colon. Patch by Ricardo Signes. - Added a new option for the truncate() method to truncate to the "local_week". This truncates to the locale's notion of the first day of the week, rather than always truncating to Monday. Patch by Christian Hansen. 1.04 2013-12-07 - Calling set_locale() or set_formatter() on an object with an ambiguous local time could change the underlying UTC time for that object. Reported by Marta Cuaresma Saturio. RT #90583. 1.03 2013-04-17 - The set_time_zone() method was not returning the object when called with a name that matched the current zone. Reported by Noel Maddy. RT #84699. 1.02 2013-04-15 - When a constructor method like new() or today() was called on an object, you'd get an error message like 'Can't locate object method "_normalize_nanoseconds" via package "2013-04-15T00:00:00"'. This has been fixed to provide a sane error message. Patch by Doug Bell. - When set_time_zone() is called with a name that matches the current time zone, DateTime now short circuits and avoids a lot of work. Patch by Mark Stosberg. 1.01 2013-04-01 - Fixed test failures on older Perls. 1.00 2013-03-31 - Bumped the version to 1.00. This is mostly because my prior use of both X.YY and X.YYYY versions causes trouble for some packaging systems. Plus after 10 years it's probably ready to be called 1.00. Requested by Adam. RT #82800. - The %j specifier for strftime was not zero-padding 1 and 2 digit numbers. Fixed by Christian Hansen. RT #84310. - The truncate method was sloppy about validating its "to" parameter, so you could pass things like "years" or "month whatever anything goes". The method would accept the parameter but then not actually truncate the object. RT #84229. - Previously, if a call to $dt->set_time_zone() failed it would still change the time zone of the object, leaving it in a broken state. Reported by Bill Moseley. RT #83940. - DateTime::Infinite objects should no longer die when methods that require a locale are called. Instead, these methods return undef for names and Inf/-Inf for numbers. This affects methods such as day_name() as well as CLDR and strftime formats. When a locale-specific format is used (like the "full" datetime format) it uses the en_US format. Reported by Paul Boldra. RT #67550. 0.78 2012-11-16 - Reverted the change to round nanoseconds up or down in various situtations. Now we always round down. This avoids the case where rounding up would require us to then increment the second value (which could then require us to increment the minute, which could then require us to increment the hour, which could then ...). In other words, we don't want to round 2011-12-31T23:59:59.999999 up to 2012-01-01T00:00:00, because that would be insane. This applies to the return values for ->microsecond, ->millisecond, and the %N specifier for strftime. Patch by Martin Hasch. RT #79845. 0.77 2012-09-25 - POD changes that should make the documentation look better, especially on the web. 0.76 2012-07-01 - The DateTime->subtract method ignored the end_of_month parameter. Patch by Chris Reinhardt. RT #77844. 0.75 2012-06-11 - The epoch for years 1-999 was broken because Time::Local is "clever". A pox on all clever APIs, I say! Reported by Christian Hansen. RT #77719. - Shut up compilation warning from 5.17.x. Reported by Tom Wyant. RT #77490.+). 0.66 2010-11-26 - A bunch of documentation cleanup. No code changes. 0.65 2010-10-25 - Actually put the right $VERSION in every package. No other changes. 0.64 2010-10-25 * All the constructors besides new() ended up calling new(), which meant that these constructors went through the parameter validation code twice. Avoiding this should make everything that constructs a new object (besides new() itself) a little faster. ** This change breaks DateTime::Fiscal::Retail454, but no other modules, to the best of my knowledge. ** - The t/39no-so.t test failed for some people. I can't reproduce it, but this release will hopefully fix the problem. Patch by Tokuhiro Matsuno. RT #62061. - Added a section on the DateTime Project ecosystem to the docs. Addresses RT #60930. - Fixed wiki links in the docs now that the wiki has moved to a new wiki platform. - Restored some of the dzil-ification. The repo now has a very minimal Build.PL file which is just enough to build the XS code and run the tests. This fixes the total lack of prereqs in the META.* files. Reported by Bjørn-Olav. RT #62427. 0.63 2010-09-24 - Actually bump the version in the module files. Oops. Reported by bricas. 0.62 2010-09-23 - Don't try to test with DateTime::Format::Strptime unless we have a relatively recent version. Should fix some test failures. 0.61 2010-07-16 - Switching to dzil in 0.56 broke the --pp flag for the Build.PL. Reported by Jonathan Noack. RT #59421. 0.60 2010-07-03 - By default, Dist::Zilla generates a Build.PL that requires Module::Build 0.3601+, but this distro really doesn't need any particular version. 0.59 2010-06-29 - More packaging fixes. This release makes sure that POD only shows up in the right files. In 0.56 through 0.58, some POD in the wrong place confused the search.cpan.org POD display code, and the main module's documentation wasn't viewable. 0.58 2010-06-28 - Versions 0.56 and 0.57 did not build XS properly when installing. 0.57 2010-06-26 - Make DateTime::LeapSecond have the same $VERSION as every other .pm file. 0.56 2010-06-26 - The set_formatter() method did not return the DateTime object, and did not actually validate the value provided for the formatter. Based on a patch by Andrew Whatson. RT #58506. - Improved docs on floating time zone. Based on suggestions by Michael Svoboda. RT #56389. - Added mention of end-of-month algorithms to docs on DateTime math. Based on a patch by Michael R. Davis. RT #58533. - License is now Artistic 2.0. 0.55 2010-03-16 - Get all tests passing on 5.6.2. Thanks to Zefram for help spotting the problems. - Moved code to my hg repo at. 0.54 2010-03-14 - Bumped the DateTime::TimeZone prereq to 1.09 to force people to use a modern version. Previously the minimum version was 0.59, and there have been a lot of bug fixes since then. - String overloading now extends to string comparison, so a DateTime object can be compared to any string. In other words if ( $dt eq $string ) { ... } will simply stringify $dt and then do a normal string-is-equals check. Previously, this would blow up unless both operands were a DateTime object. Note that future versions of Test::More (0.95_01+) will no longer stringify arguments to is(), which means that older versions of DateTime may cause new test failures when you upgrade Test::More. It is highly recommended that you upgrade DateTime before upgrading to Test::More 0.95_01+. Patch by Michael Schwern. RT #55453. - Allow passing end_of_month setting to $duration->inverse(). Requested by John Siracusa. RT #53985. 0.53 2009-12-06 - Added Test::Exception to build_requires. 0.52 2009-12-05 - Numeric to ->new() are now all validated to make sure they are integers. Previously, things like "month => 11.2" would have been allowed. Based on a bug report from Max Kanat-Alexandar. RT #45767. - Added a warning to the docs suggesting that you cache the locale time zone if you need to make many DateTime objects in the local zone. Looking up the local zone can be fairly expensive. RT #46753.. 0.50 2009-05-11 - Tests were failing on Win32 because they attempted to use a negative epoch. Fixed so that these tests are skipped. Fixes RT #45966. 0.49 2009-05-04 - A bug in the test code for handling overloaded objects in from_epoch resulted in a test failure on Perl 5.8.x. This release contains no changes besides a test code fix. 0.48 2009-05-04 - Some of the accessors (the "main" ones like year(), month(), day(), etc) now warn if they are passed a value. Patch from Shawn Moore. Fixes RT #6979. - DateTime::Duration expected DateTime to be loaded and used some constants from it, but did not explicitly "use DateTime". Reported by Jeff Kubina. RT #44740. - The CLDR formatting for "c" and "cc" was incorrectly using the local day of the week. This meant that it gave the wrong result for locales where Monday is not considered the first day of the week. Reported by Maros Kollar. RT #45007. - DateTime->from_epoch did not allow an object which overloaded numification as the epoch value. Patch by Michael Schwern. RT #45653. - Fixed how datetime subtraction is handled for some cases around DST changes. This had been improved back in 0.30, but there were still bugs. RT #45235. 0.47 2009-03-01 - The handling of CLDR format 'j' and 'jj' was backwards, using 24 hour time for locales that wanted 12 hour, and vice versa. Reported by Maros Kollar. - The CLDR formatting was missing support for lower-case "q" patterns. Reported by Maros Kollar. 0.46 2009-02-28 - Added a duration_class method for the benefit of DateTime.pm subclasses. Patch by Shawn Moore. 0.4501 2008-11-25 - The epoch() method got broken in the recent shuffling between Time::Local and Time::y2038. Unfortunately, the tests to catch this also got lost in the shuffle. Reported by Avianna Chao. 0.45 2008-11-11 - Reverted the changes to use Time::y2038, on the recommendation of Michael Schwern (the author of said module), because it is not yet stable. This may come back in a future release. 0.4401 2008-11-03 - In order to handle epochs > 2**32 properly on a 32-bit machine, we also need to import gmtime from Time::y2038. This changes fixes a whole bunch of test failures seen with 0.44. 0.44 2008-11-01 - XS-capable DateTime.pm now uses Time::y2038 instead of Time::Local. This lets it handle epochs up to 142 million years before and after the Unix epoch. - Fixed a compiler warning with Perl 5.10.0. - Fixed docs for year_with_era, which had AD and BC backwards. Reported by Vynce Montgomery. RT #39923. - The format_cldr() method did not format the "yy" format properly when the year ended in "0X". Reported by Wilson Santos. RT #40555. 0.4305 2008-10-03 - The pure Perl version of this module did not know about the end of 2008 leap second. Reported by James T Monty. 0.4304 2008-07-13 - Fix test failures when tests are run with DateTime::Locale 0.41. Reported by David Cantrell via CPAN Testers. 0.4303 2008-07-12 - There is a new leap second coming at the end of 2008.. 0.41 2007-09-10 [ BUG FIXES ] - The 13strftime.t test was failing when DateTime::Locale 0.35 was installed. The test has been adjusted and we now list DT::Locale 0.35 as the minimum version. Reported by David Cantrell. 0.40 2007-08-30 [ BUG FIXES ] - A custom formatter would be lost after a call to set() or truncate(). Reported by Kjell-Magne Øierud. RT #28728. - The truncate() method docs said it accepted "second" as a parameter, but it didn't actually do the right thing with it. Now it always truncates nanoseconds to 0 for any parameter it is passed. 0.39 2007-07-17 [ BUG FIXES ] - Yet more changes to how infinity is handled and tested. This passes for me on 32-bit Win XP and 64-bit Linux, which is promising. Patch by Yitzchak Scott-Thoennes. RT #22392. 0.38 2007-06-30 [ BUG FIXES ] - Require Test::Pod::Coverage 1.08 in pod-coverage.t, since we use all_modules, which was only exported as of version 1.08. Reported by MATSUNO Tokuhiro. Fixes RT #26594. - Fixed a bad link to the old FAQ location in the docs. Reported by Ric Signes. Fixes RT #26846. [ ENHANCEMENTS ] - DateTime.pm now explicitly overloads string comparison. This was done so that comparing a DateTime.pm object to a string returns false, rather than throwing an exception. Reported by Chris Dolan. Addresses RT #26085. 0.37 2007-03-30 [ BUG FIXES ] - Require DateTime::Locale 0.34, which fixes a problem that manifested when thawing a DateTime.pm object. See for some discussion of this. - Added pod coverage tests, and added some POD for undocumented methods as a result. [ ENHANCEMENTS ] - This distro is now GPG-signed, per RT #24776. 0.36 2007-01-18 [ BUG FIXES ] - For infinity, use 100 ** 1000 instead of 100 ** 100 ** 100. This may fix the problems with infinity on some platforms (or may not). Suggested by Bjorn Tackmann. See RT #17390, #19626, and #22392. - Require DateTime::TimeZone 0.59, which includes a similar fix. 0.35 2006-10-22 [ ENHANCEMENTS ] - Added several new methods for getting locale-based data, era_abbr(), era_name(), quarter_abbr(), and quarter_name(). The era() method returns the same data as era_abbr(), but is deprecated. 0.34 2006-08-11 [ BUG FIXES ] - DateTime's code to fall back to the pure Perl implementation was broken in most cases, making it fairly useless. Reported by Adam Kennedy and Brendan Gibson. - Under Perl 5.6.2 (and presumably 5.6.x), some of the tests mysteriously failed. I tracked this down to a weird interaction between DateTime's string overloading and Test::Builder->cmp_ok(). See RT 19626. 0.33 2006-08-09 (the "Asia/Kaohsiung" release) [ ENHANCEMENTS ] - Attempting to do an overloaded operation (add, subtract, compare) with an inappropriate argument (like $dt + 1) gives a more useful error message. [ BUG FIXES ] - The fixes in 0.30 for subtract_datetime() crossing a DST change had a bug. When subtracting two dates, both occurring on a DST change date, but where the dates did not cross the change, the answer was off by an hour. Reported by Chris Prather. See RT 20697. - Borrowed a tweak from version.pm's Makefile.PL to make compiler detection work with MSVC. 0.32 2006-07-24 [ BUG FIXES ] - Change how C compiler detection is done in the Makefile.PL so it does not rely on having make on the system. The new way should work on (most?) Unix and Win32 systems. Suggested by David Golden. See RT 18969. 0.31 2006-05-21 [ ENHANCEMENTS ] - Switched some uses of die() to Carp::croak(), where appropriate. This should make error messages more useful in many cases. Based on a suggestion by Max Maischein. See RT tickets 11692 & 18728. [ BUG FIXES ] - Removed all uses of UNIVERSAL::isa and UNIVERSAL::can as functions. - Tweaked 20infinite.t test to give more useful output for some failures, though it probably doesn't fix them. See RT 17390. 0.30 2005-12-22 [ ENHANCEMENTS ] - Expanded and rewrote the docs on date math to try to explain exactly how DateTime.pm works, and in particular cover the problems DST introduces to various types of date math. The docs now also include some specific recommendations on getting sane results from datetime math. - Added calendar_duration() and clock_duration() methods to DateTime::Duration - Explicitly override the stringification method for DateTime::Infinite objects. They now stringify as whatever the IEEE infinity and negative infinity numbers stringify to on your platform. On Linux this is "inf" and "-inf". CPAN RT #16632. [ BUG FIXES ] - delta_md() and delta_days() did not always return correct values when crossing a DST change. - The pure Perl version of the code had a dependency ordering problem where DateTime::LeapSecond depended on other pure Perl code that wasn't yet available. I'm not sure how this ever worked. - Remove mentions of leap second on 1971-12-31 from the docs, because there was no leap second that day. Reported by Mike Schilli. - If you added a second to a datetime that was on a leap second (like 2005-12-31T23:59:60) it got "stuck" and kept returning the same datetime. Reported by Mike Schilli. - Changes to the tests in 20infinite.t may fix failures seen on some platforms and with new versions of Test::More (0.62 was known to cause failures) [ *** BACKWARDS INCOMPATIBILITIES *** ] - The subtract_datetime() method switched back to using the local portion of the date _and_ time, but it now accounts for days with DST changes specially. This produces results that fix the bugs that were fixed by previous subtraction changes in 0.28 and 0.29, but without introducing even more bugs. The overall result should be sane, but please see the docs for details. 0.2901 2005-07-04 - A leap second for the end of 2005 was announced. 0.29 2005-06-03 [ *** BACKWARDS INCOMPATIBILITIES *** ] - When adding/subtracting a duration with months or days that crossed a DST change, the result was based on the local time, not the UTC time. For consistent results, it is necessary to use the UTC time (but local date) for all date math. Reported by J. Alexander Docauer. 0.28 2005-02-27 [ ENHANCEMENTS ] - The era names for the era() method are now retrieved from the DateTime.pm object's associated locale. The old era() method, which was hard-coded to use BCE and CE, is renamed secular_era(). The christian_era() method remains the same. [ BUG FIXES ] - Fixed an embarassing bug in the subtract_datetime() method. It was subtracting local times, not UTC, which caused bugs when doing subtraction across a DST change. This method is used to implement subtraction overloading, so that was affected as well. Reported by Mike Schilli. - The docs for the %U and %W strftime specifiers implied that these should be zero-padded, but the code was not doing so. Reported by J Docauer. 0.27 2005-01-31 [ ENHANCEMENTS ] - Added local_rd_values() method for the benefit of other modules like DateTime::Event::Recurrence. 0.26 2005-01-27 [ BUG FIXES ] - The docs claimed that the delta_ms(), delta_md(), delta_days() methods always returned a positive duration, but this was not true for delta_md() or delta_days(). 0.25 2005-01-10 (the "new year, new bugs" release) [ BUG FIXES ] - Calling set_time_zone() for a datetime very close to a time zone change died for many of the Olson time zones. - The docs for the from_object constructor said that by default, new objects were in the UTC time zone, but in reality the default was the floating time zone. The docs were changed to match the code. Ticket 9278 on rt.cpan.org. 0.24 2004-12-10 (the "have I mentioned I hate leap seconds" release) [ BUG FIXES ] - Fixed even more bugs related to leap seconds and time zones. Reported by Eugene van der Pijll. [ KNOWN BUGS ] - Offsets with a seconds portion (like "+00:00:30") act strangely near leap seconds. Reported by Eugene van der Pijll. This will be fixed in a future release. 0.23 2004-12-09 (the "oh how I hate leap seconds" release) [ ENHANCEMENTS ] - Added a number of convenience "set" methods: set_year, set_month, set_day, set_hour, set_minute, set_second, set_nanosecond, and set_locale. Suggested by Michael Schwern. - Added christian_era and year_with_christian_era methods. - Clarified that from_epoch(), today(), and now() all return objects in the UTC time zone. Suggested by Sagar Shah and others. - Added formatter parameter to constructor, which allows per-object stringification. Based on a patch from Daisuke Maki. [ BUG FIXES ] - Trying to serialize DateTime::Infinite objects with Storable blew up. Patch by Daisuke Maki. - Require Test::More 0.34+, since I use a function introduced in that version in the tests. Suggested by Jean Forget. - Fix a bug in strftime() which could cause weirdness with pathological specifiers like "%%{day_name}%n". Reported by Jean Forget. - Fixed a number of bugs related to leap seconds and time zones. Reported by Eugene van der Pijll. 0.22 2004-07-23 [ *** BACKWARDS INCOMPATIBILITIES *** ] - The leap second table we were using mistakenly included a leap second on December 31, 1971. This will break all versions of the DateTime::Format::Epoch::TAI64 module up to and including version 0.06. Most users of DateTime.pm will not be affected. Patch by Joshua Hoblitt. 0.2101 2004-06-10 [ BUG FIXES ] - There was a bug in the date math code that occurred if you tried to add enough days, minutes or seconds to generate a datetime 10 years in the future (or so). If the the DateTime object had a a time zone with recurring DST changes, then the date math operation would cause a fatal error "Invalid local time for date in time zone ...". Reported by Dave Faraldo. 0.21 2004-03-28 (The "Another YAPC::Taipei release party release" release) [ *** BACKWARDS INCOMPATIBILITIES *** ] - When given mixed positive & negative arguments, DateTime::Duration no longer forces all arguments to be negative. - For mixed durations, the is_positive, is_zero, and is_negative methods all return false. - Brought back stringification overloading. As of version 1.06, Devel::StackTrace will ignore this overloading when displaying a trace. [ ENHANCEMENTS ] - Add a new in_units() method to DateTime::Duration. Patch by Andrew Pimlott. - Rely on DateTime::TimeZone and DateTime::Locale having their own Storable hooks, as opposed to handling them in DateTime.pm's own Storable hooks. This should fix RT ticket #5542, reported by Dan Rowles (I hope). - More docs on how date math is done. See the new section "The Results of Date Math". [ BUG FIXES ] - DateTime::Duration's is_positive, is_zero, and is_negative methods could incorrectly return true if a duration contained mixed positive and negative units. - Better normalization of nanoseconds in DateTime::Duration. Patch by Andrew Pimlott. 0.20 2004-02-12 [ IMPROVEMENTS ] - Tweaked the "How Date Math is Done" section in DateTime.pm to provide some more explicit examples. [ BUG FIXES ] - If seconds are not negative, DateTime::Duration will try to keep nanoseconds >= 0 when normalizing them to seconds, as long as this doesn't make seconds become negative. Suggested by Andrew Pimlott. - In the datetime subtraction code, there was an off-by-one error in the code to determine if one of the datetimes occurred in a minute containing a leap second. This led to the result of the subtraction being off by one second. Patch by Andrew Pimlott. - A duration's nanoseconds weren't normalized after multiplication. Patch by Andrew Pimlott. 0.1901 2004-01-07 (the "people care about ancient history?" release) [ BUG FIXES ] - The day of week was totally busted for dates before 0000-12-25. Reported by Flavio Glock. 0.19 2003-12-01 (the "never look before a leap second" release) [ IMPROVEMENTS ] - DateTime::Duration now provides a compare() class method. - DateTime::Duration now overloads comparison to throw an exception, because comparison requires a base DateTime object. Note that previous versions of DateTime::Duration _did not_ overload comparison, so if you were comparing them, you were just comparing the value of the object references. Thanks to Rick Measham, Jon Swartz, and Max Maischein for contributing to the discussion on datetime@perl.org about how to implement this feature. - Added DateTime::Duration->multiply to complement multiplication overloading. - Added a leap_seconds method. - Added a section to the docs about floating datetimes. - DateTime::LeapSecond no longer contains code copied from DateTime.pm, instead it just uses DateTime.pm directly. Patch by Joshua Hoblitt. [ BACKWARDS INCOMPATIBILITIES ] - DateTime::LeapSecond's leap_seconds() function now returns the number of leap seconds that have occurred, as opposed to the difference between TAI and UTC for a given Rata Die day, which is what it was returning previously. This means that the values it returns are 9 second less than the previous version. This does not affect DateTime.pm because it never looke at the actual value, just the difference between two leap second values, which remains the same. 0.18 2003-10-26 (the "delta, delta, delta, can I help ya, help ya, help ya?" release) [ IMPROVEMENTS ] - Added several new methods for calculating the difference between two datetime objects. These are delta_md(), delta_days(), and delta_ms(). Each of these methods returns the difference as a duration containing just certain units. [ BUG FIXES ] - Require Pod::Man 1.14+, so that head3/head4 markup doesn't cause installation to die. [ BACKWARDS INCOMPATIBILITIES ] - The local_rd_as_seconds method is deprecated, as it doesn't really serve much purpose. 0.1705 2003-10-07 [ BUG FIXES ] - Subtracting one datetime from another was still broken, and my fix in 0.1704 broke many other subtractions. Reported by Pierre Denis again. Many thanks to Pierre for paying attention. - Subtracting datetimes where the subtraction crossed a leap second was also broken. 0.1704 2003-10-07 [ IMPROVEMENTS ] - Documented the behavior of strftime() when given an invalid format. [ BUG FIXES ] - The DateTime::Duration synopsis showed a sign() method that doesn't exist, so I removed it from the synopsis. Reported by Flavio Glock. - Subtracting one datetime from another was seriously broken. The values for days & weeks were wrong in many cases. Reported by Pierre Denis. 0.1703 2003-09-22 [ BUG FIXES ] - truncate( to => 'week' ) caused a fatal error when the beginning of the week was in the previous month. Reported by R. Mathews (rt.cpan.org #3843). 0.1702 2003-09-18 [ IMPROVEMENTS ] - Added truncate( to => 'week' ). Suggested by Flavio Glock. 0.1701 2003-09-15 [ BUG FIXES ] - If from_epoch was given a fractional epoch with a floating point value with more than 9 digits after the decimal point, the object ended up containing a floating point number of nanoseconds. We now truncate this number to an integer. Fixed by Joshua Hoblitt. - The %V strftime specifier was documented, but not implemented. Reported by Joshua Hoblitt. - Test #56 in 03components.t would die with "Invalid offset: -124" when run with DateTime::TimeZone 0.2502+. Next time, I'll read my own docs ;) 0.17 2003-08-29 (the "math is hard" release) [ BACKWARDS INCOMPATIBILITIES ] - The default end_of_month mode for negative durations is now "preserve". This makes more sense, as the previous default meant that the following code: print DateTime->new( year => 2003, month => 5, day => 31 ) ->subtract( months => 1 )->ymd; printed "2003-05-01" as opposed to "2003-04-30". Thanks to Thomas Klausner for starting a discussion on this problem. - The subtract_datetime method now returns different results, as does subtraction overloading when both sides of the subtraction are DateTime objects. The subtract_datetime_absolute method returns results similar to what was previously returned from subtract_datetime. Thanks to Matthew McGillis for bringing this up, and Joshua Hoblitt and Eugene van der Pijll for contributing to the ensuing discussion. [ IMPROVEMENTS ] - DateTime.pm compare() method is now documented to work with any other calendar class that provides a utc_rd_values() method. - Added the subtract_datetime_absolute method. See the docs for details. - Documented the inverse() method in DateTime::Duration. 0.1601 2003-08-07 [ BUG FIXES ] - On platforms like Win32, where we can't find a finite() or isfinite() function/macro, the DateTime::LeapSecond code wasn't being loaded, so many tests failed. Reported by Ron Hill. 0.16 2003-08-06 [ IMPROVEMENTS ] - The XS code now implements leap second-related calculations. However, this is only used on platforms where we can find a usable finite() or isfinite() function/macro, so it isn't used on Win32. - This distro has now borged the DateTime::LeapSecond module. It is only loaded when the XS leap second code cannot be used. - Other miscellaneous performance improvements. 0.1503 2003-07-31 [ BUG FIXES ] - Adding a duration with delta months to an infinite DateTime was quite broken. Reported by Eugene van der Pijll. 0.1502 2003-07-31 [ BUG FIXES ] - XSLoader wasn't the problem on Solaris, so it's back. - Now loading the XS version of DateTime.pm is wrapped in an eval block. If it fails with an error about the object version not matching, the pure Perl version is loaded instead. This should fix Solaris. Thanks to Joshua Hoblitt for identifying this bug. 0.1501 2003-07-30 [ BUG FIXES ] - Fixed the from_object() method to set the returned object's time zone to the floating time zone if the source object did not have a time zone, as specified in the docs. Previously, the returned object's time zone was UTC. Patch by Eugene van der Pjill. - For this release, at least, the module always uses Dynaloader. This is in order to see if this fixes a problem on Solaris where the install library version of the DateTime .so file is loaded instead of the newly compiled version in the blib directory. 0.15 2003-07-29 [ IMPROVEMENTS ] - The utc_rd_values() method now returns nanoseconds in addition to Rata Die days and seconds. Based on a patch by Joshua Hoblitt. - The from_object() method expects objects to return the same values from their utc_rd_values() methods. Based on a patch by Joshua Hoblitt. [ BUG FIXES ] - Fixed a bug in the pure Perl version of _normalize_tai_seconds that caused very weird results from datetime math. This version may be used on platforms where the XS code compiles, so it can affect quite a number of systems. Reported by Dan Sully. 0.1402 2003-07-24 [ BUG FIXES ] - Fix DefaultLocale method, which didn't work at all. Reported by Serge Leger. 0.1401 2003-07-24 [ BUG FIXES ] - Fix a test failure in 13strftime.t under Perl 5.6.1 (and probably 5.6.0). 0.14 2003-07-23 [ BACKWARDS INCOMPATIBILITIES ] - The DateTime::Language modules are no longer being developed or distributed as part of the DateTime.pm distribution. Because of this, all "language" parameters should now be replaced by "locale" parameter. The "language" parameter is deprecated and will be removed in a future release. Also note that locales should be specified via ISO codes, not names like "English". The old DateTime::Language names will continue to work indefinitely, but they load DateTime::Locale objects instead. Locale-specific data will be returned in utf8 when necessary. - Similarly, the "language" and "DefaultLanguage" methods are now deprecated in favor of "locale" and "DefaultLocale". [ IMPROVEMENTS ] - DateTime::Duration now returns the object from mutator methods, in order to make method chaining possible. Suggested by Ben Bennett. - If the value for second given to new() is 60 or 61, then it must be a valid leap second. - DateTime now uses DateTime::Locale for localization, which allows for real language and territory based localization. The locale code is generated from the ICU project's data, and is much more complete than the DateTime::Language modules. However, we are losing (hopefully only temporarily) support for the various African languages contributed by Daniel Yacob. Support for those languages should return in a future release of DateTime::Locale. - Support for the '%c', '%x', and '%X' strftime format specifiers, which output localized date and time strings. - Added the time_zone_long_name method, primarily for the benefit of DateTime::Locale. - Added a note to the DateTime::Infinite docs warning that it may not work well on Win32. [ BUG FIXES ] - DateTime::Duration was not consistent in how it handled mixed positive and negative constructor parameters. Reported by Ben Bennett. 0.13 2003-05-05 [ IMPROVEMENTS ] - DateTime now does more validation of parameters given to constructors and to the set() method, so bogus values like a month of 13 are a fatal error. - Added a new constructor, from_day_of_year(). - Added a number of new "get" methods, including era, year_with_era, hour_1, hour_12, hour_12_0, weekday_of_month, and week_of_month. Based in part on a patch from Rick Measham. - Now any object method can be called in strftime format by using "%{method}" as a format specifier. Patch from Rick Measham - Added an is_zero method to DateTime::Duration, for objects of zero length. - DateTime->from_epoch will now accept a floating point epoch and turn the post-decimal portion into nanoseconds. This was done in order to interface more accurately with Time::HiRes. - Added a DateTime->hires_epoch method that returns a floating point value for epoch, also for compatibility with Time::HiRes. - DateTime.pm now implements Storable hooks to reduce the size of serialized DateTime objects. In particular, the contained time zone object is not serialized along with the DateTime object. - It is now possible to create arbitrary DateTime::Language subclasses in any namespace. [ BUG FIXES ] - "Fixed" 20infinite.t failures on Windows with 2 icky hacks. The first simply doesn't compile the XS code that deals with infinite numbers on Win32, so the pure Perl version is used instead. However, the rest of the XS code is still compiled on Win32. The other hack is to simply skip a failing test in 20infinite.t on Win32. Hopefully, this will eventually be fixed but given that this is not core functionality for most users, I'd rather get this release out the door now. - Fix epoch() method to work properly with dates greater than 50 years ago. Apparently, if Time::Local is given a year less than 100, it tries to guess the century, and it doesn't do this by simply adding 1900. Numbers less than 53 (for the year 2003) are treated as being in the current century. Ugh. - Fixed compilation on HPUX. Patch from Dan Sully. - The last_day_of_month() method did not accept a nanosecond parameter. - A DT::Duration object created with just nanoseconds was always positive, regardless of the value given for nanoseconds. - Fixed a serious bug when subtracting one datetime from another that could cause the result to be off by up to a second, and negative when it should be positive. This was caused by the introduction of nanoseconds in 0.10. - A zero length duration reported itself as positive when it should be neither positive nor negative. - In Perl 5.6.1/Red Hat Linux 7.2, multiplying a variable with value zero by -1 gives negative-zero, which breaks tests. perl -e ' $x=0; $x*=-1; print $x ' -0 Patch by Flavio Glock. - Comparing a DateTime::Infinite object to a regular datetime could cause a fatal error. Reported by John Peacock. - Fixed a failure in the 04epoch.t tests on Win32. Negative epoch values don't work on Win32. [ BACKWARDS INCOMPATIBILITIES ] - The "Portugese" language module has been renamed to "Portuguese". I'm so embarassed! Reported by Richard Evans. - DateTime::Infinite objects no longer die if "set" methods are called. Instead, these methods are now no-op methods that simply return the original object. This makes these objects more usable when mixed with regular datetime objects. - Removed the fractional_second constructor parameter. It was incorrectly documented anyway. The fractional_second _accessor_ is still there. - DateTime::Duration objects of zero length no longer return true for is_positive. 0.12 2003-05-05 [ BUG FIXES ] - Make sure tests always run with warnings on. - Fix line that had "$] >= 5.6.0" to be "$] >= 5.006". This caused warnings and was just wrong. Reported by John Siracusa. - Quiet warnings from pure Perl implementation. - Quiet warnings from language modules with Unicode when used with Perl 5.00503. 0.11 2003-05-03 [ IMPROVEMENTS ] - Moved a little bit of the leap second code to XS, so DateTime.pm may be a tiny bit faster. - Added name() method to DateTime::Language. Suggested by Rick Measham. - Use XSLoader with Perl 5.6.0+, which according to ancient perl5-porters discussions saves some memory. - Added infinite DateTime objects. See the DateTime::Infinite docs for details. [ BUG FIXES ] - The %I and %l strftime formats were formatting hours as 0-11, not 1-12 as documented. Patch by Simon Newton. - A DateTime::Duration object created only with weeks as a parameter always was positive. Fixed by Flavio Glock. [ BACKWARDS INCOMPATIBILTIES ] - Because of changes in DateTime::TimeZone 0.13, which this version now requires, when a local time is ambiguous, the latest UTC time is used, rather than the earliest, as was done previously. - The Brazilian language module has been renamed as Portugese. - Removed DateTime::Duration->compare (which I forgot to document anyway ;) and comparison overloading for DT::Duration. There's no meaningful way to compare 60 days to 2 months. 0.10 2003-04-19 (the "I'm sure the new regime will be spiffy" release) [IMPROVEMENTS] - Added Tigre language module. Contributed by Daniel Yacob. - DateTime::Duration objects now overload multiplication. Implemented by Flavio Glock. - Added support for nanoseconds in DateTime.pm and DateTime::Duration. Implemented by Flavio Glock. - Added complete support for leap seconds (through use of DateTime::LeapSecond). Mostly implemented by Flavio Glock. [ BACKWARDS INCOMPATIBILTIES ] - Because of the addition of leap seconds to the mix, we are now forced to handle seconds separately from minutes when doing date math. This means that several aspects of the DateTime::Duration API have changed. Specifically: -- There is now an additional delta_minutes() method. -- The hash returned by the deltas() method now includes a "minutes" key. -- The seconds delta may be greater than 59. -- The seconds() method may return a number greater than 59. 0.09 2003-04-05 (the "liberation through violence" release) [IMPROVEMENTS] - As requested by numerous people, there is now a pure Perl implementation of DateTime.pm included with this distribution. If you don't have a C compiler it will be used instead of the XS implementation. - Document how floating time zones are handling in comparisons, and add the compare_ignore_floating method. Based on a patch from Eugene van der Pijll. - Allow from_epoch(), now(), and today() to accept a time_zone parameter. Based on suggestions from Tim Bunce and Joshua Hoblitt. - Allow extraction of AM/PM string list from DateTime::Language classes. - Added quarter() and day_of_quarter() methods. Based on a patch from Tim Allwine. [BUG FIXES] - If a datetime had the floating timezone and then set_time_zone was used to set it to something else, the internal UTC time of the object was not changed, meaning that its offset could be calculated incorrectly. Patch by Eugene van der Pijll. - If datetime math was done with hours, minutes, or seconds, the return value of ->epoch would be wrong after this. Based on report and patch from Iain Truskett. 0.08 2003-03-21 (the "anti-war" release) [IMPROVEMENTS] - All set/modify methods now return the datetime object, in order to make method chaining possible. Patch by Iain Truskett. - The _greg2rd and _rd2greg methods have been renamed _ymd2rd and _rd2ymd, so as to make them look more normal when used in subclasses. - Added a truncate() method. Suggested by Flavio Glock. - Added Swedish language module. Contributed by Christian Hansen. - Added language modules for Afar, Amharic, Gedeo, Oromo, Sidama, Somali, and Tigrinya (Eritrean and Ethiopian), all courtesy of Daniel Yacob. - Various doc improvements, including a section on invalid local times. [BUG FIXES] - The week() method was wrong for many dates. Reported by Christian Hansen. - The last_day_of_month() method had the DateTime class hard-coded in it. Reported by Eugene van der Pijll. - Fixed a bug when comparing a datetime object to infinity (or negative infinity). Fixed by Flavio Glock. - Date math has been fixed so that it affects the _local_ times. This means that sometimes 1 day is not equal to 24 hours when the addition/subtraction crosses over a Daylight Saving Time change. See the "How Date Math is Done" section of the docs for more details. [BACKWARDS INCOMPATIBILITIES] - Objects constructed via the new() method now have a "floating" time zone by default, instead of using the "local" time zone. This is just simpler to deal with, and for code where time zones are unimportant, this is the most appropriate default. 0.07 2003-02-26 [IMPROVEMENTS] - Added a small hack to the compare() method so that this module can be used with Set::Infinite. - Changed compare so that it can be used to compare two objects from different calendars that conform to the DateTime::Calendar interface. - Added explanation of exactly what calendar this module represents ("proleptic Gregorian calendar") to docs. - Added a Spanish language DateTime::Language subclass. Implemented by Flavio S. Glock. - Added support for specifying a language by ISO code ("en" or "pt-br") as well as the subclass name. Based on a patch from Eric Cholet. - Revamped the externally visible DateTime::Language API. - Objects created via the from_object() method are set to the time zone of the object from which they were created, if it has one, or UTC otherwise. [BUG FIXES] - The from_object() method was broken because it retrieved a UTC datetime from the object passed in, and then created a new DateTime object using that UTC time as a _local_ time. [BACKWARDS INCOMPATIBILITIES] - Removed stringification overloading. Having this in place made it impossible to create a strack trace in much of the time zone code. - Renamed the DateTime::Language->subclasses method as languages. - It is no longer possible to directly instantiate a DateTime::Language subclass, instead use: my $en = DateTime::Language->new( language => 'English' ); - The from_object() method no longer accepts a "time_zone" parameter. 0.06 2003-02-16 - The docs said that there was no year 0 in the Gregorian calendar, but that was wrong. The year() method can now return 0. The year_0() method has been removed. - Added jd() and mjd() methods. - Re-implemented some of the core code in XS for speed. 0.05 2003-02-13 - Fix handling and reporting of epoch times. Epoch times are, by definition, UTC times, so any time created from an epoch should always have its time zone set to "UTC". This can be changed after the object is created. Similarly, value returned by the epoch() method needs to be based on the object's UTC time, not it's local time. Bug reported by Kellan Elliott-McCrea. - Change year_0 so that -1 BCE is 0, not 1 CE. This corresponds to astronomical years. - Change ymd, dmy, mdy, and iso8601 to use Gregorian years (..., -2, -1, 1, 2, ... ) as opposed to astronomical years. Also make sure all negative years are formatted as 4 digits. 0.04 2003-02-10 - Explicitly set time zone for objects created during tests. 0.03 2003-02-09 - Giving a language parameter to a constructor method didn't load the language class. - Test that all language classes are at least loadable. - Added Brazilian (not quite a language ;) and Danish, again stolen from Graham Barr's TimeDate suite. - Added is_dst method. Requested by Matt Sergeant. 0.02 2003-02-09 - Fixed a bug in calculating day of year in leap years (it was +1 off starting in February). Reported by Matt Sergeant. - Subtracting one datetime from another was broken in most cases. Improved the tests for this quite a bit. Reported by Eric Cholet. - Made the version number a non-dev-release so it's visible when CPAN.pm tries to install it as a prereq for something else. 0.01_00 2003-02-04 - The first alpha release. This module draws on Date::ICal for much of its internals, so it has more history than a normal alpha release.
|
https://metacpan.org/changes/release/DROLSKY/DateTime-1.07
|
CC-MAIN-2015-40
|
refinedweb
| 7,190
| 68.87
|
The other end of the spectrum from or static typing is dynamic typing. In true dynamic typing a variable really can change its type at runtime.
This this doesn't have to be the abandonment of type checking just a move to type checking at run rather than compile time. C# hasn't quite adopted the "duck typing" approach that makes languages such as JavaScript, Ruby and Python, as it is still attempting to play within the strong typing rules it started out with.
The best way of thinking about dynamic type is as a sort of formal way to use a general object type which which allows you access to the methods and properties of the actual data type in use without the need to cast.
For example, suppose we have a class:
public class MyClass { public int MyProperty; public int MyMethod() { return 1; }}
If we now create an instance using an object reference type:
object MyObject = new MyClass();
then trying to access any of the methods or properties of the object will fail for obvious reasons – an object type doesn’t have the methods and properties of a MyClass type.
However, if you use a cast to MyClass then you can access all of the properties and methods as if MyObject was of type MyClass that is:
((MyClass) MyObject).MyMethod();
works perfectly.
In this sense using object and cast has long been the C# programmer’s way of implementing dynamic typing. In this sense dynamic typing is nothing new to the language.
However you must have had the thought
“why do I need to cast the object to the correct type – either the method call works or doesn’t work at run-time”.
Apart from making it easier to discover the programmer’s intention the cast does absolutely nothing to protect you from an error at compile time – any problems only become apparent at runtime.
With the new dynamic type you can indeed “drop the cast”.
The same code in C# can be written using the dynamic type introduced in version 4.0:
dynamic MyObject = new MyClass();MyObject.MyMethod();
The dynamic type only resolves to a method or property at runtime.
Interestingly you can mix dynamic and anonymous as in:
dynamic MyObject = new MyClass();var i=MyObject.MyMethod();
and the compiler correctly works out that i should be an int – suggesting that it isn’t completely blind to the type stored in MyObject. Notice that as dynamic is a valid static type name it is perfectly possible that an anonymous type will resolve to dynamic.
You can swap from dynamic to fully static simply by making appropriate assignments. For example:
dynamic j = 1;int i = j;
first creates a dynamic variable, an int, which is then converted to a strongly typed int. You can also force a conversion using a cast but, as always, if it can’t be done the result is a runtime exception.
Notice that dynamic really is dynamic in the sense that the determination of its type at runtime isn't a one off. A dynamic type can change its type as many times as necessary. For example:
dynamic i; i = 1; i = i + 1; i = "mike"; i = i + 1;
When the int 1 is assigned to it i becomes an int, and i+1 is an integer expression which evaluates to 2. Assigning the string "mike" to i changes its runtime type to string and now i+1 concatenates the string "1" which is implicitly cast from an int to give "mike1".
Notice that there is nothing new going on here as every thing works just as it would if the variable i was first declared as an int and then declared as a string - of course you can't change the type of a static type at compile time.
The guiding principle that has been used in implementing the dynamic type is that what happens should correspond to what happens if the dynamic type was known at compile rather than runtime.
So to work out how a dynamic type behaves simply imagine that you know its type at compile time and what happens in this case should be what happens to the dynamic type.
Whenever you change something in a language, no matter how small or innocent the change is, the ripples spread out and reach parts of the language that you might never have guessed at.
For example, with dynamic typing late binding is the rule even if the method in use isn’t virtual. Consider the following class with two overloaded versions of the same method:
public class MyClass { public string MyMethod(int i){ return "Integer"; } public string MyMethod(double f){ return "Double"; } }
If we now call the method but with a random type, i.e. a the type of the object is selected randomly, something that was impossible to do before the introduction of dynamic, as in:
Random R = new Random();MyClass MyObject = new MyClass();dynamic i;if(R.NextDouble()<.5){ i = 1;}else{ i=1.0;}string result=MyObject.MyMethod(i);
Random R = new Random();
MyClass MyObject = new MyClass();dynamic i;if(R.NextDouble()<.5){ i = 1;}else{ i=1.0;}string result=MyObject.MyMethod(i);
then which MyMethod is actually called is determined at run time according to the type of i which is discovered using reflection. If i is a double then MyMethod(double f) is called and if it i is an int then MyMethod(int i) is called.
This should be the behaviour you expect from your understanding of the way that dynamic types work but notice that this means that the late binding is being used in a situation where you might have expected the usual early binding. That is, it fits into the principle that what should happen should be the same as if the type of the dynamic variable was known at compile time.
This can be slightly more complicated in that we can mix method overloading with overriding in a derived class - but the guiding principle still applies.
For example, suppose we have a derived class which overrides a non-virtual method in the original MyClass:
public class MyClass2:MyClass{ public new string MyMethod(double f){ return "Class2 Double"; }}
As the method isn't virtual you would expect early binding to be used i.e. based on the compile type type of the object. However we have already noted that using a dynamic parameter forces late binding. So which is it?
That is of we now change the creation of MyObject in the previous example to read:
MyClass MyObject = new MyClass2();
which method will be used for a double MyClass's or MyClass2's?
At compile time the type of MyObject is MyClass even if at run time it actually refers to a MyClass2 object and so by the usual early binding rules it should be MyClass's methods that are used and indeed this is what happens - even though which MyClass method is called isn't determined until runtime.
Thus the method call is early bound to the class type but late bound according to the signature of the call.
However, if you change the method declarations to virtual and override late binding is used on them both and MyClass2's double method is called
This is ruthlessly logical and if you stop to think about it what really should happen in each case.
<ASIN:073568183X>
<ASIN:1449380344>
<ASIN:0735667454>
<ASIN:0133440575>
<ASIN:1449320414>
|
http://www.i-programmer.info/programming/c/776-dynamic-c-.html?start=2
|
CC-MAIN-2015-40
|
refinedweb
| 1,245
| 55.98
|
Users of Visual Studio 2003 and newer may directly go to the next post#2 and skip this one.
- - -
Q: How to use 'CString' in non-MFC applications?
A: In most cases, you don't need to do that. In order to use 'CString' you have to statically or dynamically link your application to the entire MFC. This would not only increase the size of your executable file, the number of its dependencies, but also makes your program non-portable (especially if it is a Console application).
The recommended solution is to use the Standard C++ Class 'std::string'. It is as powerful as 'CString', is portable, using it does not imply adding a huge amount of things you don't need to your project and last, but not least, it is part of the programming language.
This being said, if you still want to use 'CString' in your non-MFC application, here it is whar you have to do:
Include 'afx.h' in one of your main headersOpen the menu 'Project -> Settings'. On the 'General' register of the settings dialog box choose 'Use MFC in a Shared DLL' or 'Use MFC in a Static Library' from the dropdown box called 'Microsoft Foundation Classes'.Rebuild your project.A simple sample of a console application using 'CString' looks like this:
Code:
#include <afx.h>
#include <iostream>
int main()
{
CString s("Hello");
std::cout << s.GetBuffer(0) << std::endl;
return 0;
}
#include <afx.h>
#include <iostream>
int main()
{
CString s("Hello");
std::cout << s.GetBuffer(0) << std::endl;
return 0;
}
Last edited by JeffB; June 17th, 2009 at 02:35 PM.
Reason: Fixed include using html characters
Forum Rules
|
http://forums.codeguru.com/showthread.php?231164-C-String-How-to-use-CString-in-non-MFC-applications&p=678875&mode=threaded
|
CC-MAIN-2015-40
|
refinedweb
| 277
| 73.27
|
i feel very happy by finding dis site
really very nice to have an access to those people like me who didn't have small knowledge.
this site helps to access the info from basics onwards........thanxxxx aloooooot
pls help me
pls i want you to help me in getting free code on java database and on how to add many panel to container and how to remove it thanks
useful
this is very useful for me
Asking Question
sir,
how many types of jdbc drivers plz one example for each one driver?
Wonderful tutorials!
I found these tutorials extremely helpful. They provide the right amount of detail and are wonderfully expressed!
Thank you so much!
siddhu
this site is very nice
saradhi ram
i want complete material of jdbc for learning purpose
JDBC
why close the connection is necessory in JDBC?
need
i need details about jdbc with java
Java
About java core & advanced
i want to know about jdbc full
i want to know about the jdbc and odbc
java learner
Respected sir/mam
this tutorials was very helpful and it is very easy to learn ....
Can u send me the Documentation of all Java tutorials please
thanking u sir,
java to Oracle
i hav problem in writing code for java to oracle database connectivity....
plsss help!!
can anyone provide me wid the code for java to oracle connectivity??
kindly reply!!
servlet
to solve the problem
voting system in jdbc
Please help i am working on an undergraduate project which is due mid next month 15 may 2010. i want a source code for voting system in jdbc using mysql 5.0 that system should update thevoters roll on servers, thanx
Jdbc program
sir i want to small java program to connect Access
Plz send a program in my email id
Java
what do you mean by JAVA
mySQL
how do i insert an user input from console into mySQL database table in java?
jdbc - JDBC
management so i need how i can connect the pgm to database by using jdbc...? if u replyed its very useful for me... Hi,
Please read JDBC tutorial at
Thanks
Hi,
You
Javascript - JDBC
should be displayed out. I am beginner in java field so using JDBC. anybody can...Javascript Hi,
I am doing a project in healthcare domain... then some records from database table should be displayed out. I am using jsp
JSP,JDBC and HTML(Very Urgent) - JSP-Servlet
JSP,JDBC and HTML(Very Urgent) Respected Sir/Madam,
Thanks... exact requirement in which if I get an immediate help,I will be very much grateful... the code:
I am not using any html. I used only jsp & jdbc. i had written jdbc connection in method and i need to get connection in another class?
import java.sql.*;
class... driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test
jdbc
jdbc hi..i want to create a table and insert data in that table of ms-access using java application i want to perform both operations of ms-access using jdbc connection
import java.sql.*;
public class CreateTable
|
http://roseindia.net/tutorialhelp/allcomments/53397
|
CC-MAIN-2014-41
|
refinedweb
| 519
| 61.36
|
Investors considering a purchase of L-3 Communications Holdings, Inc. (Symbol: LLL) stock, but cautious about paying the going market price of $150.10/share, might benefit from considering selling puts among the alternative strategies at their disposal. One interesting put contract in particular, is the April 2017 put at the $135 strike, which has a bid at the time of this writing of $3.40. Collecting that bid as the premium represents a 2.5% return against the $135 commitment, or a 4% annualized rate of return (at Stock Options Channel we call this the YieldBoost ).
Selling a put does not give an investor access to LLL's upside potential the way owning shares would, because the put seller only ends up owning shares in the scenario where the contract is exercised. And the person on the other side of the contract would only benefit from exercising at the $135 strike if doing so produced a better outcome than selling at the going market price. ( Do options carry counterparty risk? This and six other common options myths debunked ). So unless L-3 Communications Holdings, Inc. sees its shares decline 10% and the contract is exercised (resulting in a cost basis of $131.60 per share before broker commissions, subtracting the $3.40 from $135), the only upside to the put seller is from collecting that premium for the 4% annualized rate of return.
Interestingly, that annualized 4% figure actually exceeds the 1.9% annualized dividend paid by L-3 Communications Holdings, Inc. by 2.1%, based on the current share price of $150.10. And yet, if an investor was to buy the stock at the going market price in order to collect the dividend, there is greater downside because the stock would have to lose 10.01% to reach the $135 strike price.
Always important when discussing dividends is the fact that, in general, dividend amounts are not always predictable and tend to follow the ups and downs of profitability at each company. In the case of L-3 Communications Holdings, Inc., looking at the dividend history chart for LLL below can help in judging whether the most recent dividend is likely to continue, and in turn whether it is a reasonable expectation to expect a 1.9% annualized dividend yield.
Below is a chart showing the trailing twelve month trading history for L-3 Communications Holdings, Inc., and highlighting in green where the $135 strike is located relative to that history:
The chart above, and the stock's historical volatility, can be a helpful guide in combination with fundamental analysis to judge whether selling the April 2017 put at the $135 strike for the 4% annualized rate of return represents good reward for the risks. We calculate the trailing twelve month volatility for L-3 Communications Holdings, Inc. (considering the last 252 trading day closing values as well as today's price of $150.10) to be 20%. For other put options contract ideas at the various different available expirations, visit the LLL Stock Options page of StockOptionsChannel.com.
Top YieldBoost Puts.
|
https://www.nasdaq.com/articles/commit-purchase-l-3-communications-holdings-135-earn-4-annualized-using-options-2016-09-06
|
CC-MAIN-2019-47
|
refinedweb
| 515
| 54.83
|
Plack::Middleware::Cached - Glues a cache to your PSGI application
use Plack::Builder; use Plack::Middleware::Cached; my $cache = CHI->new( ... ); # create a cache builder { enable 'Cached', # enable caching cache => $cache, # using this cache key => 'REQUEST_URI', # using this key from env env => ['my.a','my.b']; # and cache $env{'my.a'} and $env{'my.b'}, $app; } # alternative creation without Plack::Builder Plack::Middleware::Cached->wrap( $app, cache => $cache );
This module can be used to glue a cache to a PSGI applications or middleware. A cache is an object that provides at least two methods to get and set data, based on a key. Existing cache modules on CPAN include CHI, Cache, and Cache::Cache. Although this module aims at caching PSGI applications, you can use it to cache any function that returns some response object based on a request environment.
Plack::Middleware::Cached is put in front of a PSGI application as middleware. Given a request in form of a PSGI environment E, it either returns the matching response R from its cache, or it passed the request to the wrapped application, and stores the application's response in the cache:
________ _____ Request ===E===>| |---E--->| | | Cached | | App | Response <==R====|________|<--R----|_____|
In most cases, only a part of the environment E is relevant to the request. This relevant part is called the caching key. By default, the key is set to the value of REQUEST_URI from the environment E.
Some application may also modify the environment E:
________ _____ Request ===E===>| |---E--->| | | Cached | | App | Response <==R+E==|________|<--R+E--|_____|
If needed, you can configure Plack::Middleware::Cached with env to also cache parts of the environment E, as it was returned by the application.
If Plack::Middleware::Cached retrieved a response from the cache, it sets the environment variable
plack.middleware.cached. You can inspect whether a response came from the cache or from the wrapped application like this:
builder { enable sub { my $app = shift; sub { my $env = shift; my $res = $app->($env); if ($env->{'plack.middleware.cached') { ... } return $res; }; }; enable 'Cached', cache => $cache; $app; },
Caching delayed/streaming responses is supported as well.
An cache object, which supports the methods
get( $key ) to retrieve an object from cache and
set( $key, $object [, @options ] ) to store an object in cache, possibly adjusted by some options. See CHI for a class than can be used to create cache objects.
Key to map a PSGI environment to a scalar key. By default only the REQUEST_URI variable is used, but you can provide another variable as scalar, a combination of variables as array reference, or a code reference that is called to calculate a key, given a PSGI environment. If this code returns undef, the request is not cached.
Name of an environment variable or array reference with multiple variables from the environment that should be cached together with a response.
Code reference to determine a policy for storing data in the cache. Each time a response (and possibly environment data) is to be stored in the cache, it is passed to this function. The code is expected to return an array with the response as first value and optional options to the cache's 'set' method as additional values. For instance you can pass an expiration time like this:
set => sub { my ($response, $env) = @_; return ($response, expires_in => '20 min'); }
You can also use this method to skip selected responses from caching:
set => sub { my ($response, $env) = @_; if ( $some_condition_not_to_cache_this_response ) { return; } return $response; }
There already are several modules for caching PSGI applications: Plack::Middleware::Cache by Ingy döt Net implements a simple file cache for PSGI responses. Panu Ervamaa created a more general module of same name, available at.
Jakob Voß
This software is copyright (c) 2013 by Jakob Voß.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|
http://search.cpan.org/~voj/Plack-Middleware-Cached-0.15/lib/Plack/Middleware/Cached.pm
|
CC-MAIN-2016-50
|
refinedweb
| 655
| 58.52
|
Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have set group by in field Quotation / Order report in 7.0?
I have add one field category in my test module. Now I want to print report(quatation/order) and i have display product category wise print. Suppose 1.Services,2.Delivery Report will print in 10 products in services and 5 products in Delivery just like summurrywise
ITEM | Total Services | 10 Delivery | 5 Total | 15Is this possible ?
You have to create your own report which will print reports Category wise.
I mean in report 1st table will be for Category A with its Products and 2nd table for Category B with its Products.
I have edit quatation/order default in sale. I have add field category in my new addons.
You mean you want to create one more table that contains Category Name and Total Number of Products in that category? Am I right?
I have add one field categ_type in sale.order.line Now we print only this categ_type its contain no of product suppose Delivery 10 products. how I print this group_by. I hope you got it.
Solve my issue for in create one method retrive data from postgrey and set in to rml that return dict.
def get_val(self, obj): query = """ SELECT categ_type as name, sum(product_uom_qty * price_unit) as total FROM sale_order_line WHERE order_id = %s GROUP BY categ_type """%(obj.id) self.cr.execute(query) data = self.cr.dictfetchall() for t in data: dict={'name' : t['name'], 'total' : t['total']} res.append(dict) return res
repeatIn[o.get_val(o), 'p']
[[ p['name'] ]] [[ p['total'] ]]
Which script have you changed especially the place where you created this function.
In my custom module.Thanks
About This Community
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|
https://www.odoo.com/forum/help-1/question/i-have-set-group-by-in-field-quotation-order-report-in-7-0-20707
|
CC-MAIN-2018-13
|
refinedweb
| 332
| 59.4
|
I've fixed the build, the problem being that ANTLR would generate files in file.encoding and then we would compile them as UTF-8. It makes no difference to the *text*, but the *comments* contain the full source path. C:\Users\Épreuve\atelier\ ... blahblah ... . Now file.encoding=UTF-8.
I'm fighting the launcher now, in the shape of jython.py. One can easily create a complicated situation in which all sorts of encodings are in play. Just at the DOS and Python prompts:
> type argtest.py
# What do arguments appear as, when codepages intervene?
import sys, os, locale, subprocess
print sys.argv
for arg in sys.argv:
print "%s ( %r )" % (arg, arg)
> chcp
Active code page: 850
> set TEST=Épreuve
> python -i argtest.py café crème %TEST%
['argtest.py', 'caf\xe9', 'cr\xe8me', '\xc9preuve']
argtest.py ( 'argtest.py' )
cafÚ ( 'caf\xe9' )
crÞme ( 'cr\xe8me' )
╔preuve ( '\xc9preuve' )
### Notice that sys.argv contains byte strings but they are
### not encoded with the console encoding cp850.
### The os module is using the same encoding.
>>> os.getcwd()
'C:\\Users\\\xc9preuve\\Documents\\Python2'
>>> print os.getcwd()
C:\Users\╔preuve\Documents\Python2
>>> print os.getcwdu()
C:\Users\Épreuve\Documents\Python2
>>> os.getenv('TEST')
'\xc9preuve'
### There are plenty of encodings to choose from.
>>> sys.stdout.encoding
'cp850'
>>> sys.getdefaultencoding()
'ascii'
>>> sys.getfilesystemencoding()
'mbcs'
>>> locale.getpreferredencoding()
'cp1252'
### But this one is consistent with what I'm seeing:
>>> for a in sys.argv: print a.decode(locale.getpreferredencoding())
...
argtest.py
café
crème
Épreuve
What fun! I *tentatively* conclude we must treat arguments and environment variables as encoded with locale.getpreferredencoding(). This also seems to be the acceptable encoding when we come to launch a subprocess:
>>> subprocess.call(["python", "argtest.py"] + sys.argv[1:])
['argtest.py', 'caf\xe9', 'cr\xe8me', '\xc9preuve']
argtest.py ( 'argtest.py' )
cafÚ ( 'caf\xe9' )
crÞme ( 'cr\xe8me' )
╔preuve ( '\xc9preuve' )
The point here is not that these print correctly, but they print the same as they did when I ran this from the DOS prompt.
Now, in jython.py, it's all driven from sys.stdout.encoding, which is different. We may even be calling encode() where we should be decoding. Or possibly we could just leave everything as bytes in the seemingly-consistent encoding of CPython and Windows. I'll see what I can do. (I'll try not to break jython.py for Linux, though it seems the minority case here.)
Eventually, when Jython lunches again, I'll get to the bug(s) our users French and Chinese are experiencing, that pops up first in site.py.
But fighting jython.py has been instructive. There may be lessons from CPython here about what we should be doing internally to Jython when handling byte strings from the system via file system, environment and arguments.
|
http://bugs.jython.org/msg11272
|
CC-MAIN-2017-47
|
refinedweb
| 460
| 70.5
|
HTML/Adobe AIR Application Diversion Three - Add ActionScript to your HTML
This post is more than 2 years old.
So time for another diversion, once again care of Hatem who suggested it to me today. This is a feature I talked about briefly during my last presentation but didn't have a chance to actually play with. Today at lunch I did so and I'm completely blown away. The feature I'm talking about is the ability for your HTML application to include ActionScript libraries via the SCRIPT tag. This is discussed in the documentation here, but let me demonstrate two examples that I think really bring home the power of this feature. It's got to be one of the coolest things yet I've seen for HTML/AIR applications.
So - for my first test I needed to create an ActionScript class. I wrote the following class which was about as simple as I could do.
}
package {
public class TestASInHTML
{
public function TestASInHTML()
{
}
public function multiplyBy2(x:int):int {
return x*2;
}
}
}
This simple class has one function, multipleBy2, which, wait for it - does simple multiplication. Crazy, I know. JavaScript will never support this. Anyway - I need to take this class and create a SWF out of it. The docs recommend making using of acompc. This is a command line compiler of Flex/AS code into SWFs. I'm assuming this is also what Flash Builder calls in the background when you do builds. I've never used it before so I had a bit of trouble figuring out the exact syntax. Luckily I ran into this: Defining browser-like user interfaces for HTML content
In this article you can see the following example:
acompc -source-path . -include-classes HTMLHostImplementation -output Host.zip
This looked like it could possibly work, so I gave it a shot. In the folder that had my AS class, I typed:
acompc -source-path . -include-classes TestASInHTML -output Test.zip
I extracted the zip and found library.swf. Woot. So now I've got a SWF of my fancy ActionScript code. The next step was to create a very basic HTML/AIR project within Aptana. I created the following demo using the syntax provided by Adobe as a guide.
<html> <head> <title>New Adobe AIR Project</title> <script type="text/javascript" src="lib/air/AIRAliases.js"></script> <script src="lib/library.swf" type="application/x-shockwave-flash"></script> <script src="lib/jquery/jquery-1.4.2.js"></script> <script> </html>
$(document).ready(function() {
/* My first test
air.trace('loaded');
var lib = new window.runtime.TestASInHTML();
var x = lib.multiplyBy2(9);
air.trace(x);
*/
var lib = new window.runtime.TestASInHTML();
$("#source").change(function() {
$("#result").html( lib.mutliplyBy2($(this).val()));
});
});
</script>
</head>
<body>
<input id="source"> <span id="result">
</body>
<html> <head> <title>New Adobe AIR Project</title> <script type="text/javascript" src="lib/air/AIRAliases.js"></script> <script src="lib/library.swf" type="application/x-shockwave-flash"></script> <script src="lib/jquery/jquery-1.4.2.js"></script> <script>
</html>
So - a few things going on here. First off - I don't typically leave in my text code when doing blog entries. I find commented out code to be very distracting for blogs. But - in this case I wanted to show you what I tried first as a basic test. The most critical line is the script source on line 5. Notice the type. This is required. Once I've added this in, it extends my window.runtime object. As you can see later on - I end up having access to TestASInHTML natively. I can create a pointer to that class and then run my multiplyBy2 value on it. I use a bit of jQuery to bind to an input field and print out the result.
Ok, so right now you may be saying - that's cool - but so what? Well, not being a big Flex/Flash guy, I wasn't really tuned into the ActionScript open source market. I first looked at RIAForge and found a bunch of projects there. One of them was Mike Potter's ActionScript 3 Libraries. There is a lot of crap in here including an RSS parser. He wrote a handler that can take in a random RSS feed, parse it, and return a normalized set of data. (Which, by the way, ColdFusion's CFFEED doesn't do. If you want something like that, check out my Paragator project.) Ok, would it be cool to use his code? Sure it would. I downloaded his code, extracted the SWF out of his SWC file, and created the following demo:
<html> <head> <title>New Adobe AIR Project</title> <script type="text/javascript" src="lib/air/AIRAliases.js"></script> <script src="lib/libraryxml.swf" type="application/x-shockwave-flash"></script> <script src="lib/jquery/jquery-1.4.2.js"></script> <script> </html>
$(document).ready(function() {
var lib = new window.runtime.com.adobe.xml.syndication.rss.RSS20();
$.get("", {}, function(res,content) {
//jQuery automatically made it an XML object, I want just the string.
var string = (new XMLSerializer()).serializeToString(res);
lib.parse(string);
var s = "";
$.each(lib.items, function(idx,val) {
s += "<a href='" + val.link + "'>" + val.title + "</a><br/>";
});
$("#result").html(s);
});
});
</script>
</head>
<body>
<span id="result" />
</body>
<html> <head> <title>New Adobe AIR Project</title> <script type="text/javascript" src="lib/air/AIRAliases.js"></script> <script src="lib/libraryxml.swf" type="application/x-shockwave-flash"></script> <script src="lib/jquery/jquery-1.4.2.js"></script> <script>
</html>
What we have here is a RSS parser, written in ActionScript, being used in an HTML Adobe AIR application. I create an instance of the lib and call parse on the RSS. That's it. I wish it was harder. I wish I could say I had to check the RSS type or do other crap like that - but nope, I didn't.
So maybe I'm getting overly excited about this - but consider it. There is a lot of open source ActionScript out there. You can find a bunch on the Flash category at RIAForge. You can find a bunch on this blog entry that Hatem shared with me: AS3 Code Libraries (APIs). All of these bad boys could be included now in your HTML/AIR apps. Just looking over the list got me excited. Stuff like native zip support could be killer. Anyway, I hope you get the idea. Is this killer or what?
Archived Comments
Thanks for the demo, this will definitely help with the usage of external AS libs!
That is *very* cool because it opens up a ton of possibilities. A little off point, but is there an advantage to using Aptana vs. Flash Builder? Or is it free vs. paid, or just personal preference? I'm noting your series of HTML Air apps and will run through them in a couple weeks when things slow down. Also looking forward to learning more about AIR at MAX!
I don't think you can use Flash Builder to build HTML/AIR apps. I could be wrong. I used it when I wrote my AS library because, even as simple as it is, it's not a language I use every day so I wanted to ensure I didn't do any stupid syntax errors. Obviously though I could have written it w/o FB.
All Eclipse based tools can share one install - but I don't like to do that. So I use standalone editions of Flash Builder, CFBuilder, and Aptana. It just works better for me.
As far as I can tell (based on the info here -... AIR HTML apps can only be developed using Aptana by way of a plugin or an extension for Dreamweaver CS4 or CS5. Would be nice to have the AIR support in Flash Builder though.
Nope, you don't need anything. All you need is the SDK. If you watch my preso (see the AIR category), I talk a bit about doing these apps "by hand."
Sorry, I meant if you wanted to use an IDE similar to Flash Builder - the options were Dreamweaver and the plugin for Aptana. Obviously you can hand code if that floats your boat ;-)
Well, any IDE would work - but if you want the -one click to run- option, yeah, Dreamweaver or Aptana. You can also use CFBuilder. Out of the box it supports 1.5. Andy Mathews discusses adding support for AIR 2 here:...
FWIW,
Some time ago, there were a couple of TextMate bundles for AIR development as well. Essentially, any tool that can be extended to interface with command-line tools, can be extended to work with AIR.
Since Flash Builder is all about Flash development, it doesn't really make sense to have HTML authoring as part of the package. Builder is Eclipse-based however, so you can plug most other HTML development extensions into it. And to be clear, Builder does include publishing for AIR, but only with Flash technologies.
Is there another IDE/workflow you'd prefer?
Thanks,
Kevin Hoyt
Adobe Systems, Inc.
|
https://www.raymondcamden.com/2010/08/17/HTMLAdobe-AIR-Application-Diversion-Three-Add-ActionScript-to-your-HTML
|
CC-MAIN-2021-17
|
refinedweb
| 1,513
| 68.36
|
PQ representation for a vtkSMProxy that can be involved in a pipeline. More...
#include <pqPipelineSource.h>
PQ representation for a vtkSMProxy that can be involved in a pipeline.
i.e that can have input and/or output. The public API is to observe the object, changes to the pipeline structure are only through protected function. These changes happen automatically as a reflection of the SM state.
Definition at line 60 of file pqPipelineSource.h.
A source may have multiple output ports.
This method returns the number of output ports supported by this source.
Returns the pqOutputPort for the given output port.
Returns the pqOutputPort given the name of the port.
Returns all the output ports.
Returns the number of consumers connected to the given output port.
Get the number of consumers connected to output port 0.
Equivalent to calling getNumberOfConsumers(0);
Definition at line 100 of file pqPipelineSource.h.
Get the consumer at a particulat index on a given output port.
Get consumer at a particular index on output port 0.
Equivalent to calling getConsumer(0, index);
Definition at line 111 of file pqPipelineSource.h.
Returns a list of consumers for all output ports.
Returns a list of representations for this source in the given view.
If view == NULL, returns all representations of this source.
Definition at line 123 of file pqPipelineSource.h.
Returns the first representation for this source in the given view.
If view is NULL, returns 0.
Definition at line 133 of file pqPipelineSource.h.
Returns a list of render modules in which this source has representations added (the representations may not be visible).
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.
Update the pipeline with the current time.
Return the vtkSMSourceProxy instance corresponding to this pqPipelineSource.
fired when a connection is created between two pqPipelineSources.
fired when a connection is broken between two pqPipelineSources.
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.
Fired right after the underlying algorithm updates (executes).
This can be used to update data information and other similar tasks.
Fired when the selection on a port has changed.
Called when the visibility of any representation for this source changes.
called by pqPipelineFilter when the connections change.
Definition at line 229 of file pqPipelineSource.h.
|
https://kitware.github.io/paraview-docs/latest/cxx/classpqPipelineSource.html
|
CC-MAIN-2021-49
|
refinedweb
| 421
| 61.02
|
void setup() { // set up the LCD's number of rows and columns: lcd.begin(numRows, numCols); lcd.setCursor(0,0); lcd.print("Hello World"); } void loop() { }
Since my screen uses 5x7 char don't I have to change the include file LiquidCrystal.h to define ASCII 5x7 char table?
I am thinking its just a timing issue.
LCD screen fills the first line, then third, then 2nd, and last forth (this is normal I think).
Same char displayed every time I load the sketch.
Here is some pictures of what shows up on my screen.The first pic is with the code in this attachment.
#include <LiquidCrystal.h>//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // put your pin numbers herevoid setup() { lcd.begin(20, 4); // put your LCD parameters here lcd.print("This is line 1"); lcd.setCursor(0,1) lcd.print("This is line 2"); lcd.setCursor(0,2) lcd.print("This is line 3"); lcd.setCursor(0,3) lcd.print("This is line 4"); }void loop() { }
... my LCD uses a older KS0066 controller...
so I for surely know its not wiring or the bread board.
and it appears mine has 2 of these controllers
one running line 1 n 3 other runs line 2 n 4
|
http://forum.arduino.cc/index.php?topic=117944.msg887851
|
CC-MAIN-2015-40
|
refinedweb
| 217
| 78.14
|
Codeguru Update eNewsletter - September 29th, 2009
This Week's Topics
- Recently Published Books
- New & Updated Articles on CodeGuru
- Face lift to Forms; Part 2: Button
- Outline Text, Part 2
- [Updated] Doing In-Place Editing in a GridView
- Declaring Namespaces with Micro Focus for COBOL.NET
- BLOG: The Day Microsoft Killed the eBook Reader
- Hottest Discussions
- New Articles on Developer.com
- How to Structure Leadership Roles for Guaranteed Project Delivery
- Tuning and Testing Enterprise Web Services with SoapUI and JMeter
- Java Socket Programming in Client/Server Applications
Yesterday and today I've been meeting with our developers to see if we could finally start the Codeguru face lift and updates. We are in the process of going through the details of a number of requests that have been made by members of Codeguru as well as by ms. We are forging ahead!.
Coders at Work
By Peter Seibel for Apress
630 pages for $29.99
Programming Interactivity: A Designer's Guide to Processing, Arduino, and openFrameworks
By Joshua Noble for O'Reilly
734 pages for $50.00
New & Updated Articles on CodeGuru
Following are short descriptions of new articles on CodeGuru. If you are interested in submitting your own article for inclusion on the site, then you will find guidelines here.
Facelift to Forms; Part 2: Button
By Jay Thakar
Discover various options to make beautiful, easy to implement and easy to use web forms. In this article you'll explore Buttons.
Outline Text, Part 2
By Wong Shao Voon
Display outline text with a translucent shadow and display a cached outline text for video rendering.
[Updated] Doing In-Place Editing in a GridView
By Jay Thakar
Discover a different way to look at EditItemTemplate . using which user navigation for editing is reduced and ... it looks very different then regular implementation of GridView.
Declaring Namespaces with Micro Focus for COBOL.NET
By Michael Bleistein
In this article we will see how to use the ILUSING directive to declare namespaces in your COBOL.NET programs using Micro Focus.
BLOG: The Day Microsoft Killed the eBook Reader
By Brad Jones
Considering a ebook? While Microsoft isn't known for super successes in hardware, their secret ebook is worth a look.
Discussion Groups
Forums include Visual C++, General C++, Visual Basic, Java, General Technology, C#, ASP.NET, XML, Help Wanted, and much, much, more!
... HOT THREADS ...
Store information wihtin a program (C#)
How can I Initialize getJdbcTemplate()? (Java)
What changes to class lead to recompile? (C++)
New Articles on Developer.com
How to Structure Leadership Roles for Guaranteed Project Delivery
Building partnerships between management and architecture can help augment the project manager's role and guarantee delivery.
Tuning and Testing Enterprise Web Services with SoapUI and JMeter
Need to take some of the frustration out of troubleshooting your web services? Read on to find out how.
Java Socket Programming in Client/Server Applications
Java provides all the capabilities required to develop socket-based applications relatively easilyand it hides all the complexity involved.
There are no comments yet. Be the first to comment!
|
http://www.codeguru.com/announcements/article.php/3841576/Codeguru-Update-eNewsletter--September-29th-2009.htm
|
CC-MAIN-2017-09
|
refinedweb
| 508
| 55.54
|
Hi Bedartha and others,
I have matplotlib 1.1.0 running fine on Mac OS X Lion with TkAgg, Qt4Agg, MacOSX and mplh5canvas ;-) backends in good working condition. My humble opinion is that this works because I do not try to replace System Python with my own version. Given that Lion ships with Python 2.7.1, I do not feel the need to upgrade it to Python.org's 2.7.2 and potentially endure these kinds of installation woes. My current installation instructions for NumPy / SciPy / matplotlib / IPython on Lion ("current" because this is quite a moving target!) can be condensed as follows:
- use homebrew as far as possible (but don't use it to install Python, doh!)
- brew install pkg-config gfortran zeromq pyqt (follow homebrew instructions for PYTHONPATH settings for pyqt dependencies)
- use the System NumPy 1.5.1 - it's good enough for my purposes
- build git version of SciPy using gcc-4.2 - unfortunately still a (slight) pain until next stable release
- sudo easy_install readline nose pyzmq Pygments ipython matplotlib
The detailed instructions are available upon request…
Once you have pkg-config installed via homebrew or otherwise, you can literally just easy_install matplotlib! (Thanks to JDH for recently updating the PyPI repository)
Regards,
Ludwig
On Thursday 10 November 2011 at 5:44 AM, matplotlib-users-request@... wrote:
> Message: 2
> Date: Wed, 09 Nov 2011 11:22:42 -0800
> From: "Russell E. Owen" <rowen@... (mailto:rowen@...)>
> Subject: Re: [Matplotlib-users] Matplotlib "show()" error Mac OS X
> Lion
> To: matplotlib-users@... (mailto:matplotlib-users@...)
> Message-ID: <rowen-75CFDA.11224209112011@... (mailto:rowen-75CFDA.11224209112011@...)>
>
> In article <629E8F74-C832-4500-9768-8AF5FB39D633@... (mailto:629E8F74-C832-4500-9768-8AF5FB39D633@...)>,
> Bedartha Goswami <goswami@... (mailto:goswami@...)>
> wrote:
>
> > Hi,
> >
> > I have recently installed Python 32/64bit from Python.org () and then I
> > proceeded to install bumpy, scipy, matplotlib and igraph on it. But the
> > Matplotlib does not show the plots even if it opens a Figure window. Here is
> > a summary of what I had done in my installation:
> > -----
> > I first did a "clean install" by following the instructions at (with an idea
> > to reinstall Matplotlib and see if the rror repeats):
> >
> > -----
> > So now my python does not have matplotlib:
> >
> >
> > Type "help", "copyright", "credits" or "license" for more information.
> > > > > import matplotlib
> > > >
> > >
> >
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > ImportError: No module named matplotlib
> > > > >
> > > >
> > >
> >
> > Bedarthas-MacBook-Air:Desktop bedartha$
> > -----
> > Then I downloaded (again) the DMG file at:
> >
> > atplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg/download
> > -----
> > and installed Matplotlib (which seems to go through fine). But after that:
> >
> >
> >
>
>
> I suspect you are trying to install matplotlib on the 64-bit Python
> instead of the 32-bit python for which it was built
>
> I say this because 32-bit python is built using GCC 4.0.1.
>
> There is no matplotlib binary for 64-bit Python yet because I've not
> figured out how to build one successfully -- I get horrible conflicts
> with Tcl/Tk.
>
> -- Russell
Hi Russell,
The System Python 2.7.1 on 10.7 is also 64-bit (I checked the size of sys.maxint to confirm this). I have built matplotlib 1.1.0 on this with the standard Lion LLVM compiler (i686-apple-darwin11-llvm-gcc-4.2) and TkAgg works fine. Once you have pkg-config on your system (I use homebrew for this), matplotlib can be built without any further ado - no compiler bypasses, no files to edit. It can even be easy_installed directly from PyPI.
Just thinking out loud - would it make sense to base the dmg installer on System Python instead? My feeling is that the *average* user is best served in this way. There is very little difference between System Python 2.7.1 and Python.org Python 2.7.2, except that the former does not have compilation issues. Also, the System NumPy 1.5.1 is more than adequate for the average user and does not need to be replaced too. In this case, the average user can literally download the dmg and install it on a vanilla Lion system without any other dependencies. To me, this would represent the best default packaging of matplotlib on the Mac, and I would consider anything else a custom installation.
I've been using matplotlib and friends for nearly four years now on System Python (since Leopard) as a non-average user :-), and I've never felt the need to use a different Python. It certainly simplifies installation...
Regards,
Ludwig
Hi,
>>
As a test, try to set your backend to either 'cocoaagg' or 'macosx' like so:
import matplotlib as mpl
mpl.use('cocoaagg')
There have been issues with TkAgg on macs. I have personally not had any success with it (even with ActiveState's Tcl).
>>
>>
>: 'use_2to3'
> warnings.warn(msg)
> error: Could not find required distribution pyobjc-core
>>
I am sorry for this but I easy_install-ed pyobjc-core, and then easy_install-ed PyObjC.
Now the pyplot.show() command works.
My matplotlib is now up and working!
Thank you, (esp ben.root)
Bedartha
|
http://sourceforge.net/p/matplotlib/mailman/matplotlib-users/thread/74FBF93C1EBA42EAB3D0FC86666DDE05@gmail.com/
|
CC-MAIN-2014-15
|
refinedweb
| 844
| 65.73
|
It's been a long time since my last diary entry. A lot has happened since then, so I'll only talk about recent events. I am extremely happy with Nautilus 1.0.....I have a few problems with it, but they are already being worked on, which is great. I am now very much wanting to learn how to write views and sidebars for Nautilus, and bonobo components in general. The RSS viewer thing that is in the works is a really excellent idea. I am deeply saddened by Eazel having to lay people off......that is really unfortunate. But, I think that people are jumping to the conclusion that Eazel's failed - which is obviously not the case. They haven't really tried to sell anything yet. But, as soon as they do offer services for sale, I am most definitely going to get them. I want to support Eazel and Ximian. I think that they do great work. I hope that I will be able to contribute to their projects, and GNOME in general soon. Time is a hard thing to come by, but so many people here seem to manage it, so I'll make an extra effort.
I really place most of the blame on the fact that the US has become obsessed with the stock market. The concept of daytrading has really just messed up the function of the stock market, as well as normal business practices. I don't think that it is a problem unique to Free Software companies, or Linux companies, or tech companies. It is just investors not realizing that an investment is supposed to be long-term. Believe in the company, and support them. But our economy is now on a slide. Why? Because it is in the interests of the bush administration to push us into a recession, so he can gain support for a tax cut that only really benefits the wealthy. I can't say that I am particularly looking forward to the reincarnation of 80's class warfare, powered by trickle-down (oops, I mean supply-side) economics. And so legitimately good companies that I think are going to not only have excellent profit potential a little down the road, but are able to do so with the good of the public in mind are getting hurt. That is really unfortunate. I am glad that there has been something of a shakeout to get rid of companies just interested in capitalizing on a buzzword, but I hate to see problems extending to companies with a strong commitment to their work, and the community.
I am enjoying reading the "Moneyflow" article discussion. The more I think about it, the more certain I am of a few things. First, the Internet is kind of at a crossroads right now. It has the potential to start getting really cool, or keep getting less and less useful. Second, I am fed up with copyright law, and I am planning on starting to write my various governmental representatives. Third, I think a lot of the problems with payment on the Internet, as well as nifty peer to peer filesharing techniques, can be resolved with a robust, standardized system for Metadata. How else can you find the little guy? How else can you know who to pay? We can't work under the assumption that the consumer will go to the creator's website to get whatever there is to offer. Building copy protection and payment mechanisms into protocols and file formats is a really bad idea. It institutionalizes the middle man, and hurts Free Software. It also encourages piracy rather than diminishing it. Systems that will work are ones that don't treat people like criminals, and allow individuals to pick a proper "reward" for content creators. Furthermore, I refuse to believe that artists create just to get paid. If they do, the really are just not artists. Whenever I choose to create something, there is not much profit motive there. Some of the greatest works ever were created without any notion of copyright. I do believe in the original ideals of copyright law, but as it stands now, it is vastly contorted and rewritten to favor distributors rather than the people that matter - artists and appreciators.
I am becoming more and more interested in figuring out ways to leverage public domain works for the public good. There is a lot of absolutely incredible stuff out there. I have the feeling that a lot of people don't take advantage of it, either because it is hard to find, or they don't know they can. I want to figure out a way to unify a lot of the "virtual library" type projects out there, so people can search and access this stuff using something with more of a napster feel. Websites are all well and good, but we should be thinking of them more as "leisure" sorts of things. We need better searching so we can find what we want initially, and then can choose if we want to bother with the website or not. Sometimes I just want to browse through some Van Gogh. Other times I want to read about each painting, and find out about their relationships. We need ways to facilitate this. We need solid metadata systems. We need means of cross-referencing large bodies of work on the fly. We need ways to tip the people that make this all available for us. And we need it all to be in open file formats that are designed for searching and portability. Documents should be in well-structured XML. Audio should be in open formats like Ogg Vorbis. Images should be in JPG or PNG. Ok, enough ranting on this. One more rant to go:
On the topic of people complaining about various features (or lack of features) of advogato: Really, I think that the current structure of advogato is what makes it a unique and well-defined community. The diaries allow everyone to see what various community members are working on, and the public conversations are interesting to follow. The articles have no real need to be threaded - there are typically few responses to articles, so we may as well keep them as open conversations. Threading can be nice, but at the same time I see it as limiting conversation styles. The other thing that I have been kind of annoyed at is people asking for certification to a given level. It seems kind of antithetical to the idea of *trust* metrics that people ask for a given level of certification. The idea is that you prove yourself in some manner. While I'd like to be ranked higher than Apprentice, I realize that since I haven't been ranked higher, there is probably a reason. So I am perfectly content with my Apprenticeship, and am confident that when I actually deserve it, I'll be ranked higher. I certify people as a result of taking part in discussion with them. To me, that is the best indicator of where they should be in the trust metric system. The trust metric is a pretty damn cool system, and I see it as having a ton of useful applications. But it becomes pretty pointless once it is no longer about trust. So if you're not being certified up, it is probably because you haven't shown that you should be yet. Ok, that's the end of my rant.
Last night I got fed up with XMMS and how it displayed track information in a tasklist, so I changed it from being "XMMS - tracknum. track (time)" to being "track (time) - tracknum - XMMS", which lets you get a good deal more information at a quick glance. I sent a patch the the xmms people....hopefully it is incorporated.
The thought of extending metadata to services is cool. It has a lot of potential.
Quote of the day:
."
--Joseph Conrad, Heart of Darkness
I. ;-)
I took a look at - it is a very cool idea. It reminded me of a project I wanted to do 3 or 4 years ago, but I still have yet to get off the ground, or see anyone else really do. The project would be a central compilation of every public domain work that has been digitized. The goal would be to provide a nice, navigable, searchable interface to all the extremely useful research materials out there.
It would have to have the following features:
I'd imagine that the technical side would be the easy part. It would basically just have to be a big database with a well thought-out schema. The hard part is definitely organizing the content, attaching the metadata, and finding it all. Also, it would be good to be mirrored. Eventually it should be able to act as part of a distributed filesharing system. It would be an invaluable research tool.
With things like GNUpedia, and other similar efforts to create free-license encyclopedias, it seems like a much more worthwhile effort is to work on something like I describe above. An encyclopedia is only useful after there is a collection of works to reference. This would probably go further to accomplish what RMS wanted to get done: there is already no copyright on this material, so no competing interest can do anything about it. Once there is a community around it, it can be extended in all sorts of directions.
Of course, I think that the Library of Congress should provide such a resource, but the person running it seems to disagree with me. Ah well. Maybe one day when I have free time I'll try and get something like this started.
Ankh:.
Most. ;-)
I've been thinking more about metadata, and how ir could realistically be stored and organized. Of course, "realistically" is fairly subjective. My current thinking is pretty much based on the Semantic Web ideas...using RDF files to store metadata on files. That right there poses a couple problems: One, should the filesystem expose these files? I say no, at least not directly. The user should be able to modify information contained in these files, but only through utilities that are designed for it. If someone can just see them as files, and open them in emacs, then the metadata contained can be comprimised (due to how I want to organize the metadata.....see below). The other problem is whether or not these files should have metadata themselves....again, I say no. These should not be treated like normal files. They should be more like Mac's resource forks. Of course, this immediately requires a new filesystem API that knows about this, as well as protocol level support. Hence my subjective notion of realism. The one good thing is it is probably likely that protocols can be updated in a way that is backwards-compatible.
Now, you may ask, what are these RDF files going to contain? My thought on the matter is this: there should be a standard set of metadata fields to work with. Ideally, these should be based on the Dublin Core work in this area. This is a good start, but I would like to go one step further: use namespaces to specify standard metadata fields by MIME type. The Dublin Core stuff would most likely be the supertype */*, then it new metadata fields can be introduced for text/*, audio/*, image/*, video/*, and application/*. The annoying one is application/*, because there is no real continuity in the members of that set. Maybe it should be left out....I don't know. My other thought on breaking down these metadata namespaces is that the more specific areas of metadata should be typedefed fields - there should only be certain keywords that can be used. This greatly eases implementation issues, as there is no need for fuzzy logic in associating similar words. It also quickly establishes a lowest common demoninator that everyone can work with. This is why I don't think metadata files should be treated normally.
With this base, filesystems and OSes have a ton of room to innovate new features. One thing that I would like to see is the development of association graphs - so files that you use together regularly are associated together. Another side benefit to this is that a heuristic could be developed for dynamically adding metadata to files with incomplete metadata based on how the file is being used with other metadata-rich files. Also, searching that is purely based on metadata should be really fast, as all the files are small, easily indexible, and in a standard format. I'm sure that there are a ton of other things that could be built on top of this basic framework. I'd be interested in anyone's thoughts on this system....especially my initial thinking that metadata files should be treated differently than normal!
|
http://www.advogato.org/person/RyanMuldoon/diary.html?start=25
|
CC-MAIN-2016-22
|
refinedweb
| 2,163
| 72.36
|
Managing Complexity: Keeping a Large Java Project on Track
Pages: 1, 2
Showing recent CVS history proved a bit tricky. In order to display commits
by branch, we had to use cvs-exp.pl, an open source Perl script
that wraps the output of the CVS log command. We further wrapped
that in a homegrown Ruby CGI script that allows the recent commit history to
be rendered to HTML.
cvs-exp.pl
log
Since we use CVS for revision tracking, there are numerous open source tools
available to create reports. We use the StatCVS tool to generate charts and
graphs of CVS history. Again, we use a small Ruby script to drive the report
generation. Here's the line of code that runs StatCVS itself:
$ java -jar statcvs.jar -output-dir path/to/html/dir/
project_name project_module/cvslog project_module
Since StatCVS comes in one .jar file, there are no dependencies
to track. We run this report nightly, since it takes about 20 minutes to run on
all our repositories.
PMD is a Java static analysis tool that checks for unused code, empty catch
blocks, and so forth. We run a subset of the standard PMD rules, and we've
also written a couple of custom rules to check for Thread
creation, Socket creation, and various other coding practices
that are not appropriate for this project. The documentation for the PMD Ant
task is straightforward, but one thing we found helpful was to always delete
the report file from the previous hour before generating a new one. That way,
if the code being checked goes from five errors to zero errors and no new file
is generated, the previous file won't linger around.
Thread
Socket
The Dashboard Ruby script then parses the PMD HTML report and determines the
number of errors by simply counting the number of rows, as illustrated in this
snippet:
count=0
File.new("pmd_report.html").each("<td ") {|x| count += 1}
ruleViolations=(count/4) unless count==0
This result is then displayed on the front page and hyperlinked to the full
CPD is a Java duplicated-code checker that comes bundled with PMD. We run
CPD to check for sequences of more than one hundred duplicate tokens —
quite a few, considering that CPD discards whitespace, comments, and various
uninteresting sequences like import and package statements. Since CPD has an
Ant task, integrating it into the build was similar to integrating PMD.
Note that OnJava.com has published several articles on both PMD and CPD, so
there's a lot of information out there on both tools.
JUnit is a popular Java unit testing tool. Some of the developers have
begun to write JUnit tests for their code. To encourage this, we run those
tests and post the results on the Dashboard. In order to standardize a bit,
all tests are to be named by appending Test to the class name
(i.e., FooTest), and placed in a separate, parallel directory tree.
This lets the Ant task easily find the tests, and it keeps test code separate
from the production code. After the tests are run and the results sent to an
XML file via the JUnit Ant task's <formatter type="xml"/>
element, the Ruby script parses out the number of tests passed/failed:
Test
FooTest
<formatter type="xml"/>
def parseJunitFile(filename, result)
(REXML::Document.new(File.new(filename))).elements.each(
"build/target/task/message[@priority='info']") do |info|
if (info.text =~ "Tests run: ") != nil
tmp = info.text.split
result.testsTotal=result.testsTotal.to_i + tmp[2].to_i
result.testsFailed=result.testsFailed.to_i + tmp[4].to_i + tmp[6].to_i
end
end
end
This allows the totals to be displayed neatly on the Dashboard.
Generating Javadocs is also a straightforward operation with Ant. It's a
fairly time-consuming task, though, so we only run it every four hours. Note
that Javadocs can consume a considerable amount of disk space; all of the Javadocs
on the Dashboard together take up around 500 MB.
We've found it handy to build an hourly drop of the class files and source
files in case someone wants to browse or run the latest code without checking
it out and compiling it. Since the code has to be compiled anyway, creating
these .jars is a simple matter of using the Ant zip task:
zip
<target name="srczip" if="tic.build.usesSrcZip">
<delete file="${tic.build.srcZip}"/>
<zip destfile="${tic.build.srcZip}" basedir="${tic.build.srcDirForZipFile}"
includes="**/*.java"/>
</target>
<target name="jar" depends="compile">
<jar jarfile="${tic.build.jarFile}" baseDir="${buildDir}"/>
<signjar jar="${tic.build.jarFile}" keystore="/var/build/signingCA_keystore"
alias="privileged" storepass="keystore"/>
</target>
Note the dependency in the jar task; there's no need to attempt
to jar things up if the compilation step fails.
jar
What else could be added to the hourly build page? In some projects, a test coverage report (a report on the percentage of the code that the
unit tests actually cover) has been found
useful. Several tools exist to provide such a report
— Clover comes to mind.
Of course, such a report isn't very useful unless a decent number of unit tests
have been written.
Folks who are familiar with the Jakarta open source build tool Maven may notice some similarities. It might be possible to use Maven to do some of the things the Dashboard does, but
Maven was not very far along when we first began putting the Dashboard
together. It might be worth revisiting Maven to see if that's possible
now.
We've discussed some things can make a large Java project hard to manage.
We've looked at one large Java project — UltraLog — and how an
hourly build status page helped keep things under control. We've also done a
quick overview of some open source tools that you may find to be a useful part
of your hourly build page. Give them a try!
Thanks to all of the folks who have donated their time and energy towards the
various open source tools mentioned in this article.
Tom Copeland
started programming on a TRS-80 Model III, but demand for that skill has waned and he now programs mostly in Java and Ruby..
|
http://www.onjava.com/pub/a/onjava/2003/09/10/dashboard.html?page=2
|
CC-MAIN-2013-20
|
refinedweb
| 1,034
| 62.98
|
WmfLogColorSpace
WmfLogColorSpace class
The LogColorSpace object specifies a logical color space for the playback device context, which can be the name of a color profile in ASCII characters.
public class WmfLogColorSpace : MetaObject
Constructors
Properties
Remarks
The Endpoints, GammaRed, GammaGreen, and GammaBlue fields are used to specify a logical color space. The Endpoints field is a CIEXYZTriple object that contains the x, y, and z values of the RGB endpoint of the color space. The relation between tri-stimulus values X,Y,Z and chromaticity values x,y,z is expressed as follows. x = X/(X+Y+Z) y = Y/(X+Y+Z) z = Z/(X+Y+Z) The GammaRed, GammaGreen, and GammaBlue fields contain values in “8.8 fixed point” format, which is a technique for representing non-integer numbers. Each value consists of a zeroextended 8-bit magnitude followed by an 8-bit fraction, with the combined 16 bits left-shifted by 8 bits. Thus, in 32-bits, the real value N.F is 00000000nnnnnnnnffffffff00000000, where “nnnnnnnn” and “ffffffff” are binary representations of N and F, respectively. For example, for the real number 10.5, nnnnnnnn would be 00001010 (binary 10) and ffffffff would be 00000101 (binary 5), and the complete 32-bit binary value would be 00000000000010100000010100000000, which is the hexadecimal value 0x0A50.
See Also
- class MetaObject
- namespace Aspose.Imaging.FileFormats.Wmf.Objects
- assembly Aspose.Imaging
|
https://reference.aspose.com/imaging/net/aspose.imaging.fileformats.wmf.objects/wmflogcolorspace/
|
CC-MAIN-2022-33
|
refinedweb
| 228
| 55.84
|
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Here's the patch to generate tail pseudo instruction:
This patch would be better named 'Implement MC layer support for the tail pseudoinstruction' or similar. It should apply to the current head ,with D45395 rebased to apply on top of it. This is because MC layer support is a useful incremental change, and can be cleanly separated from the codegen changes (meaning we can revert one without affecting the other).
It looks like you'd just need to add the PseudoTAIL definition to RISCVInstrInfo.td and remove the PseudoTAILIndirect reference from this patch (it can be introduced in D45935).
This line is probably going to be deleted in this patch anyway, but at least for the follow-up patch that includes PseudoTAILIndirect it might be better to have expandFunctionCall return the number of MIs inserted.
Thanks for your comments @asb. There seems to be some problem with long double function arguments which I wanted to clarify.
The RISCV Calling Convention () says that for soft float abi, long doubles are passed in registers via reference:
In RV32, for example, the function double foo(int, double, long double) is passed its first argument in a0, its second argument in a2 and a3, and its third argument by reference via a4
However, consider this code:
__attribute__((noinline))
int bar(long double a) {
printf("### Val L: %LF\n", a);
return a;
}
__attribute__((noinline))
int foo() {
long double a = 1;
return bar(1);
}
Here's the assembly for function foo:
Without tail call:
_Z3foov: # @_Z3foov
# %bb.0: # %entry
addi sp, sp, -32
sw ra, 28(sp)
lui a0, 262128
sw a0, 12(sp)
sw zero, 8(sp)
sw zero, 4(sp)
sw zero, 0(sp)
mv a0, sp
call _Z3bare
lw ra, 28(sp)
addi sp, sp, 32
ret
With tail call:
_Z3foov: # @_Z3foov
# %bb.0: # %entry
addi sp, sp, -16
lui a0, 262128
sw a0, 12(sp)
sw zero, 8(sp)
sw zero, 4(sp)
sw zero, 0(sp)
mv a0, sp
addi sp, sp, 16
tail _Z3bare
I do not understand why the long double argument is passed via stack. For tail call, this results in an incorrect value being printed inside function bar:
### Val: 0.000000
For double arguments, the assembly looks fine:
_Z3foov: # @_Z3foov
# %bb.0: # %entry
lui a1, 261888
mv a0, zero
tail _Z3bard
These are the possibilities for parameter passing on RV32I/RV64I:
Because long double (fp128) and i128 are larger than 2*XLEN, they are passed indirectly and options 1-3 don't apply. Therefore the address of the value will be passed in a register, or if not available then the address is put on the stack. In order to pass indirectly, space on the stack often needs to be allocated in order to store the value. You're seeing this in the example code you pasted. You can see the logic for handling this in RISCVISelLowering.cpp if you grep for CCValAssign::Indirect.
Thanks for catching this issue. Rejecting tailcall optimisation when CCInfo.getNextStackOffset() != 0 isn't quit enough, we need to also reject it if any of the CCValAssign ArgsLocs are passed CCValAssign::Indirect (I can see the ARM's isEligibleForTailCall does that check too).
Thanks Alex for the explanation on indirect parameter passing. I have updated the condition in my patch and added a unit test.
Note: I have limited this test only to riscv32. With riscv64 I get the following error for fp128 parameter:
LLVM ERROR: Cannot select: t17: i64 = Constant<4611404543450677248>
I guess I can restrict only the failing test to riscv32 but I felt it was cleaner this way. We could enable this for riscv64 once the support for fp128 in riscv64 is more mature.
@asb What do you suggest?
Please disregard the above comment. It was meant to be added to D45395.
Thanks Mandeep, just a few minor cleanups
This change is needed for codegen rather than MC and should go in D45395
Do we actually need Uses = [X2]?
Please add a riscv64 RUN line
Please add riscv64 RUN lines
Addressed comments.
I decided to align this with ARM which has Uses = [SP] in its definition of Tail.
If I remove the definition for the Tail node then it cannot determine hasSideEfects, mayStore and mayLoad properties:
def Tail : SDNode<"RISCVISD::TAIL", SDT_RISCVCall,
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
SDNPVariadic]>;
So I had to explicitly specify them here. We can remove these in the next patch which includes the definition for Tail.
Thanks, looks good to me.
|
https://reviews.llvm.org/D46221?id=
|
CC-MAIN-2021-04
|
refinedweb
| 770
| 60.45
|
This weeks snapshot brings us bug fixes! Lots of bug fixes.
A full changelog can be found on Minecraft.net:
- [..................] x30.jsonto make a block tag called
namespace:foo, which contains a list of blocks that should be tagged with
namespace:foo.
A WORK IN PROGRESS
There's not many default tags (both item & block have
minecraft:planksand
minecraft:woolcurrently, that's it). We're migrating things over to it, still.
RECIPES
Recipes can now refer to a tag instead of an item. This should save a few hundred thousand lines of code, somewhere. think
Woo! This makes it better for my data pack I'm working on!
Huh, cool.
I like minecraft
Thank'freakin'goodness for "Tags". by TheBalliBoys shows a way of doing "mcMMO", the Spigot plugin, using command blocks. One of their ideas was to make "Roads" that would allow people with the travel skill to travel faster.
Now it looks like we have "Achievements" that can be tested for in command block which could be a way to manage custom "skills", and Tags allows a way of testing for a properly built "Road". With all these cool changes, hopefully someone will get the bug to remake mcMMO for Vanilla!
But they STILL not fixed the 'non-full screen' / 'resolution turned on in launcher' bug yet
The new "tags" reminds me a lot of the Standard Ore Dictionary in Forge.
|
http://www.minecraftforum.net/news/60649-minecraft-snapshot-17w49a
|
CC-MAIN-2017-51
|
refinedweb
| 233
| 81.93
|
Swing Section Index | Page 5
How can I create a dockable toolbar?
Swing provides support for docking toolbars using the BorderLayout layout manager. Simply add a toolbar to a container that has a BorderLayout, set the toolbar to "floatable" and you can drag it o...more
Can I use Windows Look-and-Feel on a Unix (Linux/Solaris/HP-UX) platform?
There are two parts to this answer: Yes No The answer depends on what you want to do with it. The license states that you cannot deliver an application using the Windows look and feel to non-wi..
Regarding Jtree How can I expand and collapse a complete JTree (including all subtress) programmatically?
You would think this would be simple, and perhaps part of the JTree functionality, but it's not as simple as it should be. I've never required the ability to programatically collapse a tree, so t...more
How do I get a "open dropdown" event on a JComBoBox?
This event only exists in JDK 1.4 (currently in Beta2), look at the "What's New" section of the release doc. You can see this at. more
How can I underline the second "A" in "Save As" as a mnemonic?
In Java 2, v1.4, AbstractButton (the superclass for buttons and menu items) and JLabel now support the notion of a "displayed mnemonic index". You can set this to specify the actual character to b..
Does Swing provide a Spinner component?
In Java 2, v 1.4, a new JSpinner component has been provided. See for details.more
Can I use a single, scrollable row of tabs on a JTabbedPane?
In Java 2, v 1.4 you can. The JTabbedPane API has been updated to include setTabLayoutPolicy() to allow you to specify that you want scrollable tabs. See
How can I use JProgressBar if I don't know how long a process will take?
In Java 2, v1.4, you can now define indeterminate progress bars. See for details.more
How can I retain the selected text when trying to drag/drop text from a JTextField?
This is a nasty bug in Swing... The problem is that the Caret's mouse listener and the DragGesture's mouse listener are watching for the same thing. The caret considers "press" a change of locat.. do I insert a separator into a JPopupMenu?
You can simply add a JSeparator component as follows: menu.add(new JSeparator());
How can I disable selection of ("grey out") several cells in a column of a JTable according to the value of the cells?
You can "disable" the cells by setting "enabled" to false in your table cell renderer. For example: public class MyTCRenderer extends JLabel implements TableCellRenderer { public C...more
JTable : Detecting data changes How can I detect changes of particular editable cell in a JTable ?
The trick is to listen to the model of the table. Table models fire events in the TableModelListener interface. If you implement this interface, you can add a listener to the table model as foll...more
|
http://www.jguru.com/faq/client-side-development/swing?page=5
|
CC-MAIN-2017-47
|
refinedweb
| 509
| 68.26
|
I welcome you to my next blog as part of Experimenting with Current Sense Amplifiers Design Challenge. In my previous blog post #1 I described my experiment plans as part of contest. In blogs #2, #3 and #4 I shown basic usage of MAX40080 Current Sense Amplifier sensor. Then I created libraries Libraries for automating usage of MAX40080 CSA sensor. In previous blogs #5 and #6 I announced my Libraries. In this blog I will describe my Python Library in more details similarly like I introduced C Library in previous blog post #6.
I originally did not plan to make this library, but very soon after starting experimenting with MAX40080 I and other challengers realized that it is very hard to use this sensor with Rapsberry Pi because there are no code or example provided by both chip and click board vendors. So, I decided to utilize my skills and write Python library which can be used on Rapsberry Pi for interacting with MAX40080 Current Sense Amplifier sensor. I am posting this blog late because I was very busy last two weeks. In the meantime some other challengers utilized my library and you can read their independent thoughts for example in this blog post written by colporteur.
Github
My Python library is available at GitHub. Github contains library itself and description of the library. Availability at github has in case of Python Library benefit, that library can be directly installed using pip and I do not need to publish library in some public repositories.
You can install library using following command in terminal:
pip3 install git+
Supported platforms
Library is written in Python and requires running on Linux computers. Internally it uses smbus library which I have used in first blogs. Library also depends on crc library for computing packets CRC (in first blogs I did computations manually using online calculator). From this design we can deduce supported platforms which are all computers running Linux with I2C kernel driver loaded. From practical point of view supported platforms are all Linux based single board computers like Raspberry Pi. This is difference from my C library which targets tiny microcontrollers and not the powerful SBCs.
Library basics and features
In comparison with my C library, I designed this library differently. While C library is designed for allowing developers to use all features of the chip, Python library does not follow the same goal. C library allows you to use every feature of chip, but you need to understand using these features and in fact library is very low level. In opposition this library does not support everything but is higher level and abstract you from most MAX40080 internal details.
Python library provides class named MAX40080. In constructor you can change some core settings. Default values matches usage with MikroE Current 6 Click and if you want other board, you need to specify custom values of these parameters. Parameters are i2c_controller_no for specifying I2C controller if your system has more controllers, i2c_address is I2C address of target MAX40080 which depends on configuration resistor (in case of both Current 6 Click Board and MAX40080EVSYS it is 0x21), and finally you can configure value of shunt resistor which is used for recalculating measured values to current in ampere unit. Default value of shunt parameter is 0.010 and matches shunt resistor used on Current 6 Click Board. In case of MAX40080EVSYS or custom board you need to manually set this parameter to 0.050.
After instantiation of MAX40080 class you can call its methods. Before reading any values form sensor you need to configure it. Configuration is done using configure function. You can reconfigure sensor multiple times when using MAX40080 class. Configuration function is used to set mode of operation and enable some advanced features of MAX40080. Function has 4 parameters, and all have default values. If you do not specify any parameter, then sensor will be configured to measure current at sample rate of 15 ksps and disabled digital filter. You can manually adjust parameters. There are two Boolean parameters measure_current (defaults to True) and measure_voltage (defaults to False). Set this parameter to true if you are interested in measuring specified variable. If you set both variables to true, then some restrictions to sample rates apply according to datasheet, so library will throw exception when you try to use unsupported configuration. If you set both variables to False, then library will turn sensor to standby mode. Next parameter which you can specify is ADC sample rate in kHz and lastly you can set digital filter. Digital filter (alias averaging) is feature of MAX40080 works in the way that sensor will internally accumulate multiple consecutive samples and then returns average of them. You can configure number of averaged samples. This feature is used for reducing noise.
After configuration you can call read functions. There are three methods for reading measured samples: read_current, read_voltage and read_current_and_voltage. The first two returns measured values as a float in Ampere and Volt units. The last mentioned returns two values as a tuple.
Hello Current Sensing World Example
Following Python code shows simple reading of current from the sensor and printing it:
from max40080 import MAX40080 max = MAX40080() max.configure() print(max.read_current())
Output should look like on following screenshot. Value is measured current (in Ampere unit). If you want to get miliamperes, multiple it by 1000.
As you can see, code is much simpler than in case of the same example written using my C library. But in opposition C library allows you to do more tasks.
Summary and future plans
This is all from this blog. By this blog post I am closing subsection about my libraries which I did as part of design challenge. In the meantime I received PCBs for my main experiments which I promised in first blog. So, I am starting to work on it. You can expect some blog post about my experiments which I promised in the first blog soon. In the meantime, I describe my last software related project – command line utility for experimenting with MAX40080 CSA without need to write any line of code. Thank you for reeding this blog. I would appreciate any feedback, so feel free to let comment below.
|
https://community.element14.com/challenges-projects/design-challenges/experimenting-with-current-sense-amplifier/b/challenge-blog/posts/blog-7-max40080-python-library
|
CC-MAIN-2022-21
|
refinedweb
| 1,042
| 55.03
|
Inline::Java - Write Perl classes in Java.
use Inline Java => <<'END_OF_JAVA_CODE' ; class Pod_alu { public Pod_alu(){ } public int add(int i, int j){ return i + j ; } public int subtract(int i, int j){ return i - j ; } } END_OF_JAVA_CODE my $alu = new Pod_alu() ; print($alu->add(9, 16) . "\n") ; # prints 25 print($alu->subtract(9, 16) . "\n") ; # prints -7
The
Inline::Java module allows you to put Java source code directly "inline" in a Perl script or module. A Java compiler is launched and the Java code is compiled. Then Perl asks the Java classes what public methods have been defined. These classes and methods are available to the Perl program as if they had been written in Perl.
The process of interrogating the Java classes for public methods occurs the first time you run your Java code. The namespace is cached, and subsequent calls use the cached version.
Inline::Java is driven by fundamentally the same idea as other
Inline language modules, like
Inline::C or
Inline::CPP. Because Java is both compiled and interpreted, the method of getting your code is different, but overall, using
Inline::Java is very similar to any other
Inline language module.
This section will explain the different ways to
use Inline::Java. For more details on
Inline, see 'perldoc Inline'.
Basic Usage
The most basic form for using
Inline::Java is:
use Inline Java => 'Java source code' ;
Of course, you can use Perl's "here document" style of quoting to make the code slightly easier to read:
use Inline Java => <<'END'; Java source code goes here. END
The source code can also be specified as a filename, a subroutine reference (sub routine should return source code), or an array reference (array contains lines of source code). This information is detailed in 'perldoc Inline'.
In order for
Inline::Java to function properly, it needs to know where to find a Java 2 SDK on your machine. This is done using one of the following techniques:
If none of these are specified,
Inline::Java will use the Java 2 SDK that was specified a install time (see below).
When
Inline::Java was installed, the path to the Java 2 SDK that was used was stored in a file called default_j2sdk.pl that resides with the
Inline::Java module. You can find this file by using the following command:
% perl -MInline::Java=j2sdk
If you wish to permanently change the default Java 2 SDK that is used by
Inline::Java, edit this file and change the value found there. If you wish use a different Java 2 SDK temporarily, see the J2SDK configuration option described below.
Additionally, you can use the following command to get the list of directories that you should put in you shared library path when using the JNI extension:
% perl -MInline::Java=so_dirs
There are a number of configuration options that dictate the behavior of
Inline::Java:
Specifies the path to your Java 2 SDK.
Ex: J2SDK => '/my/java/2/sdk/path'
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Specifies the starting port number for the server. If many
Inline::Java blocks are declared, the port number is incremented each time. Default is 0 (next available port number), default for SHARED_JVM mode is 7891.
Ex: PORT => 4567
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Specifies the host on which the JVM server is running. This option really only makes sense in SHARED_JVM mode when START_JVM is disabled.
Ex: HOST => 'jvm.server.com'
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Specifies the IP address on which the JVM server will be listening. By default the JVM server listens for connections on 'localhost' only.
Ex: BIND => '192.168.1.1' Ex: BIND => '0.0.0.0'
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Specifies the maximum number of seconds that the Perl script will try to connect to the Java server. In other this is the delay that Perl gives to the Java server to start. Default is 15 seconds.
Ex: STARTUP_DELAY => 20
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Adds the specified CLASSPATH. This CLASSPATH will only be available through the user classloader. To set the CLASSPATH globally (which is most probably what you want to do anyways), use the CLASSPATH environment variable.
Ex: CLASSPATH => '/my/other/java/classses'
Toggles the execution mode. The default is to use the client/server mode. To use the JNI extension (you must have built it at install time though. See README and README.JNI for more information), set JNI to 1.
Ex: JNI => 1
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Specify extra command line parameters to be passed to, respectively, the JVM and the Java compiler. Use with caution as some options may alter normal
Inline::Java behavior.
Ex: EXTRA_JAVA_ARGS => '-Xmx96m'
Note: EXTRA_JAVA_ARGS only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Same as JNI, except
Inline::Java expects the JVM to already be loaded and to have loaded the Perl interpreter that is running the script. This is an advanced feature that should only be need in very specific circumstances.
Ex: EMBEDDED_JNI => 1
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. Also, the EMBEDDED_JNI option automatically sets the JNI option.
This mode enables mutiple processes to share the same JVM. It was created mainly in order to be able to use
Inline::Java under mod_perl.
Ex: SHARED_JVM => 1
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
When used with SHARED_JVM, tells
Inline::Java that the JVM should already be running and that it should not attempt to start a new one. This option is useful in combination with command line interface described in the BUGS AND DEFICIENCIES section. Default is 1.
Ex: START_JVM => 0
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
In SHARED_JVM mode, makes every connection to the JVM use a different classloader so that each connection is isolated from the others.
Ex: PRIVATE => 1
Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM.
Enables debugging info. Debugging now uses levels (1 through 5) that (loosely) follow these definitions:
1 = Major program steps 2 = Object creation/destruction 3 = Method/member accesses + packet dumps 4 = Everything else 5 = Data structure dumps Ex: DEBUG => 2
Starts jdb, (the Java debugger) instead of the regular Java JVM. This option will also cause the Java code to be compiled using the '-g' switch for extra debugging information. EXTRA_JAVA_ARGS can be used use to pass extra options to the debugger.
Ex: DEBUGGER => 1
Throws a warning when
Inline::Java has to 'choose' between different method signatures. The warning states the possible choices and the signature chosen.
Ex: WARN_METHOD_SELECT => 1
Takes an array of Java classes that you wish to have
Inline::Java learn about so that you can use them inside Perl.
Ex: STUDY => ['java.lang.HashMap', 'my.class']
Makes
Inline::Java automatically study unknown classes it encounters them.
Ex: AUTOSTUDY => 1
Forces
Inline::Java to bind the Java code under the specified package instead of under the current (caller) package.
Ex: PACKAGE => 'main'
Normally,
Inline::Java stringifies floating point numbers when passing them between Perl and Java. In certain cases, this can lead to loss of precision. When NATIVE_DOUBLES is set,
Inline::Java will send the actual double bytes in order to preserve precision. Note: This applies only to doubles, not floats. Note: This option may not be portable and may not work properly on some platforms.
Ex: NATIVE_DOUBLES => 1
Every configuration option listed above, with the exception of STUDY, can be specified using an environment variable named using the following convention:
PERL_INLINE_JAVA_<option name>
For example, your can specified the JNI option usng the PERL_INLINE_JAVA_JNI environment variable.
Note that environment variables take precedence over options specified in the script itself.
Under Win32, you can also use set the PERL_INLINE_JAVA_COMMAND_COM environment variable to a true value to indicate that you are using the command.com shell. However,
Inline::Java should normally be able to determine this on its own.
Because Java is object oriented, any interface between Perl and Java needs to support Java classes adequately.
Example:
use Inline Java => <<'END' ; class Pod_1 { String data = "data" ; static String sdata = "static data" ; public Pod_1(){ } public String get_data(){ return data ; } public static String get_static_data(){ return sdata ; } public void set_data(String d){ data = d ; } private void priv(){ } } END my $obj = new Pod_1 ; print($obj->get_data() . "\n") ; # prints data $obj->set_data("new data") ; print($obj->get_data() . "\n") ; # prints new data
Inline::Java created a new namespace called
main::Pod_1 and created the following functions:
sub main::Pod_::new { ... } sub main::Pod_::Pod_1 { ... } sub main::Pod_::get_data { ... } sub main::Pod_::get_sdata { ... } sub main::Pod_::set_data { ... } sub main::Pod_::DESTROY { ... }
Note that only the public methods are exported to Perl.
Inner classes are also supported, you simply need to supply a reference to an outer class object as the first parameter of the constructor:
use Inline Java => <<'END' ; class Pod_2 { public Pod_2(){ } public class Pod_2_Inner { public String name = "Pod_2_Inner" ; public Pod_2_Inner(){ } } } END my $obj = new Pod_2() ; my $obj2 = new Pod_2::Pod_2_Inner($obj) ; print($obj2->{name} . "\n") ; # prints Pod_2_Inner
In the previous example we have seen how to call a method. You can also call static methods in the following manner:
print Pod_1->get_sdata() . "\n" ; # prints static data # or my $obj = new Pod_1() ; print $obj->get_sdata() . "\n" ; # prints static data
You can pass any kind of Perl scalar or any Java object to a method. It will be automatically converted to the correct type:
use Inline Java => <<'END' ; class Pod_3_arg { public Pod_3_arg(){ } } class Pod_3 { public int n ; public Pod_3(int i, String j, Pod_3_arg k) { n = i ; } } END my $obj = new Pod_3_arg() ; my $obj2 = new Pod_3(5, "toto", $obj) ; print($obj2->{n} . "\n") ; # prints 5
will work fine. These objects can be of any type, even if these types are not known to
Inline::Java. This is also true for return types:
use Inline Java => <<'END' ; import java.util.* ; class Pod_4 { public Pod_4(){ } public HashMap get_hash(){ HashMap h = new HashMap() ; h.put("key", "value") ; return h ; } public String do_stuff_to_hash(HashMap h){ return (String)h.get("key") ; } } END my $obj = new Pod_4() ; my $h = $obj->get_hash() ; print($obj->do_stuff_to_hash($h) . "\n") ; # prints value
Objects of types unknown to Perl can exist in the Perl space, you just can't call any of their methods. See the STUDYING section for more information on how to tell
Inline::Java to learn about these classes.
You can also access all public member variables (static or not) from Perl. As with method arguments, the types of these variables does not need to be known to Perl:
use Inline Java => <<'END' ; import java.util.* ; class Pod_5 { public int i ; public static HashMap hm ; public Pod_5(){ } } END my $obj = new Pod_5() ; $obj->{i} = 2 ; print($obj->{i} . "\n") ; # prints 2 my $hm1 = $obj->{hm} ; # instance way my $hm2 = $Pod_4::hm ; # static way
Note: Watch out for typos when accessing members in the static fashion, 'use strict' will not catch them since they have a package name...
You can also send, receive and modify arrays. This is done simply by using Perl lists:
use Inline Java => <<'END' ; import java.util.* ; class Pod_6 { public int i[] = {5, 6, 7} ; public Pod_6(){ } public String [] f(String a[]){ return a ; } public String [][] f(String a[][]){ return a ; } } END my $obj = new Pod_6() ; my $i_2 = $obj->{i}->[2] ; # 7 print($i_2 . "\n") ; # prints 7 my $a1 = $obj->f(["a", "b", "c"]) ; # String [] my $a2 = $obj->f([ ["00", "01"], ["10", "11"], ]) ; # String [][] print($a2->[1]->[0] . "\n") ; # prints 10
You can now (as of 0.31) catch exceptions as objects when they are thrown from Java. To do this you use the regular Perl exception tools: eval and $@. A helper function named 'caught' is provided to help determine the type of the exception. Here is a example of a typical use:
use Inline Java => <<'END' ; import java.util.* ; class Pod_9 { public Pod_9(boolean t) throws Exception { if (t){ throw new Exception("ouch!") ; } } } END use Inline::Java qw(caught) ; eval { my $obj = new Pod_9(1) ; } ; if ($@){ if (caught("java.lang.Exception")){ my $msg = $@->getMessage() ; print($msg . "\n") ; # prints ouch! } else{ # It wasn't a Java exception after all... die $@ ; } }. Note:
Inline::Java uses eval under the hood, so it recommended that you store any exception in a temporary variable before processing it, especially f you will be calling other
Inline::Java functions. It is also probably a good idea to undef $@ once you have treated a Java exception, or else the object still has a reference until $@ is reset by the next eval.
Java filehandles (java.io.Reader, java.io.Writer, java.io.InputStream or java.io.OutputStream objects) can be wrapped the
Inline::Java::Handle class to allow reading or writing from Perl. Here's an example:
use Inline Java => <<'END' ; import java.io.* ; class Pod_91 { public static Reader getReader(String file) throws FileNotFoundException { return new FileReader(file) ; } } END my $o = Pod_91->getReader('data.txt') ; my $h = new Inline::Java::Handle($o) ; while (<$h>){ chomp($_) ; print($_ . "\n") ; # prints data }. It is also probably a good idea to undef $@ once you have treated a Java exception, or else the object still has a reference until $@ is reset by the next eval.
See Inline::Java::Callbacks for more information on making callbacks.
As of version 0.21,
Inline::Java can learn about other Java classes and use them just like the Java code you write inside your Perl script. In fact you are not even required to write Java code inside your Perl script anymore. Here's how to use the 'studying' function:
use Inline ( Java => 'STUDY', STUDY => ['java.util.HashMap'], ) ; my $hm = new java::util::HashMap() ; $hm->put("key", "value") ; my $val = $hm->get("key") ; print($val . "\n") ; # prints => <<'END', AUTOSTUDY => 1 ; import java.util.* ; class Pod_10 { public Pod_10(){ } public HashMap get_hm(){ HashMap hm = new HashMap() ; return hm ; } } END my $obj = new Pod_10() ; my $hm = $obj->get_hm() ; $hm->put("key", "value") ; my $val = $hm->get("key") ; print($val . "\n") ; # prints value
In this case
Inline::Java intercepts the return value of the get_hm() method, sees that it's of a type that it doesn't know about (java.lang.HashMap), and immediately studies the class. After that call the java::lang::HashMap class is available to use through Perl.
In some cases you may not know which classes to study until runtime. In these cases you can use the study_classes() function:
use Inline ( Java => 'STUDY', STUDY => [], ) ; use Inline::Java qw(study_classes) ; study_classes(['java.util.HashMap'], undef) ; my $hm = new java::util::HashMap() ; $hm->put("key", "value") ; my $val = $hm->get("key") ; print($val . "\n") ; # prints value
The study_classes() function takes 2 arguments, a reference to an array of class names (like the STUDY configuration option) and the name of the package in which to bind those classes. If the name of the package is undefined, the classes will be bound to the current (caller) package.
Note: You can only specify the names of packages in which you have previously "used"
Inline::Java.
Sometimes you need to manipulate a Java object using a specific subtype. That's when type casting is necessary. Here's an example of this:
use Inline ( Java => 'STUDY', STUDY => ['java.util.HashMap'], AUTOSTUDY => 1, ) ; use Inline::Java qw(cast) ; my $hm = new java::util::HashMap() ; $hm->put('key', 'value') ; my $entries = $hm->entrySet()->toArray() ; foreach my $e (@{$entries}){ # print($e->getKey() . "\n") ; # No! print(cast('java.util.Map$Entry', $e)->getKey() . "\n") ; # prints key }
In this case,
Inline::Java knows that $e is of type java.util.HashMap$Entry. The problem is that this type is not public, and therefore we can't access the object through that type. We must cast it to a java.util.Map$Entry, which is a public interface and will allow us to access the getKey() method.
You can also use type casting to force the selection of a specific method signature for methods that have multiple signatures. See examples similar to this in the "TYPE COERCING" section below.
Type coercing is the equivalent of casting for primitives types and arrays. It is used to force the selection if a specific method signature when
Inline::Java has multiple choices. The coerce function returns a special object that can only be used when calling Java methods or assigning Java members. Here is an example:
use Inline Java => <<'END' ; class Pod_101 { public Pod_101(){ } public String f(int i){ return "int" ; } public String f(char c){ return "char" ; } } END my $obj = new Pod_101() ; print($obj->f('5') . "\n") ; # prints int
In this case,
Inline::Java will call f(int i), because '5' is an integer. But '5' is a valid char as well. So to force the call of f(char c), do the following:
use Inline::Java qw(coerce) ; $obj->f(coerce('char', '5')) ; # or $obj->f(Inline::Java::coerce('char', '5')) ;
The coerce function forces the selection of the matching signature. Note that the coerce must match the argument type exactly. Coercing to a class that extends the argument type will not work.
Another case where type coercing is needed is when one wants to pass an array as a java.lang.Object:
use Inline Java => <<'END'; class Pod_8 { public Object o ; int a[] = {1, 2, 3} ; public Pod_8() { } } END my $obj = new Pod_8() ; $obj->{o} = [1, 2, 3] ; # No!
The reason why this will not work is simple. When
Inline::Java sees an array, it checks the Java type you are trying to match it against to validate the construction of your Perl list. But in this case, it can't validate the array because you're assigning it to an Object. You must use the 3 parameter version of the coerce function to do this:
$obj->{o} = Inline::Java::coerce( "java.lang.Object", [1, 2, 3], "[Ljava.lang.String;") ;
This tells
Inline::Java to validate your Perl list as a String [], and then coerce it as an Object.
Here is how to construct the array type representations:
[<type> -> 1 dimensional <type> array [[<type> -> 2 dimensional <type> array ... where <type> is one of: B byte S short I int J long F float D double C char Z boolean L<class>; array of <class> objects
This is described in more detail in most Java books that talk about reflection.
But you only need to do this if you have a Perl list. If you already have a Java array reference obtained from elsewhere, you don't even need to coerce:
$obj->{o} = $obj->{a} ;
Starting in version 0.20, it is possible to use the JNI (Java Native Interface) extension. This enables
Inline::Java to load the Java virtual machine as a shared object instead of running it as a stand-alone server. This brings an improvement in performance.
If you have built the JNI extension, you must enable it explicitely by doing one of the following:
Note:
Inline::Java only creates one virtual machine instance. Therefore you can't use JNI for some sections and client/server for others. The first section determines the execution mode.
See README.JNI for more information about the JNI extension.
Starting with version 0.30, the
Inline::Java JVM can now be shared between multiple processes. The first process to start creates the JVM but does not shut it down on exit. All other processes can then connect as needed to the JVM. If any of these other processes where created by forking the parent process, the Inline::Java->reconnect_JVM() function must be called in the child to get a fresh connection to the JVM. Ex:
use Inline ( Java => <<'END', class Pod_11 { public static int i = 0 ; public Pod_11(){ i++ ; } } END SHARED_JVM => 1, ) ; my $nb = 5 ; for (my $i = 0 ; $i < $nb ; $i++){ if (! fork()){ Inline::Java::reconnect_JVM() ; my $f = new Pod_11() ; exit ; } } sleep(5) ; my $f = new Pod_11() ; print($f->{i} . "\n") ; # prints 6
Once this code was run, each of the 6 processes will have created a different instance of the 't' class. Data can be shared between the processes by using static members in the Java code.
Note: The Java System.out stream is closed in SHARED_JVM mode.
If you want to use
Inline::Java in a CGI script, do the following:
use CGI ; use Inline ( Java => <<'END', class Pod_counter { public static int cnt = 0 ; public Pod_counter(){ cnt++ ; } } END SHARED_JVM => 1, DIRECTORY => '/somewhere/your/web/server/can/write', ) ; my $c = new Pod_counter() ; my $q = new CGI() ; print $q->start_html() . "This page has been accessed " . $c->{cnt} . " times." . $q->end_html() ;
In this scenario, the first CGI to execute will start the JVM, but does not shut it down on exit. Subsequent CGI, since they have the SHARED_JVM option enabled, will try to connect to the already existing JVM before trying to start a new one. Therefore if the JVM happens to crash or is killed, the next CGI that runs will start a new one. The JVM will be killed when Apache is shut down.
See the BUGS AND DEFICIENCIES section if you have problems starting the SHARED_JVM server in a CGI.
Here is an example of how to use
Inline::Java under mod_perl:
use Apache2::Const qw(:common) ; use Inline ( Java => <<'END', class Pod_counter { public static int cnt = 0 ; public Pod_counter(){ cnt++ ; } } END SHARED_JVM => 1, DIRECTORY => '/somewhere/your/web/server/can/write', ) ; my $c = new Pod_counter() ; sub handler { my $r = shift ; my $q = new CGI ; print $q->start_html() . "This page has been accessed " . $c->{cnt} . " times." . $q->end_html() ; return OK ; }
See USING Inline::Java IN A CGI for more details.
If you are using ModPerl::Registry, make sure to use the
PACKAGE configuration option to specifiy the package in which
Inline::Java should bind the Java code, since ModPerl::Registry will place your code in a package with a unpredictable name.
See the BUGS AND DEFICIENCIES section if you have problems starting the SHARED_JVM server under MOD_PERL.
When reporting a bug, please do the following:
- Put "use Inline REPORTBUG;" at the top of your code, or use the command line option "perl -MInline=REPORTBUG ...". - Run your code. - Follow the printed instructions.
Here are some things to watch out for:
Inline::Javafrom a previous version, be sure to delete your _Inline directory so that
Inline::Java's own Java classes get rebuilt to match the Perl code.
% perl -MInline::Java::Server=status % perl -MInline::Java::Server=start % perl -MInline::Java::Server=stop % perl -MInline::Java::Server=restart
You can specify
Inline::Java options by setting the proper environment variables, and you can also set the _Inline directory by using the PERL_INLINE_JAVA_DIRECTORY environment variable.
In addition, you may also wish to set the START_JVM option to 0 in your scripts to prevent them from trying to start their own JVM if they can't find one, thereby causing problems.
Inline::Javadepends on, the usage of paths containing spaces is not fully supported on all platforms. This applies to the installation directory as well as the path for J2SDK and CLASSPATH elements.
Inline::Javais relatively slow compared to native Perl or Java.
Inline::Java::Callback, Inline::Java::PerlNatives, Inline::Java::PerlInterpreter.
For information about using
Inline, see Inline.
For information about other Inline languages, see Inline-Support.
Inline::Java's mailing list is <inline@perl.org>. To subscribe, send an email to <inline-subscribe@perl.org>
Inline::Java's home page is
Patrick LeBoutillier <patl@cpan.org> is the author of Inline::Java.
Brian Ingerson <ingy@cpan.org> is the author of Inline.
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License. See for more details.
|
http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod
|
crawl-002
|
refinedweb
| 4,160
| 63.29
|
How to create a video from an array of images in Android?
Solution 1
You can use jcodec
SequenceEncoder to convert sequence of images to MP4 file.
Sample code :
import org.jcodec.api.awt.SequenceEncoder; ... SequenceEncoder enc = new SequenceEncoder(new File("filename")); // GOP size will be supported in 0.2 // enc.getEncoder().setKeyInterval(25); for(...) { BufferedImage image = ... // Obtain an image to encode enc.encodeImage(image); } enc.finish();
It's a java library so it's easy to import it into Android project, you don't have to use NDK unlike ffmpeg.
Refer for sample code & downloads.
Solution 2
Using JCodec as demonstrated by Stanislav Vitvitskyy here.
public static void main(String[] args) throws IOException { SequenceEncoder encoder = new SequenceEncoder(new File("video.mp4")); for (int i = 1; i < 100; i++) { BufferedImage bi = ImageIO.read(new File(String.format("img%08d.png", i))); encoder.encodeImage(bi); } encoder.finish();}
Now to convert your Bitmap to BufferedImage you can use this class:
import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; import java.io.IOException; import java.io.InputStream; /** * Utility class for loading windows bitmap files * <p> * Based on code from author Abdul Bezrati and Pepijn Van Eeckhoudt */ public class BitmapLoader { /** * Static method to load a bitmap file based on the filename passed in. * Based on the bit count, this method will either call the 8 or 24 bit * bitmap reader methods * * @param file The name of the bitmap file to read * @throws IOException * @return A BufferedImage of the bitmap */ public static BufferedImage loadBitmap(String file) throws IOException { BufferedImage image; InputStream input = null; try { input = ResourceRetriever.getResourceAsStream(file); int bitmapFileHeaderLength = 14; int bitmapInfoHeaderLength = 40; byte bitmapFileHeader[] = new byte[bitmapFileHeaderLength]; byte bitmapInfoHeader[] = new byte[bitmapInfoHeaderLength]; input.read(bitmapFileHeader, 0, bitmapFileHeaderLength); input.read(bitmapInfoHeader, 0, bitmapInfoHeaderLength); int nSize = bytesToInt(bitmapFileHeader, 2); int nWidth = bytesToInt(bitmapInfoHeader, 4); int nHeight = bytesToInt(bitmapInfoHeader, 8); int nBiSize = bytesToInt(bitmapInfoHeader, 0); int nPlanes = bytesToShort(bitmapInfoHeader, 12); int nBitCount = bytesToShort(bitmapInfoHeader, 14); int nSizeImage = bytesToInt(bitmapInfoHeader, 20); int nCompression = bytesToInt(bitmapInfoHeader, 16); int nColoursUsed = bytesToInt(bitmapInfoHeader, 32); int nXPixelsMeter = bytesToInt(bitmapInfoHeader, 24); int nYPixelsMeter = bytesToInt(bitmapInfoHeader, 28); int nImportantColours = bytesToInt(bitmapInfoHeader, 36); if (nBitCount == 24) { image = read24BitBitmap(nSizeImage, nHeight, nWidth, input); } else if (nBitCount == 8) { image = read8BitBitmap(nColoursUsed, nBitCount, nSizeImage, nWidth, nHeight, input); } else { System.out.println("Not a 24-bit or 8-bit Windows Bitmap, aborting..."); image = null; } } finally { try { if (input != null) input.close(); } catch (IOException e) { } } return image; } /** * Static method to read a 8 bit bitmap * * @param nColoursUsed Number of colors used * @param nBitCount The bit count * @param nSizeImage The size of the image in bytes * @param nWidth The width of the image * @param input The input stream corresponding to the image * @throws IOException * @return A BufferedImage of the bitmap */ private static BufferedImage read8BitBitmap(int nColoursUsed, int nBitCount, int nSizeImage, int nWidth, int nHeight, InputStream input) throws IOException { int nNumColors = (nColoursUsed > 0) ? nColoursUsed : (1 & 0xff) << nBitCount; if (nSizeImage == 0) { nSizeImage = ((((nWidth * nBitCount) + 31) & ~31) >> 3); nSizeImage *= nHeight; } int npalette[] = new int[nNumColors]; byte bpalette[] = new byte[nNumColors * 4]; readBuffer(input, bpalette); int nindex8 = 0; for (int n = 0; n < nNumColors; n++) { npalette[n] = (255 & 0xff) << 24 | (bpalette[nindex8 + 2] & 0xff) << 16 | (bpalette[nindex8 + 1] & 0xff) << 8 | (bpalette[nindex8 + 0] & 0xff); nindex8 += 4; } int npad8 = (nSizeImage / nHeight) - nWidth; BufferedImage bufferedImage = new BufferedImage(nWidth, nHeight, BufferedImage.TYPE_INT_ARGB); DataBufferInt dataBufferByte = ((DataBufferInt) bufferedImage.getRaster().getDataBuffer()); int[][] bankData = dataBufferByte.getBankData(); byte bdata[] = new byte[(nWidth + npad8) * nHeight]; readBuffer(input, bdata); nindex8 = 0; for (int j8 = nHeight - 1; j8 >= 0; j8--) { for (int i8 = 0; i8 < nWidth; i8++) { bankData[0][j8 * nWidth + i8] = npalette[((int) bdata[nindex8] & 0xff)]; nindex8++; } nindex8 += npad8; } return bufferedImage; } /** * Static method to read a 24 bit bitmap * * @param nSizeImage size of the image in bytes * @param nHeight The height of the image * @param nWidth The width of the image * @param input The input stream corresponding to the image * @throws IOException * @return A BufferedImage of the bitmap */ private static BufferedImage read24BitBitmap(int nSizeImage, int nHeight, int nWidth, InputStream input) throws IOException { int npad = (nSizeImage / nHeight) - nWidth * 3; if (npad == 4 || npad < 0) npad = 0; int nindex = 0; BufferedImage bufferedImage = new BufferedImage(nWidth, nHeight, BufferedImage.TYPE_4BYTE_ABGR); DataBufferByte dataBufferByte = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()); byte[][] bankData = dataBufferByte.getBankData(); byte brgb[] = new byte[(nWidth + npad) * 3 * nHeight]; readBuffer(input, brgb); for (int j = nHeight - 1; j >= 0; j--) { for (int i = 0; i < nWidth; i++) { int base = (j * nWidth + i) * 4; bankData[0][base] = (byte) 255; bankData[0][base + 1] = brgb[nindex]; bankData[0][base + 2] = brgb[nindex + 1]; bankData[0][base + 3] = brgb[nindex + 2]; nindex += 3; } nindex += npad; } return bufferedImage; } /** * Converts bytes to an int * * @param bytes An array of bytes * @param index * @returns A int representation of the bytes */ private static int bytesToInt(byte[] bytes, int index) { return (bytes[index + 3] & 0xff) << 24 | (bytes[index + 2] & 0xff) << 16 | (bytes[index + 1] & 0xff) << 8 | bytes[index + 0] & 0xff; } /** * Converts bytes to a short * * @param bytes An array of bytes * @param index * @returns A short representation of the bytes */ private static short bytesToShort(byte[] bytes, int index) { return (short) (((bytes[index + 1] & 0xff) << 8) | (bytes[index + 0] & 0xff)); } /** * Reads the buffer * * @param in An InputStream * @param buffer An array of bytes * @throws IOException */ private static void readBuffer(InputStream in, byte[] buffer) throws IOException { int bytesRead = 0; int bytesToRead = buffer.length; while (bytesToRead > 0) { int read = in.read(buffer, bytesRead, bytesToRead); bytesRead += read; bytesToRead -= read; } } }
Solution 3
If the minimum version of you application Android SDK is greater or equal to 16 (Android 4.1) the best way of video encoding is use Android Media Codec API.
From Android 4.3 APIs.
When encoding video, Android 4.1 (SDK 16) required that you provide the media with a ByteBuffer array, but Android 4.3 (SDK 18) now allows you to use a Surface as the input to an encoder. For instance, this allows you to encode input from an existing video file or using frames generated from OpenGL ES.
Media Muxer added in Android 4.3 (SDK 18) so for convenient way of writing mp4 file with Media Muxer you should have SDK>=18.
Using Media Codec API way you will get hardware accelerated encoding and you are easily encode up to 60 FPS.
You can start from 1) How to encode Bitmaps into a video using MediaCodec? or use 2) Google Grafika or 3) Bigflake.
Starting from Grafika RecordFBOActivity.java. Replace Choreographer event with you own containing bitmap to encode, remove On Screen drawing, load you bitmap as Open GL Texture and draw it on Media Codec Input Surface.
Solution 4
jCodec has added Android support.
You need to add these to your gradle...
implementation 'org.jcodec:jcodec:0.2.3' implementation 'org.jcodec:jcodec-android:0.2.3'
...and
android { ... configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2' } }
I can confirm this works as expected, but with caveats. First being I tried some full size images and the file wrote, but gave an error on playback. When I scaled down, I would get an error if the width or height of the image was not even because it requires a multiple of 2 for YUV420J colorspace.
Also worthy of note, this makes your package HEAVY, heavy. My small project went over the dex limit by adding this and required enabling multidex.
FileChannelWrapper out = null; File dir = what ever directory you use... File file = new File(dir, "test.mp4"); try { out = NIOUtils.writableFileChannel(file.getAbsolutePath()); AndroidSequenceEncoder encoder = new AndroidSequenceEncoder(out, Rational.R(15, 1)); for (Bitmap bitmap : bitmaps) { encoder.encodeImage(bitmap); } encoder.finish(); } finally { NIOUtils.closeQuietly(out); }
Solution 5
You can use Bitmp4 to convert sequence of images to MP4 file.
Sample code :
...
val encoder = MP4Encoder() encoder.setFrameDelay(50) encoder.setOutputFilePath(exportedFile.path) encoder.setOutputSize(width, width) startExport() stopExport() addFrame(bitmap) //called intervally
It's a java library so it's easy to import it into Android project, you don't have to use NDK unlike ffmpeg.
Refer for sample code & downloads.
Khalil Khalaf
I coded, I compiled, I conquered. A good programmer writes code for machines to understand. A great programmer writes code for other programmers to understand. #SOreadyToHelpUpdated on September 25, 2020
- Khalil Khalaf almost 2 years
I want to call a function and build a video out of list of images, and then save it locally on the device:
public void CreateAndSaveVideoFile(List<Bitmap> MyBitmapArray) { // .. }
Trials:
Following java/xuggle - encode array of images into a movie, the link in the answer is a dead link
Following How to encode images into a video file in Java through programming?, The suggested library in the accepted answer does not support Android.
The next answer in the above has an approach for Android users however it is not clear for me the input and the output of that function (where did he give the images? and where did he get the video?) - I left a question comment
The next answer in the above provides a whole class, however the required library to be included has a corrupted file (when I try and download it from the provided link) - I left a question comment
Following Java: How do I create a movie from an array of images?, the suggested library in the top answer uses commands that I am not familiar with and I don't even know how to use them. Like:
I don't know how can I use the above in a Java / Android project..
Can anyone help in guiding me or/and providing me with an approach to my task? Thanks in advance.
- Khalil Khalaf almost 6 yearsAwesome, looks like what I am looking for. I will give it a try, thanks!
- Khalil Khalaf almost 6 yearsYes it made sense to me :) Thanks for your suggestions and for the link. Could we go to a chat room maybe we can talk more about the strategy?
- JY0284 almost 6 yearsThe contents on this page helped me a lot, the example there is totally practical: android-streaming-live-camera-video-to-web. If this strategy fits your requirement and you have further more questions about the implementation, we may continue to chat
- Khalil Khalaf almost 6 yearsHi and thanks for the links. Could you help with writing the complete codes?
- AndreyICE almost 6 yearsSee code in stackoverflow.com/questions/20343534/…
- nishant1000 over 4 years@KhalilKhalaf, where you able to get it working? I am trying the same code, it generates a corrupt .mp4 file.
- Khalil Khalaf over 4 years@nishant1000 This feature was dropped and I got redirected to work on something else. Did you try the "Bitmap to BufferedImage" method in the other answer before executing JCodec on the images?
- Mayank Pandya about 4 years@Abhishek can we also add Audio to video and transition animations while changing frames in video?
- caitcoo0odes almost 3 yearsjava awt is not available in Android it seems, so I don't know that BufferedImage is a viable solution here
- JaydeepW almost 2 yearsI was using CameraX and
ImageAnalysis.Analyzerto analyze the images at the same time I wanted to store what the user is seeing into a video file which would later be used for debugging and this part of code really helped. Thanks.
- Ankush Shrivastava almost 2 yearsit takes a lot of time, in my case when call this function with 145 images (low quality images- 200 kb each) it takes around 2 mins. is there any way to boost this ??
- Michael N 10 monthsThank you! I can confirm I have this working :)
|
https://9to5answer.com/how-to-create-a-video-from-an-array-of-images-in-android
|
CC-MAIN-2022-40
|
refinedweb
| 1,917
| 53.21
|
Opened 4 years ago
Closed 22 months ago
#7963 defect closed fixed (fixed)
twisted.internet._dumbwin32proc missing on Windows Python 3.4 installation
Description
Environment:
- Windows XP 32 bit
- Python 3.4.3 + virtualenv
- Virtualenv: pywin32 219, twisted 15.2.1, zope.interface 4.1.2
Test script:
from twisted.internet import reactor, protocol if __name__ == '__main__': p = protocol.ProcessProtocol() e = 'c:/python34/python.exe' a = [e] reactor.callWhenRunning(lambda: reactor.spawnProcess(p, e, a)) reactor.run()
Execution results in exception (stack trace omitted):
builtins.ImportError: No module named 'twisted.internet._dumbwin32proc'
Notes:
- Twisted was installed via "pip install twisted" within the virtual environment.
- The result was the same when installed from source via either "python setup.py install" or "python setup3.py install".
- Verified that under "site-packages/twisted/internet/" there are a lot less files than under the equivalent Python 2.7 installation:
- Python 3.4: 33 .py files
- Python 2.7: 54 .py files
I'm aware that Windows is not a priority target for Twisted Python 3 compatibility.
Could this be a packaging/installation issue? I'll be glad to cooperate on fixing this, but I'm not sure where to start.
Change History (4)
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
comment:3 Changed 4 years ago by
glyph,
Thanks for correcting my words. I didn't mean to bring in or impose any sort of "value judgement" on the subject. :)
Any advice on how to reach HawkOwl?
comment:4 Changed 22 months ago by
Note: See TracTickets for help on using tickets.
Saying it's not a "priority target" is a complex value judgement; Twisted's position on Windows / Python 3 is not nearly so nuanced; it's just not a supported platform, where "supported platform" has a very specific meaning - we don't have a buildbot for it. See here for the full list of supported platforms; at some point we need a Windows buildbot that does python 3 stuff. I don't think anyone is opposed to setting one up; you should probably talk to HawkOwl as she's done the most recent work in this area.
|
https://twistedmatrix.com/trac/ticket/7963
|
CC-MAIN-2019-26
|
refinedweb
| 362
| 59.6
|
One of the clever features of Visual Studio and technically, the assembly model itself, is that you can embed your data files right inside the assembly dll. The advantage of doing this is so you can hide your data and prevent someone from altering it with a text editor (assuming you are using text data). Of course, the end user can still hack the assembly itself, but it takes a bit more effort. Plus, there is one less file that you need to worry about deploying to the end desktop. Deploying files is a pain and you have to keep track of the directory and permissions of the file in order to read from it. Also, you can use this technique to embed test data that can be used in your unit test project without worrying about the location of the file.
Here’s how it’s done and a few tricks that you’ll need to keep in mind when you do this for your own projects. First, I’m going to just create a console application called “EmbeddedResourceDemo”.
Next, create a blank text file named “MyFile.txt” and put some text in it. I added the word “test” to my text file just to demonstrate the mechanics of this. Drag the text file into your project. The entire project solution should resemble this.
Next, you’ll need to click on “MyFile.txt” and modify the properties. Change the “Build Options” to “Embedded Resource”:
Now you’ll need to add a couple of usings to your main project:
using System.IO;
using System.Reflection;
Now add this code to your project:
namespace EmbeddedResourceDemo
{
class Program
{
static void Main(string[] args)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceName = “EmbeddedResourceDemo.MyFile.txt“;
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
Console.WriteLine(result);
Console.ReadKey();
}
}
}
}
Full Credit where it’s due
I obtained my basic code from a stack overflow answer here: How to read embedded resource text file. This site is very useful for figuring out complex problems quickly.
Run the Code
One of the “gotchas” that you’re likely to encounter is the name of the file (the resouceName). You must include the assembly name in this text otherwise the GetManifestResourceStream will not be able to find your file and it will return null.
The second gotcha you’re likely to run into is the fact that you need to change the “Build Action” to “Embedded Resource”. The same result will occur, the variable “stream” will be null.
If you run the above program, you’ll see your test message on the console window.
|
http://blog.frankdecaire.com/2014/01/25/embedded-resource/
|
CC-MAIN-2018-13
|
refinedweb
| 442
| 64.81
|
Keeping Time
Keeping Time
Almost all games will need to keep track of time in some way. On Roblox, there’s a variety of methods that scripts can measure time and wait, also known as yielding.
Simple Yielding
The simplest form of yielding can be done using the
wait function, which pauses for a given number of seconds. Its usage is straightforward:
When
wait is called, Roblox’s internal scheduler yields the thread for an amount of time that is close as possible to the given time, then signals for the thread to resume again.
Comparison to Unity’s StartCoroutine/IEnumerator
The sample below is taken from Unity Scripting API: WaitForSeconds.
using UnityEngine; using System.Collections; public class WaitForSecondsExample : MonoBehaviour { void Start() { StartCoroutine(Example()); } IEnumerator Example() { print(Time.time); yield return new WaitForSeconds(5); print(Time.time); } }
In Roblox, a similar piece of code would look like this:
Yielding Using A Function
Sometimes it is easier to define a function and run it after a given number of seconds. For this, the
delay function works perfectly: provide it an amount of time in seconds to wait, and a function to run after that time elapses:
Comparison to MonoBehavior’s Invoke in Unity
Below is an example of a Unity C# script which runs a method,
Explode, after two seconds. It is provided to showcase the similarity between MonoBehavior’s Invoke in Unity to the
delay function in Roblox.
using UnityEngine; public class ExampleScript : MonoBehaviour { void Start() { Invoke("Explode", 2); } void Explode() { print("Kaboom!"); } }
The example above is similar to the following code in Roblox:
Neither
Invoke nor
delay will pause the current thread. In other words, the script will immediately continue after the provided function call was scheduled.
Frame-by-Frame Time
More commonly, scripts will have logic that must be run as often as possible. The
RunService/Stepped event will fire each frame that the game is running, around 60 frames per second. In Studio, this is after “Run” or “Play Solo” is clicked. This event fires with the current game time followed by the time since the last frame (delta time).
Sometimes it is no longer useful to run such a function every frame. For this, save a reference to the Connection object returned by
Connect, then call
Disconnect on it later. The example below is an event-based implementation of the example from “Simple Yielding”.
Event-based approaches are generally good for keeping code clean. For more information on Events, see the article on Events.
Comparison to MonoBehavior’s Update in Unity C#
Connecting to
RunService/Stepped in Roblox is very similar to defining an
Update function within a MonoBehaviour in Unity.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Update() { print(Time.time); } }
The above example is similar to the following code in Roblox:
local RunService = game:GetService("RunService") local function Update(t, dt) print(time()) end RunService.Stepped:Connect(Update)
Render Step
Sometimes a
LocalScript is responsible for visual effects. For example, pointing an arrow towards some object. Such visual effects ought to be updated right before the screen is rendered. In Roblox, you can use the
RunService/BindToRenderStep function to accomplish this:
|
https://developer.roblox.com/en-us/articles/keeping-time
|
CC-MAIN-2021-31
|
refinedweb
| 530
| 55.24
|
I'm writing a game in C++ that calls out to Python for scripting. The C++ kernel holds an instance of ScriptCtl and calls the load(filename) method to load a script, then run() to run all loaded scripts. <code> [scriptctl.py] class ScriptCtl: threads=[] def load(self, filename): f=file(filename, 'r') contents=f.read() f.close() exec(contents) #contents exec'ed within the current scope and namespace, not within their own self.threads.append(main) def run(self): while self.threads: for g in self.threads: try: g.next() except StopIteration: self.threads.remove(g) [cutscene.py] from __future__ import generators def cutscene(): from time import time import sys from utility import sleep print "EVIL KNIGHT: I will kill you now!"; sys.stdout.flush() for s in sleep(1): yield None print "OUR HERO: I shall fight you to the death. Bring it on!"; sys.stdout.flush() for s in sleep(1.5): yield None print "***End of cutscene***"; sys.stdout.flush() main=cutscene() #initialize the generator for use by scriptctl </code> This works, barely. As a result of using exec, each script is executed in ScriptCtl.load()'s namespace. Because of this, imports have to be done inside the script functions, or the imports go out of scope before the functions get called (in scriptctl.run()). Imports also have to be done as from scriptctl.py, even though scriptctl.py deeper in the package hierarchy (so instead of 'import core.utility' I must do 'import utility' because both utility.py and scriptctl.py are in the same folder (core). This sucks. How else can I solve this problem? Ideally, I'd use Stackless Python microthreads, but version 3.0 is not out yet and there is no documentation on the current was to do microthreads. Any ideas? I'm stuck. Thanks, Dustin
|
https://mail.python.org/pipermail/python-list/2003-July/196817.html
|
CC-MAIN-2016-40
|
refinedweb
| 305
| 77.74
|
Hadoop Interview Questions – HDFS
Recommended by 117 users
Well, if you are looking for Hadoop HDFS interview questions and aspire to become a Hadoop Developer or Hadoop Admin, you have come to the right place. This list of interview questions on HDFS will prepare you to match the expectations of the employer. Before moving ahead in this Hadoop HDFS Interview Questions blog, let us know about the trends and demands in the field of Hadoop.
Big Data and Hadoop Job Trends:
According to Forrester’s prediction, the Big Data market will grow at nearly 13% rate over the next 5 years, which is more than twice as compared to the predicted growth of IT in general. Hadoop has proven itself to be a de facto in solving the problems associated with Big Data. Therefore, it is not surprising to see the huge demand for Hadoop professionals in the IT industry. Now, let us have a glance at the following image which shows the rising trend of the Hadoop jobs posting over the past few years:
Source: indeed.com
From the above image you can clearly infer that the Hadoop is the most sought after skill in the employment, not only today but, in the coming years as well. Therefore, it’s high time to pull up your sleeves and prepare for the coming Hadoop interviews.
Hadoop Interview Questions and Answers | Edureka
Here, I have provided you a list of the most frequent asked Hadoop HDFS interview questions that will help you to grab the opportunities being generated in the field of Big Data and Hadoop.
Get Hadoop Certified Now!
Hadoop HDFS Interview Questions
1. What is HDFS?
Hadoop Distributed file system or HDFS is a Java based distributed file system that allows us to store Big data across multiple nodes in a Hadoop cluster. So, if I install Hadoop, I will get HDFS as an underlying storage system for storing the huge data sets in the distributed environment.
2. What are the key features of HDFS?
♣Tip: You should also explain the features briefly while listing different HDFS features.
Some of the prominent features of HDFS are as follows:
- Cost effective and Scalable: HDFS, in general, is deployed on a commodity hardware. So, it is very economical in terms of the cost of ownership of the project. Also, one can scale the cluster by adding more nodes.
- Variety and Volume of Data: HDFS is all about storing huge data i.e. Terabytes & Petabytes of data and different kinds of data. So, I can store any type of data into HDFS, be it structured, unstructured or semi structured.
- Reliability and Fault Tolerance: HDFS divides the given data into data blocks, replicates it and stores it in a distributed fashion across the Hadoop cluster. This makes HDFS very reliable and fault tolerant.
- High Throughput: Throughput is the amount of work done in a unit time. HDFS provides high throughput access to application data.
3. Explain the HDFS Architecture and list the various HDFS daemons in HDFS cluster?
While listing various HDFS daemons, you should also talk about their roles in brief. Here is how you should answer this question:
Apache Hadoop HDFS Architecture follows a Master/Slave topology where a cluster comprises a single NameNode (Master node or daemon) and all the other nodes are DataNodes (Slave nodes or daemons). Following daemon runs in HDFS cluster:
- NameNode: It is the master daemon that maintains and manages the data block present in the DataNodes.
- DataNode: DataNodes are the slave nodes in HDFS. Unlike NameNode, DataNode is a commodity hardware, that is responsible of storing the data as blocks.
- Secondary NameNode: The Secondary NameNode works concurrently with the primary NameNode as a helper daemon. It performs checkpointing.
4. What is checkpointing in Hadoop?
Checkpointing is the process of combining the Edit Logs with the FsImage (File system Image). It is performed by the Secondary NameNode.
5. What is a NameNode in Hadoop?
The NameNode is the master node that manages all the DataNodes (slave nodes). It records the metadata information regarding all the files stored in the cluster (on the DataNodes), e.g. The location of blocks stored, the size of the files, permissions, hierarchy, etc.
6. What is a DataNode?
DataNodes are the slave nodes in HDFS. It is a commodity hardware that provides storage for the data. It serves the read and write request of the HDFS client.
7. Is Namenode machine same as DataNode machine as in terms of hardware?
Unlike the DataNodes, a NameNode is a highly available server that manages the File System Namespace and maintains the metadata information. Therefore, NameNode requires higher RAM for storing the metadata information corresponding to the millions of HDFS files in the memory, whereas the DataNode needs to have a higher disk capacity for storing huge data sets.
8. What is the difference between NAS (Network Attached Storage) and HDFS?
Here are the key differences between NAS and HDFS:
- Network-attached storage (NAS) is a file-level computer data storage server connected to a computer network providing data access to a heterogeneous group of clients. NAS can either be a hardware or software which provides a service for storing and accessing files. Whereas Hadoop Distributed File System (HDFS) is a distributed file system.
9. What is the difference between traditional RDBMS and Hadoop?
This question seems to be very easy, but in an interview these simple questions matter a lot. So, here is how you can answer the very question:
10. What is throughput? How does HDFS provides good throughput?
Throughput is the amount of work done in a unit time. HDFS provides good throughput because:
- The HDFS is based on Write Once and Read Many Model, it simplifies the data coherency issues as the data written once can’t be modified and therefore, provides high throughput data access.
- In Hadoop, the computation part is moved towards the data which reduces the network congestion and therefore, enhances the overall system throughput.
11. What is Secondary NameNode? Is it a substitute or back up node for the NameNode?
Here, you should also mention the function of the Secondary NameNode while answering the later part of this question so as to provide clarity:
A Secondary NameNode is a helper daemon that performs checkpointing in HDFS. No, it is not a backup or a substitute node for the NameNode. It periodically, takes the edit logs (meta data file) from NameNode and merges it with the FsImage (File system Image) to produce an updated FsImage as well as to prevent the Edit Logs from becoming too large.
12. What do you mean by meta data in HDFS? List the files associated with metadata.
The metadata in HDFS represents the structure of HDFS directories and files. It also includes the various information regarding HDFS directories and files such as ownership, permissions, quotas, and replication factor.
♣Tip: While listing the files associated with metadata, give a one line definition of each metadata file.
There are two files associated with metadata present in the NameNode:
- FsImage: It contains the complete state of the file system namespace since the start of the NameNode.
- EditLogs: It contains all the recent modifications made to the file system with respect to the recent FsImage.
13. What is the problem in having lots of small files in HDFS?
As we know, the NameNode stores the metadata information regarding file system in the RAM. Therefore, the amount of memory produces a limit to the number of files in my HDFS file system. In other words, too much of files will lead to the generation of too much meta data and storing these meta data in the RAM will become a challenge. As a thumb rule, metadata for a file, block or directory takes 150 bytes.
14. What is a heartbeat in HDFS?
Heartbeats in HDFS are the signals that are sent by DataNodes to the NameNode to indicate that it is functioning properly (alive). By default, the heartbeat interval is 3 seconds, which can be configured using dfs.heartbeat.interval in hdfs-site.xml.
15. How would you check whether your NameNode is working or not?
There are many ways to check the status of the NameNode. Most commonly, one uses the jps command to check the status of all the daemons running in the HDFS. Alternatively, one can visit the NameNode’s Web UI for the same.
16. What is a block?
You should begin the answer with a general definition of a block. Then, you should explain in brief about the blocks present in HDFS and also mention their default size.
Blocks are the smallest continuous location on your hard drive where data is stored. HDFS stores each file as blocks, and distribute it across the Hadoop cluster. The default size of a block in HDFS is 128 MB (Hadoop 2.x) and 64 MB (Hadoop 1.x) which is much larger as compared to the Linux system where the block size is 4KB. The reason of having this huge block size is to minimize the cost of seek and reduce the meta data information generated per block.
17. Suppose there is file of size 514 MB stored in HDFS (Hadoop 2.x) using default block size configuration and default replication factor. Then, how many blocks will be created in total and what will be the size of each block?
Default block size in Hadoop 2.x is 128 MB. So, a file of size 514 MB will be divided into 5 blocks ( 514 MB/128 MB) where the first four blocks will be of 128 MB and the last block will be of 2 MB only. Since, we are using the default replication factor i.e. 3, each block will be replicated thrice. Therefore, we will have 15 blocks in total where 12 blocks will be of size 128 MB each and 3 blocks of size 2 MB each.
18. How to copy a file into HDFS with a different block size to that of existing block size configuration?
♣Tip: You should start the answer with the command for changing the block size and then, you should explain the whole procedure with an example. This is how you should answer this question:
Yes, one can copy a file into HDFS with a different block size by using ‘-Ddfs.blocksize=block_size’ where the block_size is specified in Bytes.
Let me explain it with an example: Suppose, I want to copy a file called test.txt of size, say of 120 MB, into the HDFS and I want the block size for this file to be 32 MB (33554432 Bytes) instead of the default (128 MB). So, I would issue the following command:
hadoop fs -Ddfs.blocksize=33554432 -copyFromLocal /home/edureka/test.txt /sample_hdfs
Now, I can check the HDFS block size associated with this file by:
hadoop fs -stat %o /sample_hdfs/test.txt
Else, I can also use the NameNode web UI for seeing the HDFS directory.
♣Tip: You can go through the blog on Hadoop Shell Commands where you will find various Hadoop commands, explained with an example.
19. Can you change the block size of HDFS files?
Yes, I can change the block size of HDFS files by changing the default size parameter present in hdfs-site.xml. But, I will have to restart the cluster for this property change to take effect.
20. What is a block scanner in HDFS?
Block scanner runs periodically on every DataNode to verify whether the data blocks stored are correct or not. The following steps will occur when a corrupted data block is detected by the block scanner:
- First, the DataNode will report about the corrupted block to the NameNode.
- Then, NameNode will start the process of creating a new replica using the correct replica of the corrupted block present in other DataNodes.
- The corrupted data block will not be deleted until the replication count of the correct replicas matches with the replication factor (3 by default).
This whole process allows HDFS to maintain the integrity of the data when a client performs a read operation. One can check the block scanner report using the DataNode’s web interface- localhost:50075/blockScannerReport as shown below:
Fig. – Block Scanner Report – Hadoop HDFS Interview Question
Learn Hadoop from Industry Experts
21. HDFS stores data using commodity hardware which has higher chances of failures. So, How HDFS ensures the Fault Tolerance capability of the system?
♣Tip: Basically, this question is regarding replication of blocks in Hadoop and how it helps in providing fault tolerance.
HDFS provides fault tolerance by replicating the data blocks and distributing it among different DataNodes across the cluster. By default, this replication factor is set to 3 which is configurable. So, if I store a file of 1 GB in HDFS where the replication factor is set to default i.e. 3, it will finally occupy a total space of 3 GB because of the replication. Now, even if a DataNode fails or a data block gets corrupted, I can retrieve the data from other replicas stored in different DataNodes.
22. Replication causes data redundancy and consume a lot of space, then why is it pursued in HDFS?
Replication is pursued in HDFS to provide the fault tolerance. And, yes, it will lead to the consumption of a lot of space, but one can always add more nodes to the cluster if required. By the way, in practical clusters, it is very rare to have free space issues as the very first reason to deploy HDFS was to store huge data sets. Also, one can change the replication factor to save HDFS space or use different codec provided by Hadoop to compress the data.
23. Can we have different replication factor of the existing files in HDFS?
♣Tip: You should always answer such type of questions by taking an example to provide clarity.
Yes, one can have different replication factor for the files existing in HDFS. Suppose, I have a file named test.xml stored within the sample directory in my HDFS with the replication factor set to 1. Now, the command for changing the replication factor of text.xml file to 3 is:
hadoop fs -setrwp -w 3 /sample/test.xml
Finally, I can check whether the replication factor has been changed or not by using following command:
hadoop fs -ls /sample
or
hadoop fsck /sample/test.xml -files
24. What is a rack awareness algorithm and why is it used in Hadoop?
Rack Awareness algorithm in Hadoop ensures that all the block replicas are not stored on the same rack or a single rack. Considering the replication factor is 3, the Rack Awareness Algorithm says that the first replica of a block will be stored on a local rack and the next two replicas will be stored on a different (remote) rack but, on a different DataNode within that (remote) rack. There are two reasons for using Rack Awareness:
- To improve the network performance: In general, you will find greater network bandwidth between machines in the same rack than the machines residing in different rack. So, the Rack Awareness helps to reduce write traffic in between different racks and thus provides a better write performance.
- To prevent loss of data: I don’t have to worry about the data even if an entire rack fails because of the switch failure or power failure. And if one thinks about it, it will make sense, as it is said that never put all your eggs in the same basket.
25. How data or a file is written into HDFS?
The best way to answer this question is to take an example of a client and list the steps that will happen while performing the write without going into much of the details:
Suppose a client wants to write a file into HDFS. So, the following steps will be performed internally during the whole HDFS write process:
- The client will divide the files into blocks and will send a write request to the NameNode.
- For each block, the NameNode will provide the client a list containing the IP address of DataNodes (depending on replication factor, 3 by default) where the data block has to be copied eventually.
- The client will copy the first block into the first DataNode and then the other copies of the block will be replicated by the DataNodes themselves in a sequential manner.
♣Tip: I would suggest you to go through the blog on HDFS Read/Write Architecture where the whole process of HDFS Read/Write has been explained in detail with images.
Do you prefer watching a video tutorial to understand & prepare yourself for your Hadoop interview? Here is our video on the top 50 Hadoop interview questions.
26. Can you modify the file present in HDFS?
No, I cannot modify the files already present in HDFS, as HDFS follows Write Once Read Many model. But, I can always append data into the existing HDFS file.
27. Can multiple clients write into an HDFS file concurrently?
No, multiple clients can’t write into an HDFS file concurrently. HDFS follows single writer multiple reader model. The client which opens a file for writing is granted a lease by the NameNode. Now suppose, in the meanwhile, some other client wants to write into that very file and asks NameNode for the write permission. At first, the NameNode will check whether the lease for writing into that very particular file has been granted to someone else or not. Then, it will reject the write request of the other client if the lease has been acquired by someone else, who is currently writing into the very file.
29. Does HDFS allow a client to read a file which is already opened for writing?
Basically, the intent of asking this question is to know about the constraints associated with reading a file which is currently being written by some client. You may answer this question in following manner:
Yes, one can read the file which is already opened. But, the problem in reading a file which is currently being written lies in the consistency of the data i.e. HDFS does not provide the surety that the data which has been written into the file will be visible to a new reader before the file has been closed. For this, one can call the hflush operation explicitly which will push all the data in the buffer into the write pipeline and then the hflush operation will wait for the acknowledgements from the DataNodes. Hence, by doing this the data that has been written into the file before the hflush operation will be visible to the readers for sure.
30. Define Data Integrity? How does HDFS ensure data integrity of data blocks stored in HDFS?
Data Integrity talks about the correctness of the data. It is very important for us to have a guarantee or assurance that the data stored in HDFS is correct. However, there is always a slight chance that the data will get corrupted during I/O operations on the disk. HDFS creates the checksum for all the data written to it and verifies the data with the checksum during read operation by default. Also, each DataNode runs a block scanner periodically, which verifies the correctness of the data blocks stored in the HDFS.
31. What do you mean by the High Availability of a NameNode? How is it achieved?
NameNode used to be single point of failure in Hadoop 1.x where the whole Hadoop cluster becomes unavailable as soon as NameNode is down. In other words, High Availability of the NameNode talks about the very necessity of a NameNode to be active for serving the requests of Hadoop clients.
To solve this Single Point of Failure problem of NameNode, HA feature was intorduced in Hadoop 2.x where we have two NameNode in our HDFS cluster in an active/passive configuration. Hence, if the active NameNode fails, the other passive NameNode can take over the responsibility of the failed NameNode and keep the HDFS up and running.
32. Define Hadoop Archives? What is the command for archiving a group of files in HDFS.
Hadoop Archive was introduced to cope up with the problem of increasing memory usage of the NameNode for storing the metadata information because of too many small files. Basically, it allows us to pack a number of small HDFS files into a single archive file and therefore, reducing the metadata information. The final archived file follows the .har extension and one can consider it as a layered file system on top of HDFS.
The command for archiving a group of files:
hadoop archive –archiveName edureka_archive.har /input/location /output/location
33. How will you perform the inter cluster data copying work in HDFS?
One can perform the inter cluster data copy by using distributed copy command given as follows:
hadoop distcp hdfs://<source NameNode> hdfs://<target NameNode>
I hope you find this blog on Hadoop HDFS Interview questions very helpful and informative. For becoming a Hadoop expert, you need to work on various Hadoop related projects as well, apart from having sound theoretical knowledge. We have designed a curriculum which covers all the aspects of the Hadoop framework along with lots of hands on experience. You will be taught by the Industry Experts who will be sharing their precious experience of various Hadoop related projects.
Get Project Based Hadoop Training
Last but not the least, I would like to say that HDFS is only one of the many components present in Hadoop framework. We have created dedicated blogs for important interview questions corresponding to each Hadoop component. Therefore, I would suggest you to follow the links provided below and enjoy the readings:
- Top 50 Hadoop Interview Questions
- Hadoop Cluster Interview Questions
- Hadoop MapReduce Interview Questions
- Pig Interview Questions
- Hive Interview Questions
- HBase Interview Questions
Got a question for us? Please mention it in the comments section of this Hadoop HDFS Interview Questions and we will get back to you.
- 3JorgeSchuldt
- Anastasia Lurie
|
https://www.edureka.co/blog/interview-questions/hadoop-interview-questions-hdfs-2/?utm_source=quora&utm_medium=social-media-sg&utm_campaign=Hadoop-interview
|
CC-MAIN-2017-26
|
refinedweb
| 3,684
| 62.68
|
How to increase your coding performance by creating a JavaScript CLI
In our team we have quite a few repetitive tasks when creating new features for our Content Management System. For example when we create new modules for our GraphQL Service, each one follows the same basic structure with a schema, some resolvers and tests. Further there is a config file to let the system know there is a new module. So we always duplicate an older module, delete almost all the content and edit the names to fit our new module.
So what we really wanted was to automate all this boring stuff but couldn’t find any good tutorials on how to create and modify old files with a JavaScript CLI.
What we are going to do?
- Reading user input in the command line
- Reading and parsing a JavaScript file using babel
- Creating a test file using the exports of this file
Setting up a new project
Start with creating a project by typing the following commands:
mkdir cli-tutorial && cd $_
yarn init -y
Now we have a fresh project and can start off with adding a couple of dependencies we are going to use.
- inquirer: for user-interaction in the terminal
- babel: parsing JavaScript-files to get the AST (Abstract Syntax Tree)
yarn add @babel/parser inquirer
Open up the package.json, edit anything you like to fit your needs and also add the the start-script.
{
...
"scripts": {
"start": "node index.js"
},
...
}
Furthermore let’s create a simple JavaScript file with some exported variables/functions/classes and let’s call it dummy.js:
const sum1 = 7
const firstname = 'John'export const add = sum2 => sum1 + sum2
export const fullName = firstname + ' Doe'export class Vector {
constructor(x, y) {
this.x = x
this.y = y
}length() {
return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2))
}
}
Reading filename from user input
Now we want the user to choose a file from the current working directory. To do that three steps are necessary:
- Fetch all files that end with .js but not .test.js from the current directory.
- Show these files in a list in the terminal using inquirer.
- Wait for the user to select a file.
So we create an index.js and paste the following lines:
const fs = require('fs')
const inquirer = require('inquirer')const run = async () => {
const directoryFiles = fs
.readdirSync(process.cwd())
.filter(file => file.endsWith('.js') &&
!file.endsWith('.test.js')) const { filename } = await inquirer.prompt({
type: 'list',
name: 'filename',
choices: directoryFiles,
})
}run()
Reading the content of the file
In order to get the file’s content we need to read it using the fs module which is pretty basic. Then we can use babel’s parser module to get the AST of the the code.
...
const { parse } = require('@babel/parser')const run = async () => {
...
const content = fs.readFileSync(filename, 'utf-8')
const ast = parse(content, {
sourceType: 'module',
})
}
Setting the sourceType to module lets the parser know that it reads an ES6 file that uses import and export statements.
You can also visit and paste our dummy.js to take a peek at what the AST looks like. There are some properties of type VariableDeclaration and some properties of type ExportNamedDeclaration.
In our use case we just need all the names of those ExportNamedDeclarations, so we add this function to index.js:
function getExports(body) {
const namedExports = body
.filter(item => item.type === 'ExportNamedDeclaration')
.map(item => item.declaration)
.reduce((total, current) => {
if (current.id) {
return [...total, current.id.name]
} else if (current.declarations) {
return [
...total,
...current.declarations.map(declaration => declaration.id.name),
]
}
}, [])
return namedExports
}
The reduce function takes care of the different structure of the first export compared to the other two.
Creating a test file
To generate new files let’s create create-test-file.js which will contain our test-template:
module.exports = {
createTestFile: ({ filename, imports }) => {
return `/* eslint-env jest */
import { ${imports.join(', ')} } from '${filename}'describe('${filename}', () => {
${imports
.map(i => {
return `test('${i}', () => {
expect(true).toBeTruthy()
})`
})
.join('\r\n \r\n \t')}
})
`
},
}
Using a template-literal we can simply fill in our variables. At first we are going to import all exported properties from the original file. Then we create a test function for each of these properties.
Back to the index.js we now are able to use this template:
const { createTestFile } = require('./create-test-file')const run = async () => {
...
const exports = getExports(ast.program.body)
const testContent = createTestFile(
{ imports: exports, filename }
)
}
The last thing we need to do is to generate a filename for the test which in our case will be dummy.test.js. After that we can simply put the content into the file.
const run = async () => {
...
const testFilename = createTestFilename(filename)
fs.writeFileSync(testFilename, testContent)
}function createTestFilename(originalName) {
const parts = originalName.split('.')
return parts.slice(0, -1).join('.')
+ '.test.' + parts[parts.length - 1]
}
Now let’s run our CLI by typing yarn start into the terminal.
Make the CLI globally available
To be able to run our script from anywhere in the terminal we need to add the following to the package.json:
{
...
"bin": {
"cli-tutorial": "./index.js"
},
}
We also have to add the following line to the very top of index.js:
#!/usr/bin/env node
Now let’s globally install the CLI by running npm i -g
|
https://medium.com/@jens.hansen/how-to-increase-your-coding-performance-by-creating-a-javascript-cli-a13454d308ec
|
CC-MAIN-2021-10
|
refinedweb
| 878
| 58.08
|
A numerical library for C and C++ programmers.
On Ubuntu when you compile, link in the library with -lgsl -lgslcblas -lm eg
$ gcc test.c -o test -lgsl -lgslcblas -lm
There are manpages and info pages. There is also documentation on the homepage (above).
Building
You only need to build it on SuSE. Ubuntu has it as part of the distro.
./configure --prefix=/usr/local/shared/gsl/1.11/32 make make check > log 2>&1 make install
For reference, the 32-bit library was compiled on the Theory sector SuSE 10.2 image and the 64-bit one on the 10.3 image because that's what was available at the time.
Testing
I tested that the library was basically working with this snippet from the Info pages:
#include <stdio.h> #include <gsl/gsl_sf_bessel.h> int main (void) { double x = 5.0; double y = gsl_sf_bessel_J0 (x); printf ("J0(%g) = %.18e\n", x, y); return 0; }
The output was
J0(5) = -1.775967713143382642e-01
It is OK if the last few digits do not match.
When making the module to load gsl I added the LD_RUN_PATH variable because this library is going to be used with gcc, which is the one local compiler that's not wrapped to add -rpath options automatically. This means that LD_RUN_PATH may actually be useful (the linker ignores it if any -rpath options are present). I also set LD_LIBRARY_PATH in case people did decide to pass their own -rpath options and so clobbered the effect of LD_RUN_PATH.
There was a slight weirdism in that in the SuSE 10.3 image this all appeared to work nicely when linked with '-lgsl' rather than the full '-lgsl -lgslcblas -lm'. I think this is due to a difference in linking behaviour between 10.3 and 11.1- despite what the manpage says, ld's '--no-allow-shlib-undefined' option seems to be the default in 11.1. If you slap '-Wl,--allow-shlib-undefined' on the end of the compilation then all is well with the simple test case above. Or alternatively '-Wl,--unresolved-symbols=ignore-in-shared-libs'. Not that this is a good idea.
|
https://www.ch.cam.ac.uk/computing/software/gnu-scientific-library
|
CC-MAIN-2020-10
|
refinedweb
| 358
| 76.01
|
On 10/01/10 13:56, Stephen Hemminger wrote:> On Thu, 30 Sep 2010 14:28:55 +0800> Amerigo Wang<amwang@redhat.com> wrote:>>> File::Find will do chdir automatically, so we need to get>> the absolute patch with $File::Find::dir.>>>> Reported-by: Stephen Hemminger<shemminger@vyatta.com>>> Signed-off-by: Amerigo Wang<amwang@redhat.com>>> --->> scripts/namespace.pl | 8 ++++---->> 1 files changed, 4 insertions(+), 4 deletions(-)>> How did you test this? I tried your patches and when I run> it on a compiled kernel in a way that most developers would> do it:> $ make allmodconfig> $ make> $ ./scripts/namespace.plI use 'make namespacecheck'.>> With your patch it still doesn't find the kernel source files.> I find it frustrating because my patch worked, yours didn't.>> --------> No source file found for arch/x86/crypto/aes-i586-asm_32.o> No source file found for arch/x86/crypto/aes_glue.o...Actually, this shows it is working. :)There are two reasons why you got so many of these:1) You didn't do a 'make mrproper', so some source file may bedeleted or renamed in git repo;2) There are no path/to/foo.c for path/to/foo.o which isnormal, we should add those files to exception list.I got much fewer of such warning when I tested it.
|
http://lkml.org/lkml/2010/10/1/187
|
CC-MAIN-2014-52
|
refinedweb
| 219
| 77.43
|
I ll describe here a 'non-perfect but suitable' solution to make a tag cloud, like the one i use for this blog, with django.
Principle
We are going to use a many to many field with link a blog anetry to many tags. It will create three tables blog_entry, blog_entry_tags and blog_tag. The tags need some field to remember the number of blog entries they appears in, as well as there current font size for the tag cloud.
The algorithm to distributes n elements between b buckets, keeping a uniform distribution without having tags with same number of references in different buckets, was the tricky part. You can find discussion about font distribution alogorithm around. one here.
Related items (the things being saved into the many-to-many relation) are not saved as part of a model's save method, as you have discovered. Instead, the Add- and ChangeManipulators save the many-to-many items later. In fact, for adding a new item, this is basically required, because you need to know the new instance's primary key value before you can save a reference to it in the m2m join table -- and that value does not necessarily exist before it is saved to the database.Malcolm Tredinnick link.
An important point: When do we do this processing ? at every blog view ? in a post_save method for our blog Entry model? The problem comes from many to many relation object saving, the post_save method for entry still happen before the related tags in blog_tag and blog_entry_tags are saved, see the quote for more details.
Since i dont see how to overcome the many to many saving process and i dont want to recalculate the cloud tag values at every view, i will use a post_save dispatcher which basicaly acts like a post_save model method.
Here comes the dodgy solution. On the first save of your entry (which you do by clicking save in the edit/create form for entry objects), the dispatcher will connect to your tag_cloud generation method. But, since the tags arent saved yet, you need to save your entry twice. On the second time the tags are there and the tag cloud generation method will update the entry tags total references and font-size field. Hope you got it, my explainations are not famous for their clearness.
In order to update the tag cloud we need to save the entry object twice.
Models
model.py file for my blog application.
class Tag(models.Model): name = models.CharField(maxlength=200, primary_key='True', core=True) total_ref = models.IntegerField(blank=True, default=0) font_size = models.IntegerField(blank=True, default=0) def __str__(self): return self.name def get_absolute_url(self): return "/blog/tag/%s/" % (self.name) def __cmp__(self, other): return cmp(self.total_ref, other.total_ref) class Entry(models.Model): [...] tags = models.ManyToManyField(Tag)
Dispatcher
In our blog/view.py we can now connect the dispatcher to the tag cloud generation method. Tweak the final result using *nbr_of_buckets and base_font_size.
[...] from coulix_org.blog.models import Entry, Tag from django.db.models import signals from django.dispatch import dispatcher def process_cloud_tag(instance): ''' distribution algo n tags to b bucket, where b represents font size. ''' entry = instance # be sure you save twice the same entry, otherwise it wont update the new tags. entry_tag_list = entry.tags.all() for tag in entry_tag_list: tag.total_ref = tag.entry_set.all().count(); tag.save() tag_list = Tag.objects.all() nbr_of_buckets = 8 base_font_size = 11 tresholds = [] max_tag = max(tag_list) min_tag = min(tag_list) delta = (float(max_tag.total_ref) - float(min_tag.total_ref)) / (float(nbr_of_buckets)) # set a treshold for all buckets for i in range(nbr_of_buckets): tresh_value = float(min_tag.total_ref) + (i+1) * delta tresholds.append(tresh_value) # set font size for tags (per bucket) for tag in tag_list: font_set_flag = False for bucket in range(nbr_of_buckets): if font_set_flag == False: if (tag.total_ref <= tresholds[bucket]): tag.font_size = base_font_size + bucket * 2 tag.save() font_set_flag = True # connect signal dispatcher.connect(process_cloud_tag, sender = Entry, signal = signals.post_save)
Templatetags
We use a template tag to return a list of all tags to our template. Add the code to blog/templatetags/whatever.py file.
from coulix_org.blog.models import Tag register = template.Library() # use for tag cloud def show_tag_list(parser, token): """ {% get_tag_list %}""" return TagListObject() class TagListObject(template.Node): def render(self, context): context['blog_tags'] = Tag.objects.all() return '' register.tag('get_tag_list', show_tag_list)
Template
Here comes the template which generates the proper html code to display a nice cloud tag.
{% load whatever %} {% get_tag_list %} {% for tag in blog_tags %} <span style="font-size: {{ tag.font_size }}px;"> <a class="link-typeA" title="Number of entries: {{ tag.total_ref }}" href="/blog/tags/all/{{ tag.name }}">{{ tag.name }}</a> </span> {% endfor %}
Currently it only uses font-size, i may add some color gradient later. Please comment and propose better solutions than the two step saving dodgy method :).
8:27 a.m.
Maybe Django signals can be used to preserve the Tag Cloud in the Cache
8:49 a.m.
That's what happening with dispatcher.connect(process_cloud_tag, Isn't it what you mean ?
12:16 a.m.
I added post_delete dispatcher to delete tags not in use:
tag_list = Tag.objects.all() for tag in tag_list: total = tag.entry_set.all().count() if total == 0: tag.delete() else: tag.total_ref = total tag.save()
tag_list = Tag.objects.all() nbr_of_buckets = 8 ...
Excellent work!
5:45 a.m.
8:06 a.m.
Just Curious - Will signals works if the sender and receiver are in two different machines accessing the same database?
11:13 a.m.
No idea, a good question for #django :)
10:59 a.m.
signals are process-local
this code will result in invalid data given a fitting race-condition
7:03 a.m.
very nice tutorial. i've been use it for my pages
6:31 p.m.
Sorry, I think another way!
7:55 p.m.
what other way ? bad ? :/
|
http://www.coulix.net/blog/2006/aug/20/tag-cloud-solution-django/
|
crawl-002
|
refinedweb
| 969
| 60.31
|
This section describes how we can calculate the sum of specific column data in the database table. Consider an example of any university where we need to calculate the sum of numbers achieved by the student. Either we can do it manually or by using just the simple query. By doing it manually is a very cumbersome work, but by using simple query it can be done very easily. By seeing the example given below you can easily understand how you can get the sum of specific column. Here we are providing you an example.
Description of program:
In the program the first task we going to do is to establish the connection with MySQL database by using the JDBC driver. When the connection has been established pass the table name and name of that column of which we want to calculate the sum. If the statement gets processed then it shows the sum of the particular column else it will displays a message "SQL statement is not executed!".
Description of code:
SELECT SUM(col_name)
FROM
table_name:
This code can be used to calculate the sum of specific column in database table.
Here is the code of program:
import java.io.*; import java.sql.*; public class SumColumn{ public static void main(String[] args) { System.out.println("Sum of the specific column!"); Connection con = null; int sum = 0; String col_name; sum:"); String col = bf.readLine(); ResultSet res = st.executeQuery("SELECT SUM"+"("+col+")"+" FROM "+table); while (res.next()){ int c = res.getInt(1); sum = sum+c; } System.out.println("Sum of column = "+sum); }: Sum of Column in a Database Table
Post your Comment
|
http://www.roseindia.net/jdbc/jdbc-mysql/SumColumn.shtml
|
CC-MAIN-2017-09
|
refinedweb
| 271
| 57.98
|
IDHostAdapter.getInstance().getXMPString(doc); returns nullnandillo Nov 4, 2011 11:24 AM
Hi,
I'm trying to read and modify XMP data of a document, but i allways get a null value when reading it.
Also,
IDHostAdapter.getInstance().setXMPString(doc, updatedXMPString);
doesn't work either;
var app:Application = InDesign.app;
var doc:Document = app.activeDocument;
var idh:IDHostAdapter = IDHostAdapter.getInstance();
var xmpString:String = idh.getXMPString(doc);
var warpxmpContext:WARPXMPXMPContext = new WARPXMPXMPContext(xmpString);
warpxmpContext.wARPXMP.publicacion = "periodico";
var updatedXMPString:String =warpxmpContext.serializeToXML();
IDHostAdapter.getInstance().setXMPString(doc, updatedXMPString);
var xmpString2:String = IDHostAdapter.getInstance().getXMPString(doc);
Any ideas?
Thanks
1. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nullHarbs.
Nov 5, 2011 12:45 PM (in response to nandillo)1 person found this helpful
I've never used IDHostAdapter.getXMPString() or IDHostAdapter.setXMPString()
I would use Document.metadataPreferences instead...
Harbs
2. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nulllesavage
Nov 7, 2011 1:17 AM (in response to Harbs.)
Hi,
We have an updated version of the InDesign Host Adapter library available for download:
In terms of examples, please look at the AssetFragger CS extension example which shows adding/modifying XMP metadata using XMP Namespace Designer and InDesign Host Adapter library. This extension is available in CS Extension Builder under File > Import > CS Extension Builder > Samples. For further information, please refer to
Kind regards,
Lea
From: Adobe Forums <forums@adobe.com<mailto:forums@adobe.com>>
Reply-To: "jive-686358050-8wui-2-2dxrb@mail.forums.adobe.com<mailto:jive-686358050-8wui-2-2dxrb@mail.forums.adobe.com>" <jive-686358050-8wui-2-2dxrb@mail.forums.adobe.com<mailto:jive-686358050-8wui-2-2dxrb@mail.forums.adobe.com>>
Date: Sat, 5 Nov 2011 19:45:40 +0000
To: lab user <lesavage@adobe.com<mailto:lesavage@adobe.com>>
Subject: IDHostAdapter.getInstance().getXMPString(doc); returns null
Re: IDHostAdapter.getInstance().getXMPString(doc); returns null
created by Harbs.<.> in Creative Suite Extension Builder - View the full discussion<
3. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nullnandillo Nov 8, 2011 10:56 AM (in response to Harbs.)
Hi Harbs,
That's what I'm using in my project
But we have a legacy xmp structure that I couldn't replicate with Doc.metadaPreferences.setProperty
Also It has it's own namespace
I ended writing the xmp to a file and then loading it with doc.metadataPreferences.append
Im looking forward to use the IdHostAdapter to manipulate the xmp directly
Thanks for your answer.
4. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nullnandillo Nov 8, 2011 11:10 AM (in response to lesavage)
Hi Savage82,
I notice that this plugin has the same version number (7.0.0) that the one I have, but the size is different
I'll try it and I'll let you know
Didn't work... I still get "null"...
I tested it with the AssetFragger Example
Thanks
5. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nullHarbs.
Nov 8, 2011 2:20 PM (in response to nandillo)
I'm not sure why that was a problem.
You can use any namespace you want with the getProperty() and setProperty() methods.
I've done this with no issues...
Harbs
6. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nullnandillo Nov 8, 2011 2:31 PM (in response to Harbs.)
Hi Harbs
I couldn't create a new namespace...
And the structure had nested "seq" elements
I didn't find a way to do this with setProperty and/or createContainer
nandillo
7. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nullnandillo Feb 1, 2012 11:31 AM (in response to lesavage)
Hi Lea,
Do you have the updated version of the IdHostAdapter plugin for InDesign CS5 (7.0)
The one I downloaded from the link you provided works fine with CS5.5, but CS5 cannot load it.
Thanks,
nandillo
8. Re: IDHostAdapter.getInstance().getXMPString(doc); returns nulllesavage
Feb 2, 2012 2:17 AM (in response to nandillo)
Hi Nandillo,
The native component of the IDHostAdapter only works with CS5.5. We do not offer an equivalent for CS5.
However, please note that this does not affect the events feature which will work in both CS5 and CS5.5.
Kind regards,
Lea
|
https://forums.adobe.com/message/4180629
|
CC-MAIN-2016-18
|
refinedweb
| 681
| 51.24
|
Performance:
- Avoiding synchronous calling and using asynchronous instead.
- Optimizing data access.
- Using caching technology.
- Using response caching middleware.
- Using JSON serialization.
- Reducing HTTP requests.
- Using exceptions only when necessary.
- Using response compression.
- Making HttpContext accessibility improvements.
- Making client-side improvements.
Avoid synchronous and use asynchronous querying
Asynchronous queries avoid blocking a thread while the query is executed in the database. Async queries are important for quick, responsive client applications.
Examples:
- ToListAsync()
- ToArrayAsync()
- SingleAsync()
public async Task<List> GetBlogsAsync() { using (var context = new BloggingContext()) { return await context.Blogs.ToListAsync(); } }
Asynchronous saving(); } }
Optimize data access:
- Call all data access APIs asynchronously.
- Don’t try to get data that is not required in advance.
- Try to use no-tracking queries in Entity Framework Core when accessing data for read-only purposes.
- Use filter and aggregate LINQ queries (with .Where, .Select, or .Sum statements), so filtering can be performed by the database.
You can find approaches that may improve performance of your high-scale apps in the new features of EF Core 3.0.
Use caching technology
Increase the performance of an application by reducing the number of requests to the server. Avoid calling the server every time and cache the data instead. Store the response for the future, and use it the next time you make a call for the same response.
These are some caching techniques:
- In-memory caching.
- Distributed cache.
- Cache tag helper.
- Distributed cache tag helper.
Use response caching middleware(); }
Use JSON serialization
ASP.NET Core 3.0 uses System.Text.Json for JSON serialization by default. Now, you can read and write JSON asynchronously. This improves performance better than Newtonsoft.Json. The System.Text.Json namespace provides the following features for processing JSON:
- High performance.
- Low allocation.
- Standards-compliant capabilities.
- Serializing objects to JSON text and deserializing JSON text to objects.
Reduce HTTP requests
Reducing the number of HTTP requests is one of the major optimizations. Cache the webpages and avoid client-side redirects to reduce the number of connections made to the web server.
Use the following techniques to reduce the HTTP requests:
- Use minification.
- Use bundling.
- Use sprite images.
By reducing HTTP requests, these techniques help pages load faster.
Use exceptions only when necessary
Exceptions should be rare. Throwing and catching exceptions will consume more time relative to other code flow patterns.
- Don’t throw and catch exceptions in normal program flow.
- Use exceptions only when they are needed.
Use response compression
Response compression, which compresses the size of a file, is another factor in improving performance. In ASP.NET Core, response compression is available as a middleware component.
Usually, responses are not natively compressed. This typically includes CSS, JavaScript, HTML, XML, and JSON.
- Don’t compress natively compressed assets, such as PNG files.
- Don’t compress files with a size of 150-1,000 bytes.
- Don’t compress small files; it may produce a compressed file larger than the uncompressed file.
(source:) improvements
HttpContext accessibility is only valid as long as there is an active HTTP request in ASP.NET Core. Here are some suggestions for accessing HttpContext from Microsoft’s documentation:
- Don’t store IHttpContextAccessor.HttpContext in a field.
- Don’t access HttpContext from multiple threads.
- Don’t use the HttpContext after the request is complete
- Don’t capture the HttpContext in background threads
Client-side improvements
Client-side optimization is one important aspect of improving performance. When creating a website using ASP.Net Core, consider the following tips:
Bundling
Bundling combines multiple files into a single file, reducing the number of server requests. You can use multiple individual bundles in a webpage.
Minification
Use a content delivery network (CDN) to load static files such as images, JS, CSS, etc. This keeps your data close to your consumers, serving it from the nearest local server.
Conclusion
Now you know 10 tips to help improve the performance of ASP.NET Core 3.0 applications. I hope you can implement most of them in your development.
Syncfusion provides more than 70 high-performance ASP.NET Core UI controls that are lightweight, modular, and responsive, including our DataGrid, Charts, and Scheduler controls. Feel free to try them and provide your feedback in the comments section.
You can also contact us through our Support Forum, Direct-Trac, or Feedback Portal. We are happy to assist you!
|
https://www.syncfusion.com/blogs/post/10-performance-improvement-tips-for-asp-net-core-3-0-applications.aspx
|
CC-MAIN-2020-10
|
refinedweb
| 717
| 52.76
|
framebuf(7) framebuf(7)
NAME
framebuf - information for raster frame-buffer devices
SYNOPSIS
#include <<<<sys/framebuf.h>>>>
DESCRIPTION
Frame-buffer devices are raster-based displays. These devices use
memory-mapped I/O to obtain much higher performance than possible with
tty-based graphic terminals. Frame-buffer devices can be accessed
directly using this interface, although access through the STARBASE
libraries is recommended (see starbase(3G)). Direct access to frame-
buffer devices entails precise knowledge of the frame-buffer
architecture being used. Input cannot be piped into or redirected to
frame-buffer devices because they are not serial devices.
Each frame-buffer device is associated with a character special file.
Major and minor numbers for frame-buffer devices are implementation-
dependent. The minor numbers for these devices denote different frame
buffers. Implementation-specific details are discussed in the
appropriate systems administrator's manuals.
Communication with a frame-buffer device begins with an open(2) system
call. Multiple processes can have the frame-buffer device open
concurrently.
close(2) invalidates the file descriptor associated with the frame-
buffer device. After a close system call, any access to the frame-
buffer device address range might result in a memory fault and the
signal SIGSEGV being sent to the process (see signal(2)). A process
cannot unmap the frame buffer from its address space after the frame-
buffer special file is closed. To unmap a frame buffer, use the
GCUNMAP ioctl(2) call (see below).
Once a process acquires a lock for the frame-buffer device, it must
unlock it explicitly before calling close(2); see GCUNLOCK below.
read(2) and write(2) system calls are undefined and always return an
error. In this case errno is set to ENODEV.
The ioctl(2) system call is used to control a frame-buffer device.
The select(2) system call is used to test the frame-buffer device for
exceptional conditions. Interrupts from the graphic hardware are
considered exceptional conditions. An exceptional condition is
automatically cleared after any process that opens the frame-buffer
device is notified of the exception by a select(2) call. A call to
select(2) for read or write on the file descriptor associated with the
frame-buffer device returns a false condition in the read and write
bit masks (see select(2)).
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
A frame-buffer device can be accessed by multiple processes at once.
However, each process overwrites the output of the others unless one
of the lock mechanisms described here or some other synchronization
mechanism is used. The lock mechanisms described here are intended
for cooperating processes only.
For all frame buffers, data bytes scan from left to right and from top
to bottom. A pixel, which is a visible dot on the screen, is
associated with a location in the frame buffer. Each device maps one
or more bits in memory to a pixel on the screen, although the bits in
the frame buffer might not be continuous. Information describing the
frame-buffer structure and attributes is found in the
crt_frame_buffer_t data structure. The crt_frame_buffer_t data
structure includes the following fields:
int crt_id; /*display identifier*/
unsigned int crt_attributes; /*flags denoting attributes*/
char *crt_frame_base; /*first byte in frame-buffer memory*/
char *crt_control_base; /*first byte of the control*/
/*registers*/
char *crt_region [ CRT_MAX_REGIONS ];
/*other regions associated with the*/
/*frame-buffer device*/
The following are valid ioctl(2) requests:
GCDESCRIBE Describe the size, characteristics, and mapped
regions of the frame buffer. The information is
returned to the calling process in a
crt_frame_buffer_t data structure, and the
parameter is defined as crt_frame_buffer_t *arg;.
Although some structure fields contain addresses
of one or more frame-buffer device regions, the
values of these fields are not always defined.
Only after a successful GCMAP command is issued
(see below) are the correct addresses returned so
the user can access the frame-buffer regions
directly using the returned addresses.
GCID Provide a device identification number. The
parameter is defined as int *arg;. The
information returned when using this command is a
subset of the information provided by GCDESCRIBE,
and is provided here for backward compatibility
only.
GCON, GCOFF Turn graphics on or off. These operations are
valid for devices whose CRT_GRAPHICS_ON_OFF bit is
set in the crt_attributes field of the
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
crt_frame_buffer_t data structure returned by the
GCDESCRIBE command. Otherwise, these commands
have no effect.
GCAON, GCAOFF Turn alpha on or off. These operations are
valid for devices whose CRT_ALPHA_ON_OFF bit is
set in the crt_attributes field of the
crt_frame_buffer_t data structure returned by the
GCDESCRIBE command. Otherwise, these commands
have no effect.
GCMAP Make the frame-buffer memory, graphics control,
and other device regions accessible to the user
process making the call. Only processes that
request this can directly access frame-buffer
memory and control registers. After a successful
GCMAP call, the fields crt_frame_base and
crt_control_base in the crt_frame_buffer_t data
structure (returned by a subsequent GCDESCRIBE
ioctl(2) call), hold the valid addresses of these
two regions of the frame buffer. If, for a
specific device, more than two regions are to be
mapped to the user's address space, the base
addresses of up to CRT_MAX_REGIONS extra device
regions will be placed in the array crt_region in
successive order. Only the regions pertinent to a
specific frame buffer are mapped. Irrelevent
region fields in the crt_frame_buffer_t data
structure are set to 0. Use of the arg parameter
is implementation dependent (see DEPENDENCIES
below). The base addresses for frame-buffer
regions are always page aligned.
GCUNMAP Cause access to the frame-buffer memory, graphics
control, and possibly other device regions to be
removed from the requesting process. The
parameter arg is ignored and should be set to 0.
Any attempt to access these memory regions after a
successful GCUNMAP call results in a memory fault
and sends the signal SIGSEGV to the process.
GCLOCK Provide for exclusive use of the frame-buffer
device by cooperating processes. The calling
process either locks the device and continues or
is blocked. Blocking in this case means that the
call returns only when the frame buffer is
available or when the call is interrupted by a
signal. If the call is interrupted, it returns an
error and errno is set to EINTR. Waiting occurs
if another process has previously locked this
frame buffer using the GCLOCK command and has not
Hewlett-Packard Company - 3 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
executed a GCUNLOCK command yet. The GCLOCK
command does not prevent other non-cooperating
processes from writing to the frame buffer; thus,
GCLOCK is an advisory lock only. The parameter
arg is ignored and should be set to 0.
This call prevents the Internal Terminal Emulator
(ITE) from corrupting the state of the graphics
hardware (see termio(7)). On some systems, as
long as the frame buffer is locked with a GCLOCK
command, the ITE does not output text to it (see
DEPENDENCIES below). Any attempt to lock the
device more than once by the same process fails,
and causes errno to be set to EBUSY.
GCLOCK_NOWAIT Provide for exclusive use of the frame-buffer
device by cooperating processes. This request has
the same effect on the frame-buffer device as does
the GCLOCK request. However, this call does not
wait for the frame buffer to be released by other
processes. If the frame-buffer device is locked,
the process is not blocked; instead, the system
call returns an error and causes errno to be set
to EAGAIN. The parameter arg is ignored and
should be set to 0.
GCLOCK_BLOCKSIG Provide for exclusive use of the frame-buffer
device by cooperating processes while blocking all
incoming signals for the calling process that
otherwise might have been caught. This call is a
superset of the GCLOCK call. The parameter arg is
ignored and should be set to 0. When the display
is acquired for exclusive use (and thus locked),
all signals sent to the process that otherwise
would have been caught by the process at the time
of the GCLOCK call, are withheld (blocked) until
GCUNLOCK is requested. Any attempt to modify the
signal mask of the process (see sigsetmask(2))
before a GCUNLOCK request is made will not have
any effect on these blocked signals. The signals
are not blocked until the lock is actually
acquired, and might be received while still
awaiting the lock.
The signal SIGTSTP is also blocked whether or not
it is being caught. The signals SIGTTIN and
SIGTTOU are also blocked on frame-buffer devices
where the ITE does not output to the device while
it is locked. See DEPENDENCIES below.
Hewlett-Packard Company - 4 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
Except for the three signals mentioned above, this
call does not block signals that the process did
not expect to catch, nor does it block signals
that cannot be caught or ignored. This command
does not prevent other non-cooperating processes
from writing to the frame buffer.
GCLOCK_BLOCKSIG_NOWAIT
Provide for exclusive use of the frame-buffer
device by cooperating processes, while blocking
all incoming signals for the calling process that
otherwise would have been caught. This request
has the same effect on the frame-buffer device as
does the GCLOCK_BLOCKSIG request. However, this
call does not wait for the frame buffer to be
released by other processes. If the frame-buffer
device is locked, the process is not blocked, but
the system call returns an error and causes errno
to be set to EAGAIN. The parameter arg is ignored
and should be set to 0.
GCUNLOCK Relinquish exclusive use of the frame-buffer
device. If the device is locked with a
GCLOCK_BLOCKSIG or GCLOCK_BLOCKSIG_NOWAIT ioctl(2)
request, the signal mask of the calling process is
restored to its state prior to the locking
request.
GCRESET Reset the graphic hardware associated with the
frame-buffer device to a defined initial state.
The call enables the frame-buffer device to
respond to the ioctl requests defined here.
GCDMA_OUTPUT Send DMA output to the frame-buffer device. This
system call is used to transfer data from a user's
array to a rectangular area of the graphics
frame-buffer, or optionally, to the device's
graphics control space.
The parameters for the DMA are passed in a
"crt_dma_ctrl_t" data structure, which includes
the following fields:
char *mem_addr; /* Starting address of data
being transferred */
char *fb_addr; /* Address of framebuffer
destination */
int length; /* Number of bytes to transfer,
including those "skipped" */
int linelength; /* Number of bytes written
on each framebuffer row */
Hewlett-Packard Company - 5 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
int skipcount; /* Number of source bytes to
ignore after each "linelength" */
unsigned int flags; /* Specified options to the driver */
To write to the graphics frame-buffer, set
fb_addr to the address of the upper-left corner of
the rectangle to be drawn. The DMA will write
linelength bytes on each frame-buffer row, ignore
the next skipcount bytes of memory data, then
resume writing at the same starting position on
each succeeding frame-buffer row. This is
continued until length bytes are either written or
ignored.
To write to the graphics control space, set
fb_addr to the address of the first graphics
control register to write. In this case,
linelength and skipcount are ignored.
The flags parameter specifies options for the DMA.
Currently, there are no supported flags and this
parameter should be set to zero, otherwise the
system call will fail and errno is set to EINVAL.
The DMA has the same effect on the frame-buffer
device as using store instructions to write the
data. Thus, various graphics control registers
may affect the results of the DMA. It is the
responsibility of the user program to perform any
necessary set-up of the frame-buffer device so
that the DMA has the desired results.
The skipcount parameter allows the user to refresh
a portion of a window image that the user has
stored in memory for those cases where only a
portion of the image needs to be refreshed. The
window image is then a superset of the rectangle
being updated, and might thus have different
dimensions. The skipcount specifies the portion
of the row in the larger window image that is
excluded from the rectangle. Thus, linelength
plus skipcount would be the number of bytes in
each row of the larger window image array.
If a particular framebuffer device supports this
system call, the CRT_DMA_OUTPUT flag in the
crt_attributes field of the crt_frame_buffer_t
structure is set. Some framebuffer devices
supporting DMA might restrict alignment of the
various parameters, and are specified in the
DEPENDENCIES section below. The kernel ensures
Hewlett-Packard Company - 6 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
that these restrictions are obeyed, and if they
are not the system call will fail and set errno to
EINVAL.
It is the responsibility of the application to
guarantee that the system's physical memory is
up-to-date by flushing the processor's data cache.
One should use the GCDMA_DATAFLUSH ioctl to ensure
that the data is consistent before initiating a
DMA transfer.
GCDMA_DATAFLUSH Flush the specified data from the processor's data
cache to the system's main memory. This system
call is intended to be used before DMA to ensure
that an up-to-date version of the data is
transferred to the framebuffer or to control
space.
The parameters for the flush are passed in a
crt_flush_t data structure, which includes the
following fields:
char *flush_addr; /* Starting address of data
to be flushed */
int flush_len; /* Number of bytes to flush */
The kernel ensures that the flush_len bytes
starting at flush_addr are consistent in main
memory with respect to the cache.
GCSLOT Provide pertinent information about the calling
process's participation in the system-wide
graphics locking mechanism (see the discussion
under GCLOCK above). The GCSLOT request does not
carry out any actual locking functionality. The
lock information is returned to the calling
process in a crt_gcslot_t data structure. The
parameter is defined as crt_gcslot_t *arg;. The
crt_gcslot_t data structure is defined in the file
<sys/framebuf.h>.
GCSTATIC_MAP Prevent the Internal Terminal Emulator (ITE) from
modifying the device's color map.
GCVARIABLE_MAP Allow the Internal Terminal Emulator (ITE) to
modify the device's color map.
DEPENDENCIES
Series 700/800
When requesting GCMAP, the parameter arg is ignored and should be
set to 0.
Hewlett-Packard Company - 7 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
All supported ITEs ignore the frame buffer lock for output.
Series 700
Among the device identification constants that can be returned
both by the GCID call and in the crt_id field of the
crt_frame_buffer_t data structure by the GCDESCRIBE call are:
S9000_ID_98705
S9000_ID_98736
S9000_ID_A1659A
S9000_ID_A1439A
If a memory-mapped graphics co-processor is available, it is
mapped in with other graphics regions as the result of a GCMAP
call, and its address is recorded as the last entry in the crt
region array returned by the GCDESCRIBE call.
Series 800
The following device identification constants are returned both
by the GCID call and in the crt_id field of the
crt_frame_buffer_t data structure by the GCDESCRIBE call:
S9000_ID_98720
S9000_ID_98730
S9000_ID_98550
For the HPA1047A Interface Card, the fields of the crt_dma_info
structure have the following restrictions:
mem_addr 32-byte aligned
fb_addr 16-byte aligned
length non-zero multiple of 32
skipcount 0
ERRORS
[EAGAIN] The operation would result in suspension of the calling
process, but the request was either GCLOCK_NOWAIT or
GCLOCK_BLOCKSIG_NOWAIT.
[EBUSY] Attempted to lock the device, which is already locked
by the same process.
[EINTR] A call to ioctl(2) was interrupted by a signal.
[EINVAL] An invalid ioctl(2) command was made.
[ENODEV] Attempted to use read(2) or write(2) system calls on
the device.
Hewlett-Packard Company - 8 - HP-UX Release 11i: November 2000
framebuf(7) framebuf(7)
[ENOMEM] Sufficient memory for mapping could not be allocated.
[ENOSPC] Required resources for mapping could not be allocated.
[ENXIO] The minor number on the device file refers to a
nonexistent device.
[EPERM] Requested GCUNLOCK ioctl(2) command, but the device was
locked by a different process.
AUTHOR
framebuf was developed by HP.
SEE ALSO
select(2), open(2), close(2), signal(2), sigsetmask(2), lockf(2),
ioctl(2), mknod(1M), starbase(3G), termio(7).
Hewlett-Packard Company - 9 - HP-UX Release 11i: November 2000
|
http://modman.unixdev.net/?sektion=7&page=framebuf&manpath=HP-UX-11.11
|
CC-MAIN-2017-13
|
refinedweb
| 2,753
| 51.99
|
What are static and dynamic libraries in C?
Libraries and functions
Good coding practices state a program should perform a single task very well. If you follow this rule, you are working in modules and you will be able to reuse this file in the future in a more complex program or to debug it more easily if it’s not working the way it should. There are some tasks that, as a programmer, you will have to perform over and over again. For example, add a node to a list, free memory in a c program, check if a letter is upper or lowercase, etc. Those programs are called functions. A good programmer will optimize each one of the functions and will save it for a future occasion. A very effective way to easily access these functions is by creating libraries.
There are two kinds of libraries: standard and user-created libraries. Standard libraries are public libraries that any user can call from their programs by adding a reference to it in the header of a program or in a separate header file. You can identify them because they end in .h. User-created libraries can be static or dynamic (AKA shared) libraries. In order to choose the most appropriate, it is useful to understand how they are built and how they are incorporated into an executable file.
How to make a static library
1. In the main program, include your header file (a file where you include a list of all the standard libraries, user-created libraries, and the prototypes of the functions that you are using.
Normally, when you compile a function file without a library, you use this script:
gcc function.c main.c library.h -o function_exe
where function.c is the file with the function you added to the library, main.c is the main file where you are calling this function, library.h is the header file where you include the prototype of the function (not the actual function)and function_exe is the name of the executable file.
The problem with this approach is that when your list of functions gets too long, you might omit one by mistake or you might not find it and this will lead to compilation errors.
First of all you need to compile the files that will be part of the library into object files (with extension .o).
gcc -c function.c -o function.o
Then, you can create the library by using this command:
ar rcs libraryname.a function1.o function2.o function3.o
the r flag means that any object file that already existed will be replaced, c means that the library will be created and s will create an index file with the object files
If you didn’t create this index you can create it later using the command ranlib.
If you want to use a library in a program, this is the command you need to use:
gcc programname.c -L libraryname.a -o main
-L is the flag that indicates that you want to link a library and main is the resulting executable file.
***
As you can observe, the executable file includes the function at the moment of compilation. Thus, this file will take more space but the execution time will be lower because the function has already been compiled into the executable. This also guarantees that if the library or the function you are calling is deleted or is damaged, your executable won’t be affected because it doesn’t require it any more after it has been compiled.
As you could see in the previous cases, if you need to modify any of the function files, you need to update the library and you need to compile again. So if you are using function files that are constantly being updated, you might want to consider creating a dynamic library instead.
How to make a dynamic library
Let’s look now at how to create a dynamic library in an example.
Suppose you have all these function files:
pesos_to_dollars.c
euros_to_pesos.c
dollars_to_euros.c
You have created these function files which perform conversion tasks. You want to create a library with them. But, you are planning to keep adding to these collection of conversion files, and create a library called libconversion. These are the steps you need to follow:
- Compile each one of the files using this script:
gcc -fPIC -c pesos_to_dollars.c
gcc -fPIC -c euros_to_pesos.c
gcc -fPIC -c dollars_to_euros.c
where -fPIC means position independent code, which is a requirement of shared libraries, and -c creates an object file.
2. Compile the library adding the three functions you want to include
gcc -shared -o libconversion.so *.o
3. Create a header file where you include the prototypes of the functions you want to create and the standard libraries you used.
header.h
#include <stdio.h>
int pesos_to_dollars(int n);
int euros_to_pesos(int n);
int dollars_to_euros(int n);
__________________
4. Compile the file in which we want to use the library. This will produce an object file.
gcc -c main.c.
5. Compile the object file to link with the library and get the executable file
gcc -o test test.c libconversion.so
6. Install library so that it can be found at the time of execution and they are linked to a group of default directories. By default the dynamic loader looks for the library in specific directories: /usr/lib/, /usr/X/lib, etc. You need to use this command to save your library in one of those directories.
sudo mv libconversion.so /usr/lib
Additionally, you need to run this command, ldconfig, which creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib).
sudo ldconfig
If you are storing your library in a different path, you need to export its path to the environment variable. You can use the
'LD_LIBRARY_PATH' environment variable to tell the dynamic loader where to look.
First, you need to check if the environment has been created by using this command:
echo $LD_LIBRARY_PATH
If it hasn’t been defined, use this command:
setenv LD_LIBRARY_PATH /full/path/to/library/directory
If it has already been defined use:
setenv LD_LIBRARY_PATH /full/path/to/library/directory:${LD_LIBRARY_PATH}
or in bash, the first option if it is undefined, and the second, if not:
LD_LIBRARY_PATH=/full/path/to/library/directory
export LD_LIBRARY_PATHLD_LIBRARY_PATH=/full/path/to/library/directory:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
Finally, with this command (List Dynamic Dependencies), you can check if the linker can find the library:
ldd prog
Notice that this library will be very easily updated and the executable won’t require being recompiled since it is only linked at the moment of execution. This means that the executable will be lighter but the execution and loading time will be longer because that’s when the library will be linked. There is another disadvantage: if there is any problem with the path to the directory where the library is located, or if the library file is damaged, the executable won’t work either.
Summary: executable files linked to a static library is heavier and longer to compile but it will execute faster and you don’t have to worry about access to the library at the moment of compilation. Executable files linked to dynamic libraries are faster to compile and are smaller in size but they will take longer to load and execute because they are linked to the libraries at the moment of execution and there might be problems accessing the libraries.
More information:
man page ldd, man page ldconfig,
|
https://sandramacias2.medium.com/what-are-static-and-dynamic-libraries-in-c-e99459588d7d?source=---------5----------------------------
|
CC-MAIN-2021-31
|
refinedweb
| 1,293
| 60.85
|
David J Eddy
AWS Certified (x4), Automated Testing / Continuous Integration / Delivery / Deployment (CI/CDs), Cloud, Containers, Dev(Sec)Ops, Software Engineer.
Education
BFA from IADT Tampa, 4* AWS Certifications
Work
Infrastructure Engineer
My thoughts on the HashiCorp Infrastructure Automation Certification
How to: AWS Service Endpoints via Terraform for fun and profit
How To: Database clustering with MariaDB and Galera.
How to: Delete a stubborn Kubernetes namespaces.
Intro: k3s, a less needy Kubernetes,
What do you prefer: general all-in-one tools or focused single domain tools?
Whats your daily tool chain these days?
10 years of web development; 10 life lessons.
FIX: Terraform + AWS: InvalidVPCNetworkStateFault
Project Release: Docker + AWS + Selenium + Terraform. Get it up and running.
How To: Upgrade WSL Ubuntu 18.04 to 18.10
Opinion: Architect VS Engineer VS Developer
IBM has released Unit Testing for Mainframes.
Ever miss the forest for the trees?
How long until we can all access satellite data? Not long if AWS has its way...
How to fix "failed to delete stack: Role ... is invalid or cannot be assumed" in AWS CloudFormation
What is your biggest 'red flag' when interviewing?
Top 5 articles from my blog from 2018
Run Commands on a Remote Machine via SSH
Using `shellcheck` to lint your bash/sh scripts.
How to use Golang's "go get" from behind a proxy.
What’s the difference: A/B Testing VS Blue/Green Deployment?
Windows 10 WSL Ubuntu 18.04 proxy configuration for apt.
Passing Data Into Gatling from the Command Line
Set up Wordpress using Ansible and Terraform
Just how effective is web server caching? Very.
What's the difference: Continuous Integration, Continuous Delivery, and Continuous Deployment.
Run Linux GUI apps on Windows 10
Achievement Unlocked! All AWS Associate + Practitioner Certifications obtained.
All Day DevOps virtual conference going on today.
PHP 5 End of Life is upon us; why you should care.
What are your favorite VueJS libraries?
Migrate from AWS EC2 to Lightsail
The case against Terraform to prevent vendor lock-in.
5 PHP Tools to make your life more enjoyable.
Gatling, a load testing tool with a difference.
How to shrink your Docker images.
Tutorial on using headless Chrome in a container for End-To-End user acceptance testing
Never run a migration again using PHPs Composer
TIL: JSON.stringify() can do formatted output.
Questions to Determine Team Fit-ability.
Explain how Angular 1 works like I'm 5
CLI tool to visually see disk usage in Linux and OSX
Git log a range of lines of a file
Recent comments
How I got AWS Certified SysOps Administrator in 2 weeks ☁
All the associate exams cost $150 USD. aws.amazon.com/certifi...
Serving EC2 traffic over HTTPS
Good article Mayank! Nice that you provide multiple solutions...
Using Composer with WordPress for easy Deployments
Nice to see some PHP content here on dev.to. Keep up the good...
Is a Redis ORM a Horrible Idea?
"...Our primary database (MySQL) simply cannot keep up..." My...
Learn a New Language: Ruby or Go?
I feel like this is a more a question of what is the right ...
Tell us what your top unpopular tech opinion is 😈
There is not such thing as Jr Dev Ops.
How does deployment work at your organization?
developer commits change to feature branch locally develop...
|
https://dev.to/david_j_eddy
|
CC-MAIN-2022-27
|
refinedweb
| 549
| 60.11
|
The 0.1.2 release of the Nemerle compiler has hit our server. 0.1.2, Apr 28 2004 This release brings several important bugfixes, more documentation (great thanks to our techwriter for making it more readable) and improvements in macro subsystem. * Macros are now hygienic -- that is each macro invocation introduces new virtual namespace for generated names. See meta-programming paper for details. * Macros themselves now sits in namespaces. Notable example is printf, that is now Nemerle.IO.printf. You will need to update your sources. Common macros (like if and while) are in Nemerle.Core, so no changes are needed. * Symbols in macro quotations are now bound to their global meaning (e.g. imported namespaces, nesting in modules) at the place of quotation definition, not the place of macro use. * The <-> operator now properly computes each expression just once. * Loading assembly with -r flag now loads also all assemblies referenced by it. * New integer operators <<, >>, %|, %& and %^ for common bitwise functions. * New -- and ++ prefix operators for decrement/increment (both return void). * Events can be now accessed with add_EventName and remove_EventName, no +=/-= syntax yet. * Full support for various integer and floating point types (like uint, long, double etc). Literals like 0u, 0l, 3.14f are now also supported. * System.Windows.Forms examples can now be compiled. * "foo" "bar" is now single string literal. * Added preliminary SQL helper macros. * Reordered parameters of Fold and Map in Hashtable to match List. * Few fixes in error messages. * Several other bugfixes (particularly with code generation and boxing). * Compiler now properly checks if type of field/method is as accessible as the field/method itself. * Resolved some lengthy compilation issues with Gtk# and System.Windows.Forms types. * Resolved problem with literal fields on Windows. * Under Unix we now require mono 0.31 or later,?
|
http://nemerle.org/mailman/pipermail/devel-en/2004-April/000033.html
|
crawl-002
|
refinedweb
| 299
| 61.93
|
I talked about the importance of giving your code tender loving care when writing it here. As a follow up, this is a short guideline of a few rules to follow to make you stand out from other programmers.
This article explores PEP-8 (Python Enhancement Proposal) a guide that you can use to make your python code more presentable and easy to read.
What is PEP-8?
PEP-8 is a guide that gives rules on how to write presentable code for readability and consistency. It is specifically designed for python, but it can also be used for other languages, depending on what you and your team decides. It was written in 20o1 by Guido van Rossum, Nick Coghlan and Barry Warsaw.
“Readability Counts”
– The Zen of Python
Why use PEP-8?
Because “Code is read more often than it is written” -Guido van Rossum. Writing takes a few hours, but you and others will have to go back to your code every other time to read it.
More on why it is important to write readable code
PEP-8 Rules
Naming Conventions
In code, everything (variables, functions, methods, classes, modules) has to have a name and not just any random names. Use descriptive names. If you are not used to it, you may think naming is taxing, but once you decide to only use meaningful names, then you may notice that your coding pace is a tad faster. Why? Because you don’t have to think about strange names to give your items.
Don’t
x="Lulu"
y ="Ngei"
Would another programmer understand what x and y represent?
Do
first_name="Lulu"
last_name="Ngei
Much better, right? Another thing to remember is when naming variables, methods, functions and modules, if they have more than one word, separate them with an underscore “_”, and write them in lowercase. my_var, my_function, method, module.py
For classes, use uppercase for each word like so; Class, MyClass and do not separate the words with an underscore.
Indentation
I must confess, this is the one thing I never cared about for the longest time. I didn’t even know there were rules on how to indent lines of code. Indentation or leading whitespace is what groups statements together.
For python 3, stick to one type of spacing for consistency and to avoid errors. Either use tab (recommended) or space. Python 3 does not allow the use of both. This is the expected error:
TabError: inconsistent use of tabs and spaces in indentation
Indentation after line breaks
Either indent after the opening bracket:
num = 3
if (num > 0 and
num == 0):
print(num, 'is even')
Or indent the second condition:
num = 5
if (x> 3 and
x< 10):
print(x)
Or use a hanging indent where every line but the first line is indented:
var = my_function(
arguement_1, arguement 2,
arguement 3)
When using a hanging indent, remember no argument goes on the first line.
The best practice in commenting is comment on code as you write it. They come out clearer and more descriptive that way.
Limit characters to 72, use complete and descriptive sentences and keep updating the comments as with changes in the code. Once you have that in mind, you’re good to go.
Block Comments
Block comments explain a section of code. It usually looks like an entire paragraph. When using block comments, here are the rules to follow:
- Indent block comments to the same level as the code they are describing
- Start every line with a # followed by a single space
- Separate paragraph with a line beginning with #
def my_function():
#This is a block comment
#The function prints hello world
print("Hello World!")
Inline Comments
Inline comments come immediately next to a code statement. They describe the line of code they are next to. Avoid using inline comments a lot because they clutter code.
- Use sparingly
- 2 spaces from the code statement
- Don’t use them to explain the obvious. This gets redundant and is a waste of time
x = 10 #This is an inline comment
Whitespace
Whitespace makes code easier to read because things aren’t all bunched up. Too little of it makes your code look squeezed while too much of it makes your code look scattered. However, the right amount makes your code look perfectly neat.
Where to AVOID whitespaces
At the end of a line.
x = 5
Inside parenthesis
my_list = [ 1, 2, 3 ]
Before a comma or semicolon or colon
print(x , y)
Before opening parenthesis of an argument list for a function
my_function ():
P.S Keep a maximum of 72 characters in a single line.
For more PEP-8 guidelines, look into the PEP-8 documentation.
How to automatically follow PEP-8 rules
Keeping track of all these rules can get taxing, that is why there are linters (programs that analyze code and flag errors) available as extensions for any text editor; Visual Studio Code, Sublime, Atom and VIM.
- pycodestyle
- flake8
Conclusion
To learn more about PEP-8, the documentation is a good place to start as well as this Real Python tutorial that I read to get a brief overview when I was starting out.
Happy clean coding.
<Lulu>
|
http://techwithlulu.com/index.php/2019/09/18/pep-8-guidelines-to-writing-perfect-code/
|
CC-MAIN-2019-51
|
refinedweb
| 865
| 70.23
|
: I think what he'd prefer is something like the TypeSafeJdbcWrapper.
class Blah{ private String toStringMethod = "toString"; public String toString(); }Now, I point my editor at 'public String toString()' and change it to 'public String returnLocalizedMessage()'. Does the compiler have much chance of getting this right?
class Blah{ private Closure toStringMethod = new Closure(){ Object perform(){ return toString(); } }; public String toString(); }...for instance, doesn't suffer from this problem. I know where you're coming from. I was taught that view at college, when one of the goals was to make the language responsible for detecting problems. My first instructor bragged about how close they were in the research department to making a computer language that didn't allow you to write bugs. That was 20 years ago. Now I just test anything that can break and I don't need all that language enforcement. If you test anything that can break, accidental changes to strings will be detected by them. Life is easier that way. I think I'm still not quite coming across... it's not that I don't test these things, I use Strings all the time for some things. I don't like how I can't talk about java's first class elements without using a String though, because then I can't be lazy about changing a name - you can no longer write a generalize algorithm to do a generic boring task. And I think that smells. To be honest, I regret starting this page the way I did, because I'm not against using Strings. I'm against using them as a substitute for good language decisions. It's a OnceAndOnlyOnce thing. Maybe it's just me and the domains I've worked in. I don't worry about using plain old SQL queries when I can get away with it. I don't miss the ability to rename methods when some of the behavior is in SQL strings. There's usually one place that talks to the database and one instance of each term that might be a method name. I think OnceAndOnlyOnce minimizes the benefit of method rename refactoring, and even minimizes the need for compile time type checking.
{ AnObject anObject = ...; AList aResult = DataBase.query(anObject, "toString()"); }This is bad. Really bad. "toString()" doesn't have any semantic meaning to the compiler. I want to write this instead:
{ AnObject anObject = ...; AList aResult = ((Proxy) ((AnObject) DataBase.query(anObject)).toString()).$getList(); }A little bit longer, true, but now the compiler/runtime knows what I'm doing. We can refactor using language aware tools without fear that they don't understand the quoting of methods. And it isn't all bad... consider parameters:
{ AnObject aParameter = ...; AnObject anotherParameter = ...; AnObject anObject = ...; AList aResult = DataBase.query(anObject, "toString()", new Object[]{aParameter, anotherParameter}); }Consider the possibilities: runtime class cast exceptions cannot be ruled out by the compiler!
{ AnObject aParameter = ...; AnObject anotherParameter = ...; AnObject anObject = ...; AList aResult = ((Proxy) ((AnObject) DataBase.query(anObject)).toString(aParameter, anotherParameter)).$getList(); }Still a bit longer, but we get compile time checking for most parameters now. We start gaining ground once we have more complex queries though... because all calls to a Proxy will return an appropriately typed Proxy... we only have to convert back to a list when we want the results. And we can cache the Proxies and reuse them... the setup is a one time thing for the most part. Note: I have nothing against language which allow you to directly talk about their parts. I wish java did understand during compile/runtime that "toString()" will be referencing that particular method. But it doesn't. -- WilliamUnderwood p.s., please be exceedingly rude in pointing out flaws in my train of thought... altough I do have a working version of this, it was written after a good nights sleep. I haven't had one of those in a few days now (forget the 40 hour work week... I need to get away from the 40 hour work day first!). p.p.s, for those looking at the wiki source, please leave the things like A"""List... I know they're not strictly necessary, but it's one less thing to go wrong when somebody changes it to MySpecialList? (see the problem?)
public MyType getMyType( String theNameOfTheThingToGet );Let's say for there are (currently) four possible String's values to pass in: "Foo", "Bar", "Fubar", and "Snafu" This give us four "effective method names":
public MyType getMyType-Foo(); public MyType getMyType-Bar(); public MyType getMyType-Fubar(); public MyType getMyType-Snafu();That could be implemented as four separate "real" methods:
public MyType getFoo(); public MyType getBar(); public MyType getFubar(); public MyType getSnafu();If fact, the latter would even allow different return types for each method. At this time, the code-struture in Java and something dynamically-typed like Smalltalk or Python would look pretty much the same. What if we now need to add a new "name-of-something" - say, "Ugh"? In a statically-typed language, we need to expand the interface and add a new method:
public MyType getUgh();Then we need to go and implement it in all implementor classes. But how do we handle the case where one of those classes doesn't give a hoot about "Ugh"? Not pretty (ex. use a base class that implements every method in the interface in some "default" way, and derive every concrete class from that). In a dynamically-typed environment we just implement an additional method on the concrete class(es) that care, and don't worry about it in any place where doesn't (and, of course, unit-test all our modified classes to make sure they respond correctly to the new method). Similarly, in our original interface (remember, the one with a String parameter?), we could do exactly the same thing in Java as our dynamic friends; have the classes (or even the instances! ust like adding a method to an instance in Python) that care respond to the new "effective method name": getMyType-Ugh() Granted, there are perhaps better types to use for the "theNameOfTheThingToGet" (for example, a TypeSafeEnum? instead of a String), but I think the basic analogy is fair - or not? -- GeoffSobering This problem was solved many years ago in the Lisp world by using symbols and multiple namespaces. It was also solved in SmallTalk, Python, and a host of other dynamically-typed languages, too (more recently, for sure). My point is that using "magic strings" as a method-signature extender can be thought of as a mechanism (poor as it may be) to gain some of the benefit of dynamic-binding in a statically-bound language. Obviously, if your problem-domain is completely (or mostly) composed of entities that don't map cleanly to static-types, you probably should choose a dynamically-typed language from the start. However, if your domain has only a small number of dynamic elements mixed into a largely static set of entities (or if you're trapped in a static language for non-design reasons), then the above technique may be helpful. -- GeoffSobering The best dynamic languages pretty much treat everything as a string. Hybrid-typing systems like PHP are too problematic IMO. The drawback is that comparison operators need to be clear about whether they are comparing as string or numbers, but this is good IMO. You don't have to back up to look to find their type to know. IOW, I don't like polymorphic comparisons, at least not in scripting languages. No they don't. The best dynamic languages have types, SmallTalk, Lisp, Python, Ruby, all have types, they don't treat everything as a string. Dynamic Typing simply means the types are checked at runtime, rather than compile time. Scripting languages are the kings of polymorphism, they do it better, and make use of it more often than most static languages, so your point was what? I think you misread the above paragraph. It said the "best" languages, not necessarily all dynamic languages. It was a value judgement, not an assessment of all dynamic languages. As a value judgement, it's not very helpful unless you give us some reason why you think they're the best. Offhand, I don't think I've ever used a single scripting language that used a string for everything. Maybe TCL. But Perl, PHP, Python, Ruby, Scheme, Lisp, Smalltalk, Self, and all their variants all have types. -- JonathanTang Python fakes it well, but all member-lookups in Python are really just string-based hashtable access. foo.bar() is really foo.__type__.__dict__["bar"](foo) in Python. You can even override getattr and setattr so that ["bar"] is doing something else. The original scripting language: shell.
const char *kSalary = "salary"; // etc.Later:
int salary = record.getMonetaryField(kSalary);Also, database abstractions like HiberNate have alternate ways to specify queries. QueryByExample for instance. Also by composing query criteria objects. Seems a lot less error prone than concatenating a gnarly SQL query string. -- IanOsgood I haven't had many problems with frameworks that don't completely hide the SQL. I find it gives me the best of both worlds: automating the repetitous parts of SQL, but still allowing one to use a somewhat natural form of RelationalAlgebra instead of the verbose, hard-to-read "new-dot-new" pattern described in ExpressionApiComplaints. Plus, the frameworks/utils don't have to completely cover everything SQL syntax does (if even possible) because they are not trying to be a total wrapper, but merely helpers. This probably reduces their size by a small fraction of a pure wrapper. Plus, I often test direct SQL anyhow. If I had to use new-dot-new, I'd have to rewrite it. And, tools like HyberNate? have their own learning curves and gotcha's. (EditHint: perhaps the above should be moved to an SQL-wrapper-specific topic.)
|
http://c2.com/cgi/wiki?NoStrings
|
CC-MAIN-2015-22
|
refinedweb
| 1,644
| 65.01
|
So here we have the first set of parts for the ServoStock, a derivative of the Rostock using Closed-Loop control, a whole new com architecture, Servos for drive and NO STEPPERS. Pictured is the first attempt of the single axis using the Vitamins from a Printrbot.
Software/Communications:
The system we developed over 4 years and have now applied to a 3d printer is an extensible, namespaced communication protocol. Think of it like a domain specific language over a generic serialized communication link. The protocol allows devices to report to the computer their capabilities, then the computer can generate packets based on that report. We have complete implementations in Java and C99. Clojure, Jython, Jruby and Matlab have been tested working with this library. There is a partial implementation in pure Ruby as well.
Electronics:
We have redesigned the entire control system from the ground up. From the get-go we started using magnet orientation encoders plus low cost continuous servos. The motherboard is a Pic32mx440f128h with each axis receiving a servo pulse and an SPI channel for the encoder. The motherboard uses a 7x2 ribbon cable to connect to each axis. Each axis has a small board with the encoder chip and the connector for the servo.
Firmware:
The control loop runs at 20 ms for the servo pulse calculation, interpolation and forward/inverse kinematics. The device identifies itself as having the PID control namespace, the kinematics namespace, and the 3d printer configuration namespace. Through the communication layer you can change kinematics models, change PID constants and store all the Slic3r/Cura configurations. The configurations are stored non-volatile in Flash and travel with the printer to be read at runtime. NO MORE CONFIG FILES!!
The firmware also has auto-config system. The servo dead band is measured at boot time. The end stops are measured using the encoder with no limit switches. I am thinking about doing a bed calibration as well, but that is future work.
Bootloader:
a (new to you guys) bootloader that i developed for the DyIO controller. It is a serial bootloader that uses the same communication protocol as the printer or any other device for that matter. The bootloading interface is just another namespace that any device can implement. The toolchain for generating bootloader file is all written in Java and attaches to any Makefile build chain.
Hardware:
We have taken the idea of the Rostock and started from scratch using a full set of parametrics. A single file with measurements from the vitamins you are using is all that is needed to generate a whole new printer.
really exciting idea ...
you can also unleash your framework with 2.1W and 3.5W diode lasers (EnduranceRobots.com)
|
https://hackaday.io/project/962-servo-stock
|
CC-MAIN-2017-30
|
refinedweb
| 455
| 57.37
|
I always liked to manipulate images by code, be it by creating images and animations by code or by manipulating photos (again, by code). I already wrote two articles on how to manipulate bitmaps in a relatively fast & safe way in .Net but, even if I can create animations by drawing all the frames I need, something I miss in .Net is a framework capable of reading and writing animations (or videos) using easy to understand methods and normal Streams.
I already used AForge. I didn't look at the latest version of the library, but the problem I had with it is that I can't (or couldn't) write frame by frame to .Net Stream, forcing me to tell a file name where it will write the final video (and I wanted to send the video by TCP/IP). At that time I solved the problem by streaming each frame individually but now I decided it was time to do a small animation framework.
To be minimalist, we need a video producer (an interface) with an WriteFrame method to create fixed-time animations or animations that send the actual frame on client requests (like TCP/IP based animations) and a consumer interface, to read the next frame.
Considering I implement such interfaces, I would be already capable of writing frames to a TCP stream and then receive those frames by client on the other side. The implementation could encode each frame as a normal image or could use any algorithm to detect the changes done to the frame and send only those changes.
As I said, I am being minimalist. One interface is only responsible to add frames while the other is only responsible to read those frames.
The interfaces could be as simple as this:
public interface IFrameWriter
{
void AddFrame(Bitmap frame);
}
public interface IFrameReader
{
Bitmap GetNextFrame();
}
As simple as those interfaces look, we already have problems.
I'd like to talk about how to use the minimalist approach directly, but the Bitmap is enough to force me to create another interface, so I will continue with it.
To correct the minimalist interfaces, I should get rid of that Bitmap reference as that will create a direct reference to the System.Drawing.dll or the PresentationCore.dll and I don't want to force WPF applications to load the System.Drawing.dll as I also don't want to make Windows Forms applications to load the PresentationCore.dll (and also I don't want to make Silverlight or Console Application to have to load any of those libraries).
My solution is a reduced and safe only version of the ManagedBitmap I presented on the article Managed Bitmaps. The new ManagedBitmap is simple a matrix (or double-dimensional array) like class, that internally works over a normal array and with some graphic specific properties and methods.
ManagedBitmap
I am planning to add more methods to the ManagedBitmap (methods to draw lines, rectangles etc) but for the moment and to keep the minimalistic approach, its important traits are:
And, if you didn't saw the code or the other articles, it is important to know that the ManagedBitmap is a generic class. So, a pixel can be of type int, of type Argb32, of type Rgb24 or any type that can represent a pixel color, be it indexed or not.
int
Argb32
Rgb24
So, having a bitmap type that is independent from Windows Forms or WPF (or anything else) we can finally recreate our minimalistic interfaces.
But now we have another problem. The ManagedBitmap is generic and that forces us to choose a pixel type or to make our interface generic too.
Which is the solution I choose?
If you know me or if you are looking at the code, you know that I chose both. I try to create an interface everytime I create a generic class. The interface is there to access the object without knowing its generic arguments at compile-time (which avoids using Reflection if you need to use it that way).
So, the ManagedBitmap itself implements the IManagedBitmap interface. And that's where our minimalistic interfaces start.
IManagedBitmap
public interface IFrameWriter
{
bool ChangesContent { get; }
bool RequiresDifferentBitmap { get; }
void WriteFrame(IManagedBitmap frame);
}
public interface IFrameReader
{
bool ChangesContent { get; }
IManagedBitmap ReadFrame();
}
public interface IFrameWriter<T>:
IFrameWriter
{
void WriteFrame(ManagedBitmap<T> frame);
}
public interface IFrameReader<T>:
IFrameReader
{
new ManagedBitmap<T> ReadFrame();
}
You may notice that both interfaces have a ChangesContent property. That is because the FrameWriter may need to change the bitmap for its own logic and the FrameReader may opt to create a single bitmap and always change its content instead of allocating many bitmaps.
But what will happen if you still need the unchanged bitmap?
Well, it is up to you, the caller, to create a clone if needed. The properties are there to avoid unnecessary clones in those cases that the implementation does not change the bitmap.
And that RequiresDifferentBitmap?
In this case, the FrameWriter may be storing the old bitmap to check for changes. It is not the responsibility of the FrameWriter to clone the image to guarantee that it will contain the good old image the next call the WriteFrame() is called. It is the caller responsibility to check for that.
FrameWriter
WriteFrame()
I did that for performance reasons, as cloning every frame may take unnecessary time if there is always a new bitmap when WriteFrame() is called. But if that's not the case, it is good to check this property and clone the bitmap if needed.
With those interfaces we are already prepared to create a simple animation format/streaming.
The truth is: We don't have any way to tell the frame-rate at this moment (not through the interfaces) and that can be very problematic. But, we don't need to worry yet. When streaming webcam frames, for example, we only need to send a new frame when the other side has actually finished receiving the old frame.
So, we will need to add extra information to create a real video-streamer or a better format later, but let's not focus on that for the moment.
A very simple video animation can be done by saving each frame as an entire image, be it PNG, JPG or whatever.
It is not the recommended approach, but in the Sample application you can find this FrameWriter:
using System;
using System.IO;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Pfz.Imaging;
using Pfz.Imaging.Wpf;
namespace PfzImagingSample
{
public sealed class MultiplePngRgb24FrameWriter:
FrameWriter<Rgb24>
{
private string _directory;
public MultiplePngRgb24FrameWriter(string directory)
{
if (directory == null)
throw new ArgumentNullException("directory");
_directory = directory + "\\";
Directory.CreateDirectory(directory);
}
private int _count;
public override bool ChangesContent
{
get
{
return false;
}
}
public override bool RequiresDifferentBitmap
{
get
{
return false;
}
}
public override void WriteFrame(ManagedBitmap<Rgb24> bitmap)
{
if (bitmap == null)
throw new ArgumentNullException("bitmap");
int width = bitmap.Width;
int height = bitmap.Height;
var writeableBitmap = new WriteableBitmap(width, height, 96, 96, PixelFormats.Rgb24, null);
bitmap.CopyTo(writeableBitmap);
var encoder = new PngBitmapEncoder();
var frame = BitmapFrame.Create(writeableBitmap);
encoder.Frames.Add(frame);
_count++;
using(var stream = File.Create(_directory + _count + ".png"))
encoder.Save(stream);
}
}
}
Ok, it works and if instead of saving the files to disk I simple wrote all of them to a a single Stream I could send videos frame-by-frame over TCP/IP.
But if I simple wanted to send each frame as an entire bitmap I surely didn't need to use my managed bitmaps and this implementation is WPF specific. Unfortunately, I don't know all the inner details to recreate the PNG compression without using other references, but this is only a sample and is not our main goal.
So... let's continue.
The entire purpose of having the ManagedBitmap class is to have an easy way to access and manipulate bitmap pixels, and animation is a great place to do that.
Without other compression techniques, one of the simplest compression logics that exist is to detect which area has been changed.
For example, if I have an entire black frame
and the next frame simple has a small text on it
I can detect that the changed area is this
So, that's the first thing we can do to create our own video format.
I added the method GetDifferenceArea on the class. The method looks like this:
public DifferenceArea GetDifferenceArea<TOther>(int thisLeft, int thisTop, ManagedBitmap<TOther> otherBitmap, int otherLeft, int otherTop, int width, int height, Func<TOther, T, bool> arePixelsSimilarDelegate)
{
int thisWidth = _width;
if (thisLeft < 0 || thisLeft >= thisWidth)
throw new ArgumentOutOfRangeException("thisLeft");
int thisHeight = Height;
if (thisTop < 0 || thisTop >= thisHeight)
throw new ArgumentOutOfRangeException("thisTop");
if (otherBitmap == null)
throw new ArgumentNullException("otherBitmap");
int otherWidth = otherBitmap._width;
if (otherLeft < 0 || otherLeft >= otherWidth)
throw new ArgumentOutOfRangeException("otherLeft");
int otherHeight = otherBitmap.Height;
if (otherTop < 0 || otherTop >= otherHeight)
throw new ArgumentOutOfRangeException("otherTop");
int thisRight = thisLeft + width;
int otherRight = otherLeft + width;
if (width < 0 || thisRight > width || otherRight > width)
throw new ArgumentOutOfRangeException("width");
int thisBottom = thisTop + height;
int otherBottom = otherTop + height;
if (height < 0 || thisBottom > height || otherBottom > height)
throw new ArgumentOutOfRangeException("height");
if (arePixelsSimilarDelegate == null)
throw new ArgumentNullException("arePixelsSimilarDelegate");
int thisIndex = thisTop * thisWidth + thisLeft;
int otherIndex = otherTop * otherWidth + otherLeft;
int thisAdd = thisWidth-width;
int otherAdd = otherWidth-width;
int minX = int.MaxValue;
int maxX = int.MinValue;
int minY = int.MaxValue;
int maxY = int.MinValue;
var thisPixels = _pixelArray;
var otherPixels = otherBitmap._pixelArray;
for(int y=0; y<height; y++)
{
for(int x=0; x<width; x++)
{
T thisPixel = thisPixels[thisIndex];
TOther otherPixel = otherPixels[otherIndex];
bool arePixelsSimilar = arePixelsSimilarDelegate(otherPixel, thisPixel);
if (!arePixelsSimilar)
{
if (x < minX)
minX = x;
if (x > maxX)
maxX = x;
if (y < minY)
minY = y;
maxY = y;
}
thisIndex++;
otherIndex++;
}
thisIndex += thisAdd;
otherIndex += otherAdd;
}
if (maxX == int.MinValue)
return null;
return new DifferenceArea(minX, minY, maxX, maxY);
}
The code is complex because I wanted to cover all the possibilities and the method allows to get the difference area even if the two bitmaps have different pixel types, and at specific locations which can be different for each bitmap. But at this moment we are being minimalist so you will probably want to see this overload:
public DifferenceArea GetDifferenceArea(ManagedBitmap<T> otherBitmap)
{
var result = GetDifferenceArea(otherBitmap, null);
return result;
}
With it, we give a second bitmap to compare with the actual one. There is nothing complicated in that.
If there is no difference, null is returned. If there is a difference, a result of type DifferenceArea is returned, which contains the offsets of the different area.
DifferenceArea
So, without any other compression, I am already capable of identifying that the change from the first bitmap to the second (both of 300x225 pixels) is an area of only 113x13 pixels. It is easy to note that it will be smaller, right?
Surely we can compress even more. If we use a DeflateStream when writing our bitmap data, we will have a normal byte compression that will be applied over our reduced bitmap.
In my first sample there was no background (it was simple black) and that really allows a DelateStream to compress a lot, but what if our images have a background, like in this case:
DelateStream
And the second image is like this:
Our difference image can look like this:
Or like this:
Without another compression technique, both will have the same size. But it is not hard to imagine that for a byte compression algorithm, like Deflate, the second one is easier to compress.
Implementation note: I don't know in which block sizes DeflateStream works but I initially was writing byte-by-byte, expecting that it will compress only when "flushing", but the result was becoming bigger than the non-compressed image, so I decided to first write everything to a buffer and then write the entire buffer to the DeflateStream and then it worked fine.
DeflateStream
Ok, the actual result is not quite that. I subtract each color element from one image to another. That makes equally colored pixels become black, but different pixels will not have their original solid color, it will be a color that summed with the old value will gives the right color. Also, when debugging video frames I wanted to see the intermediate images and I added 127 to each color element, so darker places become dark gray, identical pixels become gray and lighter pixels became light gray... and I was surprised that DeflateStream was able to compress more, so I kept that in the final algorithm.
The generated difference image is this (I zoomed it to make it easier to understand):
Until this moment I was presenting the lossless compression. That is, at the end, the first image with the applied difference is identical to the second image. But to achieve a better compression we may want to lose quality, effectively making the animation easier to be compressed and faster to send over the network.
I will not show every possible way of lossy compression, but I will show a simple one. Color loss.
It is known that human beings don't see all the colors 16 millions colors the computer generates. In fact, even if we do see all of them, many monitor configurations can already change colors, so usually small color losses don't affect the result.
For example, take a look at those two squares.
and
One uses the color as 255, 255 and 255, while the other uses the color as 254, 254 and 254.
Did you noticed the difference?
If you answered yes, then congratulations. Most people will simple not see any difference and, even if you see a difference, do you think it will make any difference inside a photo?
By reducing the number of colors an image have you will also help the Deflate algorithm work better. There are a lot of algorithms that can be used to reduce the number of colors of an image (some of which are capable of choosing the most appropriate intermediate color).
But the algorithm I will use is extremely simple. Each color element is divided by a value (and as integers they will lose the possible floating part) and then multiplied again by the same value. The bigger the value used in the division and multiplication, the more colors are lost (or joined). Extremely simple, but it is enough to complete our sample.
The code to do the color reduction is this:
public static PixelManipulator<Rgb24> Get(int factor)
{
if (factor < 2)
throw new ArgumentOutOfRangeException("factor", "factor must be at least 2.");
return
(ref Rgb24 pixel) =>
{
int r = pixel.Red/factor;
r *= factor;
int g = pixel.Green/factor;
g *= factor;
int b = pixel.Blue/factor;
b *= factor;
pixel = new Rgb24((byte)r, (byte)g, (byte)b);
};
}
Such methods returns a delegate of type PixelManipulator, which can then be applied to the ManagedBitmap by callig the method ManipulateAllPixels(). To show it working, see the results for the frame 46 of the sample saved in .png after the color loss:
PixelManipulator
ManipulateAllPixels()
To make a real video format I suggest that the actual interfaces are not changed. New interfaces (IVideoEncoder, IVideoDecoder) should be created, based on the actual interfaces and adding methods to read and write extra information (like frame-rate, how many time to wait for the next frame and so on);
IVideoEncoder
IVideoDecoder
Surely it is possible to do better. There are a lot of algorithms to encode video, capable of determining which areas (instead of which area) in the image have changed and even different lossy algorithms that could do great compressions.
At the moment I am only showing a sample of how it could be done. I can say that PNG still compress better than my format for single images, so I am pretty sure that if I save the differences as PNG images I will get a better compression.
In fact, I sincerely hope my interfaces and classes can be used as the base to implement industry-standard formats to encode videos using only managed APIs.
The sample is composed of two applications. One has a basic animation running and allows to save it using multiple PNG images or using my algorithm of modification detection + DeflateStream.
The other application is capable of playing the saved animations. You must drag and drop the file or folder created by the other application to see the animation.
The samples don't have exception handling and even if the AnimationWriter application only saves a single animation, the classes are there to be used to your own animations. Also, you can check the different results of the lossy algorithm with it (I got intrigued that the biggest color loss creates bigger files than the 1/15 loss on the deflate algorithm).
When writing the article I did an animation in javascript similar to the one done in the sample. Unfortunately, codeproject is not running my javascript, so I removed the animation. I tried to make the animation in GIF, but it was getting huge (4mb... in my own format with the highest quality it gets 429kb... but gif was also losing colors).
So, I really believe my format is doing a good job... but I am frustrated that I can't put my animation.
|
http://www.codeproject.com/Articles/538415/Creating-your-own-animation-format?msg=4489656
|
CC-MAIN-2015-11
|
refinedweb
| 2,864
| 51.28
|
Resizing images from the server using WPF/WIC instead of GDI+
I and many others have written about resizing images using GDI+, or rather its .NET façade, System.Drawing. It works. But there is just this one sentence at the bottom of the documentation:
Caution:
Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.
Kind of scary, isn’t it? Nobody likes diminished performance and run-time exceptions. But when you need to generate thumbnails from managed code, what other choices do you have?
There used to be two: using interop with native APIs (which won’t work in medium trust) or writing your own image manipulation library from scratch. There might already be some purely managed image manipulation components out there that could replace System.Drawing, but I don’t know of one. If you do, by all means drop me a comment and I’ll update the post. I’m also not sure hoe fast managed code could do this sort of heavy pixel lifting.
Since WPF was introduced into the .NET framework, there has been a third possibility that will be the topic of this post.
Before we look at that, let’s put things in perspective: there are LOTS of applications and components out there that are using GDI+ (or more accurately its System.Drawing managed code expression) and they work just fine. My own photo album uses it and I’ve never had a problem with it. Most of the problems I’ve seen were due to improper resource management (not freeing handles and similar bugs) or to abuse of the API (resizing gigapixel images for example). But used reasonably and correctly, it’s an API that really doesn’t pose any serious problem and that is fairly safe. If you use it today and are satisfied with it, there probably isn’t any reason why you should change your code. And as we’ll see, System.Drawing works in medium trust whereas System.Windows.Media.Imaging does not.
So why would you want to use that fancy WPF stuff then? Well, first, it uses Windows Imaging Components, which means that you benefit from the same extensible imaging infrastructure that displays media in the Windows Explorer. This means that if you have your camera manufacturer’s raw codec or an Adobe DNG codec installed on the server, you’ll be able to resize photos using those formats without changing a single line of code. Pretty sweet. You also get a much more complete API. For example, there is support for reading and writing meta-data, which is extremely useful for gallery types of applications.
So let’s go and resize images.
As you know, images on the web are most of the time served from a different request than the page that shows them, through img tags on the page that point back to the server. For that reason, a dynamic image is not computed on the server by the page, but by a separate handler to which the img tag points and to which the page must communicate enough information through the querystring in order to construct the image.
In our case, that information is just the name of the image to resize. I’d like at this point to make a recommendation. I’ve seen many such handlers take the size of the thumbnail as a parameter. I think this is a security flaw as an attacker can easily generate requests for many different sizes, resulting in a flooded cache and/or using up lots of processing power. There are of course other, more brutal ways to launch a DoS attack but why make it easy? You will usually need at most a couple of image sizes, so it’s better to keep that information off the handler’s querystring and to code it as a setting of your application that never leaves the server. In our case, the thumbnail size is a constant that I arbitrarily set to 150 pixels.
The first thing you’ll need to do in order to resize images is to import the references to WPF into your web site. You’ll need the following assemblies:
- PresentationCore
- WindowsBase
These go under configuration/system.web/compilation/assemblies in web.config if you’re in a web site, or in project references in a WAP or library project.
There are actually several different ways that you can resize an image using the WPF API.
The fastest way is to create a BitmapImage from the file on disk and to specify the target width and height as part as image decoding:
BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = photoPath; bi.DecodePixelWidth = width; bi.DecodePixelHeight = height; bi.EndInit();
This is very efficient because the codec can scale while decoding and render only those pixels that will be in the final image.
Unfortunately, this won’t do here because in order to compute the size of the thumbnail, we need to know the dimensions of the original image: we want the thumbnail to have the same aspect ratio as the image it represents. So we need to read the image -or at least some of the image- before we can determine the size we want for the target.
The second way to resize is to apply a ScaleTransform on the image. In order to do that, we need to first read the image and grab its first (and usually only) frame:
var photoDecoder = BitmapDecoder.Create( photoStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None); var photo = photoDecoder.Frames[0];
Once we have that frame, we can apply the ScaleTransform using a TransformedBitmap. ScaleTransform is a representation of –you guessed it– a scale transformation: it has horizontal and vertical scales, and an optional center offset. To resize an image, all we have to do is this:
var target = new TransformedBitmap( photo, new ScaleTransform( width / photo.Width * 96 / photo.DpiX, height / photo.Height * 96 / photo.DpiY, 0, 0)); var thumbnail = BitmapFrame.Create(target);
We compute the scale by dividing the desired width (resp. height) by the original width (resp. height) and then multiplying the results by a DPI factor. That DPI factor, the division of the DPI of most screens by the original image’s DPI, is quite an unfortunate hack. Ideally, you’d be able to specify what DPI you want for the target image. Unfortunately, using this method you can’t, and the default is that it uses the original photo’s DPI and applies it to the target. In other terms, if you were asking for a target 150 pixels wide, and the original image was 600 pixels wide, you’d assume that a scale of 0.25 would get you the desired result: a thumbnail 150 pixels wide. But if the image was 240DPI, what you’ll actually get is a thumbnail 2.5 times bigger (in pixels) at 375 pixels wide. If in a context where the pixel dimension is what counts, this works, but examining the file in Photoshop or Paint.NET will reveal that it is 240DPI and not 96 DPI.
Using this method, you also don’t get a chance to affect the algorithm used to resize the image. Fortunately, the defaults give a pretty good quality with good performance (see below for a comparison in quality and performance).
The last resize method that I want to talk about is using a fuller drawing pipeline, giving us lots of control and additional options, at the price of performance. It is also the only one you can use if you want to do more to the image than just resize it (such as add vector graphics or watermark text).
public static BitmapFrame Resize(
BitmapFrame photo, int width, int height,
BitmapScalingMode scalingMode) {
var group = new DrawingGroup(); RenderOptions.SetBitmapScalingMode(
group, scalingMode); group.Children.Add(
new ImageDrawing(photo,
new Rect(0, 0, width, height))); var targetVisual = new DrawingVisual(); var targetContext = targetVisual.RenderOpen(); targetContext.DrawDrawing(group); var target = new RenderTargetBitmap( width, height, 96, 96, PixelFormats.Default); targetContext.Close(); target.Render(targetVisual); var targetFrame = BitmapFrame.Create(target); return targetFrame; }
Notice that this time, we were able to specify the DPI (96), and also the algorithm to use to resize the image.
One thing I noticed when testing those different algorithms is that the enumeration that WPF uses does not have as many values as it seems:
public enum BitmapScalingMode { Unspecified = 0,
Linear = 1, LowQuality = 1,
HighQuality = 2, Fant = 2, NearestNeighbor = 3, }
The explanation I got from the team on that is that at first they were vaguer “unspecified, low and high” despite the fact that the algorithms behind these names were known ones. People kept asking for specific algorithms despite them being already there, so they added the new aliases for the same values, to make it more explicit what algorithm is being used.
In all cases, I’m saving the resized bitmap as PNG as it’s simply the best format to get quality results for small thumbnails (jpg never looks very good at these scales, and GIF doesn’t have enough colors for photos):
byte[] targetBytes = null; using (var memoryStream = new MemoryStream()) { var targetEncoder = new PngBitmapEncoder(); targetEncoder.Frames.Add(targetFrame); targetEncoder.Save(memoryStream); targetBytes = memoryStream.ToArray(); }
I haven’t mentioned spitting out the image to the output stream and caching of the image, as this is virtually identical to what you’d do with GDI. You can also check out the code.
At this point, we have a wide number of options, so how do we choose between them?
I wrote a little benchmark application (which you can find attached to the bottom of this post). The application compares the rendering times and sizes for 30 jpg images, each one being 12 megapixels. It also generates different resized versions of two images that are particularly difficult to resize because of their high tendency for moiré using all the different quality settings that we have at our disposal, for GDI and WPF.
First, let’s look at the quality results:
I’ve shown before how for GDI, there is no big difference in performance between the modes that look acceptable (the ugly ones run three times as fast, but ew). So for the perf benchmark, I’ll use HQ bicubic for GDI.
For WPF, amazingly the one that looks best is the fast one. Out of the slower ones, Fant/High looks best so that’s what I’ll use to test perf.
Using these best settings, here are the results:
The time spent reading, resizing and encoding might seem weird until you realize that WPF doesn’t do the actual operations until it has to, à la Linq. This explains why reading the image or resizing it looks instantaneous whereas encoding seems to take longer than with GDI.
If we look at what exactly happens, in the fast WPF case reading does almost nothing except extract basic meta-data such as image dimensions. Then we resize, and still nothing really happens. It’s only when we ask for encoding that image data is read, resized and then encoded, resulting in encoding times that look longer than they should, but really that’s the entire operation and overall it’s wickedly fast: more than 3.5 times faster than high quality GDI. On average, it spent about a tenth of a second to resize each twelve megapixel image. That's more than a hundred million pixels processed per second.
In the regular WPF case, the bulk of the work is being done during the resize operation, which does both the decoding and the resizing, but still does so in two thirds of the time it takes GDI to do the same thing. One can see that the encoding time, which this time is only encoding (no catchup from previous operations) is in the same ballpark as GDI. Overall, this case is still 30% faster than GDI.
For completeness and to do your own comparisons based on the quality that you choose to use, here are the same numbers for all quality settings with each technology (numbers differ a little from those above, I haven't computed the statistical uncertainty of those results, but it seems to be roughly +-0.5s; sizes are exact):
On the size front, things look good as well. The quality of the output in all three cases is roughly equivalent, but the fastest method is also the one that gives the most compact results: the fast WPF method gives files that are on average 30% smaller than the same images resized by GDI and that are also about 10% smaller than the ones produced in the full WPF case.
Here are a few resized images that I used for the benchmark so that you can judge the quality<<
So except for the DPI problem, fast WPF is full of win and the one I’d choose for simple resizing.
But of course in some cases you won’t even have the option to use WPF because you just don’t have full trust. In those case, it’s OK to use GDI. But in all other cases, WPF is just faster, more efficient and it doesn’t have the known problems that led Microsoft to display a scary message on the API documentation.
- So how do I do that with GDI again?
- Where’s the code for the handler?
- Where’s the code for the benchmark?
UPDATE: added perf. numbers for all quality settings.
UPDATE 2:.
Follow-up: Resizing to JPEG.
|
https://weblogs.asp.net/bleroy/resizing-images-from-the-server-using-wpf-wic-instead-of-gdi
|
CC-MAIN-2018-51
|
refinedweb
| 2,284
| 61.87
|
Data.PVar.Queue
Description
A procrastinating queue. You can populate the back of the queue in
IO and read the front of the queue in pure code. The front of an
empty, un
closed queue is
_|_. I think it fits the definition of
referentially transparent, but it's still an abomination. It's
possible to do some really stupid things with one of these
Queues. If you read the source, this serves as an example of using
Data.PVar.Structure. Here's a simple example of using a
Queue:
import Prelude hiding (sum) import Data.Foldable (sum) main :: IO () main = do (back, front) <- newQueue -- Create a new queue. mapM_ (push back) [0..9] -- Push some values to the back of the queue. print $ peek front -- Safe to do since we know something has been written close back -- Close the queue. print $ sum front -- Safe to do since the queue is finalized
The output of the above program is:
Just 0 45
Is this useful? Who knows? It was a fun exercise.
Synopsis
Documentation
push :: QueueBack a -> a -> IO BoolSource
close :: QueueBack a -> IO ()Source
pop :: Queue a -> Maybe (Queue a, a)Source
|
http://hackage.haskell.org/package/procrastinating-structure-1.0/docs/Data-PVar-Queue.html
|
CC-MAIN-2019-30
|
refinedweb
| 194
| 83.56
|
Tutorial: SignalR Self-Host
Warning
This documentation isn't for the latest version of SignalR. Take a look at ASP.NET Core SignalR.
This tutorial shows how to create a self-hosted SignalR 2 server, and how to connect to it with a JavaScript client.
Software versions used in the tutorial
- Visual Studio 2013
- .NET 4
A SignalR server is usually hosted in an ASP.NET application in IIS, but it can also be self-hosted (such as in a console application or Windows service) using the self-host library. This library, like all of SignalR 2, is built on OWIN (Open Web Interface for .NET). OWIN defines an abstraction between .NET web servers and web applications. OWIN decouples the web application from the server, which makes OWIN ideal for self-hosting a web application in your own process, outside of IIS.
Reasons for not hosting in IIS include:
- Environments where IIS is not available or desirable, such as an existing server farm without IIS.
- The performance overhead of IIS needs to be avoided.
- SignalR functionality is to be added to an existing application that runs in a Windows Service, Azure worker role, or other process.
If a solution is being developed as self-host for performance reasons, it's recommended to also test the application hosted in IIS to determine the performance benefit.
This tutorial contains the following sections:
Creating the server
In this tutorial, you'll create a server that's hosted in a console application, but the server can be hosted in any sort of process, such as a Windows service or Azure worker role. For sample code for hosting a SignalR server in a Windows Service, see Self-Hosting SignalR in a Windows Service.
Open Visual Studio 2013 with administrator privileges. Select File, New Project. Select Windows under the Visual C# node in the Templates pane, and select the Console Application template. Name the new project "SignalRSelfHost" and click OK.
Open the NuGet package manager console by selecting Tools > NuGet Package Manager > Package Manager Console.
In the package manager console, enter the following command:
Install-Package Microsoft.AspNet.SignalR.SelfHost
This command adds the SignalR 2 Self-Host libraries to the project.
In the package manager console, enter the following command:
Install-Package Microsoft.Owin.Cors
This command adds the Microsoft.Owin.Cors library to the project. This library will be used for cross-domain support, which is required for applications that host SignalR and a web page client in different domains. Since you'll be hosting the SignalR server and the web client on different ports, this means that cross-domain must be enabled for communication between these components.
Replace the contents of Program.cs with the following code.
using System; using Microsoft.AspNet.SignalR; using Microsoft.Owin.Hosting; using Owin; using Microsoft.Owin.Cors; namespace SignalRSelfHost { class Program { static void Main(string[] args) { // This will *ONLY* bind to localhost, if you want to bind to all addresses // use http://*:8080 to bind to all addresses. // See // for more information. string url = ""; using (WebApp.Start(url)) { Console.WriteLine("Server running on {0}", url); Console.ReadLine(); } } } class Startup { public void Configuration(IAppBuilder app) { app.UseCors(CorsOptions.AllowAll); app.MapSignalR(); } } public class MyHub : Hub { public void Send(string name, string message) { Clients.All.addMessage(name, message); } } }
The above code includes three classes:
- Program, including the Main method defining the primary path of execution. In this method, a web application of type Startup is started at the specified URL (). If security is required on the endpoint, SSL can be implemented. See How to: Configure a Port with an SSL Certificate for more information.
- Startup, the class containing the configuration for the SignalR server (the only configuration this tutorial uses is the call to
UseCors), and the call to
MapSignalR, which creates routes for any Hub objects in the project.
- MyHub, the SignalR Hub class that the application will provide to clients. This class has a single method, Send, that clients will call to broadcast a message to all other connected clients.
Compile and run the application. The address that the server is running should show in a console window.
If execution fails with the exception
System.Reflection.TargetInvocationException was unhandled, you will need to restart Visual Studio with administrator privileges.
Stop the application before proceeding to the next section.
Accessing the server with a JavaScript client
In this section, you'll use the same JavaScript client from the Getting Started tutorial. We'll only make one modification to the client, which is to explicitly define the hub URL. With a self-hosted application, the server may not necessarily be at the same address as the connection URL (due to reverse proxies and load balancers), so the URL needs to be defined explicitly.
In Solution Explorer, right-click on the solution and select Add, New Project. Select the Web node, and select the ASP.NET Web Application template. Name the project "JavascriptClient" and click OK.
Select the Empty template, and leave the remaining options unselected. Select Create Project.
In the package manager console, select the "JavascriptClient" project in the Default project drop-down, and execute the following command:
Install-Package Microsoft.AspNet.SignalR.JS
This command installs the SignalR and JQuery libraries that you'll need in the client.
Right-click on your project and select Add, New Item. Select the Web node, and select HTML Page. Name the page Default.html.
Replace the contents of the new HTML page with the following code. Verify that the script references here match the scripts in the Scripts folder of the project.
<=""></script> <!--Add script to update the page and send messages.--> <script type="text/javascript"> $(function () { //Set the hubs URL for the connection $.connection.hub.url = ""; // Declare a proxy to reference the hub. var chat = $.connection.myHub; // Create a function that the hub can call to broadcast messages. chat.client.addMessage = function (name, message) { // Html encode display name and message. var encodedName = $('<div />').text(name).html(); var encodedMsg = $('<div />').text(message).html(); // Add the message to the page. $('#discussion').append('<li><strong>' + encodedName + '</strong>: ' + encodedMsg + '<(); }); }); }); </script> </body> </html>
The following code (highlighted in the code sample above) is the addition that you've made to the client used in the Getting Stared tutorial (in addition to upgrading the code to SignalR version 2 beta). This line of code explicitly sets the base connection URL for SignalR on the server.
//Set the hubs URL for the connection $.connection.hub.url = "";
Right-click on the solution, and select Set Startup Projects.... Select the Multiple startup projects radio button, and set both projects' Action to Start.
Right-click on "Default.html" and select Set As Start Page.
Run the application. The server and page will launch. You may need to reload the web page (or select Continue in the debugger) if the page loads before the server is started.
In the browser, provide a username when prompted. Copy the page's URL into another browser tab or window and provide a different username. You will be able to send messages from one browser pane to the other, as in the Getting Started tutorial.
|
https://docs.microsoft.com/en-us/aspnet/signalr/overview/deployment/tutorial-signalr-self-host
|
CC-MAIN-2021-39
|
refinedweb
| 1,190
| 58.89
|
oh ok ... thx !
Type: Posts; User: crazyboy5012
oh ok ... thx !
well this is basically the whole code .... and the error is given the scond i try to allocate the memory of the array
the error is given for the declarations.
public class AI{
int max,min;...
i was trying to create a new array:
int[][] location;
but for some reason the moment i try to call that array it gives me an error:
int[][] location;
location = new int[10][2];
error: "syntax...
omg thx !!! .... fixed it XD
i did an it lands on the exact x and y parameters which i specified it not to land on
if you look back at the code you'll see that the while will only run if the next jump(y-=cp;(cp=100)) does not...
ok found the problem ... for some reason even with the limitations it keeps creating an infinite loop.
i am not sure why ... it's either a whole in the limitations or a miss in the data ...
[EDIT]...
how will this work if i am working on a JFrame ?
i understand if i only have a console based progrem.
(btw i am building a turn based bored game)
oh simple .... i look for a proble and if i think i spot it i change it ... run it again if it does not work i repeat ....
this is the 1st time i got no results ...
I am not really keen on all of the terms yet .. can you explain your slef?
i know it is very ugly. i was forced to make it that way due to lack of knowledge and lack of time.
each x and y combination belong to a platform (ex> x1,y1 belong to platform 1), and each one of...
|
http://www.javaprogrammingforums.com/search.php?s=e5fd384a0d691fa5a307546f59666662&searchid=1514126
|
CC-MAIN-2015-18
|
refinedweb
| 295
| 83.05
|
This page describes how Google Kubernetes Engine (GKE) implements service discovery and managed DNS.
For a general overview of how DNS is used in Kubernetes clusters, see DNS for Services and Pods.
Managed DNS for GKE
GKE provides the following managed DNS options to resolve service names and external names:
- kube-dns: a cluster add-on that is deployed by default in all GKE clusters.
- NodeLocal: an optional add-on that can be used with kube-dns or Cloud DNS.
- Cloud DNS: a cloud-managed DNS infrastructure that replaces kube-dns in the cluster.
Service discovery and the kube-dns add-on
In Kubernetes, service discovery is implemented with autogenerated service names
that map to the service's IP address. Service names follow a
standard specification:
my-svc.my-namespace.svc.my-zone. Pods can also access external services, like
example.com, through their names. See DNS for Services and
Pods
for more information on the behavior of DNS in Kubernetes.
kube-dns runs as a Deployment
that schedules kube-dns replica Pods to nodes in the cluster. The kube-dns
Pods are in the
kube-system namespace. The kube-dns deployment is accessed
through a corresponding Service that
groups the kube-dns Pods and gives them a single IP address. By default, all
Pods in a cluster use this service to resolve DNS queries.
kube-dns scales to serve the DNS demands of the cluster. This scaling is
controlled by the
kube-dns-autoscaler which is deployed by default in all
GKE clusters.
kube-dns-autoscaler adjusts the number of
replicas in the kube-dns deployment based on the number of nodes and cores in
the cluster.
How Pod DNS is configured
The kubelet agent running on each Node configures the Pod's
etc/resolv.conf to
use the kube-dns service's ClusterIP. An example of this configuration is shown
below, in this example the IP address of the kube-dns service is
10.0.0.10
(this IP address will be different in other clusters):
# cat /etc/resolv.conf nameserver 10.0.0.10 search default.svc.cluster.local svc.cluster.local cluster.local c.my-project-id.internal google.internal options ndots:5
kube-dns is the authoritative name server for the cluster domain (
cluster.local)
and it recursively resolves external names. Short names that are not fully
qualified, like
myservice, are completed first with local search paths. For
example,
myservice.default.svc.cluster.local,
myservice.svc.cluster.local,
myservice.cluster.local,
myservice.c.my-project-id.internal, and
myservice.google.internal.
What's next
- Learn how to provide scalable DNS resolution using NodeLocal DNSCache for clusters requiring high volumes of DNS queries.
- Learn how to use Cloud DNS for GKE.
|
https://cloud.google.com/kubernetes-engine/docs/concepts/service-discovery?hl=hu
|
CC-MAIN-2021-25
|
refinedweb
| 455
| 58.58
|
Many languages have REPLs, often also referred to as
interpreters: Ruby has
irb; Python has
its command-line interpreter; Groovy has its console; even Java has
something akin to a REPL in BeanShell. The “REPL” acronym is derived from
a simple description of what it does:
Read: code is read as text from some input (often
stdin, but this varies if you’re using a
REPL in an IDE or other nonconsole environment).
Eval: the code is evaluated, yielding some value.
Print: the value is printed to some output device (often
stdout, sometimes preceded by other
output if the code in question happened to print content
itself).
Loop: control returns to the read step.
Clojure has a REPL too, but it differs from many other languages’ REPLs in that it is not an interpreter or otherwise using a limited or lightweight subset of Clojure: all code entered into a Clojure REPL is compiled to JVM bytecode as part of its evaluation, with the same result as when code is loaded from a Clojure source file. In these two scenarios, compilation is performed entirely at runtime, and requires no separate “compile” step.[2] In fact, Clojure is never interpreted. This has a couple of implications:
Operations performed in the REPL run at “full speed”; that is to say, there is no runtime penalty or difference in semantics associated with running code in the REPL versus running the same code as part of a “proper” application.
Once you understand how Clojure’s REPL works (in particular, its read and eval phases), you’ll understand how Clojure itself works at the most fundamental level.
With this second point in mind, let’s dig into the Clojure REPL and see if we can find bedrock.
The optimal workflow for programming in Clojure makes much more use of the REPL than is typical in other languages to make the development process as interactive as possible. Taking advantage of this is a significant source of the enhanced productivity—and really, fun!—that Clojure enables. We talk about this extensively in Chapter 10.
Example 1-1. Starting a Clojure REPL on the command line
% java -cp clojure-1.4.0.jar clojure.main Clojure 1.4.0 user=>
This incantation starts a new JVM process, with a
classpath that includes the clojure.jar file in
the current directory, running the
clojure.main class as its main entry
point.[3] See A classpath primer if you don’t yet
know what the classpath is; for now, you can just think of the classpath
as the JVM’s analogue to Python’s
PYTHONPATH, Ruby’s
$:, and your shell’s
PATH, the set of files and directories from
which the JVM will load classes and resources.
When you see the
user=>
prompt, the REPL is ready for you to enter some Clojure code. The portion
of the Clojure REPL prompt preceding
=> is the name of the current
namespace. Namespaces are
like modules or packages; we discuss them extensively later in this
chapter in Namespaces. Clojure REPL sessions
always start in the default
user
namespace.
Let’s look at some real code, a function that calculates the average of some numbers in Java, Ruby, and Python:
Example 1-2. Averaging numbers in Java, Ruby, and Python
public static double average (double[] numbers) { double sum = 0; for (int i = 0; i < numbers.length; i++) { sum += numbers[i]; } return sum / numbers.length; } def average (numbers) numbers.inject(:+) / numbers.length end def average (numbers): return sum(numbers) / len(numbers)
Here is the Clojure equivalent:
(defn average
[numbers][numbers]
(/ (apply + numbers) (count numbers)))(/ (apply + numbers) (count numbers)))
defn defines a new function
named
average in the current
namespace.
The
average function takes
one argument, referred to within its body as
numbers. Note that there is no type
declaration; this function will work equally well when provided with
any collection or array of numbers of any type.
The body of the
average
function, which sums the provided numbers with
(apply + numbers),[4] divides that sum by the number of numbers
provided—obtained with
(count
numbers)—and returns the result of that division
operation.
We can enter that
defn expression
at the REPL, and then call our function with a vector of numbers, which
yields the expected result:
user=> (defn average [numbers] (/ (apply + numbers) (count numbers))) #'user/average user=> (average [60 80 100 400]) 160
[2] If necessary, you can ahead-of-time compile Clojure to Java class files. See Ahead-of-Time Compilation for details.
[3] Alternatively, you can use
java -jar
clojure.jar, but the
-cp
flag and the
clojure.main entry
point are both important to know about; we talk about both in Chapter 8.
[4] Note that
+ here is not a
special language operator, as in most other languages. It is a
regular function, no different in type than the one we’re
defining.
apply is also a
function, which applies a function it is provided with to a
collection of arguments (
numbers here); so,
(apply + [a b c]) will yield the same
value as
(+ a b c).
No credit card required
|
https://www.safaribooksonline.com/library/view/clojure-programming/9781449310387/ch01s03.html
|
CC-MAIN-2018-30
|
refinedweb
| 849
| 60.55
|
Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "aide".
The annotated tag, aide.0.15.rc1.release has been created
at 6e639e18f79ca840673709738fe2b5b7ba842980 (tag)
tagging 1b7d73f1b689e673bc0fac3f54005db0e0a0b4ab (commit)
tagged by Richard van den Berg
on Mon Aug 2 18:57:16 2010 +0200
- Log -----------------------------------------------------------------
Released version 0.15-rc1
Hannes von Haugwitz (50):
Reformatted AUTHORS file
Added missing space and new line to error message
Added missing '-' to separator line in the report
Added missing entry for aide 0.14.1 in NEWS file
NEWS: added UNRELEASED section
Replaced 'File' by 'Entry' in database warnings
Reformatted "Entry ... has different attributes" warnings
Replaced another 'file' by 'entry'
Added missing description for '|' in aide.conf (5)
Report correct file type
Fixed strcpy issue on multi-core environments
Replaced 'Permissions' by 'Perm' to fit 9 columns
Fit detailed output in 80 columns
Another fix for the changed permissions are always reported issue
Added UNRELEASED section to NEWS file
Fixed handling of size and growing size bits
Adjusted 'permissions are always needed' comment
Added file type change detection support
Use DB_ATTR_TYPE for ignorelist and forced_attrs
Documented ftype in manual.html
Adjusted old database warning message
Always add permissions attribute to database
Added AIDEVERSION to report
Fixed documentation of ftype attribute
Added ext2 file attributes support
autogen.sh: adjusted prompt for ./configure & make
Removed obsolete .cvsignore files
src/conf_yacc.y: added TFTYPE token
d/aide.conf.in: documented ftype and e2fsattrs
Always save the inode to database
Made length of summary string dynamic
doc/aide.conf.5.in: fixed typo
s/compare_db.c: dynamic string length for +/-
Fixed report_attributes for string and long values
s/compare_db.c: Replaced 'E2fsAttrs' by 'E2FSAttrs'
Fixed report_attributes for checksum values
Fixed report_attributes for Lname and SELinux
src/compare_db.c: Fixed missing if issue
Fixed report_attributes for ACL
Fixed indent of ACL output
Fixed report_attributes for XAttrs
Fixed indent of XAttrs output
Sort files in report by filename
Added new grouped option
Fixed sorting of files in report by filename
ChangeLog: Reformatted last changelog entry
Added ftype and e2fsattrs to the default groups
doc/: updated documentation of the default groups
compare_db.c: removed obsolete compare_db function
ChangeLog: recorded 01928be and b4c4fa4
Mike Markley (19):
Fixes for improper modifications of va_list
Apply patch from mschwendt to bring getopt_long up-to-date (tracker #801853)
Applied patch for db_gzin/db_gznew initialization from bug#848664
Bring autoconf stuff up-to-date with moden versions
Add autom4te.cache
Change order of includes so that our local include dir *always* takes precedence. This fixes the problem with berkeley db's db.h conflicting with ours (at least, in most circumstances).
Oops, AC_CHECK_TYPES needs commas separating args, not spaces
Obsoleted w/new autoconf
Generate prefix from .in
Move ylwrap to toplevel dir as per new requirements for its location
Adding config.h.in
Stop overriding user variables (CFLAGS, LDFLAGS, YFLAGS) and use builtin AM_ ones instead
Bump required versions for autogen.sh
Generate prefix from .in
-V0 should probably produce no unnecessary output (such as informational messages)
Let's go with -V20 as the threshold where the extra output starts, since it's the default.
Modified debug levels. Level 5 is still default and still produces the same output as before, but most of what used to be displayed at 5+ has been moved down to 2-4. 4 is only slightly less verbose than 5 (< 5 means we don't print headers or any other "pretty" type output); 3 is parsing problems in the config or the db that shouldn't happen, mostly, and 2 is the last level that the extended output for mismatches shows up (added:/changed:/removed: lines). -V0 is still completely quiet.
Minor spelling fixes
Apply fix for 1004937
Pablo Virolainen (4):
autogen.sh cleanup.
Added missing parentheses to report_tree
Fixed silence when file are added or removed (bug introduced with ANF/ARF)
Fix posix_fadvise configure.in checking
Rami Lehti (6):
Initial revision
added comment to ustat handling
updated TODO list
updated something
Made backslash handling more elegant. Removed FIXME.
Fixed autoconf stuff so that it compiles again
Richard van den Berg (327):
Removed several semi-colons
Maximized use of gzip compression
Added text about autogen.sh
Added maintainers
Reflects current events
Reflecting move to sf.net
Added 0.10 info
Added -l flag to flex to avoid problems with flex 2.5.31
Updated version number
Initial version
Minor bug
Use "cvs export" instead
Added patch and suggestions from patch 801860 by Michael Schwendt (mschwendt)
Applied patch 803001 "Fix for some memory leaks"
Closed bug 801860
Applied patch 849857 (cosmetic report fix)
Changed URLs to point to sourceforge.net
Released aide version 0.10
Fixed bug 851671 Aide-0.10 --config-check dumps core
Applied patch [ 855639 ] Updated README file
Applied patch 853842: sshaide - contributed script
Applied PSQL patch from Marc Giger <gigerstyle@...>
Set version to "Post 0.10"
Removed aide.1 and aide.1.ru since they are created by configure
Moved #endif for WITH_MHASH thanks to berkeley@...
Added check for ISO C99 complient vsnprintf
This file is created by running autogen.sh
config.h.in is created by autogen.sh
Added ISO C99 compliant snprintf for systems that do not have it
Fixed typo
Catch more cases where we should use our own snprintf
Fixed compilation under Solaris
Include aide.h so that PREFER_PORTABLE_SNPRINTF can be defined
Fixed compilation under Solaris
Use syslog() for systems that do not have vsyslog()
report_url=syslog actually is implemented
Reformatted using: indent -br -ce -brs -nbfda -npsl -ts2 -i2
Fixed file system traversing bug for systems without readdir_r
Added an extra sanity check
Fixed bug 836257: Line numbers in verbose output off by one
Fixed segfault with syntax error in config file
Added generated man pages
Fixed typo
Fixed bug 836257: Line numbers in verbose output off by one
Added generated man pages
Man pages live in doc/ (duh!)
Added note about bug in flex version 2.5.31
Changed wording as requested in bug id 836250
Changed options in paramters as requested in bug id 836254
Fixed various documentation bugs filed as sf.net
Removed part about autoconf 2.13
Removed the word "option" everywhere.
Applied fix in config parser to avoid 10000 line limit
Applied patch 1058973: Please don't add -I$(prefix)/include
Fixed bug 836253: Manual is wrong about --check command
Added notes about AIX and static mhash
Applied patch 1058973: Please don't add -I$(prefix)/include
Removed redundant READ_BLOCK_SIZE define
Removed redundant includes directories
Make sure readdir_r is POSIX compliant before we use it
Applied patch from Virolainen Pablo to give more infomation when file attributes have changed before calculating the hash
Fixed patch from Virolainen Pablo
Minor indentation added
Fixed patch from Virolainen Pablo (again)
Applied patch id 931224: Ignoring moved files
Changed wording for I group definition
Applied patch 984424: bug fix for "--check recurses when it shouldn't"
Applied patch 853842: sshaide - contributed script
Removed extra gen_tree() as suggested in patch 985632
Allow escaping of spaces in filenames (Virolainen Pablo <pablo@...>)
Allow @@{HOSTNAME} usage in aide.conf (Virolainen Pablo <pablo@...>)
Fixed bug where shrinking files with S set where not detected
Always include aide.h before any other include file
Always include aide.h before any other include file
Do not use *_lex.o files anymore
Fixed large file under Solaris
Make large file support generic (not just for Solaris)
Use unsigned long long for file sizes
Use unsigned long long only for size
We need to include stdlib.h before defining _POSIX_C_SOURCE to include strtoull() prototype on Solaris
Use configure to define type for storage of file size in aide.db
Applied fix suggested in Debian Bug #237969
Rewrote strrxtok() to deal with multiple backslashes
Correctly parse multiple backslashes in file names
strcpy already skips next character
Fixed sshaide.sh as suggested in bug #1100740
Removed db_writeacl() from db_disk.c as suggested in bug #1143889
Set st_rdev to 0 when not used as suggested in bug #1169697
Add DB_ATTR to correct error reporting in do_md.c
Added long long support for portable snprintf
Use fwrite to be more compatible with gzwrite
Use right format if long long is not available
Use correct format if long long is available
Use AIDE_OFF_TYPE instead of AIDE_SIZE_TYPE
Test AIDE_OFF_TYPE instead of 64 bit file io
Changed ./ to /usr/local/etc as suggested in bug id 1103719
Created aide.conf.5.in and aide.conf.5.ru.in as per bug #1103719
Use correct type for size
Applied aide.1.in patch from SF bug #1217483
Applied another aide.1.in from Sven Hoexter <sven@...>
Removed return in conf_lex.l that caused --after to be ignored
Reset fs.st_rdev in 2 additional places as per bug #1253822
Open files with O_NOATIME on Linux
Fix exit() for HAVE_O_NOATIME
Added patch for cygwin compatibility as per bug #1279818
Print detailed error message when mmap() returns MAP_FAILED
Released aide 0.11-rc1
Merge offsite prepared comments
Compile aide as a static executable
Fixed some spelling errors
Changed version to Post 0.11-rc1
Ignore special characters after backslash in directory names
If open() with NO_ATIME fails, try open() again without it
We now use a newer autoconf system
Applied path 1124758: fix underquoted m4
Applied patch 1124757: dist-hook missing file snprintf.h
Applied patch 1124760: cleaner automake initialisation
Applied patch 1124782: gettextize related patch
Quote aide version
Applied patch from Debian bug #121717: aide spelling fixes
Print start and stop timestamp together
Print database_out path with -i and -u
Added bzip2.sh
Check for ino64_t and dirent64 separately
Needs bash, Solaris sh will not work
Ignore 'c' when 'I' is in effect
Warn if 'I' and 'c' are used together
Remove russian translations
Update maintainer
Make dist fails on rm without -f
Do not stop parsing directory at unescaped .
Fix "make dist" and "make check"
Ignore aide.conf.5
Release version 0.11-rc2
Added gpg scripts to contrib
Simplify "make dist"
Remove conf_yacc.h from distribution
Applied 'allow new files' patch
Applied 'allow new files' patch
Applied fix to ANF
Applied 'allow removed files' patch
Improve libmhash error message
Log tree matching verbosely
Revert check_list_for_match to old behaviour
Documentation update
Allow report_url to change syslog facility
Only warn when DB_CHECKINODE and DB_CTIME are used together
Added GPG scripts by Vincent Danen <vdanen@...>
Fix layout of aide.conf.5
Cleanup --help output
Add separators in --check output
Fix typo
Add --disable-lfs option to configure
Released version 0.11-rc2
Updated for version 0.11
Changed version to post-0.11-rc3
Explicitly check for readdir64
Added note about --disable-lfs in README
Fall back to strtoimax if strtoll is not available
Protect against non existing syslog facilities
Updated aide.spec.in as suggested in SF bug #1428576
Fix the broken @@ifhost and @@ifnhost directives
Released version 0.11
Changed version to post-0.11
Set AIDEVERSION right after including config.h
Added note about SIGTERM
Use @sysconfdir@ as directory in aide.1
Mordernize use of AM_INIT_AUTOMAKE
Use AIDEVERSION to avoid clash with VERSION of other packages
Applied manual patch from Marc Haber
Added note about problems with mhash 0.9.x
Use system strnstr when available
Add --disable-static flag to configure
Allow aide.db to be supplied on stdin
Allow http/https/ftp URLs through libcurl
Show WITH_CURL in AIDECOMPILEOPTIONS
Debug code should use error()
Add spaces to error messages (Marc Haber)
Don't warn about rules referring to non-existent directories by default
Abort if aide.db does not have checksum when FORCEDBMD is used
Explain aide.conf and aide.db signing
Minor cleanups
Fix mmap on HPUX
Fix seg faults on OpenBSD
Added support for posix_fadvice()
Fix stat type in report_tree()
Remove the use of NODE_ADD_CHILDREN, hopefully it is no longer needed
Added syntax changed from 10-manpages.dpatch
Added newlines as per SF bug #1461182
Added report_attributes group (Pablo Virolainen)
Regenerate configure when version.m4 changes
Added report_attributes group
Released version 0.12-rc1
Bump version to post-0.12-rc1
Fixed filesize stored in postgres
Don't exit() when error() fails to write twice
Do exit() when error() fails to write twice
Close database files earlier
Added note about --disable-static on Mac OS.
Released version 0.12-rc2
Released version 0.12
Changed version to post-0.12
Added file locking for output files
Added note about rpl_malloc on AIX 5.3 with mhash
Include version.m4 in distribution tar file
No need for absolute $(srcdir) in configure
Use AC_CONFIG_FILES(files..) instead of AC_OUTPUT(files..)
Removed redundant targets from Makefile.am
Added "Add xattr support" patch from Steve Grubb <sgrubb@...>
Added "report miscompares to Linux Audit System" patch from Steve Grubb
Added "Allow building without mhash library" patch from James Antill
Added "correct db_names" patch from Steve Grubb <sgrubb@...>
Added "memory leaks and performance updates" patch from Steve Grubb
Added "deadcode removal" patch from Steve Grubb <sgrubb@...>
Added "change K&R functions to void functions" patch from Steve Grubb
Added "Memleak fix for ACLs, SELinux, XAttr" patch from James Antill
Allow compilation when WITH_SELINUX is not defined
Fix --with-selinux on debian
Add --with-xattr to configure
Make --with-selinux work without pkg-config
Clean up pkg-config usage by Michael Schwendt <mschwendt@...>
Fix syslog URLs (Yves Mettier <ymettier@...>)
Remove stpcpy declaration because it is not defined in util.c
Aide requires at least mhash version 0.9.7.
Fix segfault when line->cntx is NULL
Add --without-mhash to configure
Don't use DB_SELINUX and DB_XATTR when not present
Fix use of libgcrypt
Add INITIALERRORSTO to "compiled with" message
Add new group 'l' to detect changed link name
Add linkname to L and >
Update documentation with new groups
Minor changes
Supply strnlen in utils.c
Revert parse_url() behaviour to before libcurl patch
Fix tabs
Fix typo
Released version 0.13-rc1
Get ready for 0.13 release
Added note about cross compiling as per SF bug 1589115
Fix some aide/Aide/AIDE inconsistencies per SF bug 1569825
Fix error message about HAVAL and CRC32 with --update and gcrypt
Whirlpool is defined in mhash >= 0.9.2
Fix --with and --without logic of configure
Clear LIBS after gpg-error check
Make --without switches of configure work
Released version 0.13-rc2
Added file locking for output files
Redhat -> Red Hat
Changed version to post-0.13-rc2
Check for WHIRLPOOL so old mhash can be used (Pablo Virolainen)
Set meaningful exitcodes when --check is used
Released version 0.13
Changed version to post-0.13
Changed version to 0.13
Removed ustat dead code
Fix typo
Work around for error while reading gzipped aide.db files
Use lseek() instead of fseek() on aide.db
Released version 0.13.1
Changed version to post-0.13.1
Do not warn about files not being directories
Do not use optional components in "make check"
Use absolute path in srcdir for "make check"
Use abs_top_srcdir instead
Use abs_top_srcdir instead
Only use optional groups in "make check" when enabled
Prevent segfaults in db_write_byte_base64, patch from James Antill
Fix aide.spec, patch by George Hansper <georgeh@...>
Quit autogen.sh if required tools are not found
Display complete selinux context
Turn CR/LF into LF
Fix equals matches, patch by Brian De Wolf <bldewolf@...>
Prelink patch by Peter Vrabec <pvrabec@...>
Require aclocal and automake >= 1.10
Added new option to summarize changes in output file
Fixed wrong char array size
Add b: block count
Added autoconf patch from Steve Grubb <sgrubb@...>
Removed AM_PROG_LIBTOOL from configure.in
Added autoconf patch from Steve Grubb <sgrubb@...>
Fix several warnings
Check LD in configure
Fix xattrs typos
Reworked summarize_changes option
Drop old flex files
Adjust building of fopen.c
Fix error handling for prelink
Fix checksums letter
Always save the permission to database
Fix line->attr&DB_LINKNAME is always true issue
Remove localignorelist for changed nodes
Disable DB_ACL bit if acls are not supported
Replaced snprintf.c with the version from rsync-2.6.9
Released version 0.14-rc1
Changed version to post-0.14-rc1
Show -D in --help
Refix line->attr&DB_LINKNAME is always true issue
Re-enable large file support on 32 bit systems
Additional checks for snprintf.c
Fix off64_t and other size warnings
Correct linker settings
Released version 0.14-rc2
Fix xattrs and selinux bits
Released version 0.14-rc3
Changed version to post-0.14-rc3
Fixed some AC_ARG_WITH magic
Define ENOATTR if needed
Released version 0.14
Changed version to post-0.14
Do not use += in configure, fixes bug 2972100
Change gzdopen() from wb+ to wb, fixes bug 2976146
Do not strcat into uninitialized data, fixes bug 2919946
Add missing db_sql prototypes, and Sun Studio compatibility
Initialize gcrypt properly, fixes bug 2763470
Use DB_ATTR_TYPE for compare_dbline()
Use exit() instead of abort()
Fixed changed permissions are always reported issue
Support spaces and other characters in file paths in config
Added aide-attributes.sh script
Added Steve and Hannes
Added aide-attributes.sh script
Released version 0.14.1
Changed version to post-0.14.1
Released version 0.14.2
Changed version to post-0.14.2
Released version 0.15-rc1
-----------------------------------------------------------------------
hooks/post-receive
--
aide
|
http://sourceforge.net/p/aide/mailman/aide-commits/thread/E1OfyKL-00016K-EP@sfp-scmshell-4.v30.ch3.sourceforge.com/
|
CC-MAIN-2015-22
|
refinedweb
| 2,889
| 62.88
|
Lazy evaluation for Python.
Project description
Lazy evaluation for Python.
Usage
To use yzal:
from yzal import lazy, strict @lazy def add(x, y): sum = x + y print('Adding {:d} + {:d} = {:d}', x, y, sum)
The following only creates a Thunk, it does not run the lazy function above.
>>> sum = add(3, 7)
There are two ways to get the result of the lazy evaluation. The first is simply to perform an operation that requires a strict value.
>>> 5 + sum Adding 3 + 7 = 10 15
The second way is to explicitly request a strict value.
>>> sum = add(3, 7) >>> strict(sum) Adding 3 + 7 = 10 10
Note
If we did not recreate the Thunk the side effect string would not have displayed again. This is because Thunk’s will only evaluate the lazy expression they contain once. Further requests for a strict value will return a cached result. It is important to remember this when the lazy function is not pure.
Requirements
- Python 3.5 or greater
- lazy_object_proxy
Thanks
We wish to thank the following projects, without which yzal would have been much harder to write:
- lazy_object_proxy - A fast and thorough lazy object proxy.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|
https://pypi.org/project/yzal/0.0.1/
|
CC-MAIN-2019-51
|
refinedweb
| 217
| 73.27
|
Components and supplies
Apps and online services
About this project
MKR1000 is a powerful board that combines the functionality of the Zero.
Follow these steps to get started with this example:
1. Wire up the Arduino MKR1000 board.).
Code
arduinowifi.inoArduino
/* Arduino WiFi Script Server Created October 20, 2013 Mikael Kindborg, Evothings AB TCP socket server that accept commands for basic scripting of the Arduino board. This example is written for a network using WPA encryption. For WEP or WPA, change the Wifi.begin() call accordingly. The API consists of the requests listed below. Requests and responses end with a new line. The input parameter n is a pin number ranging from 2 to 9. The response is always a 4-character string with a hex encoded number ranging from 0 to FFFF. Possible response string values: H (result from digital read) L (result from digital read) 0 to 1023 - Analog value (result from analog read) Set pin mode to OUTPUT for pin n: On Response: None Example: O5 Note: O is upper case letter o, not digit zero (0). Set pin mode to INPUT for pin n: In Response: None Example: I5 Write LOW to pin n: Ln Response: None Example: L5 Write HIGH to pin n: Hn Response: None Example: H5 READ pin n: Rn Response: "H" (HIGH) or "L" (LOW) Example: R5 -> H ANALOG read pin n: An Response: int value as string (range "0" to "1023") Example: A5 -> 42 */ // Include files. #include <SPI.h> #include <WiFi101.h> // Your network SSID (network name). // TODO: Enter the name of your wifi network here. char ssid[] = "wifi name"; // Your network password. // TODO: Enter the password of your wifi network here. char pass[] = "wifi password"; // Your network key Index number (needed only for WEP). int keyIndex = 0; // Server status flag. int status = WL_IDLE_STATUS; // Create WiFi server listening on the given port. WiFiServer server(3300); void setup() { // Start serial communication with the given baud rate. // NOTE: Remember to set the baud rate in the Serial // monitor to the same value. Serial.begin(9600); // Wait for serial port to connect. Needed for Leonardo only while (!Serial) { ; } // Check for the presence of the WiFi shield. if (WiFi.status() == WL_NO_SHIELD) { // If no shield, print message and exit setup. Serial.println("WiFi shield not present"); status = WL_NO_SHIELD; return; } // Connect to Wifi network. while (status != WL_CONNECTED) { Serial.print("Connecting to Network named: "); Serial.println(ssid); // Connect to WPA/WPA2 network. Update this line if // using open or WEP network. status = WiFi.begin(ssid, pass); // wait 10 seconds for connection: delay(10000); } // Start the server. server.begin(); // Print WiFi status. printWifiStatus(); } void loop() { // Check that we are connected. if (status != WL_CONNECTED) { return; } // Listen for incoming client requests. WiFiClient client = server.available(); if (!client) { return; } Serial.println("Client connected"); String request = readRequest(&client); executeRequest(&client, &request); // Close the connection. //client.stop(); Serial.println("Client disonnected"); } // Read the request line. The string from the JavaScript client ends with a newline. String readRequest(WiFiClient* client) { String request = ""; // Loop while the client is connected. while (client->connected()) { // Read available bytes. while (client->available()) { // Read a byte. char c = client->read(); // Print the value (for debugging). Serial.write(c); // Exit loop if end of line. if ('\n' == c) { return request; } // Add byte to request line. request += c; } } return request; } void executeRequest(WiFiClient* client, String* request) { char command = readCommand(request); int n = readParam(request); if ('O' == command) { pinMode(n, OUTPUT); } else if ('I' == command) { pinMode(n, INPUT); } else if ('L' == command) { digitalWrite(n, LOW); } else if ('H' == command) { digitalWrite(n, HIGH); } else if ('R' == command) { sendResponse(client, String(digitalRead(n))); } else if ('A' == command) { sendResponse(client, String(analogRead(n))); } } // Read the command from the request string. char readCommand(String* request) { String commandString = request->substring(0, 1); return commandString.charAt(0); } // Read the parameter from the request string. int readParam(String* request) { // This handles a hex digit 0 to F (0 to 15). char buffer[2]; buffer[0] = request->charAt(1); buffer[1] = 0; return (int) strtol(buffer, NULL, 16); } void sendResponse(WiFiClient* client, String response) { // Send response to client. client->println(response); // Debug print. Serial.println("sendResponse:"); Serial.println(response); } void printWifiStatus() { Serial.println("WiFi status"); // Print network name. Serial.print(" SSID: "); Serial.println(WiFi.SSID()); // Print WiFi shield IP address. IPAddress ip = WiFi.localIP(); Serial.print(" IP Address: "); Serial.println(ip); // Print the signal strength. long rssi = WiFi.RSSI(); Serial.print(" Signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); }
Schematics
Author
Chandana Pathirage
- 2 projects
- 11 followers
Published onApril 13, 2016
Members who respect this project
you might like
|
https://create.arduino.cc/projecthub/cpathirage/create-mobile-apps-for-android-and-ios-connecting-to-the-mkr-692f00
|
CC-MAIN-2021-17
|
refinedweb
| 758
| 60.41
|
Suppose there are n bikes and each can cover 100 km when they are fully fueled. We have to find the maximum amount of distance we can go using these n bikes. Here we can assume that all bikes are similar and a bike consumes 1 litre of fuel to cover 1 km distance. So, if n bikes start from same point and run parallel, we can go only 100 km, in this case our target is to cover maximum distance, with minimum fuel. And minimum wastage of fuel means minimum number of bikes used. If the bikes run serially, then helps to cover more distance. So, we transfer some amount of fuel from last bike to another bike and don’t run the last bike after certain point. But now the problem is what distance the fuel transfer has to be performed such that the maximum distance is covered and fuel tank of rest of the bikes do not overflow.
So, if the input is like n = 3 and fuel = 100, then the output will be 183.33
To solve this, we will follow these steps −
covered_diatance := 0
while n > 0 is non-zero, do
covered_diatance := covered_diatance + (fuel / n)
n := n - 1
return covered_diatance
Let us see the following implementation to get better understanding −
def maximum_distance(n, fuel): covered_diatance = 0 while (n > 0): covered_diatance = covered_diatance + (fuel / n) n = n - 1 return covered_diatance n = 3 fuel = 100 print(maximum_distance(n, fuel))
3, 100
183.33333333333334
|
https://www.tutorialspoint.com/find-the-maximum-distance-covered-using-n-bikes-in-python
|
CC-MAIN-2021-21
|
refinedweb
| 245
| 55.78
|
>
How do I make a real time clock in my game so that the player can see it? Would I do it like so:
var dt = Date();
private var textMesh : TextMesh;
var day = dt.Now.Day.ToString();
var month = dt.Now.Month.ToString();
var year = dt.Now.Year.ToString();
var hours = dt.Now.Hour.ToString();
var minutes = dt.Now.Minute.ToString();
if (parseInt(minutes) < 10) minutes = "0" + minutes;
var seconds = dt.Now.Second.ToString();
if(parseInt(seconds) < 10) seconds = "0" + seconds;
function Start () {
textMesh = GameObject.Find ("Timer").GetComponent(GUIText);
textMesh.text = hours.ToString();
textMesh.text = minutes.ToString();
textMesh.text = seconds.ToString();
}
And how do I have it the the time (and date) gets updated?
Answer by Bunny83
·
Jun 27, 2011 at 12:27 AM
It's way simpler ;). btw you assign hours, minutes and seconds to the same textmesh so you override the others and only the seconds will show up.
Like Ashkan said a coroutine would be the best since the time needs only an updated per sec. It's better to update at least 2 times a sec. to avoid synchronisation interferences.
function Updatetime()
{
while(true)
{
var today = System.DateTime.Now;
textMesh.text = today.ToString("yyyy-MM-dd_HH:mm:ss");
yield WaitForSeconds(0.2f);
}
}
function Start()
{
Updatetime();
}
I don't know what format you want but you can change the format string as you like ;) Take a look at the this page.
This is the more efficient answer. Always be careful not to do things every frame when a much less frequent update will suffice.
If the clock only needed to update every minute, the WaitForSeconds time could be set to just a little over the time remaining until the next munite ticks over, for example.
i told to do this in my answer too. the problem of this ocde is that the variable can be defined outside the function to prevent deleting and creating it once per call.
Yes, but it first says to do something expensive in the Update() function. Feel free to edit your answer for more clarity, it's a collaboration, not a competition.
surely man! i just wanted to mention and nothing more. i think having both there is good because still many novices are afraid of coroutines and don't know how to use them.
Answer by Ashkan_gc
·
Jun 26, 2011 at 05:36 PM
just update the text of textMeshes or any other text element that you want to show your date/time in in Update
use something like this in your Update
function Update ()
{
textMesh.text = td.Now.Minutes.ToString();
}
i did not checked for minutes less than 0 but you can and should do it to display 09 instead of 9 as you did yourself in declarations.
now you are using only a textmesh and rewriting it's value 3 times show it will show the seconds. use dt.Time.ToString() to get the complete time in Update or use += for minutes and seconds to concatinate strings instead of replacing them. keep in mind that these string processings are time and memory consumming so doing it in a coroutine instead of Update (for example 5 times a second) can help much. after all the time will not change 70 times a second. so the same hh:mm:ss will be computed and displayed.
function UpdateTime()
{
while(true)
{
//calculate times and update strings
yield WaitForSeconds(0.2f); //5 times a second
}
}
and start this UpdateTime in Start/Awake.
Answer by jimrota
·
Feb 21, 2016 at 10:41 PM
I ended up doing this for the new UI system (have to add using UnityEngine.UI namespace)
public Text textDate; //had to attach a UIText component to this
//then in some script
IEnumerator UpdateTime() {
while(true)
{
var today = System.DateTime.Now;
textDate.text = today.ToString("yyyy:MM:dd @ HH:mm:ss");
yield return new WaitForSeconds(0.2f);
}
}
And then call StartCoroutine(UpdateTime()) from the Start()
Not sure if I need the while(true) clause, but.
Textmesh on canvas not showing up
1
Answer
Blurry text with TextMeshPro
0
Answers
New Update Text Issue
0
Answers
Single Step (pause, resume), or externally clock game loop
0
Answers
Unity Crashing on Play after updating to 2018.2.1f1
0
Answers
|
https://answers.unity.com/questions/135492/realtime-clock.html
|
CC-MAIN-2019-26
|
refinedweb
| 706
| 72.97
|
The infra.git repo uses python wheel files, virtualenv and pip to manage dependencies. The process for bootstrapping these is contained entirely within bootstrap/ directory.
See dockerbuild for a tool that tries to make a lot of this easier. If you use dockerbuild to build a wheel for bootstrap, you will need to upload it manually to the wheelhouse. (TODO: We should enable Dockerbuild to upload to wheelhouse too.) Check the
.dockerbuild/wheels directory for the local wheel.
Just run:
gclient sync # OR gclient runhooks
Say we want to add a stock my_pkg python package at version 1.2.3:
If it comes from a tarball:
$ ./bootstrap/ingest_source.py <tarball> ... deadbeefdeadbeefdeadbeefdeadbeef.tar.gz
If it comes from a repo, file a ticket to have it mirrored (no matter what VCS!) to
chromium.googlesource.com/external/<repo_url>
Grab the git commit hash of the commit to build: badc0ffeebadc0ffeebadc0ffeebadc0
Then add the actual dep:
$ edit bootstrap/deps.pyl # add a new entry (see the 'deps.pyl' section) ... 'my_pkg' : { 'version': '1.2.3', 'build': 0, # This is the first build 'gs': 'deadbeefdeadbeefdeadbeefdeadbeef.tar.gz', # if tarball 'rev': 'badc0ffeebadc0ffeebadc0ffeebadc0', # if repo } ...
Then build it:
$ ./bootstrap/build_deps.py --upload # builds and uploads my_pkg-1.2.3-0_deadbeef...-....whl to google storage
build_deps.pyfor each platform.
gclient syncfails with
__main__.NoWheelException: No matching wheel found for. See for more details), then you have to run
build_deps.pyto rebuild the missing packages. See also ‘rolling deps’ below. If you don’t have permission to upload the generated packages to Cloud Storage (e.g. if you're not a Googler), then drop the
--uploadoption and all packages will be stored locally only.
Do everything in the Adding a new dep section, but before running
build_deps.py, add a file
custom_builds/{wheel package name}.py. This file is expected to implement:
def Build(source_path, wheelhouse_path)
See custom builds below for more detail.
Run
gclient runhooks. Under the hood, this runs:
./bootstrap/bootstrap.py --deps_file bootstrap/deps.pyl ENV
This creates a virtualenv called
{repo_root}/ENV with all the deps contained in
bootstrap/deps.pyl. You must be online, or must already have the wheels for your system in cache.
If you already have an
ENV directory, bootstrap.py will check the manifest in
ENV to see if it matches deps.pyl (i.e. the diff is zero). If it's not, then
ENV directory will be re-created from scratch.
run.py will automatically use the environment
ENV. It is an error to use
run.py without first setting up
ENV.
This file is a python dictionary containing the exact versions of all Python module dependencies. These versions are the standard upstream package versions (e.g. ‘0.8.0’), plus the commit hash or sha1.{ext} of an ingested source bundle.
The format of this file is
{'package_name': <values>}. This file is a Python ast literal, so comments are allowed and encouraged.
Note that the
package_name key is the pip-reported name (the one set in
setup.py). It may be different from the name used for import, and for the wheel.
Values are:
And either:
rev: The revision or sha1 of the source for this module. The repo is
git+{package_name}
gs:
{sha1}.{ext}indicates file
gs://chrome-python-wheelhouse/sources/{sha1}.{ext}. The sha1 will be checked against the content of the file.
And optionally:
implicit: A boolean indicating that this dep should only be installed as a dependency of some other dep. For example, you want package A, which depends on package Z, but you don't really care about Z. You should mark Z as
implicitto allow it to be pinned correctly, but not to deliberately install it.
Some python modules don't have functional python repos (i.e. ones that pip can natively clone+build), and thus ship their source in tarballs. To ingest such a tarball into the infra google storage bucket, use
ingest_source.py /path/to/archive. This will print the value for the ‘gs’ key for a deps.pyl entry.
Any time a new dependency/version is introduced into
deps.pyl, you must run
build_deps.py --upload. If the dependency is a pure-Python dependency (i.e. no compiled extensions), you only need to run it once on CPython 2.7. You can tell that it's a pure python module by looking at the name of the wheel file. For example:
requests-2.3.0-py2.py3-none-any.whl
Is compatible with Python 2 and Python 3 (py2.py3) any python ABI (none), and any OS platform (any).
Running build_deps.py will only attempt to build dependencies which are missing for the current platform.
If the module does contain compiled extensions, you must run build_deps.py on the following systems (all with CPython 2.7):
x86_64
x86_64
x86_64
TODO(iannucci): Add job to build wheels on all appropriate systems.
Once a wheel is sucessfully built, it is uploaded to
gs://chrome-python-wheelhouse/wheels if it is not there already.
Only Googlers have access to that bucket. Make sure to run the following command to authenticate first:
depot_tools/third_party/gsutil/gsutil config
build_deps.py assumes that it can find
gsutil on
PATH, so go ahead and install it appropriately for whichever platform you're on.
Sometimes building a wheel is a bit trickier than
pip wheel {repo}@{hash}. In order to support this, add a script named
custom_builds/{name}.py. This module should have a function defined like:
def Build(source_path, wheelhouse_path)
Where
source_path is a string path to the checked-out / unpacked source code, and
wheelhouse_path is a string path where
build_deps.py expects to find a
.whl file after Build completes.
Note that your Build function will actually need to invoke pip manually. Currently you can get the path for pip by doing:
os.path.join(sys.prefix, 'bin', 'pip'), and you can invoke it with subprocess (example).
Since wheel is a package needed to build the wheels, it has a slightly different treatment. To roll a wheel, bump the version in deps.pyl, and then run
bootstrap_wheel_wheel.sh to build and upload the wheel for
wheel pinned at the version in
deps.pyl.
Once you do that,
build_deps.py will continue working as expected.
TODO(iannucci): actually implement this
Windows builds require a slightly more care when building, due to the complexities of getting a compile environment. To this effect,
build_deps.py relies on the
depot_tools/win_toolchain functionality to get a hermetic windows compiler toolchain. This should not be an issue for chromium devs working on windows, since they should already have this installed by compiling chromium, but it's something to be aware of.
If it is necessary to roll a patched version of a library, we should branch it in the infra googlesource mirror. This branch should be named
{version}-cr, and will build packages whose version is
{version}.{cr_version} (e.g. modify
setup.py on this branch to add an additional component to the version field).
For example, given the package
jane at version
2.1.3, we would create a branch
2.1.3-cr. On this branch we would commit any changes necessary to
2.1.3, and would adjust the version number in the builds to be e.g.
2.1.3.0.
A builder is failing with NoWheelException, but you feel strongly that the entry in deps.pyl matches what is in the wheelhouse.
One thing that might be happening is that pip doesn't think that wheel, based on its filename, is supported for that platform. You might log on to that bot and start a python interpreter:
>>> import pip >>> pip.pep425tags.supported_tags
will list all of the supported tags for that platform. What to do next depends on your particular situation, but hopefully this information is helpful for giving you ideas.
|
https://chromium.googlesource.com/infra/infra/+/c1d4b8abee2664be7539920566f01de190ba96e1/bootstrap
|
CC-MAIN-2019-30
|
refinedweb
| 1,304
| 68.77
|
- Explore
- Create
- Tracks
As we know, Hadoop 3.x support more than 2 namenode or more than 1 standby namenode now.
So if ambari which is 2.7.1.0 now support this feature or not?
Answer by Jonathan Sneep ·
Hi @owen chaos
As Jay mentioned, this is supported in Ambari 2.7 with HDP 3
Have a look at the following document, from page 34 onwards,
The HDFS NameNode High Availability feature enables you to run redundant NameNodes in the same cluster in an Active/Passive configuration with a hot standby. This eliminates the NameNode as a potential single point of failure (SPOF) in an HDFS cluster. As of Hadoop 3.0, you can configure more than one backup NameNode. ....
mainly, this is where you setup multiple NN's in ambari 2.7 with hdp3;
<property> <name>dfs.ha.namenodes.mycluster</name> <value>nn1,nn2,nn3</value> <description>Unique identifiers for each NameNode in the nameservice</description> </property><br>
Also, note; the minimum number of NameNodes for HA is two, but you can configure more. You should not exceed five NameNodes due to communication overhead. Three NameNodes are recommended.
Thank you very much.
But something still not clear, which is how I setup the third Namenode in Ambari 2.7.
I already update hdfs-site.xml with a nn3 config, and restart HDFS which functionally normal without the third Namenode.
If we should create the the third Namenode by Ambari API, as I found no place or button in Ambari GUI.
Answer by Jay Kumar SenSharma ·
Ambari 2.7 provides support for NameNode Federation:
An HDFS federation allows you to scale a cluster horizontally by configuring multiple namespaces and NameNodes. The DataNodes in the cluster are available as a common block of storage for every NameNode in the federation.
.
Also Ambari 2.7.0 Release Notes "New Features" (HDFS: NameNode Federation) section talks about this:
Thank you for your reply.
More than one standby NameNode means we can tolerant more than two namenode failure.
As we have only two namenode in Hadoop 2.x, the cluster will go down once the active and standby namenode went down.
And we can have one Active NameNode and 2 or 4 Standby NameNode in Hadoop3 which can provide a better high availability.
So I'am asking if Ambari could support this feature.
Answer by ChanHyuk Park ·
I also wanna know how to make third namenode
I need.
|
https://community.hortonworks.com/questions/214997/ambari-support-more-than-one-standby-namenode-or-n.html
|
CC-MAIN-2019-30
|
refinedweb
| 405
| 58.79
|
So I've been busy publishing map services from an "old" standalone ArcGIS Server environment to Portal/Federated ArcGIS Server. Which means you create a map services and Portal creates a corresponding item. In the process, I've had to undo and clean up a few things. It's easy to wipe out map services with Python:
from arcgis import gis
mygis = gis.GIS(url, username='arcgis_python')
gis_servers = gisprod.admin.servers.list()
server1 = gis_servers[0]
rest_folder = '<your_REST_endpoint_folder>'
map_services = server1.services.list(rest_folder)
for service in map_services:
try:
service.delete()
except Exception as e:
print(e.message)
Alternatively, of course, you could simply select the services in ArcCatalog and delete them, if you're so inclined. But the script is convenient, when you have a list of services to remove.
But now what happens is that the service gets removed but the Portal item representing the services does not. Which results in a broken item. This happens even if the item is protected.
The proper way to clean things up would be by removing the Portal item, which takes the map services with it.
item = gisprod.content.get('7db0bc4128eb4d819794815e4654a358')
item.delete(0)
However, if the map services is gone, is there a way to link that item back to the service?
If I publish the map service again, this creates a new item with a new item Id. The old one doesn't show up more.
Also, for map services that show up as Portal items, what is the server id, when I interrogate dependencies:
item.dependent_upon()
{'total': 1,
'start': 1,
'num': 1,
'nextStart': -1,
'list': [{'dependencyType': 'serverId', 'id': 'FK7U7Hisd6qRFdPK'}]}
What's the code 'FK7U7Hisd6qRFdPK' reference?
|
https://community.esri.com/thread/230917-arcgis-server-map-services-portal-item-relationship-fix-broken-link
|
CC-MAIN-2019-30
|
refinedweb
| 275
| 66.64
|
*
Command Line compiling
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
posted
Mar 01, 2006 21:56:00
0
In a couple of days I have to take this silly programming
test
to advance to senior status in my computer science program. We have to compile on the command line and am getting weird compile errors with a practice exam written over a year ago. The strange thing is it compiles fine(minus a few genrics related warnings)with eclipse), but I cannot use that in the test.
What is happening is the compiler can not find certain classes/interfaces that are pre-written. It works with 1.4 but not 1.5, and I have to use 1.5 for the test.
Here is the Node class, and List interface. When compiled seperately, there are no errors/warnings.
public interface List { /** Checks for an empty list */ public boolean isEmpty(); /** Attempts to find and delete a single instance of the item passed in. If it fails to do so, false is returned (true is returned if deletion is successful) */ public boolean delete(Comparable itemToDelete); /** Inserts the item passed as a parameter */ public void add(Comparable itemToAdd); /** Deletes all items in the list - creates an empty list */ public void deleteAll(); /** Prints the list in forward order */ public void print(); /** Prints the list in reverse order */ public void printReverse(); /**Sort the list of Comparables into ascending order*/ public void sort(); /**Sort the list of Comparables into descending order*/ public void sortReverse(); }
public class Node { private Comparable item; private Node next; /* delete from this point down */ public Node(Comparable newItem) { item = newItem; next = null; } // end constructor public Node(Comparable newItem, Node nextNode) { item = newItem; next = nextNode; } // end constructor public void setItem(Comparable newItem) { item = newItem; } // end setItem public Comparable getItem() { return item; } // end getItem public void setNext(Node nextNode) { next = nextNode; } // end setNext public Node getNext() { return next; } // end getNext } // end class Node
Here is the code for
LinkedList
, an abstract class. The errors that it generates are:
LinkedList.java:17: cannot find symbol
symbol: class List
public abstract class
LinkedList
implements List
^
LinkedList.java:19: cannot find symbol
symbol : class Node
location: class
LinkedList
protected Node head;
^
LinkedList.java:23: cannot find symbol
symbol : class Node
location: class
LinkedList
head = new Node(null, null); //dummy head node
^
LinkedList.java:46: cannot find symbol
symbol : class Node
location: class
LinkedList
Node cur, prev;
^
LinkedList.java:69: cannot find symbol
symbol : class Node
location: class
LinkedList
Node cur = head.getNext();
public abstract class LinkedList implements List { protected Node head; public LinkedList() { head = new Node(null, null); //dummy head node }//end constructor public boolean isEmpty() { return head.getNext() == null; }//end isEmpty public void deleteAll() { head.setNext(null); }//end deleteAll // This method will attempt to find and delete a single instance // of the item passed in. If it fails to do so, false is returned // (true is returned if deletion is successful) public boolean delete(Comparable itemToDelete) { if (isEmpty()) return false; else //at least one item in list { Node cur, prev; for (cur = head.getNext(), prev = head; cur != null && cur.getItem().compareTo(itemToDelete) != 0; cur = cur.getNext()) prev = cur; if (cur == null) return false; else { prev.setNext(cur.getNext()); return true; } }//end else }//end delete method public String toString() { String result = ""; if (!isEmpty()) { Node cur = head.getNext(); while (cur != null) { result += cur.getItem() + "\n"; cur = cur.getNext(); } } else result = "Empty List"; return result; }//end toString() }// end class
I realize that some of the methods are not implemented, but that is not what the errors are about. There are no packages and all .java files are in the same folder.
I even tried to create very simple classes to see if I could get those to work, but nope.
I am sure the problem is something simple, but any help will be appreciated!
[ March 01, 2006: Message edited by: Rusty Shackleford ]
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2367
posted
Mar 01, 2006 22:01:00
0
Try this.
javac -classpath . LinkedList.java
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
posted
Mar 01, 2006 22:04:00
0
Wow, thanks. I knew it was going to be something easy.
Do you know offhand what I need to do to get rid of having to use classpath?
I never had to before I started using eclipse so maybe eclipse changes a system variable?
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24166
30
I like...
posted
Mar 01, 2006 22:14:00
0
You've most likely got the CLASSPATH environment variable set, and your setting doesn't include "." (which means 'the current directory.') The default when the environment variable is unset is (effectively) just "." and nothing else.
[Jess in Action]
[AskingGoodQuestions]
subject: Command Line compiling
Similar Threads
need help with compareTo()
Reversing a doubly linked list
Generic Java - Linked List
Recursion: returning a value/not returning a value(void)
Nullpointer.. am I losing a reference in this code?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
JForum
|
Paul Wheaton
|
http://www.coderanch.com/t/402590/java/java/Command-Line-compiling
|
CC-MAIN-2014-15
|
refinedweb
| 863
| 62.88
|
Have you ever heard the comment from someone, “Boy I sure would like to get this report as a PDF on my computer in order to send it to Bob over in accounting. He doesn’t have a login for this BSP application and it’d be great to send him this data.” Well I haven’t either, OK, not exactly like it but similiar. It left me with two choices, 1, give “Bob” a login or 2, figure out how to output my report as PDF.
Being a frequent visitor to SDN I remembered reading a few things about PDF and outputing so I began my searching…
BSP Programming: Handling Of Non-HTML Documents
Generate file .doc or .pdf as from a text
Well after playing around with the information, and I mean really good information given in these posts/weblogs I realized that I still had a few questions left unanswered. Namely, “How do I get the data as OTF?”.
This lead me to post a new topic in the BSP forum called PDF output and with the help my fellow SDNers I think we’ve come up with all the info needed to enlighten those stubmling around in the dark like myself.
Special thanks go out to…
So we came down to basically 3 major possibilities for doing this.
- FM: CONVERT_OTF
- FM: CONVERT_ABAPSPOOLJOB_2_PDF
- External Tools
To get started let’s create our BSP page.
Page Layout
\
This is basically the code from Brian’s weblog with a couple of new radio options.
Page Attributes
style=”width:350px;border:thin inset;background:lightgrey;background-color:lightgrey”>\ content\ TYPE\ STRING
display_type\ TYPE\ STRING
display_url\ TYPE\ STRING
file_content\ TYPE\ XSTRING
file_length\ TYPE\ STRING
file_mime_type\ TYPE\ STRING
file_name\ TYPE\ STRING
OnInputProcessing
That there will get all of the normal stuff working that Brian describes in his weblog on dealing with NON-HTML documents.
Now let’s go into each of these 3 possibilites and see which one works best for you…
FM: CONVERT_OT
This seems to be the best possible solution; to be honest with you, I like this one. Not sure why but I do. First things first is that you have to create a SmartForm (transaction SMARTFORMS) and once you create the SmartForm just in the menu click ENVIRONMENT – FUNCTION MODULE NAME. You see once you create the SmartForm and activate it it generates a function module.
Let’s make a SmartForm
I started by calling transaction SMARTFORMS, there I gave my SmartForm a name and selected “CREATE”
Once created I started to edit the SmartForm, the first step was the Form Interface, I entered my table parameters there.
Then I defined my global variables for the table and the table structure.
Then on the Initalization tab of the Global section I was able to initialize my table.
Then simply click on your Page and you can then create a table element, which then under the data table you define your table LOOP.
Then for test purposes I simply added one cell of data and one text label to the cell, then dragged from my field list box the name of one cell to the new text box.
Once that was all complete I was able to “activate” the SmartForm and then get the function module name from the menu option.
So got your SmartForm? OK, then let’s modify our code to add in for that. Go to your OnInputProcessing Event Handler and append this to the bottom of the existing code.
OnInputProcessing
As you can see we give our now selected table of data to the SmartForm for processing and then the OTF encoded results from the SmartForm to the CONVERT_OTF FM for processing.
Did you try it? Did you get your PDF file like me?
FM: CONVERT_ABAPSPOOLJOB_2_PDF
Raja provided a nice code sample to work with for this option.
sy-spono will then contain your Spool number which you can then use with the function module CONVERT_ABAPSPOOLJOB_2_PDF with the Spool number as a parameter. This will return a table, PDF STRUCTURE TLINE, which you can then save with .pdf extension. As Raja pointed out “I havent tried this myself inside a BSP application, but i feel that it should work.”
From a logic point of view I will say that since the normal ABAP write statements don’t work directly in the BSP you would have to really think hard to figure out how to get this to work. We are now attempting to do just that and will post back with an update to the weblog if we figure it out.
Another option would be if you had the spool number first, for example from a select list or something. You would be as dynamic as with the SmartForm method but it should also work, just gotta convert your PDF table to XSTRING.
I think that should work, we will keep you posted on further developments using this method.
Here is a solution from Raja: SPOOL TO PDF
External Tools
Now there are lots of these tools out there, Eddy points out HTMLDOC. Eddy goes on to tell us that all we have to is
“The way to go is to install HTMLDOC, then make an external command. In your BSP page (with extension pdf, is needed for MIE) make you HTML and write it to temp file. Call the external command with the temp file as input. Then read the pdf and set it as content and set all response headers for pdf. Clean up the temp files. It works good and fast.
There are also JAVA and ActiveX tools out there as well. Each of you will have to decide your own strategy of course. Personally if the system can already do it then why install another component that you may have to worry about compatability issues with in the future?
Where does all this leave us?
So as you can see there are often many possiblities for problems you encounter and it is just a matter of deciding which one works best for you. In this case does it make sense to create a SmartForm for each and every item you want to print out? Perhaps if you have a Corporate Identity that you must adhere to then this could be the best way.
The “spool” seems like a great choice simply because you don’t have create a SmartForm first. In fact a clever person might just have a ABAP report that runs and creates the Spool outputs and then a BSP which lets a person select an existing Spool and then retrieve it as PDF.
External tools are always available and there are lots of them out there, however, you have to ask yourself “Do you really want to add a component that may not be compatible after the next SP or Release?”. These are problems that sometimes arise as we move into the future, whereas, an internal solution such as SmartForms or ABAPSPOOL to PDF well those I think will be supported in the future.
Please consider this weblog a work in progress as I don’t think we’ve heard the end of our efforts with ABAP Spool and I’m sure there are quite a few more possible solutions out there and I hope you’ll share yours with us as well!
What the future holds!!
From Matthias Zeller, Indeed Interactive Forms is the “next generation” forms tool in SAP (and not only for interactive, but also for print forms). It is available starting with Web AS 6.40. Smart Forms and SAPscript will be continue to be available but all new development around SAP forms will be done in the new Interactive Forms. The Adobe document services (ADS) which are part of Interactive Forms can generate different output including PDF, PS, PCL and ZPL (for Zebra Label printers).
So with Interactive Forms you will be able to generate PDF in an SAP system natively by merging forms data with a form template (so you do not need to create OTF anymore and use the CONVERT_OTF libraries to generate PDF). This can be configured in ABAP using transaction SFP or with Web Dynpro for Java to create PDF documents embedded in a Web UI (and in the future also with Web Dynpro for ABAP).
The PDFs generated with ADS are actually the latest version PDF 1.6 and can be made accessible to blind people via screen readers.
Tips:
From Jonathan Bourne,.
Without any help of SMARTFORMS from ABAP programming forum(there you go!!!).
Thanks a million for the weblog, makes it so much easier.
Regards,
Subramanian V.
(Thanks for putting me in the spotlight :P)
I struggled for a few hours on the SmartForm – ok it’s a very basic one but it did the trick for testing purposes 🙂
Just checked that this weblog of yours is posted in SDN (topic). Probably it should be in BSP.
Regards,
Subramanian V.
Regards,
Subramanian V..
Thanks again for a great article.
JB
This is an excellent post that shows the collective power of SDN.
Very nice, Mark.
I’m very familiar with getting PDF’s and Excel onto our Supplier Portal…great to see we are following the same process!! We recently put “EBP Purchase Order Display” via PDF into a BSP on the SAP Portal…GREAT to see you guys using a function module I haven’t used yet (CONVERT_ABAPSPOOLJOB_2_PDF), I’ve always used the “convert OTF” and then get that into PDF to get it to work…I must say the making a COMPLEX SmartForm is the “bottleneck” in the process…I hope SAP get SmartForms to the level of ease as creating a document using Crystal Reports (for example) one day!!
But once again great work guys!!
Lynton Grice
Lynton
Regards
Lynton
Need help with the following questions.
Hi, generates a sap script which displays the data in a SAP Script Form.
Now our problem is how do we display the form in the iView? converts the data into a pdf file.
How do we display the data in the .pdf format in the iView.
Thanks in advance
1) Is it possible to pass parameters dynamically (For eg userid of the person who has logged onto the portal) from webdynpro to a RFC? If yes, how?
Thanks in advance.
Jayesh
I was able to use your code (with minor changes) to convert mail forms to PDF. You can use FM MAIL_FUNCTION_MODULE_NAME to get the mail form function module name, and substitute that in the ‘call function’ of OnInputProcessing
Thanks, you saved me tons of work!
Brant Berg
Is the same code will work in MVC Concept????
If yes where we need to write all the code??
is it in the DO_HANDLE_EVENT or in the View page??
Expecting the reply ASAP.
Thanks,
Greetson
As for this code, yes it works fine in MVC and where you write it all depends on you and your application.
If you have specific questions take a jump over to the BSP forum, it’s a much better place for helping each other out.
Still, I’m wondering which table you use for zsystems.
data: lt_sys type table of zsystems.
I cannot find this table. Would you please tell me the origin?
And which table do you use for zsystemtab? This table is referenced within the smartform
Thank you very much for your help,
Stephan
Craig
I do the test in a 6.40 UNICODE system.
Finally, I find a code to do the conversion:
data: spool_nr type TSP01-RQIDENT,
line type tline,
l_pdf_xstring type xstring,
lt_lines type table of tline,
l_pdf_len type i.
field-symbols
type X.
…code to obtain the spool_nr…
CALL FUNCTION ‘CONVERT_ABAPSPOOLJOB_2_PDF’
EXPORTING
SRC_SPOOLID = spool_nr
NO_DIALOG = ‘ ‘
IMPORTING
PDF_BYTECOUNT = l_pdf_len
TABLES
PDF = lt_lines
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12
.
clear l_pdf_xstring.
loop at lt_lines into line.
assign line to
casting type X.
concatenate l_pdf_xstring
into l_pdf_xstring in byte mode.
endloop.
l_pdf_len = xstrlen( l_pdf_xstring ).
…code to make cached_response…
This was also on a 620 system. But you can really use any tables.
SAP Note
The following error text was processed in the system:
An exception with the type CX_SY_DYN_CALL_PARAM_MISSING occurred, but was neither handled locally, nor declared in a RAISING clause
Exception Class CX_SY_DYN_CALL_PARAM_MISSING
Error Name
Program CL_O20Q0EUR89BCFKJ1CHWU5YVP65JCP
Include CL_O20Q0EUR89BCFKJ1CHWU5YVP65JCM005
ABAP Class CL_O20Q0EUR89BCFKJ1CHWU5YVP65J
Method _ONINPUTPROCESSING
BSP Application ZANU_PDF_OUTPUT
BSP Page FIRST.HTM
Line 99
Long text The call of the function /1BCDWB/SF00000571 failed: the required parameter WA_ZDPBIR was not filled.
What is the reason and possible solution?
Regards,
Anubhav Jain.
I want to convert a smartform document into pdf in my BSP Applikation.
But when it have to convert, i got the message “Data didnt begins with ‘%pdf-‘”in the pdf reade . I dont know why???
Here is my Code from the Intialization Event:
* event handler for data retrieval
* parameters for generated function module
data: l_function_module_name type rs38l_fnam,
ls_output_options type ssfcompop,
ls_control_parameters type ssfctrlop,
ls_output_data type ssfcrescl,
l_devtype type rspoptype.
* generated result: HTML with embedded CSS
data: ls_xmloutput type ssfxmlout,
lt_html_raw type tsfixml,
l_xstring type xstring, “needed for HTTP response
l_html_xstring type xstring,
l_xlength type i.
* generated result: PDF format
data: l_pdf_xstring type xstring,
lt_lines type table of tline,
ls_line type tline,
l_pdf_len type i.
* Cookie mit Eingabewerten holen
cl_bsp_server_side_cookie=>get_server_cookie(
EXPORTING
name = ‘lt_fields’
application_namespace = ‘NONE’
application_name = ‘NONE’
username = ‘NONE’
session_id = ‘NONE’
data_name = ‘NONE’
“IMPORTING
“expiry_date = date
“expiry_time = time
CHANGING
data_value = lt_fields ).
* Cookie mit Equipmentdaten holen
cl_bsp_server_side_cookie=>get_server_cookie(
EXPORTING
name = ‘ums_equip_ges’
application_namespace = ‘NONE’
application_name = ‘NONE’
username = ‘NONE’
session_id = ‘NONE’
data_name = ‘NONE’
“IMPORTING
“expiry_date = date
“expiry_time = time
CHANGING
data_value = ums_equip ).
*———————————————————————–
* Get name of generated function module
*———————————————————————–
call function ‘SSF_FUNCTION_MODULE_NAME’
exporting formname = ‘Z_REPKOST_GES’
* variant = ‘ ‘
* direct_call = ‘ ‘
importing fm_name = l_function_module.
*—————————————————————————
* get device type from language
*—————————————————————————
call function ‘SSF_GET_DEVICE_TYPE’
exporting
i_language = sy-langu
* i_application = ‘SAPDEFAULT’
importing
e_devtype = l_devtype
exceptions
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 4
others = 5.
if sy-subrc 0.
* error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
* set device type in output options
ls_output_options-tdprinter = l_devtype.
*———————————————————————–
* Call the generated function module
*———————————————————————–
call function l_function_module_name
exporting
* archive_index =
* archive_parameters =
control_parameters = ls_control_parameters
* mail_appl_obj =
* mail_recipient =
* mail_sender =
output_options = ls_output_options
user_settings = space
UMS_EQUIP = UMS_EQUIP
LT_FIELDS = LT_FIELDS
importing
* document_output_info =
job_output_info = ls_output_data
* job_output_options =
* tables
* zsystems = lt_sys.
*———————————————————————–
* Conversion of output format OTF into PDF format
*———————————————————————–
* now convert the final document (OTF format) into PDF format
call function ‘CONVERT_OTF’
exporting
format = ‘PDF’
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ‘ ‘
* COPYNUMBER = 0
importing
bin_filesize = l_pdf_len
bin_file = l_pdf_xstring ” binary file
tables
otf = ls_output_data-otfdata
lines = lt_lines
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5
.
if sy-subrc 0.
* error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
DATA: cached_response TYPE REF TO if_http_response.
DATA: guid TYPE guid_32.
DATA: fileUpload TYPE REF TO CL_HTMLB_FILEUPLOAD.
if sy-subrc EQ 0.
CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg = 1.
l_pdf_len = xstrlen( l_pdf_xstring ).
cached_response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = ‘application/pdf’ ).
cached_response->set_status( code = 200 reason = ‘OK’ ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).
CALL FUNCTION ‘GUID_CREATE’
IMPORTING
ev_guid_32 = guid.
CONCATENATE runtime->application_url ‘/’ guid ‘.pdf’INTO display_url.
cl_http_server=>server_cache_upload( url = display_url
response = cached_response ).
ENDIF.
RETURN.
I hope you can help me.
Kind Regards
I am having some problem in generating the cached response. I am writing my code in a method of a class which is triggered from Web UI. The object runtime is not defined here so it throws an error each time. Please let me know how should I proceed.
Thanks,
Abhishek
too bad that this blog is nearly unreadable. it would still be very useful today and is cited on some pecial interest pages.
good job done long time ago. and now back to the future 🙂
Hi Anton,
This blog was submitted in the Report Your Missing Blog Content document and you may track the process via this document. The content will be repaired shortly.
Thanks,
Oxana
|
https://blogs.sap.com/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp/
|
CC-MAIN-2017-51
|
refinedweb
| 2,673
| 63.09
|
H E A L T H Y
L I V I N G
H E A L T H Y
feel good • live simply • laugh more
P L A N E T
FREE
Medical Honoring ECO Massage Earth Day YARDS Targeted Therapy for Specific Ills
Local Events and Celebrations
Turning Lawns into Native Landscapes
April 2017 | Collier / Lee Edition | swfl.NaturalAwakeningsMag.com
2
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
natural awakenings
April 2017
3
35789
30-day risk free trial
Over 2 million satisfied users since 1998 TV dialog is clear and understandable 4
Collier/Lee Counties swfl.NaturalAwakeningsMag.com Works better than hearing aids
Voice Clarifying Products
TV Ears is a trademark of TV Ears, Inc. © 2017 TV Ears, Inc. All Rights Reserved
natural awakenings
April 20172017 by Natural Awakenings. All rights reserved. Although some parts of this publication may be reproduced and reprinted, we require that prior permission be obtained in writing. Natural Awakenings is a free publication distributed locally.
Natural Awakenings is printed on recycled newsprint with soybased ink.
6
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
natural awakenings
April 2017
7
letterfrompublisher Living Mindfully Mindfulness means paying attention in a particular way: on purpose in the present moment and nonjudgmentally. ~Jon Kabat-Zinn
Try to leave the.
Earth a better place than when you arrived.
Here’s to being present in your life so you don’t miss it! Mindfully yours,
~Sidney Sheldon Sharon Bruckman 8
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
contents 18
25
48
10 18 22 24 28 30 36 41 48 49 50 54 56 58 62 81 83
newsbriefs healthbriefs therapybriefs globalbriefs actionalert earthdayevents community spotlight businessspotlight ecotip wisewords consciouseating fitbody greenliving healthykids calendar classifieds resourceguide
Natural Awakenings is your guide to a healthier, more balanced life. In each issue readers find cutting-edge information on natural health, nutrition, fitness, personal growth, green living, creative expression and the products and services that support a healthy lifestyle.
33 THE HEART OF THE
WILD REVEALS OUR SPIRITUAL LIFE
by Terry Tempest Williams
34 WALK, KAYAK OR RUN
on Southwest Florida's Wild Side by Lily Viola
38 MEDICAL MASSAGE
IN SOUTHWEST FLORIDA
Specialized Skills for Special Populations by Linda Sechrist
42 BENEFITS OF by Linda Sechrist
44 ECO YARDS
Turning Lawns into Native Landscapes.
by Lisa Kivirist and John D. Ivanko
CALENDAR SUBMISSIONS Email calendar events to: NACalendar@NaturalAwakeningsMag.com or fax to 239-434-9513..
swfl.NaturalAwakeningsMag.com
54
MINDFULNESS BASED STRESS REDUCTION
advertising & submissions
EDITORIAL SUBMISSIONS Email articles, news items and ideas to: NAEditor@NaturalAwakeningsMag.com. Deadline for editorial: the 10th of the month. Or visit: swfl.NaturalAwakeningsMag.com/Resources
44
52 CULTIVATING A DEEP
SENSE OF CONNECTION
Local Resources Offer Ways to Honor Diversity
56
by Linda Sechrist
54 RUN FUN
Races Beckon Beginners by Aimee Hughes
56 ECO-FRIENDLY
HOME BUILDING
Innovations Boost Energy Efficiency
60
by John D. Ivanko and Liam Kivirist
58 NEW WAVE Kids Organize to Save Our Oceans by April Thompson
60 ENZYME THERAPY FOR PETS
A Key to Good Health by Shawn Messonnier
natural awakenings
April 2017
9
newsbriefs Monarch Wellness Celebrates Fifth Anniversary
M
onarch. See ad, page 23.
Violet Bell to Perform at Happehatchee Center
S
tirring folk-soul music will fill the air at the Happehatchee Center, in Estero, when the Durham, North Violet Bell.
News to share? Send your submissions to: NAeditor@NaturalAwakeningsMag.com Deadline is the 10th of the month.
10
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
EVERGLADES UNIVERSITY
ALTERNATIVE MEDICINE
Bachelor's Degree Includes: – _ –
Herbology and Botany Nutrition and Aging Traditional Chinese Medicine
– – –
Ayurvedic Medicine The Herbal Medicine Chest Health Psychology
SCAN HERE
Additional degree programs are available LEARN MORE This degree includes a course in the U.S. Green Building Council principles of sustainability, certified by the USGBC.
ONLINE DIVISION 855.723.9087 Everglades University is accredited by the Southern Association of Colleges and Schools Commission on Colleges to award bachelor’s and master’s degrees. natural awakenings
April 2017
11
newsbriefs Eyes Wide Open Center Hosts Spiritual Events
R
everend Lorraine Meyer, founder of Healing Arts, Miami, will present One True Love: Accessing Lorraine Meyer.
12
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
National Walking Day Event in Naples
B
lue Zones Project is partnering with the city of Naples, local schools and organizations to encourage everyone to walk for at least 30 minutes on April 5 as part of National Walking Day. A one-mile community group walk will begin at 5:30 p.m. at the bandshell at Cambier Park, in Naples. Walkers will head north on 8th Street to showcase the recent redevelopment project along Central Avenue (a partner project between Blue Zones Project and the city of Naples completed last fall that improved the walkability and bike-ability of this central corridor) and end at the Garden of Hope and Courage at the NCH downtown campus. Walkers will receive a Blue Zones Project T-shirt and be entered into a $1,000 prize drawing. Light hors d’oeuvres and wine will be served to participants after the walk is finished. Walk start location: 755 8th Ave. S. For more information, visit SouthwestFlorida.BlueZonesProject.com.
Lecture on Groening’s Teachings in Cape Coral
M
at Bruno Groening power, Lesjak will discuss these documented healings and teach participants (1906-1959). See ad, page 20. natural awakenings
April 2017
13
newsbriefs True Food Kitchen Opens in Naples
T
rue Food Kitchen, the popular restaurant brand from Fox Restaurant Concepts founder Sam Fox and integrative medicine expert and author Dr. Andrew Weil, has opened its first Florida location at the Waterside Shops, 5415 Tamiami Trail North, in Naples. The health-driven culinary destination offers a signature spring menu, featuring seasonal dishes and cocktails. Inspired by the principles of Weil’s anti-inflammatory diet, True Food Kitchen merges nutrient-rich ingredients with a flavor-forward menu that rotates regularly to let guests experience great-tasting ingredients at the peak of their freshness and flavor. Dishes include Spaghetti Squash Casserole, Inside Out Quinoa Burger and Scottish Steelhead, along with flavorful bowls, pizzas and antioxidant-packed desserts, freshly pressed fruit and vegetable juices, seasonal cocktails, wine and a selection of local beers. The open-kitchen concept brings guests closer to the team’s culinary craft, while the outdoor patio features fireside dining. Open daily for lunch, dinner and weekend brunch and dinner, the full-service restaurant caters to nearly every food preference with a variety of gluten-free, naturally organic, vegetarian and vegan offerings. For more information, call 239-431-4580 or visit TrueFoodKitchenNaples.com.
Yoga Event Supports Pets with Cancer
Y
oga enthusiasts can spend time in downward facing dog, cat pose and other favorite asanas while raising money for The Brodie Fund to help pets fight cancer in a Warrior Pose for Pets event from 1 to 2 p.m., April 22, at BKS Yoga Studio, in Naples. All proceeds will go to cancer treatment and veterinary care of pets with cancer. Participants can also visit with pet vendors at the studio before and after class or purchase raffle tickets for a chance to win a gift basket. Cost: $20 donation and $5 raffle tickets. Location: 2900 Tamiami Tr. N. For more information, call 239-213-9276, email Info@bksYogaStudio.com or visit bksYogaStudio.com. See ad, page 73.
14
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Ramanand to Lead Three Events Special Moving Sale Ramanand, of the Mata at Altered Elements Bramachari Amritanandamayi Center, in Wash-
Bramachari Ramanand
Amma
ington, D.C., will host three evenings of spiritual discourse, devotional music and meditation from 7:15 to 9:30 p.m., April 3, at Shangri-La Springs, in Bonita Springs; from 6 to 9 p.m., April 4, at House of Gaia, in Naples; and from 6 to 8:30 p.m., April 5, at All Faiths Unitarian Congregation, in Fort Myers. The events will feature humorous, engaging and inspirational spiritual talks about renowned peace advocate Amma (Mother), sharing her message of selfless service and love. Ramanand will also lead devotional singing accompanied by several 14-to-16year-old musicians traveling with him and the audience. He will conduct meditations and conclude the evenings with a chant for world peace.
Admission is free. Locations: 27750 Old 41 Rd., Bonita Springs; 1660 Trade Center Way, Ste. 1 and 3, Naples; and 2756 McGregor Blvd., Fort Myers. For more information or to register, call 480-290-0231, email Kessel.Joyce@ gmail.com or visit Amma.org, EmbracingTheWorld.org or AmmaDC.org.
A
ltered.
natural awakenings
April 2017
15
newsbriefs Rev. Rosemergy’s Final Service at Unity of Fort Myers
A
fter. Jim Rosemergy, “You are here.”’” Location: 11120 Ranchette Rd. For more information, call 239-278-1511, email Office@UnityOfFortMyers.org or visit UnityOfFortMyers.org. See ad, page 76.
Classes Available for Massage Therapists in Fort Myers
T
he Florida Academy, in Fort Myers, is providing continuing education classes for massage therapists to maintain their licensure by the state. Practitioners must renew their licensure every other year. See ad, page 37.
YogaCAN Returns to Naples Beach Hotel
Y
oga643-4673, ext. 203, email Jodi@ CancerAllianceOfNaples.org or TiffanySmith@GreenMonkey.com or visit CancerAllianceOfNaples.org or any participating yoga studio.
16
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
YOLLO Wellness Offers Free Magneceutical Health Immersion Session
Y
OLLO’s’s response. Location: 3033 Winkler Ave., Ste. 170. For more information or an appointment, call 239-275-0039, email Wendy@ got-o2.net or visit YolloWellness.com. See ad, page 67.
natural awakenings
April 2017
17
Drinking More Water Improves Food Intake
amenic181/Shutterstock.com
R
u.
18
Collier/Lee Counties
239-793-8888 •
swfl.NaturalAwakeningsMag.com
PlusONE/Shutterstock.com
healthbriefs
Barefoot Running Improves Technique
B
are.
19
healthbriefs
Sedentary Kids Lag in Reading Skills
study from the University of Eastern Finland, in Kuopio, has found that less active boys perform worse in reading and arithmetic classes than their more active counterparts. Researchers studied 89 boys and 69 girls ages 6 to 8 and measured their sedentary time and moderate to vigorous physical activity .
Tai Chi Eases Chronic Neck Pain
ESB Professional/Shutterstock.com
A
20
Collier/Lee Counties
swfl.NaturalAwakeningsMag.
Anna Grigorjeva/Shutterstock.com
A
Chelation Cuts Risk of Cardiovascular Disease
esearchers.
Sage Linked to Cognitive Health.
Dionisvera/Shutterstock.com
Shidlovski/Shutterstock.com
R
The sweetest of all sounds is praise. ~Xenophon natural awakenings
April 2017
21
Are you tired of being sick & tired? FREE $10 CARD
TO FOOD & THOUGHT FOR 1sT 10 pEOplE wHO Rsvp & ATTEnD
Stress, Hormones & Health Event Join us
Wednesday, Apr 19th at 6:30 PM.
Get a gift card! RSVP today.
Functional Medicine is devoted to discovering the underlying causes of chronic health issues. Evie educates patients about safe and natural therapeutic and lifestyle changes to facilitate the body’s innate ability to heal. Adrenal Stress Disorders, Fatigue/Insomnia, Allergy & Food Sensitivities, Male & Female Hormone Imbalances, Bio Identical Hormones, Thyroid Disorders and other health issues.
EviE BrEEdlovE-Mangapora arnp
9200 Bonita Beach Rd., Ste 213 Bonita Springs FL 34135
239-777-4647 evie@inneressencehealth.com
therapybriefs
Holistic Relief for Restless Legs
Taged. See ad, page 46.
22
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Cryotherapy Facial Rejuvenation
C
ry a threeminute.
natural awakenings
April 2017
23
globalbriefs News and resources to inspire concerned citizens to work together in building a healthier, stronger society that benefits all.
Saving Sharks.
Cabeca de Marmore/Shutterstock.com
Nagy-Bagoly Arpad/Shutterstock.com
Ocean Sanctuaries Expand in Pacific
24
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
ssuaphotos/Shutterstock
Dare to go green
Home of Florida’s TOP Hair Colorist
organic salon
Experience Organic, Non-Toxic Salon Services • Florida’s #1 American Board-Certified Haircolorist • Master Stylists - Internationally Trained • Florida’s TOP Curly Hair Experts - Trained in Deva Ouidad - Founder of Raw Curls Academy • Beautiful, New, Modern salon. • Featured in many beauty industry publications • Walk-ins welcome (first-come first-served) Home of Raw Hair Organics, Raw Curls, and Rodz Grooming For Men natural & organic products
®
Melanie
Owner
597-0939 2940 Immokalee Rd Unit 4, Naples, FL
natural awakenings
April 2017
25
globalbriefs Tree Terminators
kao.
Growing Organics Toxin-Free Farmlands Rise to 4.1 Million Acres
26
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
PhotoSky/Shutterstock.com
alenka2194/Shutterstock.com
Insects Assault America’s Forests
natural awakenings
April 2017
27
Michele Paccione/Shutterstock.com
actionalert
Stand Up March for Science this Earth Daychairwoman, says, “Within hours, satellite marches were popping up around the country, then the world.” Organizers report several hundred established event locations and the number continues to grow. To join or create an event, visit MarchForScience.com/ satellite-marches.
28
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
natural awakenings
April 2017
29
earthdayevents
more information, call the Info ZooLine at 239-262-5409 or visit NaplesZoo.com.
Earth Day Re-Use and Recycle Roundup
Kai19/Shutterstock.com
9 a.m. to 4 p.m., Thursday, April 13
30
Collier/Lee Counties
they are able to analyze problems, think critically, balance needs and take informed action.” Earth Day isn’t just one day. Aware citizens can take a rewarding action every day. Help Southwest Florida celebrate and forward its progress toward sustainability at these local Earth Day 2017 events.
The Naples Zoo at Caribbean Gardens WILD for the Planet 9 a.m. to 1 p.m., Saturday, April 1 One of more than 100 U.S. accredited zoos and aquariums participating in North America’s largest combined Earth Day celebration, conservation groups and local businesses with a green focus will discuss living more sustainably. Kids will get free Earthfriendly gifts from participating partners and guests can test their skills at the Trash Challenge, plant a seed to take home and more. Free for Collier County residents. Location: 1590 Goodlette Rd., Naples. For
swfl.NaturalAwakeningsMag.com
Goodwill Industries will celebrate Earth Day by encouraging area residents to bring clothing, electronics, shoes, books, household items, computers and cell phones to donate. Free shredding of documents is offered by Goodwill Secure Shred and residents can discard unused, unnecessary or expired medicines with safe disposal provided by Drug Free Collier’s Operation Medicine Cabinet. Hazardous household chemicals, rechargeable batteries, paints, used motor oil and fluorescent bulbs are also accepted for collection by Collier County Solid Waste Management. Location: Goodwill Towne Centre parking lot, 3579 Tamiami Tr. E., Naples. For more information, call 239-9952106 ext. 2213 or 239-252-7575.
Earth Day Presentation and Guided Walk on Sanibel 11 a.m., Friday, April 21 Participants can enjoy a guided trail walk through the interior wetlands and mid-island ridges of the Center Tract while listening to a discussion of native habitats, natural and cultural history, and preservation efforts. Meet at the Nature Center and proceed to the trails. Cost: $5 for non-members and free to members and children. Location: Sanibel-Captiva Conservation Foundation, 3333 Sanibel-Captiva Rd., Sanibel. For more information, call 472-2329 or visit Blog.sccf.org.
House of Gaia Can’t Stop the Feeling 6 to 8 p.m., Friday, April 21 Children, ages 6 to 12, can celebrate Earth Day in style with a Glow Dance. Hosted by a DJ, participants can dress up and enjoy face painting, music, dancing and celebrate life together. Parents can drop kids off or stay. Healthy snacks will be available. Cost: $10 per child and $5 for each ad-
ditional siblings. Location: 1660 Trade Center Way, Ste. 1, Naples. For more information, call 239-272-6152 or visit HouseOfGaia.org.
Park Environmental Center, 5505 Rose Garden Rd., Cape Coral. For more information or to RSVP, call 239-5494606 or visit CapeParks.com.
Pepper Ranch Preserve Guided Hike
Arbor Day Celebration
9 a.m., Saturday, April 22
Featuring native plants and trees for sale, the Arbor Day Celebration includes demonstrations and exhibits. Visitors can enjoy live music, a poster contest, a giant slide, free trees and free ice cream for the first 50 kids.
The 2,512-acre Conservation Collier preserve property was acquired to help protect and restore the native habitats for the benefit of wildlife, providing aquifer recharge and nature-based education and recreation for residents. Cost: free. Location: 6315 Pepper Rd., Immokalee. For more information or to register, call 239-252-2961.
Lee County Great American Cleanup 9 a.m. to noon, Saturday, April 22
9 a.m. to 2 p.m., Saturday, April 22
Location: Riverside Park, 10450 Reynolds St., off Old U.S. 41. For more information, call the Tree Advisory Board Liaison at 239-949-6262 or visit CityOfBonitaSprings.org.
Earth Day Buy One, Get One Sale
Keep Lee County Beautiful recruits volunteers, site captains, area managers and local sponsors to foster unity and strengthen bonds through beautification and improvement efforts across the county and is part of the nationwide Great American Cleanup effort. Projects may include community gardens, habitat restoration, invasive plant removal, litter-free events, litter cleanups, landscape maintenance and planting, playground/park equipment restoration and tree plantings.
9 a.m. to 4 p.m., Saturday, April 22
Location of sites and event dates vary. For more information or to register, call 239-334-3488 or visit klcb.org/greatamerican-cleanup.html.
9 a.m. to 5 p.m., Saturday, April 22
Rain Barrel Workshop Native Plant Sale 9 a.m. to 1 p.m., Saturday, April 22 Choosing native plants for the yard can save time, money and work because they are adapted to our dry winters and hot, rainy summers. Rain barrels save money and resources by gathering and storing rainwater safely for yard watering. Lee County master gardeners will answer questions at the workshop (until noon) and the sale. Admission is free; workshop: $45 includes barrel. Advance registration and payment is required. Location: Rotary
In celebration of Earth Day, the Rookery Bay Environmental Learning Center will offer buy-one, get-one-free admission. Cost: $5 for adult and $3 for children ages 6-12. Children under 6 are free. Cannot be combined with other offers. Location: 300 Tower Rd., Naples. For more information, call 239-530-5972 or visit RookeryBay.org.
Celebrate Earth Day at Naples Botanical Garden Origami in the Garden is on exhibit through April 23.
10 to 10:30 a.m. at J.N. “Ding” Darling National Wildlife Refuge on Sanibel Island. The refuge will celebrate the 47th anniversary of Earth Day in partnership with the Ding Darling Wildlife SocietyFriends of the Refuge. Along with many fun Earth- and family-friendly activities, attendees can enjoy the appearance of Bagzilla, a “bag monster” dressed in the average person’s annual plastic bag consumption. A Birds of the Refuge Program will take place in the Crossdike Pavilion from 1 to 1:30 p.m. Location: 1 Wildlife Dr., Sanibel. For more information, call 239-472-1100, ext. 236, or visit DingDarlingSociety.org.
Conservancy of Southwest Florida Earth Day Festival 10 a.m. to 4 p.m., Saturday, April 22 Visitors can enjoy local entertainment, keynote lectures, conservation speakers and children’s presentations at this event, featuring many vendors and environmental exhibitors. Activities include exploring the Conservancy Nature Center buildings, taking an electric boat ride, renting a kayak or canoe or walking a nature trail. Free admission for members, $10 for non-member adults and $5 for children 3 to 12. Location: 1495 Smith Preserve Way, off Goodlette Rd., Naples. For more information, call 239-430-2466 or visit Conservancy.org/events/earthday. —Continued on page 32.
Cost: Free for members and children 3 and under. $14.95 for non-member adults and $9.95 children ages 4 to 14. Location: 4820 Bayshore Dr. For more information, call 239-643-7275 or visit NaplesGarden.org.
Earth Day at the Refuge at J.N. “Ding” Darling National Wildlife Refuge 10 a.m. to 1:30 p.m., Saturday, April 22 Visitors can bike or hike Wildlife Drive for free from 7 a.m. to 7 p.m., watch Bag It! Is Your Life Too Plastic?, a free film, from 11 to 11:45 a.m. and participate in a family craft and story from
We won’t have a
society if we destroy the environment. ~Margaret Mead
natural awakenings
April 2017
31
Earth Day Events —Continued from page 31.
Musical Earth Day Program 10:30 to 11:30 a.m., Saturday, April 22 Led by educator, musician and Calusa Nature Center volunteer Carolyn Stanley, children from 3 to 12 years old will sing songs, make rhythm instruments and draw pictures while learning how to care for the environment and why trees are essential for our survival. Sponsored by Fort Myers Quakers, registration starts at 10 a.m. Cost: $5 for children, $10 for adults and free for first 50 children age 3 to 12. Location: 3450 Ortiz Ave., Fort Myers. For more information, call 239-275-3435 or visit CalusaNature.org.
Koreshan Farmers’ Market and Native Plant Sale 8 a.m. to 1 p.m., Sunday, April 23 Native plant experts from the Coccoloba Chapter of the Florida Native Plant Society will answer questions and give advice on using native plants in landscaping, the fertilizer ordinance and invasive plant species. Local fresh produce, seafood, honey, arts and crafts, pickles and olives, fresh mozzarella cheese, native plants and trees are available for purchase. Cost: $1 environmental impact fee. Location: 3800 Corkscrew Rd., Estero. For more information, call 239-273-8945 or visit fnpsCoccoloba.org.
Invasive Species Presentation 7 p.m., Wednesday, April 26 Annisa Karim, of Southwest Florida Cooperative Invasive Species, will give a presentation on combating invasive plants and animals, along with an introduction to regional efforts and reporting options. Admission is free. Location: Interpretive Center, Six Mile Cypress Slough Preserve, 7751 Penzance Blvd., Fort Myers. For more information or to reserve a seat, call 239-533-7557 or email SloughConnections@gmail.com. 32
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
inspiration
Persistent redness? • PimPles? ViSibLe bLooD VeSSeLS?
The Heart of the Wild Reveals Our Spiritual Life
IWall Wilten—alone—locked inside the cave. liams, reprinted with permission. Learn I waved my hand in front of my face. more at CoyoteClan.com/index.html.
acne-rosacea SPA De LAriSSA Offers:
Gail Johnson/Shutterstock.com
Excerpts from “America’s National Parks” from The Hour of Land
Get treatment for
natural awakenings
April 2017
33
ifty, Marco Island and
Baby gators at CREW
Roseate spoonbill at Bird Rookery Swamp
Kids hiking at Bird Rookery Swamp trails
Erik Weihenmayer, author of No Barriers, is totally blind, yet has climbed the highest peaks on all seven continents, saying, "Don, I can hear the alligator breathing!"
Walk, Kayak or Run
on Southwest Florida’s Wild Side by Lily Viola
F
34
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
photos by Anne Reed
photo by Don McCumber
Science has proven that people that spend a lot of time in nature are generally healthier and experience positive perks such as improved short-term memory, restored mental energy, stress reduction, improved concentration, sharper thinking and creativity, and improved mental health overall.
Pair of great egrets
photo by Don McCumber
strategist for CREW Land & Water Trust, use, but require special use permits for a nonprofit organization coordinating horseback riding or primitive camping. land acquisition, land management and Solar powered talking tail posts educate public use of the 60,000-acre Corktrail-goers about observing safety rules. screw Regional Ecosystem Watershed. Geocaching on part of CREW property The CREW project spans the Corkscrew allows visitors to participate in the Marsh, Bird Rookery Swamp, Flint Pen recreational activity of hunting for and Strand, Camp Keais Strand and Corkfinding hidden object by means of GPS screw Swamp Sanctuary; all wild places coordinates posted on a website. with trails where Reed and her three To continue enjoying Florida’s wild daughters—14, 9 places by kayak, and 7—enjoy hiking, bike, on foot or in biking and running. a tent means taking Reed and her action to protect daughters, native the 2 million-acre Ohioans, find comfort wetland ecosystem in exploring CREW’s of the Everglades marsh hiking trails, cythat extends from press dome trails and central Florida to bird rookery swamp the southern end of trails with volunteers. the Florida main“We are all outdoor land and the Florida Baby gator enthusiasts, and were Keys. Sign the “Now familiar with the wildlife in Ohio and or Neverglades” declaration (Glades northern Michigan, but we didn’t have Declaration.org) to support the 200snakes or alligators. Florida’s wildlife felt plus respected Everglades scientists that dangerous to us until we learned about believe increased storage, treatment native reptilian, avian and mammalian and conveyance of water south of Lake species from volunteers leading field Okeechobee is essential to stop the trips. We lost our fear, gained respect damaging discharges to coastal estuarand experienced a twinge of nostalgia ies, restore the flow of clean, fresh wafor home when we saw unexpected red ter to Everglades National Park, Florida maple trees,” recalls Reed. Bay and the Florida Keys, improve the No boardwalk exists on the 13-mile health of Lake Okeechobee and protect loop of CREW’s bird rookery swamp the drinking water for 8 million Floridtrail. “Visitors are likely to see an alligaians living in Monroe, Miami-Dade, tor crossing their path while they are Broward and Palm Beach counties. busy looking at wildflowers, butterflies, otters, red shouldered hawks and wadFor more information, email NowOr ing birds such as the stately great egrets Never@GladesDeclaration.org. For and snowy egrets, as well as limpkins more information on CREW and Everfeeding on apple snails,” says Reed. glades Area Tours, visit CrewTrust.org CREW trails are designated multiand EvergladesAreaTours.com.
Great egret showing off his plumage
Dr. David Cooper leading a hike at CREW marsh trails
Night-scented orchids (Epidendrum nocturnum) natural awakenings
April 2017
photos this column: by Don McCumber
photo by Anne Reed
Roseate spoonbills
35
communityspotlight
Inner Essence Health
Works to Help People Enjoy Life, Not Just Live it by Lee Walker
W
orking in a primary care your mechanic, because you know there is medical practice where a problem,” she explains. health practitioners had Declaring that she doesn’t heal anyincorporated integrative medicine gave one, Breedlove explains confidently that Evie Breedlove Mangapora a head start the body heals itself. “I guide, educate and in what was to become her true callencourage patients regarding how they ing—practicing functional medicine. can support their body’s innate healing Influenced by good mentors that were process with neutraceuticals, supplements, ahead of their time in using practices nutrition, good sleep habits and other such as vitamin C infusions, Breedlove, lifestyle changes that include the right atan advanced registered nurse practitiotitude and mindset, which are all aspects ner, benefitted from expertise and expeof functional medicine, she says. rience that now serves the patients she “My mom’s positive attitude of, ‘I’m treats at Inner Essence Health, located going to do this my way,’ amazed me. Afwithin the offices of Wellbridges Health ter she shared her diagnosis, I assumed the Center, in Bonita Springs. fetal position in my bed for three days. I When her mother was diagnosed didn’t care that I only felt like wearing my with breast cancer, Breedlove exhaustyoga pants or pajamas when I drove my Evie Breedlove ed every conventional medical resource children to school. It was my mom’s lack to which she had access in Michigan, where she lived then. of ‘Why not me?’ attitude and her desire for quality of life “I consulted a traditional oncologist, formulated a treatment rather than quantity of life that lifted me up and out of bed,” plan and flew to Florida. When I explained to my mom that recalls Breedlove, who connected with Wellbridges owner the plan included chemotherapy and radiation, she refused Deb Post at a nurse practitioner meeting while temporarily to implement it. Mom had already consulted with Dr. Teresa living in the area and supporting her mother. Sievers, in Bonita Springs, because she didn’t want to suffer “I was already in my functional medicine fellowship the damaging effects of conventional treatments and was with the Institute and understood what Deb talked about. determined to find out why she had cancer and what she We stayed in touch afterwards and eventually discussed could do to prevent it from reoccurring. When she told my setting up an office at her place of business,” exme about what Teresa recommended, I decided I would plains Breedlove. go fully prepared with all my questions to my mom’s next “I believe that with today’s insurance, high deductibles doctor’s appointment. I left that appointment with in-depth motivate individuals to become more proactive with their knowledge that not only benefited my mom, but also her health. I see individuals striving to achieve an optimal quality treatment plan and my future. I enrolled at the American of health, instead of living up to a ripe old age in a wheelAcademy of Anti-Aging Medicine/Medical Metabolic Instichair. People seek me out to help with concerns about belly tute, where Teresa got her training. Today, my mom is enjoy- fat, weight gain, stress, fatigue, thyroid conditions, hormone ing good health. She eats only organic, threw out her toxic imbalances and sleep disturbances,” advises Breedlove. chemical housecleaning products, perfumes and makeup. “They want good health to be a strong foundation for their She has no regrets, enjoys her grandchildren and apprecilife, rather than living dependent on pharmaceuticals. I love ates her healthy lifestyle. Sometimes she acts younger than I to help people make healthy lifestyle choices and achieve do,” enthuses Breedlove. their goals, which is why I also give free monthly presenta Breedlove lets her patients know that she is a firm betions in the community on various health topics such as liever in a time and place for conventional health care, medi- my Hormones and Your Health on April 19 at 6:30 p.m., at cations and surgery. She also informs them that she believes Wellbridges Health Center.” in using the protocols of functional medicine to determine the underlying causes of their health challenges. “Symptoms Inner Essence Health is located at 9200 Bonita Beach Rd., are your body’s red warning flags. Think of the ‘check engine’ Ste. 113, in Bonita Springs. For more information, call 239light on your car. When it lights up, you immediately call 777-4647 or visit InnerEssenceHealth.com. See ad, page 22. 36
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
natural awakenings
April 2017
37
Medical Massage in Southwest Florida
Specialized Skills for Special Populations by Linda Sechrist
I
n Southwest Florida, specialty certificheck every two years. Approved procate programs representing advanced viders, such as Geri Ruane, one of four education and training within a mofounding directors of Oncology Masdality qualified as therapeutic massage sage Alliance (OMA), in Austin, Texas, and bodywork are benefitting masoffer beginning and advanced weekend sage therapists and their clients. Often workshops. considered as requirements for specific populations—pregnant women, seOncology Massage niors, athletes, infants, cancer patients Ruane clarifies the essential aspects and survivors—some outcome-based of an oncology massage therapist’s specialty modalities are referred to as (OMT) skill set. “A properly trained “medical massage”. therapist has an informed understandSpecialty techniques are taught ing of the disease itself and the many by continuing education providers ways it can affect the human body; approved by the National Certificathe side effects of cancer treatments, tion Board for Therapeutic Massage & such as medications, surgery, chemoBodywork, a nonprofit organization therapy and radiation; and the ability that provides an accredited, voluntary to modify massage techniques in orcertification beyond entry-level state lider to adapt accordingly. Hospitals in LMT, pFT, MLD/cDpD.C., now censure. As a result, specialty therapies 35 states and Washington, CertifiedtheraLymphedema are delivered by trained massage offerTherapist massage therapy Compression Bandaging pists according to a national standard of to individuals during • OncOlOgy care certified excellence for working in collaboration cancerPractitiOner treatment.” • Medical Massage • lyMPh drainage with doctors, chiropractors, wellness Trained in oncolo• MyOfascial release centers, retirement care communities • sPOrts Massage gy massage at Memo• active isOlated stretching and other medical settings. rialtheraPy Sloan Kettering • craniOsacral To maintain their status,822 therapists Cancer Center in New Anchor Rode Drive, Naples, FL 34103 must complete 24 hours ofBy continuing York293-0960 City, Christina AppoiNtmeNt (239) • iamchristinamitchell@gmail.com MA49769 MM22673 education and 100 hours ofbestbodymassage.com work expe- Mitchell, owner of Christina Mitchell rience, and pass a criminal background Best Body Massage in
Ther apeuTic Massage
christina M. Mitchell,
38
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Tehjan lymph, blood and Prendivil,
this technique is for the treatment of lymphedema, an accumulation of fluid that can occur after lymph nodes are removed during surgery, most often for Robyn a mastectomy,” says Berry Alvina complementary care Quatrano masTabatha sage, as well as neuPetersen romuscular active release techniques, like that offered at Naples Massage & Neuromuscular by owner Tabatha Petersen, as well as Meredith Musick, a LMT and yoga teacher in Naples, are Meredith among the most effecMusick tiveasTeo cial release, but also Nikol Jennifer Colucci Ermin appreciate the relief Luis Centers.com. See ad, page 24. —Continued on page 40. natural awakenings
April 2017
39.
Laser Dentistry “Creating New Smiles Every Day”
Local Resources
—Continued from page 39.
Awakening Through Synergy, 1084 Business Ln., Naples. 239-529-7582. AwakeningThroughSynergy.com. See listing, page 86. Be Well Natural Health Clinic, 1032 Goodlette Rd. N., Naples. 239-3075616. BeWellNaples.com. See ad, page 21. CURA Holistic Health and Massage Center, 3411 Tamiami Tr. N., Ste. 200, Naples. 239-450-4325. FeelHealed.com. See ad, page 64. Florida Academy continuing education classes, 4387 Colonial Blvd., Ft. Myers. 239-489-2282. See ad, page 37. Christina Mitchell, Naples, 239-2930960. BestBodyMassage.com. See ad, page 71. Meredith Musick, Naples. 239-2698846. MeredithMusick.com. See ad, page 32. |
“You do not change the landscape, you change the eyes”
Create a life of joy PSYCHOTHERAPY FOR AN EVOLVING UNIVERSE In therapy you will learn to cope with life stressors, manage your feelings and understand yourself and those you love.
KATHLEEN B. D’ORSI, LCSW
Florida Licensed Psychotherapist -Evening/Weekend Hours Available Serving the Naples Area 239-513-0255 • 40
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Naples Massage & Neuromuscular, 5926 Premier Way, Ste. 134, Naples. 239-325-9410. NaplesMassage.net. See ad, page 27. Organic Skincare & Bodyworx, 13240 Tamiami Tr. N., Ste. 207, Naples. 239514-4494. OrganicSkinCareAnd Bodyworx.com. See ad, page 3. Purely You Spa, 3066 Tamiami Tr., N., Ste. 302, Naples. 239-331-8266. PurelyYouSpa.com. See ad, page 17. Alvina Quatrano, Naples. 732-2665276. TheArtOfHolisticMassage.com. See listing, page 83. RB Institute, Inc., 13601 McGregor Blvd., Ste. 13, Ft. Myers. 239-9394646. RobynBerry.com. See ad, page 70. Shangri-La Springs, 27750 Old 41 Rd., Bonita Springs. 239-949-0749. ShangriLaSprings.com.
businessspotlight
Naples Massage & Neuromuscular A Multi-Modality Clinic Without A Clinical Feel by Lisa Marlene
F
rom the age of 5, ART, similar to deep Tabatha Peterson, tissue massage techniques owner of Naples and myofascial release, Massage & Neuromusworks by manipulating cular, knew for certain soft tissue, thereby reducwhat she wanted to do ing stress placed on joints when she grew up. “I and nerves. It is much wanted to work in masmore targeted than massage therapy,” says the sage, breaks up adhesions former resident of Onor restores proper tissue tario, Canada. “Today, it function, and is customgives me joy to be doing tailored to the patient. what I love. I get a great Lower back pain, carpal Sensory deprivation tank deal of satisfaction from tunnel syndrome, bursitis, listening attentively to clients who tell me about their tennis elbow, sciatic nerve pain, shoulder pain (includpain and in providing them with quick resolution which ing frozen shoulder), shin splints and plantar fasciitis are helps them to move forward in life,” says Petersen. generally relieved by ART treatments. Using her 10 years of experience in active re“Most are these conditions are the result of overused lease techniques (ART), and 22 years of experience in muscles, which contribute to scar tissue formation, tears, medical and sports massage, Peterson is living out her pulls, strains and inflammation. The goal of active release childhood vision. The graduate of the Canadian College technique is to restore normal mobility and ‘glide’ between of Massage and Hydrotherapy completed a two-year, muscular tissue and nerves. It can also help push joint fluid in-depth, 2,500-hour program focused on medical and throughout the body and stimulate the lymphatic system, sports injury therapies, closely following European which helps lower inflammation,” says Peterson. guidelines. Additionally, Peterson has motor vehicle Flotation therapy is recognized for releasing horaccident rehabilitation expertise, as well as proficiency mones, undoing the effects of stress, and increasing in pre- and post-surgical massage therapy, sports injury blood flow. An hour in a sensory deprivation tank can massage, and a Selective Functional Movement Assessimprove myriad conditions, including stress, chronic ment certification. pain, jet lag, anxiety, fatigue, high blood pressure, A multi-modality clinic without a clinical feel, headaches, pre-menstrual tension, postnatal depression Naples Massage & Neuromuscular offers a wide array of and insomnia. “In addition, the effects of flotation have massage therapy services, including Thai massage, mialso enabled many individuals to benefit from increased graine treatment, myofascial release, Swedish massage, fertility, flexibility, agility and sports performance. We pregnancy massage and more. The facility also offers two often have clients combine it with one of our specialized floatation chambers, known as sensory deprivation tanks. massage services for an unparalleled therapeutic and Active release technique (ART) is a type of soft tissue relaxing experience,” explains Peterson. therapy that helps relieve tight muscles and nerve trigger points, greatly reducing joint stress or muscular pains. Naples Massage & Neuromuscular is located at 5926 “I’ve visited ART practitioners for years to help me overPremier Way, Ste. 134, in Naples. For more information, come a number of muscle- and joint-related injuries,” call 239-325-9410 or visit NaplesMassage.net. See ad, says Peterson. page 27.
natural awakenings
April 2017
41
MBSR group practicing Awareness of Breath meditation
The Benefits of Mindfulness Based Stress Reduction by Linda Sechrist
T
housands of inditeacher, having completed viduals throughout professional training the U.S. have turned through both the Center for to the simple practice of Mindfulness in Medicine, Mindfulness-Based Stress Health Care and Society at Reduction (MBSR) for the University of Massachureasons that vary from relief setts Medical School and of chronic pain and stress the Center for Mindfulness to dealing with illness, at the University of Caliimproving academic or athfornia San Diego. In 2010, letic performance, healing she completed MBSR in Madeline Ebelini from trauma and becoming Mind-Body Medicine with better leaders. Even politicians such Jon Kabat-Zinn, the program’s founder. as Congressman Tim Ryan, author of A She is also a registered yoga teacher. Mindful Nation: How a Simple Practice The practice of mindfulness is the Can Help Us Reduce Stress, Improve intentional cultivation of the innate Performance and Recapture the Americapacity for non-judgmental, momentcan Spirit, are finding that the benefits to-moment awareness. Increasingly of MBSR apply to current challenges recognized as a healing and wholethat affect our lives, communities and some way to live, the MBSR comsociety as a whole. bination of a variety of mindfulness In Southwest Florida, hundreds of meditation practices, gentle stretching local residents such as retired physician and simple yoga strengthens inborn Jim Bova and his wife, Kathy, as well as internal resources, which naturally flow Sara Barry, a local middle school teach- into everyday experiences and interacer, have benefitted from the eight-week tions. MBSR practitioners respond to mindfulness program offered at Integra- life more thoughtfully by choice and tive Mindfulness, in Bonita Springs. less automatically by habit, experience Founder Madeline Ebelini holds a less negative judgment and anger, enjoy Master of Arts degree in Transpersonal better sleep, moods and energy levels, Psychology and is a trained MBSR and notice improvement in emotional 42
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
well-being. Additionally, in learning to listening attentively, they often benefit from improved relationships, acceptance of things as they are, wise action and changes that arise from a place of alignment, rather than denial. “Practices included in the MBSR program that I teach originated in a healthcare setting as possible solutions for individuals whose physicians informed them that there was nothing more that they could do to help them deal with chronic pain. Those who participated in the earliest MBSR programs learned to differentiate between psychological pain and physical pain. In letting go of the psychological pain, they gained a better quality of life,” says Ebelini. Since 2002, a great deal of brain research, such as Alterations in Brain and Immune Function Produced by Mindfulness, published in Psychosomatic Medicine in 2003, has revealed the effects of eight-week mindfulness training on brain and immune function that occurred during a three-month and three-year follow up with individuals practicing MBSR. Other important studies showed a reduction in the incidence of other medical disorders such as anxiety, depression and the lowering of elevated blood pressure. Bova first learned about mindfulness while reading Kabat-Zinn’s Wherever You Go There You Are: Mindfulness Meditation in Everyday Life, in which he mentions that he made many personal notes. In the fall of 2015, Jim and Kathy committed to the eight-week course that includes a one-day silent retreat. Both agreed that they didn’t want to wait until they had catastrophic medical issues to deal with, and the decision proved to be a prophetic. “2016 was not a good year for either of us. Kathy had to have a second orthopedic surgery on her ankle and was diagnosed with early stage breast cancer. I had a stroke. We also had to euthanize our amazing dog that was our companion for more than 14 years,” says Jim, who notes that mindfulness practices helped him and Kathy navigate those challenging situations. “I am thankful that Jon introduces medical science to support the importance and value of mindfulness.
The brain science that is eloquently explained in the book lends the necessary credibility that makes mindfulness a non-denominational practice of stress reduction, which enhances health and life,” explains Jim, who has cardiovascular disease. “I appreciate that my practice allowed me to reduce my stress level, which is one of my risk factors. I’ve also been able to reduce the dosage of my medication.” Jim and Kathy meditate and use aspects of mindfulness practice now nearly every day, although he notes that when they travel, setting aside the time is more challenging. He describes how mindfulness is useful while driving in traffic. “Drawing in a deep breath and scanning my body to become fully aware of how it is feeling are the steps before I assume the mental position of observing without judgment. Mindfulness has been a very positive experience that has enhanced our lives,” advises Jim, whose grandson and granddaughter are students at the same charter school that provides a mindfulness meditation as an aspect of every school day. “I think about how this
will positively affect students’ ability to listen in class, resolve conflicts, reduce stress levels during tests and have better relationships. I also think about how it would have helped me in medical school, as well as throughout my entire medical career.” Barry was interested in meditation long before her September 2016 enrollment in Ebelini’s class. She felt that MSBR would be emotionally helpful for the personally stressful times that she was experiencing. As a parent of a 6-year-old son, she also thought that mindfulness could help her to be more present with him, as well as her students. “At Madeline’s recommendation upon completion of the eight-week course, I enrolled in the online mindful educators course. Both courses helped me have better relationships with my students. By learning to adopt a curious beginner’s mind, I am able to avoid prejudging students whose behavior is defiant and disruptive. A beginner’s sense of curiosity allows for more listening, patience, and wonder about what is going on with students, rather than reacting to their disruptive be-
havior, which actually occurs less and less,” clarifies Barry. “In the mindfulness educator course, the teacher talked about consciously creating or setting the container within which students experience a calm attitude and respond to the presence that they unconsciously sense,” advises Barry. In Mindful Nation, Ryan describes encounters with teachers that have implemented mindfulness programs in schools. “They tell great stories about the difference mindfulness makes in their classroom and about how they are able to avoid burnout by increasing their resilience. In essence, mindfulness can be a powerful tool in boosting our children’s educational experience and in improving our health as a nation,” says Ryan. Integrative Mindfulness is located at Woods Edge Cir. in Bonita Springs. For more information on the free Apr. 14 MBSR introductory information talk at 9:30 a.m., call 239-590-9485. For more information, visit Integrative Mindfulness.net. See ad, page 23.
natural awakenings
April 2017
43
Four-Season Climates
ECO YARDS Turning Lawns into Native Landscapes by Lisa Kivirist and John D. Ivanko
T
“
raditional. 44
Collier/Lee Counties.
swfl.NaturalAwakeningsMag
45
46
Collier/Lee Counties
swfl.NaturalAwakeningsMag.”
Non-Toxic Options for a Backyard Oasis by Ryan Scofield
I
photo by Anne Reed
n the designing of butterfly habitat. an outdoor oasis To preserve this that includes an safe haven, do not eco-friendly yard, use any kind of switching to orpesticide. Register ganic pest control with the North options might be American Butterthe most obvifly Association ous place to start. (naba.org) to However, there certify the safe site are other steps butterfly garden. to take that can Use rain provide tranquil barrels to collect and beautiful rainwater from spaces for enjoythe roof, gutters ing time outdoors. and downspouts Reduce the of the house, and Julia butterfly at Cypress Dome Trails amount of grass use it on plants. To that needs cutting and irrigated by avoid mosquitoes that lay their larvae in converting the lawn to a mixed landsuch recesses, use all the water in the scape that includes decorative stone barrel within five days. Treat the water walkways, as well as areas accented with one tablespoon of ecofriendly liqwith decorative pavers or stones. This uid dish soap; that creates a protective sets the stage for showcasing outdoor film on the surface of the water. lawn furniture and enjoying more Avoid gas-powered lawn equipoutdoor dining time. ment that is among the worst air-pollut When choosing ground covers that ers. When possible, use a manual push not only reduce water usage but also mower or an electric lawnmower. save time and energy in lawn maintenance consider plants for their texture Ryan Scofield is the owner of Two Tired and density, as well as how high they Services. For more information on ecogrow and how well they spread and friendly landscaping and lawn care, choke out weeds. call 239-302-8922 or visit TwoTired Set aside an area for a special Services.com. See ad, page 64.
natural awakenings
April 2017
47
ecotip
eat well.
Your FREE Gift Natural Awakenings’ tagline is ‘feel good, live simply, laugh more’. Each month we bring you news and information to help you achieve those goals. NOW, we have a MindPT video session entitled “NATURAL AWAKENINGS” to help reinforce the mindset of our motto and we are pleased to OFFER IT TO YOU FOR FREE as part of our ongoing commitment to inspire, educate and help make a positive difference in your life.
Download your MindPT Session Now! And…It’s YOURS TO KEEP. Along with a SPECIAL BONUS! On your phone: 1. Download the MindPT APP 2. Register 3. Enter this referral code: NASB 4. View your FREE Session & BONUS, over & over On your computer: 1. Enter this URL into your browser MindPT.com/NATURALAWAKENINGSFreeGift?source=4799 2. Go To Page 3. Register 4. View your FREE Session & BONUS, over & over
48
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Butterfly Rescue
How to Create Helpful Home Habitats We watch the graceful flight of colorful butterflies and appreciate their crucial role as pollinators. Establishing butterfly gardens or accommodating them in yard plantings increases food sources radically threatened by reductions in blossomrich landscapes due to development, intensive agriculture, insecticides and climate change. The National Wildlife Federation (nwf.org) (Wildflower.org) (FloridaNativeButterflies.org), (edf.org) program by donating $35 for one acre up to $350 for 10 acres. Their goal is to retain and protect 2 million acres.
Sean Xu/Shutterstock.com
It’s easy to
wisewords
integrate nature into them will ramp up the public health costs later on.
Tony Juniper on How Thriving Ecosystems Sustain Prosperity by Randy Kambic
L
eading ecosuburbs
What can citizens do to trengthenterm. natural awakenings
April 2017
49
Eggs-pert Advice How to Buy Good Eggs from Happy Hens by Judith Fertig
J
an. 50
Collier/Lee Counties
laying chickens, they need to provide
swfl.NaturalAwakeningsMag.com
chrisdorney/Shutterstock.com
consciouseating
H
Bozena Fulawka/Shutterstock.com
ereRaised.”
natural awakenings
April 2017
51
Cultivating a Deep Sense of Connection
Local Resources Offer Ways to Honor Diversity by Linda Sechrist.
If you are willing to look at another person’s behavior toward you as a reflection of the state of their relationship with Affinity Circles Rosemergy advises, “In our two Affinity themselves, rather than a statement about your value as a Circles that meet once a week, there are person, then you will, over a period of time, cease to react ground rules for conduct in creating a consciousness of compassion and affinat all. ~Yogi Bhajan ity for one another. In these small groups
A
ccording to Ai-jen and Kelsang Chopag, Poo, founder and diresident teacher at Samurector of the National drabadra Kadampa BudDomestic Workers Alliance, dhist Center, in Fort Myers, “There are times we have to offer their thoughts about have conflict, and tension mindsets, practices and has to exist to bring someprocesses that can lead us thing else into being. But in the direction of healing they have to coexist with a divides. deep sense of connection and shared destiny.” Rev. Diane Scribner Clevenger Using Quantum In tumultuous times, Truths to Prime the it is the norm to wallow in Well of Worldviews divisiveness and to blame, “Our present environbemoan, ridicule and vilify ment calls us to recognize views that don’t align with quantum truths—we are our own. As fear and stress all interconnected, there abound, a cycle of conflict is no degree of separation leaves less opportunity for and we are responsible for trust, empathy and compasour thoughts, words and sion; the foundation of love. actions. What we do has Bringing disparate great rippling effects,” says groups and individuals Clevenger. She uses a metaRev. Jim Rosemergy together to offer them ways phor of pumping an abanto see their interdependoned well for water to explain what dence and interconnections as a source can happen when opposing worldview for change is happening throughout the concerns are first encountered and U.S. in a growing movement among expressed, even in a safe environment. groups that are interested in building “Priming an old well brings up muddy a shared destiny and a more collective undrinkable water. This represents our sense of humanity, even in the face constricted thoughts of blame, shame, of opposition. The National Coalition disbelief and doubt. This is no time to for Dialogue and Deliberation and the stop pumping and proclaim that the World Café Community Foundation are well isn’t working. Be curious, and nobringing people together across divides tice the conditions clouding the water. to tackle tough challenges and achieve Continue pumping, knowing that clean, cooperative action. clear, life-giving water will follow. Locally, Unity of Naples Reverend “We are all called to participate Diane Scribner Clevenger, Unity of Fort now in the process of spiritual chemiMyers Reverend Jim Rosemergy, Gottcalization, a metaphysical term used by man Couples Therapist Peggy Walsh, Charles Fillmore, co-founder of Unity.
52
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com The Wisdom engage. It was developed of Buddha by John Gottman from the Chopag, an ordained pioneering work of Anatol Buddhist monk, uses Rapport, an international his light, humorous and peace negotiator with practical delivery of the highly successful conflict Buddha’s teachings to resolution techniques. “Beoffer wisdom for experifore engaging in any perencing a sense of consuasion, both individuals nection and shared desare required to interview tiny. “World peace and Peggy Walsh each other extensively happiness are grassroots about the partner’s posimovements that have to tion and to summarize and start within each person. validate that position in a We each have to learn manner which lets them how to be happy within,” feel they were understood. he says. The speaker is tasked with There are two types of talking honestly about their problems—inner probfeelings and beliefs. No lems that we can control blaming, criticism or ‘you’ and outer problems that statements are allowed. The we can’t always control. listener is encouraged to We don’t have to solve an Kelsang Chopag take notes in order to sumouter problem to be happy. marize and reflect back what is heard,” We simply accept it as is. Acceptance is says Walsh, who notes that validation the most fundamental way to move forand communicating understanding ward from place of being happy, rather and empathy doesn’t mean that the than from a place of rejecting what is. parties agree. No judgment, debate or “We can solve our inner problems valuation. Just acceptance.” FortMyers.org. Peggy Walsh, Fort Myers. 718-2086986. PWalshFlorida@comcast.net. See ad, page 14. Unity of Fort Myers, 11120 Ranchette Rd., Fort Myers. 239-278-1511. UnityOf FortMyers.org. See ad, page 76. Unity of Naples, 2000 Unity Way, Naples. 239-775-3009. NaplesUnity.org. See ad, page 67.
natural awakenings
April 2017
53
Races Beckon Beginners by Aimee Hughes
54
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com, at Aimee@LongevityTimes.com.
Dennis W Donohue/Shutterstock.com
RUN FUN
lzf/Shutterstock.com
fitbody
Natural Awakenings publishes in over 85 markets across the U.S., Puerto Rico and the Dominican Republic (listed below). Contact us about acquiring an existing publication FOR SALE highlighted in RED*. Northern CO/ Cheyenne
Los Angeles, CA Riverside, CA Sacramento, CA San Bernadino, CA Santa Barbara/ Ventura, CA • Santa Clara Co., CA • Southern, MA • Annapolis, MD *Natural Awakenings recently received the • Baltimore, MD prestigious FBR50 Franchise Satisfaction • Kansas City, MO Award from Franchise Business Review. natural awakenings
• Saint Louis, MO • Bronyx, NY • Brooklyn/ Staten Island, NY • Cleveland, OH • Pittsburgh, PA • Nashville, TN • Ft. Worth, TX • Salt Lake City, UT Inquire about
April 2017areas 55 other open
It costs slightly more on a monthly mortgage to build a home that costs far less per month to operate.
NA Fun Fact:
Natural Awakenings is published in 80+ U.S. markets.
56
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
~Dan Chiras-house.”
Energy Storage
Tesla Motors does more than produce high-end electric cars and solar shingles. The company is also on the cutting edge
To advertise with us call: 239-272-8155 research,.
natural awakenings
April 2017
57
If the oceans die, we die.
healthykids healthy
~Captain Paul Watson, founder, Sea Shepherd Conservation Society
NEW WAVE Kids Organize to Save Our Oceans Prasert Wongchindawest/Shutterstock.com
by April Thompson
E
arth dis-
58
Collier/Lee Counties
carded
swfl.NaturalAwakeningsMag.com.
What We Can Do Now Everyone has a part to play in keeping oceans clean and healthy. Here are some ways concerned individuals of all ages can help. Do away with disposable plastics. Use reusable alternatives to singleuse.
Primary sources: Ocean.si.edu; Ocean.org; Ocean.NationalGeographic.com natural awakenings
April 2017
59
naturalpet
ENZYME THERAPY FOR PETS A Key to Good Health
E
nzymes are among the most commonly used supplements for cats and dogs because they are widely beneficial. They support digestive health and enhance nutrient absorption, as well as reduce inflammation and boost overall wellness.
60
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Liliya Kulianionak/Shutterstock.com
by Shawn Messonnier
Enzymes help normal, healthy pets use nutrients and support the righting of gastrointestinal disorders, whether involving simple vomiting, diarrhea, chronic or complete constipation, anal sac disorders or inflammatory bowel disease, regardless of cause.. For more information, visit PetCareNaturally.com. natural awakenings
April 2017
61
calendarofevents
SATURDAY, APRIL 1 Moving Sale – Altered Elements is holding a special sale of its inventory of jewelry, crystals, mineral rocks, antiques, photos, metaphysical tools and more through the end of this month as it plans to close the facility and focus completely on its location at 5630 Yahl St. 532 Park St, downtown Naples. 4300654 or AlteredElements@hotmail.com. See news brief, page 15. Seraphim Blueprint Level VI – Apr 1-2. Participants are now ready for grace and union with the divine. They will begin to feel a real need to absorb beauty and feel closer to source. $225. Prerequisite: SB V. In person or via teleconference. Maria Hubbuch: 910-6576 or Mutu@aol.com. HarmonizingAmbientEnergy.com. Reiki for Pets – 9-11am. Bring a dog, cat, small animal or bird and receive a five-to-15-minute reiki session for them. Whether they are ill or healthy, animals benefit from the healing energy of reiki. Pets must be leashed or comfortably crated. Free; donations accepted for local charity groups. Kunjani Café, 780 Seagate Dr, Naples. 980-3257. FireflyWithin.org. WILD for the Planet – 9am-1pm. Conservation groups and local businesses with a green focus will inform on living more sustainably. Kids will get free Earth-friendly gifts from participating partners. Take the Trash Challenge, plant a seed to take home, and more. Free for Collier County residents. Naples Zoo, 1590 Goodlette Rd, Naples. 262-5409. NaplesZoo. com. See article, page 30. Beyond Trigger Points – Apr 1-2. 9am-6pm. LMT continuing education with Cathy Cohen. 16 CEUs. $250. Florida Academy, Colonial Center, 4387 Colonial Blvd, Ft Myers. 489-2282. See ad on page 37 and news brief on page 16. Adelante! Going Forward Together – 9:30am3pm. Celebrate paradise – using our common wisdom, let’s shape a vision that will help us build a better future for all. Begins with conversational circles to gather the collective wisdom from the participants, followed in the afternoon with selforganizing action circles. Free and open to all. St Monica’s Episcopal Church, 7070 Immokalee Rd, Naples. CircleConnections.com. Really, Really Free Market – 10am-2pm. Potluck of reusable items. No money, barter or trade; everything is free. Fleischmann Park, Naples. Facebook page: Naples Really Really Free Market. Weekend Childbirth Education – Apr 1-2. 10am3pm. Learn about stages of labor, pain coping practices, moving beyond your birth worries and more. Breastfeeding class included. The Family Birth Center of Naples, 2930 Immokalee Rd, Ste 2.
62
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
594-0400. Register/fee: FBCNaples@gmail.com. NaplesBirthCenter. Twists, Binds and Arm Balances – 10:30am12:30pm. With Gus Komninos, greenmonkey yoga. Practice offers the ability to strengthen the lower back and core, with elements of detoxing from within. Starts with a heating flow, twisting at the core, while maintaining focus on breath and alignment, and then incorporates binds and challenging but fun arm balances. $45. 6200 Trail Blvd, Naples. 598-1938. greenmonkey.com/naples-events. Healthy Hips and Shapely Shoulders – 1-3pm. With Marni Task. $25/advance, $30/day of. Love Yoga Center, 4949 Tamiami Tr N, Ste 204, Naples. 692-9747. LoveYogaCenter.com. See ad, page 22.
SUNDAY, APRIL 2 Eckankar Spiritual Discussion – 11am. Topic: Spiritual Wisdom on Life after Death. ECK Center of Southwest Florida, 12995 S Cleveland Ave, Ste 155, Ft Myers. 482-4034. Annual Unity Youth Ministry Silent Auction and Fundraiser Fair – 11am-2pm. Bring the children and enjoy face painting, crafts, games, a bounce house, music, jewelry, food, and a silent auction. Unity is a self-financed organization supporting the youth of Southwest Florida. They welcome all young people and their parents or guardians to join for an afternoon of family fun with lots of activities. Unity of Fort Myers, 11120 Ranchette Rd. 278-1511. YouthAndFamilyMinistry@yahoo.com. Yoga Festival of Naples – 1-8pm. Fun for the whole family: meditation, yoga workshops, kirtan, music, vendors, kids yoga, food. Sponsored by the Health and Wellness Sanctuary of Southwest Florida. North Collier Regional Park, 1500 Livingston Rd, Naples. Eventbrite.com/e/yoga-festival-naplestickets-31754074291. Intro to Wicca – 2pm. New series begins. In this weekly progressive class, learn what wicca is, concept of deity, altars, holidays, magick and more. Free. The Labyrinth, 12995 S Cleveland Ave, Ste 108, Ft Myers. RSVP: 939-2769. Argentine Milonga Dance – 4-8pm. $15. Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio.com.
natural awakenings
April 2017
63
MONDAY, APRIL 3 Book Giveaway – 9:30am-5pm. Dr Mark Corke will distribute the book The Poison in Your Teeth, by Dr Tom McGuire. Watch the video Evidence of Harm, a new documentary about mercury fillings. Call the office for a tour or with questions on holistic care. Laser Dentistry, 1550 Matthew Dr, Ft Myers. 936-5442. The Elephant: An Evening of Storytelling – Stories You’ll Never Forget! – 7-9pm. Ten storytelling performers and a dynamic emcee will captivate and entertain with personal stories, folk tales, tall tales, fractured tales and more. Moving stories, laughter, and fun. $20. Sugden Theatre (Tobye Studio), 701 Fifth Ave S, Naples. Box Office: 263-7990. OpenDreaming.com/the-elephant. Amma Spiritual Talk – 7:15-9:30pm. With Bramachari Ramanand. An evening of spiritual discourse, devotional music and meditation centered on Amma (Mother), known throughout the world: sharing her message of selfless service and love. Shangri La Springs, 27750 Old 41 Rd, Bonita Springs. 480-290-0231. Amma.org. See news brief, page 15.
TUESDAY, APRIL 4 The Seasoned Circle Series – 1pm. Threemonth series – Hope is Not a Plan. Part III: Capturing Our Own Legacy – the process of life review and writing our narrative presented by Linda Sechrist, of Natural Awakenings magazine. Free. Christus Victor Lutheran Church, 15600 N Tamiami Tr, Naples. 597-1043. ChristusVictorFl. org. See ad, page 65. Amma Spiritual Talk – 6-9pm. With Bramachari Ramanand. An evening of spiritual discourse, devotional music and meditation centered on Amma (Mother), known throughout the world: sharing her message of selfless service and love. House of Gaia, 1660 Trade Center Way, Ste 1 & 3, Naples. 480-290-0231. Amma.org. See news brief, page 15.. Picnic ’n’ Flick – 6:30pm. See an inspirational film, Pride, and an opportunity to share with the group afterward. BYO food to nosh during the movie and a blanket and pillow if you so desire. The film, based on a true story, shows the viewer what can be accomplished with cooperation, respect, and the power of true solidarity. Rated R (mild). Love donation. House of Gaia, 1660 Trade Center Way, Naples. RSVP: Info@HouseOfGaia.org. Meetup.com/TreeSisters-of-the-Sacred-Forest-ofSouthwest-Florida. Breastfeeding Class – 6:30-8:30pm. Learn how to successfully breastfeed a. 5940400. Fee info/register: FBCNaples@gmail.com or NaplesBirthCenter.com.
64
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
us n i o J r this
fo t! even free
The last “Session” of the “Seasoned Circle” Series
“HOPE is NOT a Plan!” April 4th @ 1pm:
“Capturing Our Own Legacy”
Join us for this interactive program facilitated by Linda Sechrist, Editor/Sr. Staff Writer with Natural Awakenings magazine. The process of life review and writing our own narrative is not only healing, but extends information about YOU into future generations! Join us for this FREE Program Presented by Christus Victor Lutheran Church Senior Ministries 15600 N. Tamiami Trail in North Naples For more information contact: Sherry Slater, Director 239-597-1043 • seniorministry@cvlcfl.org
natural awakenings
April 2017
65
Download Natural Awakeníngs'
FRESH, NEW APP TODAY! Upgraded and updated mobile app for active people seeking healthy and sustainable choices
• Search the National Directory to • Keep up to date with push notifications locate services and products, at • Sign up for promotions and newsletters home or on the go • Watch for franchise “for sale” listings • Find your local magazine/read • Read feature stories en Español articles • So much more and it’s FREE!
Tarot Part I – 7pm. Learn the meaning of the cards and how to utilize this wonderful tool. A Rider Waite deck is required. $30. Part II on 4, APRIL. National Walking Day – 5:30-7:30pm. Blues Zones Project is partnering with the city of Naples, local schools and organizations in Naples, Bonita Springs and Estero to encourage everyone in the community to walk for at least 30 minutes. One mile group walk meets at Cambier Park at the bandshell and will culminate at the Garden of Hope and Courage at the NCH downtown campus. 755 8th Ave S, Naples. SouthwestFlorida.BlueZonesProject.com. See news brief, page 13. Amma Spiritual Talk – 6-8:30pm. With Bramachari Ramanand. An evening of spiritual discourse, devotional music and meditation centered on Amma (Mother), known throughout the world: sharing her message of selfless service and love. All Faiths Unitarian Congregation, 2756 McGregor Blvd, Ft Myers. 480-290-0231. Amma.org. See news brief, page 15.
THURSDAY, APRIL 6
Search “Natural Awakenings”and download. Monkey Sprouts Community Event – 4-5:30pm. With Tiffany Smith. This event is for parents and children prenatal to preteen. Meditate, practice yoga and connect with community. Bring questions and suggestions to support you or your child’s yoga practice. Attendees may come and go as they please, but there will be a 30-minute formal practice at 4:30pm. Free with current greenmonkey package. 6200 Trail Blvd, Naples. 598-1938. greenmonkey. com/naples-events. Songwriters at Sunset Concert – 5:30pm. Hear original music and the stories behind the songs in an intimate Bluebird Café style on the beach in the gazebo and enjoy a Lover’s Key sunset. Free concert admission with park entry fee. $8/parking fee (2-8 people), $4/single person/vehicle, $2/pedestrian/ bicyclist. Lovers Key State Park, 8700 Estero Blvd, Ft Myers Bch. FriendsOfLoversKey.org. Usui Reiki Level II – 7pm. Learn long-distance healing method using channeled universal life force energies. Symbols, visualizations, meditations and exercises are included. Attunement and certification available upon completion. Prerequisite: Usui Reiki
66
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
natural awakenings
April 2017
67
Level One. $50. The Labyrinth 12995 S Cleveland Ave, Ste 108, Ft Myers. RSVP: 939-2769.
FRIDAY, APRIL 7 Healing in America Certified Energy Healing Therapy Development Level I Class –Apr 7-9. Contact credits for massage therapists and nurses. $425. Private home in Naples. Karen CoratelliSmith regional director: 692-9120 or kSmith727@ comcast.net. Info: HealingInAmerica-Southeast.org. Art Walk – Mar 3-4. 6-10pm, Fri; 11am-4pm, Sat. Fourteen art galleries invite locals and visitors to a self-guided walking tour throughout downtown Fort Myers River District core and the Gardener’s Park area. Art enthusiasts can meet the artists and enjoy the live art demonstrations. FortMyersArtWalk.com. Healing Sound Concert – 7-8:30pm. With Nathan Dyke. Experience sounds and vibrations in your body as Dyke plays a variety of indigenous instruments in an intuitively guided sound healing concert. Each person will experience the vibrations on their own bodies. $20. 6710 Winkler Rd, Ste 2, Ft Myers. RSVP: 277-1399. LotusBlossomClinic.com.
SATURDAY, APRIL 8 Thoracic Outlet Syndrome – 9am-3pm. LMT continuing education with Tony Kicklighter. 6 CEUs. $125. Florida Academy, Colonial Center, 4387 Colonial Blvd, Ft Myers. 489-2282. See ad on page 37 and news brief on page 16. One True Love: Accessing Akashic Records – 10am-5pm. With Lorraine Meyer, RM. Akashic
records, “book of life”, a collection of events and knowledge encoded on etheric plane, could be accessed to expand awareness and enhance your life. $195. 9200 Bonita Beach Rd, Ste 204, Bonita Springs. Preregister: 948-9444. SilviaCasabianca. com. See news brief, page 12.. Open House – 11am-4pm. Topic: You vs Pain. Enjoy classes, demos, special offers and samples. Meet the health partners and learn about services: thermography, hypnotherapy, acupuncture, massage, IN.FORM health coaching, stress and pain relief, Foundation Training, yoga, qigong and more. Be Well Natural Health Clinic, 1032 Goodlette Rd, Naples. 250-9312. BeWellNaples.com. See ad, page 21. Complimentary Reiki Circle – 1-2pm. Reiki master Addy Huff will explain the practice of reiki, how it is similar to the yoga philosophy and how it is used for healing purposes. Participants will enjoy a meditation and will receive reiki energy from experienced practitioners. Wear comfortable clothing and bring water, journal and pen. Donations collected with proceeds going to Parkside Elementary lunches in East Naples. 6200 Trail Blvd, Naples. 598-1938. greenmonkey.com/naples-events. Experiential Meditation Course – 1-4pm. With Bill McLaughlin. Learn the mind/body connection method for stress mastery and peak performance.
Stop negative habits and emotions at their source. $20. Be Well Natural Health Clinic, 1032 Goodlette Rd, Naples. 287-3458. ExperientialMeditation.org. See ad, page 33. Movement and Breath for Labor – 2-3:30pm. Join Cheryl Bernardi, with LifeBehold, to prepare your mind and body for labor and birth through movement and breathing exercises. The Family Birth Center of Naples, 2930 Immokalee Rd, Ste 2, Naples. 248-7931. $25/early bird, $30/door. Register: LifeBehold@gmail.com or LifeBehold.com. Feldenkrais ATM – Soften Your Shoulders – 2:304:30pm. With JoAnne Rahl. Learn moves to antidote the 21st-century forward head posture and computer slump and pain. $25/early registration, $30/day of. BKS Yoga Studio, 2900 Tamiami Trl N, Naples. 213-9276. BKSYogaStudio.com. Laughter Yoga and Mindfulness – 3:30-5pm. With Jill Emmerich and Michelle Falco of Monarch Wellness. Learn to cope with everyday life challenges through laughter and positive mindfulness. Sponsored by Monarch Wellness and the Mental Health Association of Southwest Florida. Free. Lowdermilk Park, Naples. Preregistration required: 231-3208. MonarchWellness.net. Kirtan – 7pm. With Rick Franz. Love Yoga Center, 4949 Tamiami Tr N, Ste 204, Naples. 692-9747. LoveYogaCenter.com. See ad, page 22.
SUNDAY, APRIL 9 Crystal Bowl Meditation – 10am, 1pm & 7:30pm. With Cathy Blair. Relax, revitalize and recalibrate through the loving harmonics of the crystal singing bowls. Find your peaceful center so you move through your days with grace and ease while shining your light. Bring pillow, mat and blanket. $20 cash or check. The Original Salt Cave, 4962 Tamiami Tr N, Naples. 398-3953. Eckankar Worship Service – 11am. Topic: God’s River of Love. ECK Center of Southwest Florida, 12995 S Cleveland Ave, Ste 155, Ft Myers. 4824034. See ad, page 76. Mindfulness.net.
MONDAY, APRIL 10 Full Moon/Sunset/Bird Rookery Kayak Tour – 5:30-8:30pm. With GAEA Guides - guided kayak nature tours.. Caloosahatchee River near Ft Myers. RSVP: 694-5513. Is Your Thyroid in Distress? – 6:15-8pm. Learn about the signs and symptoms of thyroid disease and a seriously-out-of-balance gut which may be at the bottom of your fatigue, hair loss, weight loss issues, severe allergies and more. $15. 6710 Winkler Rd, Ste 2, Ft Myers. RSVP: 277-1399. LotusBlossomClinic.com. Full Moon Mondays – 7:30-8:30pm. With Gus Komninos. Yoga under the light of the full moon
68
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
FARM ANIMAL
PETTING
ZOO!
STRAWBERRIES, tomatoes, squash, zucchini, black-eye peas, green beans, okra, egg plant, cucumbers, bell peppers, jalapeno peppers, banana peppers, papayas, avacados, swiss chard, kale, turnip greens and more... MILKSHAKES and HOMEMADE GIFT BASKETS!
18672 SR 31, Alva
GEM AND FOSSIL MINING
PAN FOR GEMS,SHARKS TEETH AND FOSSILS
natural awakenings
April 2017
69
will consist of 108 sun salutes. Komninos leads four groups of 27 sun salutes, beginning with the most accessible version. All levels. $5/advance, $10/door. All proceeds benefit the Naples Art Association. Young Plaza at the von Liebig Art Center, 585 Park St, Naples. 598-1938. greenmonkey.com/ naples-events.
TUESDAY, APRIL 11 Journey Beyond Words – 5:45-7:15pm. Also 4/25. Join on a small-group journey thru this companion study class for the Course in Miracles. $25/session. Email for questions and special south Ft Myers location details: Deb@LotusBlossomClinic.com.. Full Moon Celebration – 6:45pm. With Cathy Blair. Honor the full moon as we recalibrate and set our intentions of peace and harmony for all of humanity. Join with like minded souls setting an intention for the foundation of the New Earth frequencies. Bring beach chair or towel. Love offering going to wildlife rescue. Miramar Public Beach on Gulf Shore Blvd N (southernmost public beach) off Harbour Dr, Naples. 398-3953.
WEDNESDAY, APRIL 12. Spiritual Communion Prayer Service – 6:457:15pm. Meditate during this special Prayer Service for the celebration of Maundy Thursday and the Last Supper. Love donation. Unity of Fort Myers, 11120 Ranchette Rd. 278-1511. UnityOfFortMyers.org.
THURSDAY, APRIL 13 Usui Reiki Level II – Learn long distance healing method using channeled universal life force energies. Symbols, visualizations, meditations and exercises are included. Attunement and certification available upon completion. Prerequisite: Usui Reiki Level One. $50. The Labyrinth 12995 S Cleveland Ave, Ste 108, Ft Myers. RSVP: 939-2769.. Earth Day Reuse and Recycle Roundup – 9am4pm. Collier County Solid and Hazardous Waste Management will host a free pharmaceutical takeback by Drug Free Collier’s Operation Medicine Cabinet; free tire recycling; auto and home products and devices for recycling; free paper shredding by Goodwill Secure Shred; and clothing, shoes and books collected by Goodwill Industries for resale. Goodwill Towne Centre, 3579 E Tamiami Tr. 2527575. See article, page 30.
70
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
Alienated Grandparent Anonymous (AGA) – 5-6pm. Provides information and support for grandparents that have been cut off from access to their grandchildren. Collier County Regional Library, Central Ave and 7th St, Naples. Info@AGA-FL. org. AGA-FL.org. The Autism Epidemic – 6:30pm. With Deborah J Post, ARNP. The Center For Disease Control says one out of 50 children will fall into the autism spectrum. We will look at the multiple causal factors that potentially contribute to this devastating diagnosis and what can be done to prevent it. Wellbridges Health Center, 9200 Bonita Beach Rd, Ste 213, Bonita Springs. RSVP: 231-8354. Violet Bell Live – 7-9pm. Lizzy Ross and Omar Ruiz-Lopez, based out of Durham, NC, make folk-soul music that sings in your bones. Multiinstrumentalist Omar Ruiz-Lopez elevates the music with violin, guitar, cello, mandolin, and stellar vocal harmonies. $15/tickets; members/free. The Happehatchee Center, 8791 Corkscrew Rd, Estero. 9925455. Happehatchee@gmail.com. Happehatchee. org. See news brief, page 10.
FRIDAY, APRIL 14 Introduction to Mindfulness-Based Stress Reduction (MBSR) – 9:30-10:30am. With Madeline Ebelini, MA, RYT. Preview of internationally acclaimed eight-week stress-reduction course using mindfulness meditation, gentle yoga and scientific research pioneered by Dr Jon Kabat-Zinn at U Mass. Free. Advance registration requested. Integrative Mindfulness, Fountains Professional Park, 3372 Woods Edge Cir, Ste 102 Bonita. 590-9485. IntegrativeMindfulness.net. Satya Prema Ethereal Arts – 7:30-9:30pm $20. Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio.com. Good Friday Candlelight Service – 5-6pm. Join for a sacred candlelight service on Good Friday reflecting on one’s own spiritual transformation. Love donation. Unity of Fort Myers, 11120 Ranchette Rd. RSVP: 278-1511. UnityOfFortMyers.org. Women’s Gathering – 7pm. A bimonthly gathering for women over 21 to discuss women’s issues in society, religion and relationships. Support and empower other women and network. Vent in a safe environment. Refreshments will be served. $5. The Labyrinth, 12995 S Cleveland Ave, Ste 108, Ft Myers. RSVP: 939-2769.
SATURDAY, APRIL 15 Chronic Tension Headaches – 9am-3pm. LMT continuing education with Tony Kicklighter. 6 CEUs. $125. Florida Academy, Colonial Center, 4387 Colonial Blvd, Ft Myers. 489-2282. See ad on page 37 and news brief on page 16. Psychic Development for Kids – 10-11am. With Paulette McDaniel. A monthly class for children to learn more about spiritual gifts and how to use them and most importantly, they will learn they are not alone in their uniqueness. $15. The Mystical Moon Ft Myers, 8890 Salrose Ln, Ste 107, Ft Myers. RSVP: 939-3339. Women of UniTea and The Men’s Group – 10amnoon. 3rd Sat. Monthly luncheon where ladies socialize and learn from the talents and expertise of different guest speakers each month. A gathering for the gentlemen also includes a guest speaker each month. Bring a dish to share. Love donation. Unity
of Fort Myers, 11120 Ranchette Rd. 278-1511 or Office@UnityOfFortMyers.org. 28.. Freedom and Balance in the Hips – 1:30-4:30pm. With Meredith Musick. An all levels yoga workshop for athletes and yogis alike, to improve overall pelvic/hip balance to unleash the power of the spine. $35/early registration, $40/day of. BKS Yoga Studio, 2900 Tamiami Tr N, Naples. 213-9276. BKSYogaStudio.com. See ads, pages 32 and 73.
SUNDAY, APRIL 16 Easter Sunrise Service – 7-8am. Gather outside at the beautiful gazebo beside Peace Lake on our sacred campus for the annual Easter Sunday Sunrise Service will be facilitated by Licensed Unity Teacher Christina Bowman. Socialize afterwards in our Friendship Hall enjoying coffee and refreshments, then plan to stay for the Easter Flower Service in the Sanctuary. Love donation. Unity of Fort Myers, 11120 Ranchette Rd. 278-1511. UnityOfFortMyers.org. Easter Flower Service – 10-11:15am. During this traditional Easter Service, celebrate your personal
resurrection with flowers, blessings and personal reflection. This sacred event with be Rev Jim Rosemergy’s last Easter teaching before his retirement. Unity of Fort Myers, 11120 Ranchette Rd. 278-1511. UnityOfFortMyers.org. See news brief, page 16. Gentle Plus Yoga Nidra – 10-11:30am. With Susan Weinman. A 60-minute gentle yoga class, suitable for all levels, followed by 30 minutes of yoga nidra, a form of guided meditation. $20/ drop-in or regular class packages apply. BKS Yoga Studio, 2900 Tamiami Tr N, Naples. 213-9276. BKSYogaStudio.com.
TUESDAY, APRIL 18 Rune Casting for Beginners – 2.
WEDNESDAY, APRIL. Stress, Hormones and Health Event – 6:30pm. With Evie Breedlove-Mangapora. For those who are tired of being sick and tired. Free $10 gift card to Food & Thought for the first 10 to RSVP and attend. 9200 Bonita Beach Rd, Ste 213, Bonita Springs. RSVP required: 777-4647. See ad, page 22. Healing Night Sound Immersion – 7pm. With Cathy Blair. Bathe in the loving frequencies of the singing bowls and the healing vibrations of the Himalayan salt. Bring all aspects of self into alignment for your soul’s expansion into oneness. Bring beach chair and blanket. $25 cash or check. The Original Salt Cave, 4962 Tamiami Tr N, Naples. 398-3953. Numerology for Beginners – 7 Nutrition Class – 7-8:30pm. Nutrition for pregnancy, lactation, postpartum and family. Pregnant moms receive a free gift. The Family Birth Center of Naples, 2930 Immokalee Rd, Ste 2. 594-0400. Register: FBCNaples@gmail.com.
THURSDAY, APRIL 20 Book Giveaway – 8am-5pm. Dr Mark Corke will distribute the book The Poison in Your Teeth, by Dr Tom McGuire. Watch the video Evidence of Harm, a new documentary about mercury fillings. Call the
natural awakenings
April 2017
71
ing the native habitats for the benefit of wildlife, providing aquifer recharge and nature-based education and recreation for residents. Free. 6315 Pepper Rd, Immokalee. Register: 252-2961.
office for a tour or with questions on holistic care. Laser Dentistry, 1550 Matthew Dr, Ft Myers. 9365442. FortMyersLaserDentist.com.. Peaceful Mind – 6-7:30pm. Every third Thursday of the month. With William Ward and Peggy Sealfon. Unwind and energize through use of Restorative Sound (crystal and Tibetan bowls) and Integrative Relaxation (yoga nidra). $80/4 classes. Client discount available. Monarch Wellness, Naples. Preregistration required: 231-3208. MonarchWellness.net. Decluttering Tag Sale – 6:30pm. Help us get rid of things no longer required or not selling. All kinds of stuff, including books, massage equipment, candles, CDs. Nominal prices. Bring tea or crackers for meet and greet and buy cool stuff. 9200 Bonita Bch Rd, Ste 204. Preregister: 948-9444. SilviaCasabianca.com.
FRIDAY, APRIL 21 Earth Day Presentation/Guided Walk – 11am. Guided trail walk through the interior wetlands and mid-island ridges of the Center Tract with discussion of native habitats, natural and cultural history and preservation efforts. Meet at the Nature Center and proceed to the trails. $5/nonmembers; members and children free. Sanibel-Captiva Conservation Foundation, 3333 Sanibel Captiva Rd, Sanibel. 472-2329. Blog.sccf.org. See article, page 30. Gaia Earth Day – Can’t Stop the Feeling – 6-8pm. Celebrate Earth Day in grand style with a Glow Dance party with DJ for children 6 to 12 years old. Shine in the dark; dress up, face painting, music, dancing and celebrate life together. Parents can drop kids off or stay. Healthy snacks will be available. $10/child, $5/siblings. House of Gaia, 1660 Trade Center Way, Ste 1, Naples. Info: 272-6152 or HouseOfGaia.org. See article, page 30.
72
Collier/Lee Counties
Lee County Great American Cleanup – 9am-noon. Part of the nationwide Great American Cleanup effort, projects include community gardens, habitat restoration, invasive plant removal, litter-free events, litter cleanups, landscape maintenance and planting, playground/park equipment restoration and tree plantings throughout Lee County. Location of sites and event dates vary. Info/register: 334-3488 or klcb.org/ great-american-cleanup.html. See article, page 30. Music Walk – 6-10pm. The River District comes alive on the third Friday of the month as local and regional musicians line the streets. From jazz and blues to rock & roll, many genres can be heard and vary each month. Free to the public with many venues featuring additional attractions and specials. Downtown Ft Myers. RiverDistrictEvents.com. Reiki Healing Circle – 7pm. Let the power of reiki help promote healing on the physical, mental, emotional and spiritual levels. Free. The Labyrinth, 12995 S Cleveland Ave, Ste 108, Ft Myers. RSVP: 939-2769. Connect to the Healer Within –7-9pm. With Dan and Karin. Firefly Within hosts an evening of learning, conversation and sharing of reiki energy to awaken and connect to the healer within. Donation for local charity groups. Kunjani Café, 780 Seagate Dr, Naples. 980-3257. FireflyWithin.com.
SATURDAY, APRIL 22 Reiki Level I Intensive – 8:30am-8pm. With Silvia Casabianca, reiki master. Become a reiki practitioner. Heal self, support others. Reiki history, precepts, chakras, qigong applied to reiki, hand positions, attunements. $165. 12 FL CEUs, nurses, MHC, LMTs, midwives, nutritionists, CSWs, MFTs. 9200 Bonita Beach Rd, Ste 204, Bonita Springs. Preregister: 948-9444. SilviaCasabianca.com. Pepper Ranch Preserve Guided Hike – 9am. The 2,512-acre Conservation Collier preserve property was acquired with the goals of protecting and restor-
swfl.NaturalAwakeningsMag.com
Rain Barrel Workshop and Native Plant Sale – 9am-noon, workshop; 9am-1pm, plant sale. Shop for native plants and learn how rain barrels save money and resources by gathering and storing rainwater safely for yard watering. Lee County master gardeners will answer questions at the sale and workshop. Free admission; $45/workshop includes barrel. Rotary Park Environmental Center, 5505 Rose Garden Rd, Cape Coral. Register: 549-4606 or CapeParks.com. See article, page 30. Arbor Day Celebration – 9am-2pm. This event features native plants and trees for sale, along with demonstrations and exhibits. Enjoy live music, poster contest, giant slide, free trees, and free ice cream to the first 50 kids. Riverside Park, 10450 Reynolds St off Old US 41. 949-6262 or CityOfBonitaSprings.org. See article, page 30. Earth Day BOGO – 9am-4pm. In celebration of Earth Day, the Rookery Bay Environmental Learning Center offers buy one, get one free admission. Cannot be combined with other offers. Must pay at door. $5/adults, $4/children ages 6-12, under 6 free. 300 Tower Rd, Naples, Register: 530-5972 or RookeryBay.org. See article, page 30. Earth Day at Naples Botanical Garden – 9am5pm. Origami in the Garden is being exhibited until 4/23. Members and children 3 and under free, $14.95/adults, $9.95/ children ages 4-14. 4820 Bayshore Dr. 643-7275 or NaplesGarden.org. See article, page 30. Prenatal Massage – 9am-6pm. LMT continuing education with Mary Ann Chirichella. 8 CEUs.
$175. Florida Academy, Colonial Center, 4387 Colonial Blvd, Ft Myers. 489-2282. See ad on page 37 and news brief on page 16.
children, $10/adults, free for first 50 children age 3-12. Calusa Nature Center, 3450 Ortiz Ave and Colonial Blvd, Ft Myers. CalusaNature.org. See article, page 30.
Earth Day at the Refuge – 10am-1:30pm (programs); 7am-7pm, Wildlife Drive is open free to bikers and hikers ($5/vehicle). Schedule: 1010:30am, Family Craft and Story or Gators and Crocs Program; 11-11:45am, Bag it!: Is Your Life Too Plastic? film showing; 1-1:30pm, Birds of the Refuge Program. JN Ding Darling National Wildlife Refuge, 1 Wildlife Dr, Sanibel Island. 472-1100. See article, page 30.
Warrior Pose for Pets – 1-2pm. Spend time in downward facing dog, cat pose and all your other favorite asanas while raising money for the Brodie Fund to help pets fight cancer. Enjoy pet vendors at the studio before and after class, purchase raffle tickets for gift baskets. $20/donation & $5/raffle tickets. BKS Yoga Studio, 2900 Tamiami Trl N, Naples. 213-9276. BKSYogaStudio.com. See news brief, page 14.
Conservancy of Southwest Florida Earth Day Festival – 10am-4pm. Vendors and environmental exhibitors, local entertainment, keynote lectures, conservation speakers and children’s presentations. Experience the Conservancy Nature Center buildings, take an electric boat ride, rent a kayak or canoe or walk a nature trail. Members free, $10/adults, $5/children 3- 12. 1495 Smith Preserve Way, off Goodlette Rd, Naples. 430-2466 or Conservancy. org/events/earthday. See article, page 30.
Introduction to Food Healing – 1:30-4:30pm. Discover the power of the phytochemicals in foods to reverse disease and support radiant health. Enjoy generous samples from the food-healing protocols. $25. 6710 Winkler Rd, Ste 2, Ft Myers. RSVP required: 277-1399. LotusBlossomClinic.com.
Psychic Faire – 10am-5pm. Choose from a list of our experienced readers and healers offering many services: readings/astrology, mediumship, tarot/ palm readings, reiki. $25/20 minutes. The Mystical Moon Bonita Springs, 8951 Bonita Beach Rd SE, Ste 255, Bonita Springs. RSVP: 301-0655. Musical Earth Day Program – 10:30-11:30am. Led by Carolyn Stanley. Geared for ages 3 to 12, there’ll be music and other activities related to water and trees. Children will sing songs, make rhythm instruments and draw pictures while learning how to care for the environment and why trees are essential for our survival. Sponsored by Fort Myers Quakers. $5/
SUNDAY, APRIL 23 Fourth Annual YogaCAN – 8am, doors open; 9:30am, classes begin. Local yoga leaders unite to raise donations for the Cancer Alliance of Naples. Providing financial support to Collier and Lee County residents being treated for cancer. Includes yoga class and refreshments afterwards. $40/donation ahead, $50/door, $10/kids. 643-4673, ext 203. Naples Beach Hotel, 851 Gulf Shore Blvd N, Naples. Register: CancerAllianceOfNaples.org. See news brief, page 16. Koreshan Farmers’ Market and Native Plant Sale – 8am-1pm. Local fresh produce, seafood, honey, arts and crafts, pickles and olives, fresh mozzarella cheese, native plants and trees available for purchase. Native plant experts from the Coccoloba
Chapter of the Florida Native Plant Society will be on hand to answer questions and give advice. $1 environmental impact fee. 3800 Corkscrew Rd, Estero. 273-8945 or FNPSCoccoloba.org. See article, page 30. Rev Jim Rosemergy’s Swan Song – 10-11:15am. Rev Jim Rosemergy is retiring after 41 years teaching Unity Principles and spiritual ways of living, and 11 years at Unity of Fort Myers. Join us as we honor this highly respected teacher, distinguished author of over a dozen books and world-renown spiritual leader during his final Sunday Service of his illustrious career. Love donation. Unity of Fort Myers, 11120 Ranchette Rd. 278-1511. UnityOfFortMyers. org. See news brief, page 16. Eckankar Community HU Chant –11am. ECK Center of Southwest Florida, 12995 S Cleveland Ave, Ste 155, Ft Myers. 482-4034. Relax and Restore – 2-4pm. With Marjorie McShand and Katie Mulligan. An extended restorative yoga style workshop including aromatherapy, hands-on adjustments and relaxing head/hand/foot massages. $45/early registration, $50/day of. BKS Yoga Studio, 2900 Tamiami Tr N, Naples. 213-9276. BKSYogaStudio.com. Sacred Sound Ceremony – 6:30-8:30pm. $20. Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio.com.
MONDAY, APRIL 24 Foundations of Kabbalah – 6:30pm. With North Miami Beach Kabbalah Center. Acquire rarely seen perspective by which you can significantly improve quality of life and the world around. Learn roots of most powerful Kabbalah secrets. Integrate spiritual
natural awakenings
April 2017
73
Blvd, Ft Myers. RSVP: 533-7557 or SloughConnections@gmail.com. See article, page 30.
principles into daily routine. Free. 9200 Bonita Beach Rd, Ste 204, Bonita Springs. Preregister: 948-9444. SilviaCasabianca.com. See news brief, page 12.
New Moon Celebration – 7pm. With Cathy Blair. Set an intention for the new you envision. Let the singing bowls reveal your piece in the divine plan and carry your requests up into the universe. Wrap yourself in the loving harmonics of the singing bowls. Bring beach chair and blanket. $25 cash or check. The Original Salt Cave, 4962 Tamiami Tr N, Naples. 403-9170.
TUESDAY, APRIL 25 Numerology for Beginners – 2.
THURSDAY, APRIL 27
The Skinny on Weightloss – 6pm. With Dr Claudia Marcelo. Successful strategies for a new you. Hughes Center for Functional Medicine, 800 Goodlette Rd, Ste 270, Naples. 649-7400. HughesCenterNaples.com. See ad, page 87.. There is No Incurable – A New Path to Health for Body and Soul – 7pm. Dr Matjaz Lesjak MD, a member of the Medical Scientific Group of the Bruno Gröening Circle of Friends will present lectures about spiritual healings, medically verifiable. Free, donations appreciated. Tony Rotino Senior Center, 5817 Driftwood Pkwy, Cape Coral. 414852-2222. Bruno-Groening.org. See ad on page 20 and news brief on page 13. Ecstatic Kirtan – 7:15-8:45pm. With Missy Balsam. An evening of connection, community building and heart-opening singing. No experience necessary. $15 love offering. House of Gaia, 1660
74
Collier/Lee Counties
Trade Center Way, Ste 1 & 3, Naples. 272-6152. HouseOfGaia.org.
WEDNESDAY, APRIL 26 Eckankar Community HU Chant – 6:45pm. Vineyards Community Center, 6321 Arbor Blvd, Naples. 482-4034. Eckankar Spiritual Discussion – 7:30pm. Topic: Spiritual Wisdom on Life after Death. Vineyards Community Center, 6321 Arbor Blvd, Naples. 482-4034. Invasive Species Presentation – 7pm. Annisa Karim of SW Florida Cooperative Invasive Species will give a presentation on combating invasive plants and animals, an introduction to regional efforts and reporting options. Free; seating is limited. Interpretive Center, Six Mile Cypress Slough Preserve, 7751 Penzance
swfl.NaturalAwakeningsMag.com
Open House – 3-7pm. Free makeovers by Jane Iredale and La Bella Donna (by appointment), free 10-minute mini-facials (cleanse and moisturizer), $1/minute chair massage, free food, wine and prizes drawn every hour. 15 percent off storewide. $20/door (refunded with purchase). Organic Skincare and Bodyworx. 13240 Tamiami Tr N, Ste 207, Naples. 514-4494. OrganicSkincareAndBodyworx.com. Acupuncture: Ancient Medicine for Today’s Patient – 5:30-6:30pm. With Naples premier classical homeopath and doctor of Oriental medicine Dr Julia A Eastman, DOM, CCH. Informative program for adults – yoga class provided for children in attendance. Q&A to follow. $10/yoga class. House of Gaia, 1660 Trade Center Way, Ste 1 & 3, Naples. RSVP: 272-6152. HouseOfGaia.org. Thyroid Demystified – 6:30pm. With Deborah J Post, ARNP. Many patients hear from their doctor that their thyroid lab work is within normal limits. Yet the symptoms of hypothyroid persist and no one listens. Attendees will learn why they may be right and how to understand their thyroid and what labs tell the real story. Wellbridges Health Center, 9200 Bonita Beach Rd, Ste 213, Bonita Springs. RSVP: 231-8354.. Rune Casting for Beginners – 7. John of God and The House of Saint Ignatius of Loyola 2018 Journey Discussion and Movie – 7-9pm. With John of God Casa Guides Karen Coratelli-Smith and David Karg. Learn about the John of God, the man, The Entities of Light, Saint Ignatius of Loyola, and the spiritual journey opportunity. Private home in Naples. Reservations required: Karen: 692-9120 or kSmith727@ comcast.net. Naples Storytelling Guild – 7-9pm. Community of storytellers and storylisteners. Bring a story, or just come to listen. Practice stories, get feedback, have fun. Office of Dr Joel Ying. Free. 2335 Tamiami Tr N, Ste 206, Naples. OpenDreaming.com/naplesstorytelling-guild.
FRIDAY, APRIL 28 Healing in America’s Community Healing Session – 6:15-8:40pm. With Karen Coratelli-Smith and David Karg. Join 24 guests and 12 healers for this amazing evening of energy healing therapy. $20. Unity of Naples, 2000 Unity Way. Reservations required: Karen: 692-9120 kSmith727@ comcast.net. Pet Walk – 6-8pm..
SUNDAY, APRIL 30Mindfulness.net. Kundalini Yoga Gong Bath – 2-4pm. With DamaDe’. A Kundalini yoga class followed by the sound therapy of the gong while you lie in savasana. $25/early registration, $30/day of. BKS Yoga Studio, 2900 Tamiami Tr N, Naples. 213-9276. BKSYogaStudio.com.
plan ahead SATURDAY, MAY 6 World Labyrinth Day – 12:30pm. Attendees will participate in a Labyrinth meditative walk followed by a closing ceremony, and then enjoy herbal grounding tea. Donation. The Happehatchee Center, 8791 Corkscrew Rd, Estero. 992-5455. Happehatchee.org.
TUESDAY, MAY 9 Picnic ’n’ Flick – 6:30pm. See an inspirational film, Sing Street, and an opportunity to share with the group afterward. Bring food to nosh during the movie and a blanket and pillow if you so desire. The film, about bullying and youthful angst, illustrates how at the core, we have more in common than
what seems to divide us on the surface. PG-13. Love donation. House of Gaia, 1660 Trade Center Way, Naples. RSVP: Info@HouseOfGaia.org. Meetup.com/TreeSisters-of-the-Sacred-Forest-ofSouthwest-Florida.
SATURDAY, JUNE 3 Vianna Stibal’s ThetaHealing Dig Deeper Advanced Weekend Class – Jun 3-4. With Karen and David. Class offers practitioner’s authority to practice the work. Prerequisite: ThetaHealing Basic and advanced courses. $444. Private home in Naples. Preregistration required: Karen Coratelli-Smith licensed ThetaHealing Instructor: 692-9120 or kSmith727@comcast.net. Info: ThetaHealing.com.
FRIDAY, JUNE 9 ThetaHealing Basic DNA Weekend Class – Jun 9-11. $444 includes Vianna Stibal’s ThetaHealing book. Private home in Naples. Preregistration required: Karen Coratelli-Smith, Licensed ThetaHealing instructor: 692-9120 or kSmith727comcast.net. Info: ThetaHealing.com.
SATURDAY, AUGUST 12 John of God and The House of Saint Ignatius of Loyola Spiritual Journey – Aug 12-27. With John of God casa guides Karen Coratelli-Smith and David Karg. Join for an enlightenment opportunity of a lifetime in Abadiania, Brazil. Everything is taken care of for you. Set your intentions for healing of emotions, mind, body and soul. Travel is from Miami to Brazilia, transfers, R&B, Casa donation all included. Info/register: 692-9120 or KSmith727@ comcast.net.
SATURDAY, APRIL 29 Art and the Consciousness of Oneness – 10amnoon. With Jose Maria Castillo. This monthly interactive workshop includes lecture, meditation, observing sketch, as well as sketching by participants. $25 or $20/OMZ members/students. Supplies required. Open Mind Zen Naples, 1250 Tamiami Tr N, Ste 205. Register: 961-2491 or OpenMindZenNaples.com.. Monarch Wellness Open House – 1-6pm. Join in celebrating their five year anniversary as an integrative wellness practice. Sample wellness classes and meet their professional counselors and wellness teachers. Free. Drop by South/East Naples location, 1-3pm at 12264 Tamiami Tr E, Ste 202, Naples; Central Naples location, 3-6pm at 843 Myrtle Terr, Naples. RSVP: 231-3208. See news brief, page 10.
natural awakenings
April 2017
75.
sunday. The Gypsy Sea Witch – 8am-1pm. Vendor booth specializing in the highest-quality crystals, sage, incense, herbs and other spiritual tools. $1 environmental impact fee collected at Koreshan State Historic Site, 3800 Corkscrew Rd, Estero. 754-444-9779. Nicole@TheGypsySeawitch.com. TheGypsySeaWitch.com. Beginners’ Orientation: An Introduction to Meditation Postures and Techniques – 9:15-10am. Last Sunday. Get to know our style of practice, our
76
Collier/Lee Counties
lineage, ways to practice Open Mind Zen. Cushions and chairs provided. $10 suggested donation. Open Mind Zen Naples, 1250 Tamiami Tr N, Ste 205. 961-2491. OpenMindZenNaples.com./youth and family ministry – 10am. With Rev Jim Rosemergy, senior minister. Join at 9:30am for The Gathering, a 20-minute meditation and reiki session before and after service. 11120 Ranchette Rd. 278-1511. UnityOfFortMyers.org. Unity of Naples – 10am. Service and Sunday school conducted in open, accepting and empowering environment. Children deepen their relationship with God. Nursery care provided. Naples. 775-3009. NaplesUnity.org. Yoga at the Garden – 10-11am. With Susie Lentz, of greenmonkey yoga. Students can enjoy yoga surrounded by the beauty of the Naples Botanical Gardens on the Kapnick Caribbean lawn. $10/members, $20/nonmembers (includes admission to the Garden). 4820 Bayshore Dr, Naples. 598-1938. Zen Meditation and Dharma Talk – 10-11:30am. With Andy Solis or Laurie Lyons. Includes silent
swfl.NaturalAwakeningsMag.com
seated and walking meditation. Concludes with open discussion. $10 suggested donation. Open Mind Zen Naples, 1250 Tamiami Tr N, Ste 205.. Fort Myers Quakers – 10:30am. Refresh yourself with silent worship. Iona House, Calusa Nature Center, 3450 Ortiz Ave, Ft Myers. 437-4615. FortMyersQuakers.org or FtMyers.Quakers@gmail.com. Spiritual Study Group – 10:30am. With Rev Joyce Heist. Study and discuss Science of the Mind principles. Happehatchee Center, 8791 Corkscrew Rd, Estero. sjoyceh@aol.com. Unitarian Universalist Congregation of Greater Naples – 10:30am. Service, youth classes and childcare. Celebrate freedom, reason and compassion. All welcome. 6340 Napa Woods Way, Naples. 4556553. Office@uunaples.org. uunaples.org. Unitarian Universalist Church of Ft Myers Sunday Service – 10:30-11:30am. All welcome. 13411 Shire Ln, Ft Myers. 561-2700. uucfm.org. Children’s Crystal Circle – 11am. With Nikki D. Children ages of 5-17 will explore the world of crystals and meditation and will be able to touch, feel, experience and learn about the magic and history of crystals. Each student will receive a crystal to take home. $10. Koreshan State Historic Site, 3800 Corkscrew Rd, Estero. 754-444-9779. Nicole@ TheGypsySeaWitch.com.TheGypsySeaWitch.com. Cycling Class for Parkinson’s – 12:30-2pm. Find support from other people with Parkinson’s, feel better and reduce your symptoms. Physician referral required. Free. Bonita Springs YMCA, 27200 Kent Rd. Marla Ramsey: 221-7560. Southwest Florida Amma Satsang – 2-5pm. 2nd Sun. Share in Amma’s blessings; meditation, bhajans, videos of Amma and her teachings. Veg-
etarian potluck afterwards. Free. Cape Coral. Info: 671-6058 or Kessel.Joyce@gmail.com..
and with ease which cultivates strength, balance and awareness. $10 (packages available). AHA! A Holistic Approach Center, 15971 McGregor Blvd, Ft Myers. 433-5995. Journey Within Meditation – 6-7pm. Crystal bowls and guided meditation will lead you into relaxation followed by reiki energy healing. Receive a personal message to continue your journey. 100 percent of donations go to local charity groups. Kunjani Craft Coffee and Gallery, 780 Seagate Dr, Naples. 980-3257 or FireflyWithin.org. Strength Class – 6-7pm. This coed, full-body conditioning class changes with a monthly theme for a completely unique workout each time. $18/drop-in. Beyond Motion, 11985 Tamiami Tr N, Naples. 2549300. Go2BeyondMotion. Sunset Beach Yoga – 6:45-7:45pm. With Sue Rokela. Students can enjoy yoga surrounded by the beauty of nature. Check Facebook for weather cancellations. $5 plus state park entry fees. DelnorWiggins Pass State Park, 11135 Gulfshore Dr, Naples. 598-1938. greenmonkey.com/naples-schedule.. Candlelight Yoga Flow – 7-8pm. With Dina Radcliffe, RYT. $15/drop-in or $120/10 classes. Integrative Mindfulness Studio, Fountains Professional Park, 3372 Woods Edge Cir, Ste 102, Bonita Springs. 280-9095. IntegrativeMindfulness.net.. Mindfulness Meditation – 7-8:15pm. This informal class will explore the techniques of mindful meditation. Chairs and cushions provided. $10/suggested donation. Open Mind Zen Naples, 1250 Tamiami Tr N, Ste 205. 961-2491. OpenMindZenNaples.com. Compassionate Friends: Collier County Group – 7:30pm. 2nd. Nu Tango Practica – 8-9:30pm. 1st & 3rd Mon. Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio. Yoga for Anxiety Relief – 10:30-11:30am. With Michelle Falco, RYT. Gentle class to calm the body with yoga specific self-talk skills. $50/4 classes; client discount available. Monarch Wellness, Naples. Preregistration required: 231-3208. MonarchWellness.net. Reverse the Age of the Spine Series – Noon-1pm. Using the Great Yoga Wall with Meredith Musick. For private location in Naples and more info: 269-8846.. Yoga Regulators – 5-6pm. Specialized yoga for active kiddos to improve behavior, focus, and attention through learning self-control and appropriate release of energy. Ages 7-12. $80/4 classes. Client discount available. Monarch Wellness, Naples. Preregistration required: 231-3208. MonarchWellness.net. Yoga – 5:15pm. Knowledgeable teachers, small groups. $15. Health and Wellness Sanctuary, Naples. 269-2221. Gentle Yoga – 6-7pm. Slow-flow mixed with restorative. You’ll be guided to move with your breath
natural awakenings
April 2017
77
tuesday
Therapeutics Class – 1-2pm. Awakening Through Synergy, 1084 Business Ln, Naples. 529-7582. AwakeningThroughSynergy.com.
wednesday
Yoga – 8:30am. With Julie Christenbury. Beginners to intermediate. Small classes to suit your needs. Boost physical/emotional well-being. Gain balance, strength. $18. Bonita Springs. RSVP: 948-9444. SilviaCasabianca.com.
Hatha Yoga – 5:30pm. With Chris Neal. Beginners to advanced. Relax, improve balance, range of motion, performance. $18. Private classes available. Eyes Wide Open Center, 9200 Bonita Bch Rd, Ste 204, Bonita Springs. 948-9444. EyesWideOpenCenter.com.
Food Addicts in Recovery Anonymous (FA) – 9am. A 12-step program for food addiction. No dues, no fees, no weigh-ins. Community Congregational Church, 15300 Tamiami Tr N, Naples. Nancy: 352-0527.
Transformational Yoga – 9-10am. Meditative class to tune into a deep inner mind/body connection. $50/4 classes; client discount available. Monarch Wellness, Naples. Preregistration required: 2313208. MonarchWellness.net.
Meditation – 6pm. Donation. Health and Wellness Sanctuary, Naples. 269-2221..
Hatha Yoga – 9-10:30am. With Meredith Musick. All levels. BKS Yoga Studio, 2900 Tamiami Tr N, Naples. 269-8846. MeredithMusick.com. Women’s Overeaters Anonymous Step Writing Meeting – 10am. Free. 9470 Corkscrew Palms Circle, Ste 104, Estero. Sandy: 973-809-5338 or Helen: 247-0385. Pilates Level I Foundations – 10am-10:50am. With Susan Mann, PT, DPT. Learn the basics to progress your strength, flexibility and balance safely. Fitness for Life, 28811 S Tamiami Tr, Bonita Springs. 948-5555. Estuary Kayak Tour in Estero Bay – 10am-1pm. Birds, dolphins, manatees and more. $40. Includes equipment and FL master naturalist guide. GAEA guides, Bonita Bch. 694-5513. Foundation Training – 10:30-11am. With Harry Grimm. Correct your posture, strengthen your core and avoid back and neck pain at any age. Golfers and desk jockeys alike can improve their game and end their pain. First class free. Be Well Natural Health Clinic, Colonial Square Office Park, 1032 Goodlette Rd, Naples. 227-0021. – 1-2pm. With Dina Radcliffe, RYT. $15/drop-in or $120/10 classes. Integrative Mindfulness, The Fountains Professional Park, 3372 Woods Edge Cir, Ste 102, Bonita Springs. 280-9095. IntegrativeMindfulness.net.
FUNdamentals of Yoga – 6-7pm. With Ellen Duff. An introduction to yoga that will help to slowly build strength, flexibility and great technique. $10 (packages available). AHA! A Holistic Approach Center, 15971 McGregor Blvd, Ft Myers. 433-5995. Adult Children of Alcoholics (ACA) Group – 6-7:30pm. 12-step program. A fellowship of men and women that have suffered from anxiety or depression and anger after growing up in highly stressful environments. 10051 Plantation Rd, Ft Myers. 931-9009. “Understanding Y” Coed Co-Dependents Anonymous (CoDA) – 6:30-8pm. A 12-step program for men and women. Common purpose is a desire for healthier relationships. 9470 Corkscrew Palms Cir, Ste 104, Estero. David K: 470-0899 or Linda M: 949-4910. Food Addicts in Recovery Anonymous (FA) – 7pm. A 12-step program for food addiction. No dues, no fees, no weigh-ins. Gulf Coast Church of Christ, 9550 Ben C Pratt (6 Mile Cypress), Ft Myers. 338-5948. La Leche League – 7pm. 1st Tue. Mother-to-mother breastfeeding support group. Children welcome. Free. St Hilary’s Episcopal Church, 5011 McGregor Blvd, Ft Myers. lllFlorida.com..
Body/Mind/Soul Consultations – 9am-5pm. By appointment. Health and Wellness Sanctuary, Naples. 269-2221.. Caregiver Support Group for the Blind and Visually Impaired – 10am. 3rd Wed.. Women Seeking Serenity Through the 12 Steps – 10am. Free. Hope Lutheran Church, Old US 41, Bonita. Carol: 405-1947. Exploring Coastal Habitats Walk – Thru April. 1011am. Naturalist guided walk exploring one of the most productive ecosystems in nature. Free. Beach pass required or entrance fee. Barefoot Beach Preserve Learning Center, Barefoot Beach Blvd, Bonita Springs. FriendsOfBareFootBeach.org. Cocohatchee River/Wiggins Pass Estuary Kayak Tour – 10am-1pm. Birds, dolphins and other critters. $45. Includes all equipment and FL master naturalist guide. GAEA guides. N Naples. 694-5513. Peer Support Group for the Blind and Visually Impaired – 12:30-2:30pm. Facilitated by Rick H
Learn to cope and feel less isolated while making connections with others. Lighthouse of Collier, 2685 Horseshoe Dr S, Ste 211, Naples. RSVP: 430-3934. Adult Children of Alcoholic/Dysfunctional Families – 2:30-4pm. If your parents were alcoholics/addicts, let’s overcome that upbringing. Dry Palms Foundation, 1251 Lamar Rd, N Ft Myers. Jane: 728-7106. Locally Grown Produce Market – Thru May. 3-6pm. Purple Spoon Culinary, 25151 Chamber of Commerce Dr, Bonita Springs. Info: ChefKristina.com. Wellness Wednesdays – 4-5pm. April topics: You vs Pain. Drop-in to learn tips from our health partners on what you can do to avoid or reduce pain with thermography, Foundation Training, acupuncture, massage and qigong. Be Well Natural Health Clinic, Colonial Square Office Park, 1032 Goodlette Rd, Naples. Schedule: BeWellNaples.com. Confident Caterpillars – 5-6pm. With Salima Silverman. Children ages 5-12 learn healthy coping skills, build self-confidence and enjoy fun exercise. $80/4 classes; client discount available. Monarch Wellness, Naples. Preregistration required: 2313208. MonarchWellness.com. Art Alive – 5-8pm. 1st Wed. Naples Art District Studio and Gallery Tours consist of more than 36 professional artists showcasing their recent works of art and demonstrating their medium. Meet the artist, party and bring home unique treasures for your home. Look for the magenta and white art flags in the district. 596-5099. Directions/map: NaplesArtDistrict.com. Healing, Prayer and Meditation Service – 6pm. First Wed. Love offering. Unity of Naples Church, Sanctuary, 2000 Unity Way, Naples. 775-3009. NaplesUnity.org. Barre Motion Class – 6-7pm. Naples’ original Pilatesbased, cardio barre class. This high-energy class is ideal for dancers and non-dancers alike. Be prepared to sweat. $18/drop-in. Beyond Motion, 11985 Tamiami Tr N, Naples. 254-9300. Go2BeyondMotion.com. Restorative Yoga – 6-7pm. With Linda Mundt, ERYT. $15/drop-in. Integrative Mindfulness studio, Fountains Professional Park, 3372 Woods Edge Circ, Ste 102, Bonita Springs. 405-7330. IntegrativeMindfulness.net. Creating Harmony Meditation Class – 6:30pm. With Carol May. Open your qi, connect to your still point and in turn create balance, peace and joy. Love donation. Ancient Touch, Sunshine Professional Center, 9200 Bonita Beach Rd, Ste 208, Bonita Springs. 223-5107. Pet Loss and Grief Support Group – 6:30pm. 2nd Wed. Compassionate support: pet loss, medical crisis, chronic illness. Free. 1939 Park Meadows Dr, Ft Myers. 936-1732. Open Social Dancing – 6:30-7pm, group class ($5); 7-9pm, dancing ($12). Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio.com. Crystal Bowl Meditation and Spirit Messages – 7pm. With Nikki D. Recharge your energy, rebalance your chakras, and reconnect to your higher self as well as strengthen your connection with spirit. $15. Koreshan State Historic Site, 3800 Corckscrew Rd Estero. Preregister: 754-444-9779 or Nicole@ TheGypsySeaWitch.com.TheGypsySeaWitch.com.
It is never too late to be
what you might have been. ~George Eliot
La Leche League – 7pm. 3rd Wed. Mother-to-mother breastfeeding support group. Children welcome. Free. Cape Coral Hospital Women’s Center, 2nd fl, 636 Del Prado Blvd S, Cape Coral. lllflorida.com.
natural awakenings
April 2017
79. Meditation Class – 7-8:15pm. Guided meditation and practical advice with Buddhist monk Kelsang Chopag. No experience necessary. $10. Open Mind Zen, 1250 N Tamiami Tr, Ste 205, Naples. MeditationInNaples.org. Nar-Anon Family Groups – 7:30pm. Providing support and hope to those in despair because of a relative or friend’s addiction. Cape Professional Center, 1216 SW 4th St, Ste 6, Cape Coral. 691-3653.
thursday Yoga – 8:30am. With Julie Christenbury. Beginners to intermediate. Small classes to suit your needs. Boost physical/emotional well being. Gain balance, strength. $18. Bonita Springs. RSVP: 948-9444. SilviaCasabianca.com. Mind-Body Renewal – 9-10am. With Peggy Sealfon. Combining yoga, qigong and integrative relaxation (yoga nidra). Feel refreshed and recharged. $50/4 classes; client discount available. Monarch Wellness, Naples. Preregistration required: 231-3208. MonarchWellness.net. Hatha Yoga – 9-10:30am. With Meredith Musick. All levels. BKS Yoga Studio, 2900 Tamiami Tr N, Naples. 269-8846. MeredithMusick.com. Stretch and Strength – 11:30-12:30pm. With Sondra Dansby. This hour-long class does a little with every part of the body. Using breath, core work, stretching and the resistance of your own body to build strength, it varies each week. $10 (packages available).. IN.FORM Meetings – 4-6pm. Learn how to fit better habits into your busy life and enjoy the side effects of weight loss, better gut and cardio health and more energy. Different topic each week for 13 weeks, in-
lowed by spirit messages. $15. Center of Eternal Light, 260 Professional Pl, N Ft Myers. 599-4700. CenterOfEternalLight.com.
cludes half-hour of qigong or other exercise. Be Well Natural Health Clinic, 1032 Goodlette Rd, Naples. RSVP: BeWellNaples.com/In-form-mtgs. Infant and Pregnancy Loss Support Group – 5:15-6:45pm. 2nd Thurs. 1095 Whippoorwill Ln, Naples. 298-9725. Facebook page: Grieving. Yin/Yoga Nidra Class – 5:30-6:45pm. Awakening Through Synergy, 1084 Business Ln, Naples. 5297582. AwakeningThroughSynergy.com. Peaceful Mind – 6-7pm (weekly except 3rd Thur). With rotating teachers. Unwind and energize through use of restorative sound, integrative relaxation, meditation group and peaceful mind yoga. $50/4 classes; client discount available. Monarch Therapy, Naples. Preregistration required: 2313208. MonarchWellness.net. Adult Children of Alcoholics (ACA) Group – 6-7:30pm. 12-step program. A fellowship of men and women that have suffered from anxiety or depression and anger after growing up in highly stressful environments. 10051 Plantation Rd, Ft Myers. 931-9009. Yoga – 6:15pm. Knowledgeable teachers, small groups. $15. Health and Wellness Sanctuary, Naples. 269-2221. Salsa Night – 7-7:45pm, group class ($8); 8-9:30pm, salsa party ($12). Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio.com. Silent Meditation – 7-8:15pm. Seated and walking meditation in the Zen tradition. Discussion on presented topic. $10/suggested donation. Open Mind Zen Naples, 1250 Tamiami Tr N, Ste 205. 961-2491. OpenMindZenNaples.com. Messages and Meditation – 7:30pm. With Deborah Noonon. Open discussion. Guided meditation, fol-
friday Pilates Level 2 Equipment Combo – 8-8:50am. Energetic, flowing pace using the Reformer, Cadillac, Chair and Spine Corrector to increase flexibility and core strength for improved balance. Fitness for Life, 28811 S Tamiami Tr, Bonita Springs. 948-5555.. La Leche League – 10am. 2nd Fri. Mother-tomother breastfeeding support group. Center Point Community Church, 6590 Golden Gate Pkwy, Naples. 404-4933. Laurielll@aol.com. Ding Darling Lecture Series – Thru Apr 14. 10am & 1pm. Photographic presentations will feature birds and other wildlife and their habitat during the lecture series. Book signings will follow most lectures. Arrive one hour early to assure seating. JN “Ding” Darling National Wildlife Refuge, Sanibel Island. Info/schedule: DingDarlingSociety.org. Historic House Open/Guided Tour – 10am-4. Women’s Co-Dependents Anonymous – Noon. Hope Lutheran Church, Old 41 Rd, Bonita Springs. Sally: 920-279-2388. Cycling Class for Parkinson’s – 12:30-2pm. Find support from other people with Parkinson’s, feel better and reduce your symptoms. Physician referral required. Free. Bonita Springs YMCA, 27200 Kent Rd. Marla Ramsey: 221-7560. Adult Children of Alcoholic/Dysfunctional Families – 2:30-4pm. If your parents were alcoholics/ addicts, let’s overcome that upbringing. Dry Palms Foundation, 1251 Lamar Rd. Jane: 728-7106.. IN.FORM Friday – 3-4pm. Learn about this revolutionary body transformation program that starts with gut and cardio health. Supplements combined with 13 weeks of free coaching can help one gain health and ditch fat. Be Well Natural Health Clinic, 1032 Goodlette Rd, Naples. Jo: 250-9312. Sunset/Bird Rookery Kayak Tour – 5:30-8:30pm. On the Caloosahatchee River. See thousands of
80
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
birds coming in to roost for the night. $40. Includes equipment and FL master naturalist guide. GAEA guides, Ft Myers. 694-5513. UniTeens Night – 6-8:30pm. Activities, discussions, meditations, crafts, fun and food for teenagers to connect with established friends or make new ones. Unity of Fort Myers, 11120 Ranchette Rd. RSVP: 278-1511. UnityOfFortMyers.org. Buddhist Meditation and Teachings – 6:307:30pm. With Buddhist Teacher JoAnn Lawrence. Practical teachings and guided meditation to understand the mind, change habits and find relaxation and peace. $10 suggested donation. Must RSVP, seating is limited. 4933 Tamiami Tr N, Ste 200, Naples. 822-5806. JoAnnLawrence@gmail.com.
saturday Compassionate Friends: Lee County Group – 9am. 4th Sat. For bereaved parents. Unity Church of Bonita, 28285 Imperial Pkwy, Bonita Springs. 690-7801. swflcf@live.com.. Food Addicts in Recovery Anonymous (FA) – 10am. A 12-step program for food addiction. No dues, no fees, no weigh-ins. Moorings Presbyterian Church, 791 Harbour Dr, Naples. Nancy: 352-0527. Naturalist Guided Walk – Thru April. 10am. Free. Naturalist walk through maritime forest and coastal strand. Free. Beach pass required or entrance fee. Barefoot Beach Preserve Learning Center, Barefoot Beach Blvd, Bonita Springs. FriendsOfBarefootBeach.org. Barefoot Beach Preserve Lecture Series – Thru Apr. 10am. Featuring different speakers each week. Free. Beach pass required or entrance fee. Barefoot Beach Preserve Learning Center, Barefoot Bch Blvd, Bonita Springs. Schedule: FriendsOfBarefootBeach.org. Women Seeking Serenity through the 12 Steps – 10am. Free. Hope Lutheran Church, Old 41 Rd, Bonita Springs. Carol: 405-1947. Hip Hop – 10-11am. $15 or $100/10 classes. Allstar Dance Studio, 4910 Tamiami Tr N, Ste 118, Naples. 304-9013. AllstarDanceStudio.com. Estuary Kayak Tour in Estero Bay – 10am-1pm. Birds, dolphins, manatees and more. $40. Includes all equipment and FL master naturalist guide. GAEA guides, Bonita Bch. 694-5513. Historic House Open/Guided Tour – 10am4. Drum Class/Circle – 3-4pm, class; 4-5:30, circle. 1st Sat. With Debo Kumi. Bring your drums, shakers, open heart and dance. Learn new rhythms for the circle. $10/class; donation/circle. The Happehatchee Center, 8791 Corkscrew Rd, Estero. 992-5455. Happehatchee@gmail.com Happehatchee.org.
classifieds Fee for classifieds is a minimum charge of $25 for up to the first 20 words and $1 for each additional word. To place an ad, email NAclassifieds@ naturalawakeningsmag.com. FOR RENT OFFICE SPACE FOR RENT – Anchor Rode Dr; Internet and utilities included. 12-by-13-foot room with wood floors and window. 293-0960. OFFICE/THERAPY ROOMS FOR RENT – Nicely finished with waiting room. Ground floor Landmark Professional Building, near Colonial Blvd. Handicap accessible. Ample parking. Rent one or both. Starting at $300/month. Utilities included. 209-0199. TRANQUIL ROOM FOR RENT – All-new and beautiful organic spa room with hardwood floors located at a medical wellness center near Fifth Ave South. Perfect for acupuncturist, nutritionist, counselor, energy healer or other. $700/month. 777-0344. ROOM FOR RENT –12-by-10-feet in established functional medical practice. Looking for integrative professional. Professional buildings at 9200 Bonita Beach Rd, Bonita Springs. Call regarding price and amenities: 481-5600.
OPPORTUNITIES.
RETREATS SPIRITUAL RETREAT TO ISRAEL – Meditations, initiations and channeling with Rae Chandran. Join Natural Awakenings Publisher Sharon Bruckman and Naples medical qigong practitioner Dr. Susan Deflavis Winters on this life-changing tour of Israel with this very special guide. 340-1036 or Panquswf@gmail.com.
SERVICES ELDER CARE – MUSIC THERAPY – Violinist and Musical Therapist JamesSteven Farnsworth brings loving kindness and beautiful music for the care of Alzheimer’s; those in surgical Rehabilitation; and those in Hospice treatment. He has many excellent recommendations. Please visit his website for further information: JamesSteven.com/ TheHealingViolin. Sublime music refreshes the soul and mind. He can be contacted at 510-292-7786.
Love’s in Bloom, Find Your Sweetie! the largest database Join of health-conscious and eco-minded, spiritual singles and manifest an extraordinary relationship!
Try it for FREE at NaturalAwakeningsSingles.com natural awakenings
April 2017
81!
J U N E
Chronic Pain plus: Hybrid Vehicles
Readers are Seeking These Providers & Services: Acupuncturists • Chiropractors • Massage Therapy Exercise Instruction • Physical Therapists • Yoga Classes Homeopathy • Tai Chi Instruction • Hydrotherapy • Ice Therapy Infused Heat Therapy • Healthy Restaurants • Herbalists Supplements • Auto Charging Stations Electric Bicycles/Motorbikes • Hybrid Auto Dealerships ... and this is just a partial list!!
J U L Y
Contact us to learn about marketing opportunities and become a member of the Natural Awakenings community at:
239-272-8155 82
Collier/Lee Counties
swfl.NaturalAwakeningsMag.com
communityresourceguide Connecting you to the leaders in natural health care and green living in our community. To find out how you can be included in the Community Resource Guide email NAadvertising@naturalawakeningsmag.com to request our media kit.
ACUPUNCTURE ACUPUNCTURE/CUPPING
Jack Morris, AP, Dipl Ac (NCCAOM) Advanced Certified Cupping Specialist, MPS Certified 6628 Willow Park Dr, Ste C 1032 Goodlette Rd (Colonial Square) 239-293-4005 Specializing in long- and short-term pain issues, detoxification, cupping (reverse pressure therapy), migraines and TMJ, menses irregularity, PMS and infertility, smoking cessation and PTSD. 43..
DR. ROBERT MURDOCH, BOARDCERTIFIED ACUPUNCTURE PHYSICIAN 32.
ALTERNATIVE MEDICINE DR JOEL YING, MD
2335 Tamiami Trl N, Ste 206, Naples 239-200-6796 • JoyHealthWellness.com Support body, mind and spirit with a holistic approach to health and wellness. Integrate board-certified internal medicine, natural medicine, wellness, craniosacral therapy. Blog, newsletter and online courses at LivingThePresentMoment.com..
BIOFEEDBACK FIREFLY WITHIN, LLC
Karin S Wolfe, CBS 3405 Pelican Landing Pkwy, Bonita Springs 239-980-3257 • FireflyWithin.com Info@FireflyWithin HolisticHealingArts.info.
TERESA KENNEDY (MA71100) Therapy of the Gulf (MM21480) 824 Anchor Rode Dr, Naples 928-444-0606 • 239-262-8722
Licensed massage therapist with 14 years of experience. Myofacial orthopedic and sports massage therapist. Educated, trained and worked with patients, including individuals with cancer, in Connecticut. See ads, pages 20 and 47.
ROLFED IN PARADISE, INC.
Cindi Curci-Lee, RN, BSN Advanced Certified Rolfer Movement Practitioner Yamuna Body Rolling Instructor 5100 N Tamiami Trl, Ste 126,35843 (Naples), MM29338 (Ft Myers).
natural awakenings
April 2017
83
PAULA TERRY, LMT
239-821-3088, by appt. (Collier & Lee) Trained at the Upledger Institute, Paula utilizes CranioSacral Therapy combined with HeartCentered Therapy, Somato.
CHIROPRACTOR 70. 77.
NETWORK CHIROPRACTOR Dr. Michele Pelletiere 3411 Bonita Beach Rd, Ste 302, Bonita Springs • 239-949-1222
DENTISTRY.
84
Collier/Lee Counties 40. 28./.
swfl.NaturalAwakeningsMag.com
ENERGY HEALING REV. KAREN CORATELLI-SMITH 239-692-9120 HealingInAmerica-Southeast.org HugsForHappiness.com KSmith727@comcast.net
Licensed teacher and certified practitioner of ThetaHealing and Healing in America. Past Life Regression Counselor and Spiritual Counselor, Cranio-Sacral Therapist, Seraphim Blueprint and Esoteric practitioner.
Feldenkrais® ATM® Student Teacher Kinesis Structural Integration Practitioner Licensed Massage Therapist 501 Goodlette-Frank Rd, Ste D-304, Naples 239-777-2597 • JoAnnRahl.com Discover how to move with ease and comfort using Feldenkrais® Awareness Through Movement®. Accelerate your healing by combining private sessions with public classes/workshops. Check website and ongoing events for class times. MA26919, MM24629.
FENG SHUI LINDA MUNDT DESIGN
239-405-7330 • LindaMundt.com Linda@LindaMundt.com Creating space for a peaceful mind. More than 10 years creating homes, schools and businesses to enhance relationships, health, clear thinking and project start-up energy. Color and space design. Staging. Clutter clearing. 22. 213, 64. 68. 25.
EYES WIDE OPEN CENTER
9200 Bonita Beach Rd SE, Stes 202-204 239-948-9444 • SilviaCasabianca.com Regain body wisdom! Innovative, holistic support to reduce stress and anxiety, improve lifestyle, find life purpose or simply cultivate wellness for self, the community or the planet. Psychotherapy, couples counseling, parenting guidance. Reiki, qigong, Bach Flowers and Trager Approach®. Massage and CEU classes for health professionals. All levels yoga. Call for assessment. 70.
INTUITIVE CONSULTATION HEATHER FAUN BASL
630-210-8688, 312-502-1539 GraceAngels.com Heather@GraceAngels.com Specializing in intuitive counsel and psychic work including Akashic records, card readings, connection with loved ones, home and business readings/clearings, energy healing, personal mentoring and angel work with children. Working with individuals that have health concerns, mental stress and/or want to find clarity with their life situations.
LIFE COACH VALORIE MORRIS
Licensed Louise Hay "You Can Heal Your Life" Coach, Workshop Leader, Teacher & Speaker • 24.
Look deep into nature, and then you will understand everything better. ~Albert Einstein natural awakenings
April 2017
85 65. 71.
NUTRITION PATTI BADINER, MB-EAT + ONE-ONONE COACHING Mindfulness Based Eating Awareness Training Instructor 612-718-1416 • PersonalWeigh@gmail.com
Lose the dieting mentality and gain a balanced relationship with food through Mindful Eating. Discover the power of tuning into your body and mind by combining mindfulness meditation practices with eating awareness, and achieve permanent weight management without struggle. 18.
PHYSICAL THERAPY
REALTOR
INNERCONNECTIONS
KAREN L. BEATTY, ABR, GRI
Frederick B. Stahlman, BS, PT, CST-D InnerConnectionsPT.com Naples: 239-398-3154
Downing-Frye Realty, Inc Naples • 239-269-7788 Klbeatty48@aol.com • KarenBeatty.com
Upledger Institute instructor. 30 years of experience. Holistic practice focusing on personal empowerment and teamwork. Craniosacral therapy, fascial mobilization, lymphatic drainage. Energy balancing, structural manual therapies with customized exercise. See ad, page 6.
Florida native, loving and selling Naples since 1977. Karen knows!
PILATES SUSAN MANN, PT, DPT
Fitness for Life of Naples 28811 S Tamiami Tr, Bonita Springs 239-948-5555 Physical therapist and pilates instructor specializing in women's health. Accepting new clients for private pilates and group classes – schedule your appointment today! with researchbased methods from the Gottman Institute. Reconnect sexually with your partner using sex therapy. Explore individually the issues that are troubling and holding you back. See ad, page 14.
DOROTHY RODWELL, LMFT & RTR THERAPIST 25.
YOGA AWAKENING THROUGH SYNERGY, LLC Jennifer Colucci 1084 Business Ln, Naples • 239- 529-7582 AwakeningThroughSynergy.com
Brand new healing art space offering therapeutic and Thai massage, yoga therapy and multistyle yoga classes and workshops including Therapeutics, Hatha, Yin/ Yoga Nidra, restorative, Vinyasa-Flow and crystal bowls. MA# 74913. MM# 35896. 73. posture, breath-work, heal injuries, The Great Yoga Wall®. Massage therapy: sports, Swedish, Lomi Lomi. Nutritional counsel. Gift certificates available. See ad, page 32.
Today, 88 of the Fortune 100 companies have mandated Leadership in Energy and Environmental Design as their standard. ~Mahesh Ramanujam 86. Claudia Marcelo, D.O. april lecture
The Skinny on Free In-Body Weight Loss: Composition Successful strategies for a new you.
with Dr. Claudia Marcelo
april 25, 2017 6:00pm
limited Seating rSVP on Website or call the office
april special
Pamela Hughes, D.O. Pamela Hughes, D.O.
Experiencing hair loss?
LaserCapÂŽ
Analysis for all Guests!
(239) 649-7400 800 goodlette rd n suite 270 n naples Fl 34102
What is LaserCap? An FDA-cleared, technologically advanced light therapy treatment for hair loss that is convenient, discreet and effective.
call For sale price
n Functional Diagnostic testing n supplements n nutritional analysis/therapy n hyperbaric therapy n nutritional iV therapy n chelation therapy natural awakenings
April 2017
87
Southwest Florida (SWFL) Collier/Lee Counties Natural Health, Green Living Magazine
Published on Mar 30, 2017
Southwest Florida (SWFL) Collier/Lee Counties Natural Health, Green Living Magazine
|
https://issuu.com/swflnaturalawakenings/docs/nanaples0417-lo
|
CC-MAIN-2018-34
|
refinedweb
| 20,663
| 51.34
|
hyper 0.0.1
HTTP/2.0 for Python
HTTP is changing under our feet. HTTP/1.1, our old friend, is being supplemented by the brand new HTTP/2.0 standard. HTTP/2.0 provides many benefits: improved speed, lower bandwidth usage, better connection management, and more.
hyper provides these benefits to your Python code. How? Like this:
from hyper import HTTP20Connection conn = HTTP20Connection('twitter.com:443') conn.request('GET', '/') resp = conn.getresponse() provides support for draft 9 of the HTTP/2.0 draft specification and draft 5.0 following guidelines:
- Check for issues, both open and closed, before raising a new one. It's possible your idea or problem has been discussed before. GitHub has a very useful search feature: I recommend using that for a few minutes.
- Fork the repository on GitHub.
- Run the tests to confirm that they all pass on your system. If they don't, you will need to investigate why they fail. hyper has a substantial suite of tests which should cover most failures.
- Write tests that demonstrate your bug or feature. Ensure that they all fail.
- Make your change.
- Run the entire test suite again, confirming that all tests pass including the ones you just added.
- Send a pull request. GitHub pull requests are the expected method of collaborating on this project.
If for whatever reason you strongly object to the GitHub workflow, email the maintainer with a patch.
License
hyper is made available under the MIT License. For more details, see the LICENSE file in the repository.
- Downloads (All Versions):
- 20 downloads in the last day
- 181 downloads in the last week
- 681 downloads in the last month
- Author: Cory Benfield
- License: MIT License
- Categories
- Package Index Owner: Lukasa
- DOAP record: hyper-0.0.1.xml
|
https://pypi.python.org/pypi/hyper/0.0.1
|
CC-MAIN-2014-15
|
refinedweb
| 295
| 68.97
|
First, I am running on linux and when i use the java command to run a program (i.e. java foo), it just sits after it finishes. how can I get it to fully close(specifically, the program I am posting at the end of this post)
Second, is there an equivalent to the return 0 in C++. i.e. input validation fails and you want to exit? I can't figure out how to do that.
here's the program I've written:
import javax.swing.*; class Ch2Sample1 { public static void main(String[] args) { String name; while(true) { name = JOptionPane.showInputDialog(null, "What is your name?"); if(name.length()!=0) break; else { JOptionPane.showMessageDialog(null, "Oops! You didn't enter anything.\nPlease try again."); } } JOptionPane.showMessageDialog(null, "Your name is " + name); } }
|
https://www.daniweb.com/programming/software-development/threads/32280/two-basic-java-questions
|
CC-MAIN-2017-30
|
refinedweb
| 132
| 70.5
|
Testing Inside the Container
By N. Alex Rupp
01 Jun 2006 | TheServerSide.com
Part 1: Testing Inside the
Container
Part 2: Testing Entity Beans
Part 3: Advanced Testing
Techniques
"Testing EJBs in a fake container is like trying to test java objects in a fake VM." David Blevins, OpenEJB.
Introduction
This article discusses how to use OpenEJB's container driven testing features to simplify and supercharge your EJB testing.
All the EJB testing philosophies out there involve building up an elaborate but ultimately fake environment within which to test your beans, separating you and your tests from EJB and the Container. This approach is a dead end. The real answer is to test your beans as close to the EJB Container as you can getdirectly inside the Container. Container driven testing lets you write more isolated, fine-grained and robust unit tests. Your EJB applications are EJB applications! Admit it! Test them as such!
Testing Inside the Container
In order to understand the advantages of the OpenEJB approach to testing, you first need to understand a few details about the EJB specification. The EJB spec uses different terms for the EJB Container and the EJB Server, but never clearly and explicitly defines the distinction between the two. OpenEJB defines an explicit contract in order to separate the concerns of the Container and the Server. This explicit division of roles is central to the OpenEJB architecture and is a key to its uniquely embeddable nature.
The terms "EJB Container" and "EJB Server" are abstract and not defined by the spec in terms of concrete implementation detail. In OpenEJB's world however, the Container has the basic job of holding instances and running them through their lifecycle, the Server's job is to extend the bean's interfaces to clients and delegate calls to the Container.
The OpenEJB project has published an illustration of the Container / Server breakdown . OpenEJB has two implementations of EJB Server available, the Local Server (aka IntraVM) and the Remote Server.
If you compare the pictures from the Local and Remote Server pages, you start to get an idea of how an implemented server looks. When you run OpenEJB embedded, you are just using the Local Server to get at beans. In fact, the beans in the Container are also using this Server when they look each other up through JNDI.
The Remote Server is a more complex, as it listens on a socket for incoming requests from clients. When a request comes in on the socket, it reads in the data, launches off a thread which is used to delegate the call to the container, then goes back to listening for more requests. Sounds simple, but there is a lot of overhead to anything network based; protocols, thread pools, serialization and deserialization, communication performance, network security, class distribution, etc.
The Server layer in Geronimo will do all the same things as the Remote Server, but add in clustering, load balancing, and other advanced functionality. The Server layer in Apple's WebObjects also does the same thing as the Remote Server, but does so using CORBA's IIOP protocol via OpenORB.
If you mentally compare the descriptions of the Server implementations described, you begin to see how EJB Servers can get so heavy. Because OpenEJB separates the interface distribution concerns from the instance management concerns, it can be made as light or as heavy as you need it.
Starting up a full-blown EJB Server would add a lot of overhead to your testing process. If you only need the EJB container functionality, this overhead would be overkill. On the other hand, some of your tests might need to be run against a full-blown EJB Server. To date, most testing frameworks for EJB focus on simulating an EJB Container environment, because the EJB Container cannot be cleanly separated from any of the commercial EJB Servers. The flaw in this strategy is that developing an EJB testing framework eventually becomes as complex as developing a real EJB Server.
Conversely, OpenEJB is specifically designed to be embeddedespecially for unit testing. The OpenEJB project uses test-driven development, and its developers need a way to automatically test the capabilities of their own container. To achieve this, they built a framework extending JUnit and leverage their unique architecture to isolate the container and perform lightning-fast unit tests directly against the EJB Container. This helps them make sure the Container is functioning the way it should, and gives you the ability to run tests on your EJBs.
Here is where OpenEJB really shines. The ability to embed the EJB Container, coupled with the ability to selectively include the full EJB Server environment lets you can write robust tests for the following functionality:
- Transaction integrity
- Multithreaded behavior
- The effect of static variables and singletons at runtime
- How components will run when deployed in concert
- How components will run when they're alone
- Component behavior at different points in the EJB lifecycle
- Simulated RMI client calls
- CRUD operations for entity beans
- Proper serialization of Stateful Session Beans
This is by no means a complete list. If not planned for and implemented properly, these issues and many others could wreak silent havoc in a production environment. Outside of a Container, it is almost impossible to reliably test these areas.
OpenEJB lets you determine how little or how much of the Container and Server you want to include.
By taking advantage of OpenEJB for container driven testing, you can dramatically improve your test's capabilities without saddling them with ugly code or a complicated infrastructure. In fact, testing with OpenEJB doesn't require you to lace your test code with any OpenEJB specific or non-compliant APIs. Not only can you write more robust container driven tests, but you can do it without API lock-in.
Sound good? It gets better. You can also automate the entire testing package using a simple Maven build that I've already written for you, and (believe it or not), you don't even need to install OpenEJB.
Enough talk. Let's fire up our container and run some tests.
Getting started
The following directions are for setting up and running the example application in a Windows environment. If you're working in a Unix environment, make sure to change the path to the installation directory in the /conf/openejb.conf file and make sure JAVA_HOME and MAVEN_HOME are on your classpath. Maven's a breeze--you'll have no problem keeping up.
Install the JDK
- Install J2SDK 1.4.2 to the default directory C:j2sdk1.4.2_04
- Set the JAVA_HOME variable:
C:> set JAVA_HOME=C:j2sdk1.4.2_04
Install Maven
- Download
- Unzip to C:
- Check your installation:
C:>dir maven-1.0-rc2 Directory of C:maven-1.0-rc2 05/09/2004 02:00p <DIR> . 05/09/2004 02:00p <DIR> .. 05/09/2004 02:00p <DIR> bin 05/09/2004 02:00p <DIR> lib 03/23/2004 02:53p 2,491 maven-navigation-1.0.xsd 03/23/2004 02:53p 14,760 maven-project.xsd 05/09/2004 02:00p <DIR> plugins 2 File(s) 17,251 bytes 5 Dir(s) 6,253,555,712 bytes free
- Set the MAVEN_HOME variable:
C:> set MAVEN_HOME=C:maven-1.0-rc2
- Add %MAVEN_HOME%/bin to your PATH variable:
C:> set PATH=%PATH%;%MAVEN_HOME%bin
- Check to make sure maven is in your PATH:
C:> maven --version __ __ | / |__ _Apache__ ___ | |/| / _` V / -_) ' ~ intelligent projects ~ |_| |___,_|_/___|_||_| v. 1.0-rc2
Install the EJB Testing Examples
- Download
- Unzip to C:
- Check your installation:
C:>dir ejb-testing-examples-part01 Directory of C:ejb-testing-examples-part01 05/16/2004 08:09p <DIR> . 05/16/2004 08:09p <DIR> .. 05/16/2004 07:53p <DIR> example_01 0 File(s) 0 bytes 2 Dir(s) 15,507,103,744 bytes free C:>dir ejb-testing-examples-part01example_01 Directory of C:ejb-testing-examples-part01example_01 05/16/2004 08:29p <DIR> . 05/16/2004 08:29p <DIR> .. 05/16/2004 02:04p <DIR> conf 05/16/2004 04:21a 3,440 maven.xml 05/16/2004 12:11a 440 project.properties 05/16/2004 07:52p 4,155 project.xml 05/16/2004 02:04p <DIR> src 4 File(s) 8,347 bytes 4 Dir(s) 15,506,739,200 bytes free
Compile & Test Your Session Beans
- Go to C:ejb-testing-examples-part01example_01
C:>cd ejb-testing-examples-part01example_01
- Build the EJB JAR and run the session bean tests:
C:ejb-testing-examples-part01example_01>maven __ __ | / |__ _Apache__ ___ | |/| / _` V / -_) ' ~ intelligent projects ~ |_| |___,_|_/___|_||_| v. 1.0-rc2 Attempting to download openejb-core-1.0-SNAPSHOT.jar. build:start: default: java:prepare-filesystem: java:compile: [echo] Compiling to C:ejb-testing-examples-part01example_01/target/classes java:jar-resources: test:prepare-filesystem: test:test-resources: test:compile: test:test: jar:jar: aspectj:init: jar: validate: java:prepare-filesystem: java:compile: [echo] Compiling to C:ejb-testing-examples-part01example_01/target/classes java:jar-resources: test:prepare-filesystem: test:test-resources: test:compile: test:test: [junit] Running com.nrfx.articles.openejb.Example01Test [junit] Tests run: 34, Failures: 0, Errors: 0, Time elapsed: 4.356 sec [junit] Running com.nrfx.articles.openejb.Example02Test [junit] Tests run: 34, Failures: 0, Errors: 0, Time elapsed: 4.406 sec BUILD SUCCESSFUL Total time: 20 seconds
If everything went off correctly, you've just run unit tests on an EJB Session components directly against an embedded EJB Container. No framework in the middle. No assembly required. You didn't even need to install OpenEJB--everything required in order to compile, validate and load your enterprise components into the EJB Container was either in this simple build, or has since installed itself.
Once the enterprise component JAR is compiled, assembled and validated, the tests run extremely fast. The output above came out of my old Pentium III. Just imagine how fast this would run on a modern machine!
One of the reasons these tests run so fast is that OpenEJB doesn't "hot deploy" the beans. There is one startup phase where beans are loaded and that is it. Hot deploy stategies aren't failsafe and frequently don't work; requiring you to manually stop and start the server anyway. Hot deploy is a feature for very large environments with both several running applications and continuous availability needs. It is certainly not required for testing, development or any production environment with just a single application. Cutting it out speeds things up significantly and removes a major complaint people have with most EJB servers.
Another reason the tests run so fast is that OpenEJB doesn't generate EJBC stubs or compile the bean components in the container. Instead, it uses dynamic proxies to load the beansa strategy shared by at least one other EJB Container vendor.
A third speed-boost is gained from validating each EJB for basic spec compliance before loading it into the container. We'll go over this in more detail later on.
Suffice to say this strategy works. You can test EJBs directly against an embedded EJB Container, and you can do it fast. Next we're going to take a look at how you do it, starting with a simple Session Bean test.
A Sample Test Case
At this time we're going to step inside of one of the test case classes, and see how an EJB unit test is assembled.
package com.nrfx.articles.openejb; import java.util.Properties; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import junit.framework.TestCase; public class Example01Test extends TestCase { protected ExampleHome ejbHome; protected Example ejbObject; private String name="nrfx/examplebean"; public Example01Test() throws Exception { InitialContext context = new InitialContext( System.getProperties() ); Object obj = context.lookup(name); ejbHome = (ExampleHome)PortableRemoteObject. narrow( obj, ExampleHome.class); ejbObject = ejbHome.create(); } public void test01_returnStringObject() { try{ String expected = new String("1"); String actual = ejbObject. returnStringObject(expected); assertEquals(expected, actual); } catch (Exception e){ fail("Received Exception " + e.getClass() + " : "+e.getMessage()); } } // ... }
The first thing you should notice about this simple example test is that there are no OpenEJB specific APIs or hard-coded properties used to find the InitialContext. This is of critical importance; it means that your tests are not bound to the OpenEJB API, and that your tests will not be locked in to a specific EJB Container implementation. OpenEJB does not need to be your production server in order to use it for testing. Furthermore, the tests you write could actually be run against another server provided you put the right JNDI parameters in project.properties and deployed the beans using that server's tools. These are normal unit tests, and are 100% EJB compliant.
All the magic is in the creation of the InitialContext object which is required to access any
EJB. When
org.openejb.client.LocalInitialContextFactory is used as the JNDI provider,
it will automatically embed OpenEJB into the testing VM. Afterwards, the same instance of OpenEJB
is used for all the tests within that VM. This gets a bit tricky when you're running tests inside
an automated build environment like Maven, because Maven creates a new VM for each test class.
Notice, also, how the JNDI call uses the system properties instead of hard-coded properties. If
the above example didn't have to be squished down to a 50 character wide column, you could get your
InitialContext to the EJB Container in one Container-agnostic line of code.
Finally, we didn't get our
InitialContext to the Container in the
setUp() method. That's because we'd have to re-create the context object for every
single test method in the class. This would unnecessarily slow down our tests.
Once you've got the initial setup for your test class written, you can add as many test methods as you like.
The functionality we're testing is a bit simplistic, but it gets the point across. Once you've got your bean component, you can isolate its different API features and hammer away at them until you're satisfied the component is doing what it should.
Coming Up
We've only just barely scratched the surface. The next two sections in this series will cover testing Entity Beans, and advanced testing techniques.
|
http://www.theserverside.com/news/1365417/Testing-Inside-the-Container
|
CC-MAIN-2016-18
|
refinedweb
| 2,391
| 54.93
|
beginner wrote: > On Jul 25, 10:19 am, Stargaming <stargam... at gmail.com> wrote: >> On Wed, 25 Jul 2007 14:50:18 +0000, beginner wrote: >> > Hi, >> >> > I am wondering how do I 'flatten' a list or a tuple? For example, I'd >> > like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4]. >> >> A recursive function, always yielding the first element of the list, >> could do the job. See the ASPN Python Cookbook for a few >> implementations.? >> query=flatten§ion=PYTHONCKBK&type=Subsection >> >> > Another question is how do I pass a tuple or list of all the aurgements >> > of a function to the function. For example, I have all the arguments of >> > a function in a tuple a=(1,2,3). Then I want to pass each item in the >> > tuple to a function f so that I make a function call f(1,2,3). In perl >> > it is a given, but in python, I haven't figured out a way to do it. >> > (Maybe apply? but it is deprecated?) >> >>> def foo(a, b, c): print a, b, c >> ... >> >>> t = (1, 2, 3) >> >>> foo(*t) >> >> 1 2 3 >> >> Have a look at the official tutorial, 4.7.4 >> current/tut/node6.html#SECTION006740000000000000000 >> >> > Thanks, >> > cg >> >> HTH, >> Stargaming > > Hi Stargaming, > > I know the * operator. However, a 'partial unpack' does not seem to > work. > > def g(): > return (1,2) > > def f(a,b,c): > return a+b+c > > f(*g(),10) will return an error. > > Do you know how to get that to work? f(*(g() + (10,)) Not the most beautiful solution, but it works. Diez
|
http://mail.python.org/pipermail/python-list/2007-July/420093.html
|
CC-MAIN-2013-20
|
refinedweb
| 271
| 74.69
|
structure to hold all necesary data to perform the LLL's basis reduction algorithm. More...
#include <eg_dbasis_red.h>
structure to hold all necesary data to perform the LLL's basis reduction algorithm.
Definition at line 102 of file eg_dbasis_red.h.
array of pointers to arrays containing the vector basis in extended (including zero coef) form. The vectors themselves are considered as allocated outside. everything else is considered as internally allocated.
Definition at line 109 of file eg_dbasis_red.h.
Actual length of the EGdBsRed_t::basis array.
Definition at line 107 of file eg_dbasis_red.h.
Number of elements in the basis.
Definition at line 104 of file eg_dbasis_red.h.
Here we store and compute the Gram-Schmidt needed for the LLL basis reduction algorithm.
Definition at line 114 of file eg_dbasis_red.h.
Length of the vectors in the basis, note that it should be that length >= dim.
Definition at line 105 of file eg_dbasis_red.h.
|
http://www.dii.uchile.cl/~daespino/EGlib_doc/structEGdBsRed__t.html
|
CC-MAIN-2015-14
|
refinedweb
| 153
| 53.37
|
I started work on my ATS math library recently; though I'm not sure it will be a wholehearted success, there were parts that deserve attention.
Let us first consider the following Haskell function to check primality:
hsIsPrime :: Int -> Bool hsIsPrime 1 = False hsIsPrime x = all ((/=0) . (x
mod)) [2..m] where m = floor (sqrt (fromIntegral x :: Float))
This is actually quite nice, but it is also far from "as fast as C". We can rewrite this in ATS as follows:
#include "share/atspre_staload.hats"
staload "libats/libc/SATS/math.sats" staload UN = "prelude/SATS/unsafe.sats"
fun sqrt_int(k : intGt(0)) : [ m : nat ] int(m) = let var pre_bound: int = g0float2int(sqrt_float(g0int2float_int_float(k))) var bound: [ m : nat ] int(m) = $UN.cast(pre_bound) in bound end
fn is_prime(k : intGt(0)) : bool = case+ k of | 1 => false | k => begin let fun loop {n : nat}{m : nat} .<max(0,m-n)>. (i : int(n), bound : int(m)) :<> bool = if i < bound then if k % i = 0 then false else loop(i + 1, bound) else if i = bound then if k % i = 0 then false else true else true in loop(2, sqrt_int(k)) end end
As can be seen, this is a bit more involved. Some of this is to be expected as we prove termination, but some of it is simply due to using a lower-level language.
Note first the rather involved termination metric here - we use
.<max(0,m-n)>.
to ensure that it is well-founded. I learned this trick reading the ATS manual,
and I actually encourage prospective learners to do this as well; it can be hard
to get your hands on code samples.
Next, note the use of
:<> in the type signature of
loop.
This is how ATS manages effects. You can have
:<!ntm> for a function that may not terminate,
:<!exn> for a function that
could throw an exception, etc. So
:<> simply means that the function is pure
and total (that is, terminating).
Finally, note the use of an existential type in the declaration
var bound: ....
Existential types are a feature special to ATS; they are not present in any
mainstream languages or even Idris. The type
[ m : nat ] int(m) can then be
passed as an argument to
loop, though
loop takes the universally quantified
{m : nat} ... bound: int(m). Hence, we have a powerful technique that allows us to
take a function on an ordinary
int and nonetheless prove termination.
At this point, we can write a small Haskell wrapper. This is slightly dry, but I think it will be informative.
#define ATS_MAINATSFLAG 1
extern fun is_prime_ats { n : nat | n > 0 } : int(n) -> bool = "mac#"
implement is_prime_ats (n) = is_prime(n)
This is the necessary code on the ATS side of things; it simply exposes the
function in the compiled library. We can compile it to C (placing it in
cbits
per Haskell packaging convention) with:
$ mkdir -p cbits $ patsopt -dd prime.dats -cc > cbits/prime.c
On the Haskell side we have the following:
module Numeric.NumberTheory where
import Data.Word import Foreign.C
foreign import ccall unsafe is_prime_ats :: CInt -> CBool
convertBool :: CBool -> Bool convertBool = go . fromIntegral where go :: Word8 -> Bool go 0 = False go 1 = True go _ = False
isPrime :: Int -> Bool isPrime = convertBool . is_prime_ats . fromIntegral
Our
.cabal file will be a bit simple-minded. We simply add the following to
our
library stanza:
c-sources: cbits/primes.c include-dirs: /usr/local/lib/ats2-postiats-0.3.8/ccomp/runtime/ , /usr/local/lib/ats2-postiats-0.3.8/ ghc-options: -optc-mtune=native -optc-flto -optc-O3
Finally, we can benchmark both functions alongside one another:
This is exactly what we wanted - a 5x speedup compared to pure Haskell, with even more static guarantees to boot! With C, you can get the same speed (or perhaps even faster), but it always feels like an uncanny compromise. ATS allows us to write the functional code we want (with attendant safety guarantees) and still get the speed we need.
|
http://blog.vmchale.com/article/ats-math
|
CC-MAIN-2021-17
|
refinedweb
| 668
| 73.27
|
Now that it appears that the integration of JBossCache into AS5.0 in well underway, will it be ok to everyone that I remove the deprecated code in PojoCache? The portion that I refer to specifically is under the namespace: org.jboss.cache.aop (both src and tests).
The new corresponding one in 2.0 is org.jboss.cache.pojo. It will make the maintanenance easier. But it implies that it is not backward compatible anymore (e.g., you can't use the old code to run in 2.0 release). In addition, the 1.4 style annotation will no longer be supported. We will use the annotation in 5.0.
+1.
|
https://developer.jboss.org/thread/97150
|
CC-MAIN-2018-34
|
refinedweb
| 112
| 71.51
|
02 July 2012 06:30 [Source: ICIS news]
SINGAPORE (ICIS)--The settlement of the July Asian contract price (ACP) for paraxylene (PX) now hangs by a thread as three major producers have not been able to reach a consensus with their buyers over price, market sources said on Monday.
Four major suppliers have put forth their nominations last week but most negotiations were still ongoing by last Friday.
Only Idemitsu Kosan Co settled with one major buyer at $1,160/tonne (€916/tonne) CFR on Friday, after slashing its nomination price to $1,200/tonne CFR Asia from $1,300/tonne CFR Asia initially.
Japanese major JX Nippon Oil has decided to not settle the July ACP as discussions with customers could not end in an agreement.
“There will be no July ACP for PX for us as we could not reach an agreement with customers,” said a company source.
Other contract supplier S-Oil of ?xml:namespace>
“They are unable to reduce their prices further after discounting to $1,250/tonne, so there is likely to be no settlement for S-Oil,” said a contract buyer of the company.
The last contract seller ExxonMobil is expected to reach an agreement with customers today, according to buyers who purchase on contracts from the company.
The PX ACP is deemed settled when at least two producers settle a price with two separate buyers.
PX is used to make purified terephathalic acid (PTA), which is a feedstock for manufacturing polyesters.
(
|
http://www.icis.com/Articles/2012/07/02/9574258/asia-px-july-contract-settlement-hangs-by-a-thread.html
|
CC-MAIN-2014-41
|
refinedweb
| 248
| 56.18
|
Have you wonder what impact everyday news might have on the stock market. In this tutorial, we are going to explore and build a model that reads the top 25 voted world news from Reddit users and predict whether the Dow Jones will go up or down for a given day.
After reading this post, you will learn,
Now let's get started, read till the end since there will be a secret bonus.
For the input text, we are going to concatenate all 25 news to one long string for each day.
After that are going to convert all sentences to lower-case, remove characters such as numbers and punctuations that cannot be represented by the GloVe embeddings later.
The next step is to convert all your training sentences into lists of indices, then zero-pad all those lists so that their length is the same.
It is helpful to visualize the length distribution across all input samples before deciding the maximum sequence length.
Keep in mind that the longer maximum length we pick, the longer it will take to train the model, so instead of choosing the longest sequence length in our datasets which is around 700, we are going to pick 500 as a tradeoff to cover the majority of the text across all samples while remaining relatively short training time.
In Keras, the embedding matrix is represented as a "layer" and maps positive integers(indices corresponding to words) into dense vectors of fixed size (the embedding vectors). It can be trained or initialized with a pre-trained embedding. In the part, you will learn how to create an Embedding layer in Keras, initialize it with GloVe 50-dimensional vectors. Because our training set is quite small, we will not update the word embeddings but will instead leave their values fixed. I will show you how Keras allows you to set whether the embedding is trainable or not.
Embedding()
The following function handles the first step of converting sentence strings to an array of indices. The word to index mapping is taken from GloVe embedding file so we can seamlessly convert indices to word vectors later.
def sentences_to_indices(X, word_to_index, max_len): """ Converts an array of sentences (strings) into an array of indices corresponding to words in the sentences. The output shape should be such that it can be given to `Embedding()`. Arguments: X -- array of sentences (strings), of shape (m, 1) word_to_index -- a dictionary containing the each word mapped to its index max_len -- maximum number of words in a sentence. You can assume every sentence in X is no longer than this. Returns: X_indices -- array of indices corresponding to words in the sentences from X, of shape (m, max_len) """ m = X.shape[0] # number of training examples # Initialize X_indices as a numpy matrix of zeros and the correct shape X_indices = np.zeros((m, max_len), dtype=int) for i in range(m): # loop over training examples # Convert the ith training sentence in lower case and split is into words. You should get a list of words. sentence_words = [w.lower() for w in X[i].split()] # Initialize j to 0 j = 0 # Loop over the words of sentence_words for w in sentence_words: # Set the (i,j)th entry of X_indices to the index of the correct word. if w in word_to_index: X_indices[i, j] = word_to_index[w] # Increment j to j + 1 j += 1 if j >= max_len: break return X_indices
After that, we can implement the pre-trained embedding layer like so.
trainable
from keras.layers.embeddings import Embedding def pretrained_embedding_layer(word_to_vec_map, word_to_index): """ Creates a Keras Embedding() layer and loads in pre-trained GloVe 50-dimensional vectors. Arguments: word_to_vec_map -- dictionary mapping words to their GloVe vector representation. word_to_index -- dictionary mapping from words to their indices in the vocabulary (400,001 words) Returns: embedding_layer -- pretrained layer Keras instance """ vocab_len = len(word_to_index) + 1 # adding 1 to fit Keras embedding (requirement) emb_dim = word_to_vec_map["cucumber"].shape[0] # define dimensionality of your GloVe word vectors (= 50) # Initialize the embedding matrix as a numpy array of zeros of shape (vocab_len, dimensions of word vectors = emb_dim) emb_matrix = np.zeros((vocab_len, emb_dim)) # Set each row "index" of the embedding matrix to be the word vector representation of the "index"th word of the vocabulary for word, index in word_to_index.items(): emb_matrix[index, :] = word_to_vec_map[word] # Define Keras embedding layer with the correct output/input sizes, make it trainable. Use Embedding(...). Make sure to set trainable=False. embedding_layer = Embedding(vocab_len, emb_dim, trainable=False) # Build the embedding layer, it is required before setting the weights of the embedding layer. Do not modify the "None". embedding_layer.build((None,)) # Set the weights of the embedding layer to the embedding matrix. Your layer is now pretrained. embedding_layer.set_weights([emb_matrix]) return embedding_layer
Let's have a quick check of the embedding layer by asking for the vector representation of the word "cat".
embedding_layer = pretrained_embedding_layer(word_to_vec_map, word_to_index) embedding_layer.get_weights()[0][word_to_index['cat']] # array([ 0.45281 , -0.50108 , ... 0.71278 , 0.23782 ], dtype=float32)
The result is a 50 dimension array. You can further explore the word vectors and measure similarity using cosine similarity or solve word analogy problems such as Man is to Woman as King is to __.
The task for the model is to take the news string sequence and make a binary classification whether the Dow Jones close value will rose/fail compared to previous close value. It outputs "1" if the value rose or stays the same, "0" when the value decreases.
We are building a simple model contains two stacked GRU layers after the pre-trained embedding layer. A Dense layer generates the final output with softmax activation. GRU is a type of recurrent network that processes and considers the order of sequences, it is similar to LSTM regarding their functionality and performance but less computationally expensive to train.
model = Sequential() model.add(pretrained_embedding_layer(word_to_vec_map, word_to_index)) model.add(GRU(128, dropout=0.2, return_sequences=True)) model.add(GRU(128, dropout=0.2)) model.add(Dense(1)) model.add(Activation('sigmoid')) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
Next, we can train the evaluate the model.
history = model.fit(X_train_indices, Y_train, batch_size=batch_size, epochs=10, validation_data=(X_test_indices, Y_test)) model.save("./model.h5") score, acc = model.evaluate(X_test_indices, Y_test, batch_size=batch_size)
It is also helpful to generate the ROC or our binary classification classifier to access its performance visually.
Our model is about 2.8% better than the random guess of the market trend.
For more information about ROC and AUC, you can read my other blog -
In this post, we introduced a quick and simple way to build a Keras model with Embedding layer initialized with pre-trained GloVe embeddings. Something you can try after reading this post,
Any ideas to improve the model? Comment and share your thoughts.
You can find the full source code and training data here in my Github repo.
If you are new to the whole investment world like I did years ago, you may wonder where to start, preferably invest for free with zero commissions. By learning how to trade stocks for free, you'll not only save money, but your investments will potentially compound at a faster rate. Robinhood, one of the best investing app does just that, whether you are buying only one or 100 shares, there are no commissions. It was built from the ground up to be as efficient as possible by cutting out the fat and pass the savings to the customers. Join Robinhood, and we'll both get a stock like Apple, Ford, or Sprint for free. Make sure you use my shared link.Share on Twitter Share on Facebook
|
https://www.dlology.com/blog/simple-stock-sentiment-analysis-with-news-data-in-keras/
|
CC-MAIN-2018-43
|
refinedweb
| 1,271
| 54.02
|
Circle Sort
Sign up for FREE 1 month of Kindle and read all our books for free.
Get FREE domain for 1st year and build your brand new site
Reading time: 25 minutes | Coding time: 5 minutes
Circle sort is a sorting algorithm in which concentric circles are made on array and the elements lying on the same circle diametrically opposite to each other are compared and if the element in left side is found to be greater than that of right side then they are swapped. The above process is repeated in the recursive manner and the array is divided into sub arrays until we get the array of sorted pairs.
It is an unstable, recursive, parallelizable, in place sorting algorithm. It's one of the fastest ways to sort an inverted array with an average time complexity of O(N log N) and space complexity of O(1)
Algorithm
- Consider an array of n elements.
- Compare the first elemment of the array to the last element, then the second element to the last element and so on.
- Then recursively split the array into two sub arrays and repeat the above step until we get the array of single element.
Example
Assume the Unsorted input array is: [6,5,3,1,8,7,2,4].
Based on the above algorithm we first compare the first and the last element and then the second and second the last element and so on until all the elements get compared, and then we divide the array int two sub-arrays and make the same comparison until we get the sorted array.
Step 1: Compare i th element with n-i th element and swap if there are not in the correct order
Step 2: Split the array into two parts of equal size and follow the above step for each part
Step 3: Split each part into another two parts and follow the same comparison
Step 4: On splitting the array into equal parts, each part is of size 1 and hence, we have a sorted array
Implementation
Following code is the C++ implementation of the above algorithm.
#include<bits/stdc++.h> using namespace std; bool circleSortRec(int a[], int low, int high) { bool swapped = false; if (low == high) return false; int lo = low, hi = high; while (lo < hi) { if (a[lo] > a[hi]) { swap(a[lo], a[hi]); swapped = true; } lo++; hi--; } if (lo == hi) if (a[lo] > a[hi + 1]) { swap(a[low], a[hi+1]); swapped = true; } int mid = (high - low) / 2; bool firstHalf = circleSortRec(a, low, low+mid); bool secondHalf = circleSortRec(a, low+mid+1, high); return swapped || firstHalf || secondHalf; } void circleSort(int a[], int n) { while (circleSortRec(a, 0, n-1)) { ; } } int main() { int a[] = {-1, 5, 15, 2, 12, 44, 60, 8}; int n = sizeof(a)/sizeof(a[0]); cout<<"\nUnsorted : "; for (int i=0; i<n; i++) cout << a[i] << " "; circleSort(a, n); cout<<"\nSorted : "; for (int i=0; i<n; i++) cout << a[i] << " "; return 0; }
Complexity Analysis
Best case time complexity: O(N log N)
Worst case time complexity: O(N log N log N)
Average case time complexity: O(N log N)
Space complexity: O(1)
On each step, there will be N comparisons and it will continue till each part has size 1 which will require log N splitting steps. Hence, the overall complexity is O(N log N).
In one go, we get array sorted in two parts. To fix this, we need to run circle sort again. Running circle sort for log N times garentees that the array will be sorted. This is because an element can be at the wrong side atmost log N times as the array is split log N times in each run. Hence, the worst case time complexity will be O(N log N log N)
|
https://iq.opengenus.org/circle-sort/
|
CC-MAIN-2021-17
|
refinedweb
| 642
| 53.28
|
I'm making an "arena" pyton script where users can battle. It reads from "ArenaList.txt" and each string is formatted "username skill", like "wootiown 15" or something like that. I'm trying to find a way to get the int at the end of that string, set that to one int, get the username at the beginning and set it to an str, then be able to change the skill value in the file. Thanks!
How about using
str.split? The following code should work (I think, your question isn't very clear):
def getNumber(): data = [] with open('ArenaList.txt', 'r') as file: for line in file: name, number = line.split() number = int(number) data.append([name, number]) return data
This creates a new list containing the names and skills of each player. For example, if the file contained
wootiown 15 testing 5
the above function would return
[['wootiown', 15], ['testing', 5]]
|
https://codedump.io/share/lFLIl2DQZwO4/1/how-to-get-an-int-from-the-end-of-a-string-seperated-by-a-space-that-might-have-more-ints-in-it
|
CC-MAIN-2021-21
|
refinedweb
| 153
| 73.98
|
Para la versión en español ve a mi blog
In this post we are going to see how to logout a user after idle using Nuxt and Web Workers. I found out is a long process so im gonna keep it simple and well explained so everybody can follow along. Due to its extension I'm going to divide it into different sections.
In this section we are going to:
- Install and configure everything needed to use web workers with Nuxt.
- Code our very first worker
- Execute our worker
I'm not going to explain what web workers are, but we are going to see how they work.
Are you ready? Here we go!
Installation and configuration
First we are going to install worker-loader this will help us to make webpack register our worker
Install with yarn:
yarn add worker-loader
Next we are goint to
nuxt.config.js and add the following code over build
build: { extend (config, ctx) { if (ctx.isClient) { config.module.rules.push({ test: /\.worker\.js$/, loader: 'worker-loader', exclude: /(node_modules)/ }) } } }
With this we are telling webpack to get all the files with extension
.worker.js and load them through
worker-loader
All the files that serve as workers must have .worker.js extension*
Coding our very first worker
Let's add a new file under plugins directory (the name is up to you) and add the following.
import SessionWorker from '~/assets/js/session.worker.js' export default (context, inject) => { inject('worker', { createWorker () { return new SessionWorker() } }) }
and then we register it in
nuxt.config.js
plugins: [ { src: '~/plugins/web-worker.js', ssr: false } /* Important ssr: false cause the workers wont work server side, just client*/ ],
At the moment the compilation will fail because we have not created our file
session.worker.jsbut patience, we are going to that.
Here we are basically giving the necessary instruction to create our worker. If you have doubts about plugins head to the documentation, its explained very simple.
Now we will create a folder and a file inside
assets (assets -> js -> session.worker.js)
It is important that the new file is called in the same way as the one we import in our plugin, and it is on the same path.
And add:
self.addEventListener('message', (event) => { console.log('[WORKER] worker con data: ', event.data) })
What is this?
self references the worker itself
message it is the first parameter that the function receives and should not say otherwise.
If its different than message It wont work
The
event parameter is the one it receives when worker is called (we'll get to that)
So what my worker will do? just print to console the received message
But, how? Lets see.
Executing our worker
Lets head to
pages -> index (you can actually run it anywhere, I chose in that specific place because it is the first contact of the application) and we add the following:
created: function () { if (process.browser) { // Remember workers just work in client? const worker = this.$worker.createWorker() // Instruction assigned in plugin worker.addEventListener('message', this.workerResponseHandler) worker.postMessage('Message sent to worker') } }, methods: { workerResponseHandler: function (event) { console.log('[WORKER REPONSE]', event.data) } }
What did we just see?
const worker = this.$worker.createWorker() We are creating the worker variable to start it.
worker.addEventListener('message', this.workerResponseHandler) We are creating the event by passing two parameters:
messagethis must keep it's name, otherwise wont work
this.workerResponseHandlerfunction that handles worker response.
worker.postMessage('Message sent to worker') We send a message to our worker so it can be printed in console
Lastly:
workerResponseHandler print the worker response.
Its done! It is all for our first part, an apology if the explanation is very extensive, however it is a complicated process and I wanted it to be as clear as possible.
What we saw in this tutorial?
- Install and configure everything needed to use web workers with Nuxt.
- Code our very first worker
- Execute our worker
Stay with me to see the next steps to logout a user after X time of inactivity.
Any questions or comments you have, with pleasure you can find me on twitter as @c3ppeu
Greetings!
Top comments (1)
Hey, where's the rest parts? Would be interesting to see a web-worker handling authorization, like checking tokens in a background, then refresh/logout when needed.
|
https://dev.to/paramo/nuxt-web-workers-logout-after-idle-4lbm
|
CC-MAIN-2022-40
|
refinedweb
| 723
| 57.16
|
.
In the first part of this series we already learned about REST and GraphQL. I explained what each of them is good for and in which case you should use REST and when you should use GraphQL instead.
In this part we will create a REST WebService based on Spring Boot which will be transformed to GraphQL in the third part of this series.
The service which we will build is a simple backend for a guestbook. To keep it very simple we will build only the backend, which will give us the opportunity to get a list of guestbook entries via a REST interface which then can be consumed by every client like a website or a mobile app.
Furthermore it will allow us to add a new entry, as well as delete an existing one. The delete operation will be secured by basic auth, as we don’t want any user to delete entries from our guestbook.
Each guestbook entry consists of a title, a message and the name of the author.
To keep it simple we will not use any database. The first message is hardcoded and stored in a simple list, only kept in memory. All new entries added via the REST interface will be added to this list. Also the credentials to log in are stored within the code. For authentication we will use the features provided by the Spring Framework.
Furthermore we don’t use specific Service and Repository layers. You should do so if you are going to write a real application intended for productive use, but we, in this little demo, will not.
In order to follow the setup, you will need a Java8 Runtime and a working installation of maven. If you want to download the source from the github repository you will need a git client.
Furthermore you need a Java IDE of your choice. I will use IntelliJ, so things might look a little different on your machine, at least if your setup differs from mine.
The source code we develop here can also be downloaded from.
So buckle up and let’s start.
To setup the project from scratch we start at to select our needed components.
On the time writing this article the following settings should be the most actual ones
After you initialized the application with the above mentioned settings, download and extract the zip-File to a destination of your choice and open it in your preferred IDE.
You should see something like this:
As you can see, the initializer has created an empty project with all the necessary code to run an simple SpringBoot application. We have an GuestbookApplication class which is responsible for startup and configuration,
as well as an simple test for even this application class.
Let’s begin by implementing our guestbook REST-endpoint.
Therefore we create an new class under the de.consol.blog.graphqlspringboot.guestbook.rest package and call it GuestbookController.
The class should be annotated with @RestController in order to show Spring that this is an endpoint class.
For our first step we also need a method which has no parameters and returns a list of strings. Let’s call this method getEntries. In the end this method will return a list of Entry object, but for now strings will be sufficient enough.
This method will also be called when you open the endpoint in the browser as an index page.
The complete listing of the class should look like this:
package de.consol.blog.graphqlspringboot.guestbook.rest; import java.util.ArrayList; import java.util.List; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class GuestbookEndpoint { @GetMapping() public List<String> getEntries(){ List<String> result = new ArrayList<>(); result.add("Hello World"); return result; } }
If you start the application by running the main method in the GuestbookApplication class and try to access localhost:8080 on your browser, you will be prompted with an login dialog.
>
Note: This is only the case if you follow this article along and code step by step. When you got the files from the github repository this is already fixed.
>
This is because we are using SpringSecurity. So by default all endpoints will be secured by username and password.
For now we will leave it as it is. Later on we will disable security for all endpoints except some selected ones such as the endpoint for delete.
If you want to access the endpoint and see the hello world message in your browser you can login with username user and the password which is prompted in the startup log of the application.
Search for a line like this (your password will be different):
In order to get rid of the hardcoded hello world return value with the Hello World message we are going on by implementing the Entry model of our guestbook. It consists of some basic string attributes:
Let’s implement the Entry class in a separate model package under de.consol.blog.graphqlspringboot.guestbook.model and give it the following content:
package de.consol.blog.graphqlspringboot.guestbook.model; import java.util.Objects; public class Entry { private String title, message,author; /** * Gets message * * @return value of message */ public String getMessage() { return message; } /** * Sets message */ public void setMessage(final String message) { this.message = message; } /** * Gets author * * @return value of author */ public String getAuthor() { return author; } /** * Sets author */ public void setAuthor(final String author) { this.author = author; } /** * Gets title * * @return value of title */ public String getTitle() { return title; } /** * Sets title */ public void setTitle(final String title) { this.title = title; } @Override public String toString() { return "Entry{" + "title='" + title + '\'' + ", message='" + message + '\'' + ", author='" + author + '\'' + '}'; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Entry entry = (Entry) o; return Objects.equals(title, entry.title) && Objects.equals(message, entry.message) && Objects .equals(author, entry.author); } @Override public int hashCode() { return Objects.hash(title, message, author); } }
After adding the class, instead of returning a simple string, we can return a list of Entry instances in our controller.
So we change the getEntries method in the controller to something like this:
public List<Entry> getEntries(){ final Entry firstEntry = new Entry(); firstEntry.setAuthor("Me"); firstEntry.setMessage("Hello World"); firstEntry.setTitle("The first message here"); List<Entry> result = new ArrayList<>(); result.add(firstEntry); return result; }
If you restart the application and have a look at your browser again you will see, that now a list of JSON objects is returned instead of simple strings.
That is because SpringBoot transforms java objects to their json representation out of the box.
Before we implement the missing endpoint methods for adding new entries and delete existing ones, we first have to deal with the security settings of our application.
By now, every time we start the application a new password is generated for the user user. We will change this to have a static password for the user and permit all users, even anonymous ones, to see the entries and add new entries as well.
For the security configuration we will have a SecurityConfiguration class under de.consol.blog.graphqlspringboot.guestbook.configuration where we will add our user and password to an InMemory authentication scheme.
This should only be used in demo or test cases, because it is of course not secure at all
See the following listing:
package de.consol.blog.graphqlspringboot.guestbook.configuration; @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("user").password("secret").roles("OWNER"); } @Override public void configure(final HttpSecurity http) throws Exception { http.csrf().disable(); http.authorizeRequests().antMatchers("/", "/entry").permitAll(); super.configure(http); } }
As you can see, we will ignore our root endpoint, which is for listing the entries, as well as the (not yet existing) entry endpoint which is for adding new entries.
When you restart the application and give it a try, you will see that there is no login form anymore and you can see all the existing entries without giving a username or password.
Adding the possibility to add new entries is very simple and straight forward. All we have to do is to add a new method in our controller, add the annotation that this will be a PostMapping and implement the logic.
To do so, we will refactor the code written above to have a managed list to share between the getEntries-Method and the addEntry-Method.
To make the life easier on creating Entry-Instances, will add a few new methods in the Entry class as well:
... /** * Sets message */ public Entry message(final String message) { this.message = message; return this; } ... /** * Sets author */ public Entry author(final String author) { this.author = author; return this; } ... /** * Sets title */ public Entry title(final String title) { this.title = title; return this; }
Now with the above shown changes we are able to build our entry instances as shown in the following listing of the GuestbookController class:
package de.consol.blog.graphqlspringboot.guestbook.rest; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import de.consol.blog.graphqlspringboot.guestbook.model.Entry; @RestController public class GuestbookController { private static List<Entry> result = new ArrayList<>(); static { final Entry firstEntry = new Entry().author("Me").title("Hello World").message("This is the first message here"); result.add(firstEntry); } @GetMapping() public List<Entry> getEntries() { return result; } @PostMapping(path = "/entry") public void addEntry(@RequestBody final Entry newEntry, HttpServletResponse response) { if (result != null && doesNotContainEntry(newEntry)) { result.add(newEntry); } else{ response.setStatus(HttpStatus.NOT_ACCEPTABLE.value()); } } private boolean doesNotContainEntry(final Entry newEntry) { return result.stream().filter(entry -> entry.getTitle().equals(newEntry.getTitle())).count() == 0; } }
You can see that we share the result list globally in the controller. Furthermore you see the implementation of the addEntry method. Other than the getEntries method, this one is annotated with @PostMapping because this will be a post request sending us the data for a new entry.
The method checks if the given entry is null or if an entry with the same title already exists.
If one of this is true, the client will get an 406 error response which says that the given entity is not applicable. Otherwise the entry will be added to the list and the client will get 200 indicating that the operation was successful.
Last but not least we will implement the missing method to delete an entry by its title. If we would use a database to store our guestbook entries we would of course use the primary key of the entry to find the right one.
But as we only have an in memory list, the title is sufficient enough for our demo purpose.
So all we have to do is to create a new method in our controller, which gets the title of the entry to be deleted. Then lookup the entry in the list and delete if it exists, otherwise return a http 404 to the client.
Let’s have a look in the code:
@DeleteMapping(path = "/deleteMessage/{title}") public void deleteEntry(@PathVariable("title")final String title, HttpServletResponse response){ Entry found = findEntryByTitle(title); if(found != null){ result.remove(found); }else{ response.setStatus(HttpStatus.NOT_FOUND.value()); } } private boolean doesNotContainEntry(final Entry newEntry) { return result.stream().filter(entry -> entry.getTitle().equals(newEntry.getTitle())).count() == 0; }
As you can see, we use another mapping method, the @DeleteMapping. This is because we want to get a request with the HTTP Delete method. Furthermore we use a PathVariable for giving us the title of the entry to be deleted.
Give it a try in your REST tool of choice and use DELETE as your request method. You will notice when you try to call the deleteMessage endpoint, that you have to pass the user and password which we set up in the security configuration above. Otherwise the application will return a 401 indicating that you are not authorized to call this endpoint.
## Summary
In this post we have created a REST WebService on SpringBoot which can list and add guestbook entries, as well as delete a single one by giving the title. To secure the service we used SpringSecurity, one of the many components available for SpringBoot.
In the next episode we will convert this service to use GraphQL.
|
https://labs.consol.de/development/2019/09/26/graphql_spring_boot_restservice.html
|
CC-MAIN-2020-40
|
refinedweb
| 2,072
| 55.84
|
I’ve a code snippet below which gets the dataclass variables (keys) with "_dg" prefix, then gets the attribute of each key according to declaration order and appends them into a list. At the end this will be merged into a single element and returned as a string.
def create_decrypted_EFSOD(self) -> str: _ = [] try: for attr in list(self.__dict__.keys()): if attr.startswith("_dg"): _.append(self.__getattribute__(attr)) return "".join(_) finally: del _
Where my dataclass is declared as:
@dataclass class PassiveAuthenticator: """ Passive Authentication of eMRTD Documents for Inspection Systems (IFD's). Protects against IC forging. Refers to "Doc. 9303, Machine Readable Travel Documents, Part 11 - Security Mechanisms for MRTDS" by ICAO, 2021, Section 6.1 and Appendix G for more details about security protocols. """ _dg1: str _dg2: str _dg3: str . .
I know the
_ variable always refers to last returned value, that is why I used it to avoid creating unnecessary variable, but creating a temporary variable still bothers me. What is the best practice for this situation?
Also, does deleting
_ variable mean anything since it’ll be redeclared again? Since I’m a C++ dev it’s a habit to deallocate.
>Solution :
To repeat what was already said in the comments:
- no,
_does not refer to the last returned variable
- no,
_is not a good name for the variable, it should be used on variables that are unused but your variable is used
- no, python has automatic GC and you do not need to explicitly
del _.
Therefore your code should simply be
def create_decrypted_EFSOD(self) -> str: matching_attributes = [] for attr in list(self.__dict__.keys()): if attr.startswith("_dg"): matching_attributes.append(self.__getattribute__(attr)) return "".join(matching_attributes)
or simplified using a list comprehension
def create_decrypted_EFSOD(self) -> str: return "".join(value for attr, value in self.__dict__.items() if attr.startswith("_dg"))
|
https://devsolus.com/2022/06/24/what-is-the-best-practice-to-do-with-temporary-unused-list/
|
CC-MAIN-2022-27
|
refinedweb
| 307
| 57.57
|
Hi all
I have a general question that come up few weeks ago when writing an AVL data structure in java.
first a little bit background to help me explain the situation.
list of classes :
public class BinaryNode
public class BinaryTree
public class BinarySearchNode extends BinaryNode
public class BinarySearchTree extends BinaryTree
public class AVLSearchNode extends BinarySearchNode
public class AVLSearchTree extends BinarySearchTree
I wrote a recursive code for the method "protected BinaryNode insert(MyObject toAdd)" in the BinarySearchNode (BSN) class (it's doing a regular BSN insert).
I used this kind of recursive calls in it : this.getLeft().insert(toAdd); this.getRight().insert(toAdd);
when writing the method "protected BinaryNode insert(MyObject toAdd)" in the AVLSearchNode (ASN) class, I followed this algorithm:
first I did a regular BSN insert : BinaryNode tmp = super.insert(toAdd);
then I rotated the tree if balance was needed.
now for my question :
I notice that each recursion call in the "BSN insert" is first going to the "ASN insert" then back to "BSN insert", also in the folding back it's run on both inserts.
I wanted it to stay only in the BSN insert in runtime, finish doing it then proceeds to the ASN insert,I did try the following in the BSN insert:
I was trying casting to BSN, I was trying used a temporary BSN variable for the recursive calls, but no good, when coming from the child back to the father he always consider "this" as AVL type.
so how do I make it stay in the BSN insert finish it then proceeds to the ASN insert?
* I'm probably missing something, as I'm only beginner in Object oriented programming, hope I had success in explaining myself.
* the code worked in the end, it's just looks weird to me, I thought about the case I had "n" children's and I call a super recursive method from the first class (meaning from the oldest father), if the recursive call will go throw all the children's in the way? (sounds to me a little bit crooked)
Nivg
Jack of Clubs
Posts: 5
Joined: Tue Apr 13, 2010 6:26 am
|
http://mathhelpforum.com/advanced-math-topics/142886-object-oriented-trees-question.html
|
CC-MAIN-2017-26
|
refinedweb
| 360
| 51.11
|
This problem was solved and this is a stupid question.
But I leave my topic here hope this can helps some one.
Quote:
hi everyone, im new to programming. I only do web programming before.;
i tried to compile those line of codes with gcc on my CentOS 5 server:
It gave errors.It gave errors.Code:
#include <iostream>
using namespace std;
int main()
{
cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
cin.get();
}
I googled it and people said i should use g++ instead of gcc; Yeah that would be fine but WHY ?
On this site GCC, the GNU Compiler Collection - GNU Project - Free Software Foundation (FSF) they said gcc can compile c++ as well, why i cannot use it?
Please somebody let me know why, i will appreciate so much. I hate doing things that i dont know why. I will not use g++ to compile my *.cpp until i know why. Thank you.
|
https://cboard.cprogramming.com/cplusplus-programming/129386-why-gcc-cant-compile-cplusplus-printable-thread.html
|
CC-MAIN-2017-30
|
refinedweb
| 159
| 85.79
|
Ramazan Kartal wrote:
> Now, my question is how can we make the wcslen a
> builtin function? I simply need a function when given
> a static const wide character string, will return the
> length of the string at compile time.
>
>
Minus typos from replying half asleep already:
#define STRLEN_CONST(STR) \
(sizeof (STR) / sizeof ((STR)[0]) - 1)
or:
#define STRLEN_CONST(STR) \
((STR) ? (sizeof (STR) / sizeof ((STR)[0]) - 1) : 0)
Is you want NULL to have 0 length.
Works for char[] or for wchar_t[], const arrays, or literals.
Cheers,
Pedro Alves
Hi all,
I have the following "sample.cpp":
#include <stdio.h>
#include <string.h>
int main()
{
printf("length of string is %i\n", strlen("this is
a test"));
printf("length of wide character string is %i\n",
wcslen(L"this is a test"));
}
I compile it with following command line:
gcc -O3 -S -c sample.cpp
I get a "sample.s"(irrelevant parts has been cut)
1. movl $LC0, (%esp)
2. movl $14, %eax
3. movl %eax, 4(%esp)
5. call _printf
6. movl $LC1, (%esp)
7. call _wcslen
8. movl %eax, 4(%esp)
9. movl $LC2, (%esp)
10. call _printf
You can easily see that compiler did not emit a call
to strlen (line 2), but did emit a call to wcslen
(line 7). I guess this is because strlen is a builtin
function and compiler knows how strlen works and in
this particular case strlen gets a static const char
string, so it can calculate the length of the string
at compile time. But wcslen is not a built in function
so it should emit code to call wcslen.
Now, my question is how can we make the wcslen a
builtin function? I simply need a function when given
a static const wide character string, will return the
length of the string at compile time.
I am asking this in this list because I am using Mingw
/Windows XP and plan to use GCC/Linux, so the solution
should be workable on these two platforms.
Any help will be appreciated,
Regards,
Ramazan Kartal
____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
thanks. Love the win32 port of gtk btw!
On Thu, Mar 08, 2007 at 03:40:45AM +0200, Tor Lillqvist wrote:
>
looks like pfm (pure friggin magic) to me, but how does it work?
I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details
|
https://sourceforge.net/p/mingw/mailman/mingw-users/?viewmonth=200703&viewday=8
|
CC-MAIN-2017-13
|
refinedweb
| 436
| 84.17
|
Code. Collaborate. Organize.
No Limits. Try it Today.
This avoid spaces in the folder name just to take out any headaches.)
You will then want to open a shell (if you are on Windows, open the Start menu and go to "Programs->Mono 1.x.x->Mono Command Prompt" and will set up your paths so you don't have to do anything extra). You will want to cd to that directory we just created. We are going to be using this window a lot so leave it running in the background.
Now go ahead, open up your favorite editor (MonoDevelop, vi, Emacs, Notepad, etc.)
Some of you that have used the CSC compiler on Windows may notice the "-pkg:" as a little odd. This doesn't exist in CSC because Mono comes from the world of Linux. What that does is lookup for a package config file under that name. In the package config folder exists a file
using System;
using Gtk;
public class GtkHelloWorld {
public static void Main() {
Application.Init();
//Create the Window
Window myWin = new Window("My first GTK# Application! ");
myWin.Resize(200,200);
//Create a label and put some text in it.
Label myLabel = new Label();
myLabel.Text = "Hello World!!!!";
//Add the label to the form
myWin.Add(myLabel);
//Show Everything
myWin.ShowAll();
Application.Run();
}
}
Now just compile like we did before and run it using 'mono HelloWorld.exe' and you should get something like this:?" Well, we have other widgets that have the ability to contain multiple widgets at the same time. Some of those widgets will inherit from a Gtk.Box container widget or from the container widget directly in some cases. A Bin container widget inherits form the container widget directly as well, just like all other widget containers, but a Bin can only contain one control. similar to Application.Run() in many ways. Normally, when the application gets done processing any code on its main thread, the application will stop. Since ShowAll() doesn't block, the code would continue on and shut down. The Application.Init() command tells the runtime to listen for any Gtk.Windows launched, and when you run the Run command, it starts Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
http://www.codeproject.com/Articles/10021/GTK-Beginners-Guide?msg=1946382
|
CC-MAIN-2014-23
|
refinedweb
| 386
| 67.45
|
strlen() prototype
size_t strlen( const char* str );
The strlen() takes a null terminated byte string str as its argument and returns its length. The length does not include the null character. If there is no null character in the string, the behaviour of the function is undefined.
It is defined in <cstring> header file.
strlen() Parameters
str: Pointer to the null terminated byte string whose length is to be calculated.
strlen() Return value
The strlen() function returns the length of the null terminated byte string.
Example: How strlen() function works
#include <cstring> #include <iostream> using namespace std; int main() { char str1[] = "This a string"; char str2[] = "This is another string"; int len1 = strlen(str1); int len2 = str = 13 Length of str2 = 22 str2 is longer than str1
|
https://www.programiz.com/cpp-programming/library-function/cstring/strlen
|
CC-MAIN-2020-16
|
refinedweb
| 127
| 70.13
|
On Sun, 2 Oct 2005, Rajat Das wrote:
Hi, This is what I tried. I installed ncurses with the following configuration ./configure --with-shared --without-normal --without-debug --with-trace --enable-widec I then tried the following test program.
#include <locale.h>
#include <ncurses.h> int main() { WINDOW * win;
setlocale(LC_ALL, "");
initscr(); win = newwin(10,10,10,10); box(win,0,0); wrefresh(win); endwin(); } I did not use the _XOPEN_SOURCE_EXTENDED definition as I was not sure where exactly to define it. I compiled the program thus: gcc box.c -lncursesw I ran the program from a linux console. I got no output at all ie. no box on the screen. I then recompiled with the regular library thus:
With the changes noted above (and if $TERM is "linux"), you should see lines.With the changes noted above (and if $TERM is "linux"), you should see lines.
gcc box.c -lncurses This time I got a box with dashed lines(with + and - characters), something like +----+ | | +----+ "Faith is the bird that sings when the dawn is still dark." - Tagore
-- Thomas E. Dickey
|
https://lists.gnu.org/archive/html/bug-ncurses/2005-10/msg00015.html
|
CC-MAIN-2016-07
|
refinedweb
| 181
| 75.81
|
Java util date
Java util date
The class Date in "java.util" package represents... to
string and string to date.
Read more at:
http:/
Java I/O - Java Beginners
Creating Directory Java I/O Hi, I wanted to know how to create a directory in Java I/O? Hi, Creating directory with the help of Java Program is not that difficult, go through the given link for Java Example Codehttp - Java Beginners
java i/o thnx alot sir that this code helped me much in my program... so that i could write it line by line such as-
Hello Java in roseindia
Hello... visit the following link:
Thanks
Associate a value with an object
with an object in Java util.
Here, you
will know how to associate the value... of the several extentions
to the java programming language i.e. the "...;}
}
Download this example
STACK&QUEUE - Java Interview Questions
://
Hope that it will be helpful for you...STACK&QUEUE Hi.. I Want Stack & Queue Programs?i want source code... visit the following links:
freemarker example - Java Beginners
freemarker example hi,
i am new to freemarker. please send me an example for freemarker. i want to get the values from java and display those values in the page designed using freemarker(how to get the values from java
Java hasNext
Java hasNext()
This tutorial discusses how to use the hasNext() method... Iterator. We are going to use
hasNext()
method of interface Iterator
in Java... through the following java program. True is return by this method in case
Java i/o
Java i/o How can you improve Java I/O performance I/O Examples
;
What is Java I/O?
The Java I/O means...
In this section we will discussed about How files can be handled in Java.
Java I/O Byte Streams
In this section we will discussed the I/O Byte Streams.
Java
Java File Management Example
Hi,
I Java there is api in the java.io package for managing the text... of file.
Read the example Read file in Java for more information on reading...Java File Management Example Hi,
Is there any ready made API
Sample Code For ArrayLlist - Java Beginners
about ArrayList.
Java FileInputStream Example
FileInputStream
Java has Two types of streams- Byte & Characters. For reading... to note
here, the value -1 is an int not a byte value.
Given below example will give you a clear idea :
Example :
The content in the Devfile.txt
Java Comparator Example
Java Comparator Example Can you provide me an example of Comparator... is an example that compares the object of class Person by age.
import java.util.... of person before sorting is");
for(int i=0; i < person.length; i
Synchronized with example - Java Beginners
Synchronized with example Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thread tries to access a particular resource we can lock the method using synchronized keyword. Then after
Java Example Update Method - Java Beginners
Java Example Update Method I wants simple java example for overriding update method in applet .
please give me that example
Hi ..I am Sakthi.. - Java Beginners
://
Thanks...Hi ..I am Sakthi.. can u tell me Some of the packages n Sub... that is available in java and also starts with javax. package
HEMAL RAJYAGURU
Java Comparable Example
Java Comparable Example I want to know the use of Comparable Interface. Please provide me one example
Comparable interface is used....
Here is an example that compares two ages using Comparable Interface.
import
Where can I learn Java Programming
question which is "Where can I learn Java Programming?". We
have... have to search more for "Where can I learn Java
Programming?", just...Learning Java is one of the tough task for beginners. It requires efforts
Java ArrayList Example
Java ArrayList Example How can we use array list in java program...:"+array.size());
for(int i=0;i<array.size();i++){
System.out.println("ArrayList Element"+i+" :"+array.get(i
example explanation - Java Beginners
example explanation can i have some explanation regarding the program given as serialization xample.... Hi friend,
import java.io..../java
Getting Previous, Current and Next Day Date
current and next date in java. The java util package provides...;+ nextDate);
}
}
Download this example.
Output...
C:\vinod\Math_package>java GetPreviousAndNextDate
array example - Java Beginners
i cannot solve this example... i = 0; i < dependents.length; i++) {
temp.append(dependents[i].getFirstName());
temp.append(" ");
temp.append(dependents[i].getLastName());
temp.append
Java Example Codes and Tutorials
Java Tutorials - Java Example Codes and Tutorials
Java is great programming... to
programming section.
Section I - Introduction to Java...;
Java Break
Example
Java I/O problem
Java I/O problem
Write a Java application that prompts the user to input their Name, Address, Date of Birth and Student ID number using the standard input - this information should then be saved to a file named studentData
Java FTP file upload example
Java FTP file upload example Where I can find Java FTP file upload example? What is the link of the FTP examples on your website?
Thanks
... Programming in Java tutorials with example code.
Thanks
StringReverse Example - Java Beginners
StringReverse Example I have been asked to add three additional functions from the string library to the following code. I'm really having a difficult time do so.
public class StringReverseExample
{
public static void
I wonder - Java Beginners
I wonder Write two separate Java?s class definition where the first one is a class Health Convertor which has at least four main members:
i. Attribute weight
ii. Attribute height
iii. A method to determine number
java - Java Interview Questions
more information to visit.......
hash map is not synchronized and
hash table is synchronized
but i want an explanation with simple real time example
Hi friend,
Some points
Inheritance Example In Java
Inheritance Example In Java
In this section we will read about the Inheritance...
Here I am giving a simple example which will demonstrate you about how to use
Java 8 consumer class(interface) example
How to use the Java 8 consumer class(interface)?
In this example program I will show you how you can use the consumer
interface of the Java 8 to iterate...("Value is:"+t);
}
}
Read more tutorials and example of Java 8
java - Java Beginners
java write a programme to to implement queues using list interface Hi Friend,
Please visit the following link:
Thankslet
://
Thanks...java what is the use of java.utl Hi Friend,
The java
Which java can i download?
Which java can i download? Hello,
i'm a beginner on java.
Which java can i download for to exercise with my codes?
Thanks in advance.
nobody.
And i download Eclipse java. But when i want to install
First Java Program Example
;. To demonstrate about a Java
program I am giving a simple example.
Example
Here... your first program in Java. In this example I have created a simple class
named...First Java Program Example
In this section we will discuss about the first
i/o
i/o
Write a Java program to do the following:
a. Write into file the following information regarding the marks for 10 students in a test
i. Matric no
ii. Marks for question 1
iii. Marks for question 2
iv. Marks
SortedMap (interface) example in java Collection Framework
SortedMap (interface) example in java Collection Framework
In this example I will show you how you can use SortedMap interface in your Java
application
stack and queue - Java Beginners
://
Hope...stack and queue write two different program in java
1.) stack
2
Java Client Application example
Java Client Application example Java Client Application example
Java Wrapper Class Example
Java Wrapper Class Example
In this section we will read about how to use...)
Example
Here I am giving a simple example which will demonstrate you about how to use
the wrapper classes in Java. In this example we will create
ajax example
example
Ajax example Hi,
Where can I find Ajax example...,
I am looking for ajax post example.
Thanks
Hi,
You can... ajax get example
jQuery ajax get example Hi,
How I can use jQuery
conert java code to jsp... plz imm i wan...
conert java code to jsp... plz imm i wan... how to convert this java code into jsp??
Java| Frameworks| Databases| Technology| Development| Build...
iPhone Baby Names Application
Currency Format Example
This Example shows you how
file i/o - Java Beginners
file i/o hiii,
i have to read some integers from a text file and store them in link list..
so please can i have source code for it.??
thanks
i have an ques. of advanced java
i have an ques. of advanced java write a wap to implement AWT by login form
Java - Java Interview Questions
://
Thank you for posting
This is what i need - Java Beginners
This is what i need Implement a standalone procedure to read in a file containing words and white space and produce a compressed version of the file....
for this question i need just :
one function can read string like (I like
Example of HashMap class in java
Example of HashMap class in java.
The HashMap is a class in java collection framwork. It stores values in the
form of key/value pair. It is not synchronized
Java Stack Example
Java Stack Example
In this section we will read about how you can provide...
the stack collection in the Java programming. In this example you will see how... Java class where I will import the necessary package java.util.Stack
Example of HashSet class in java
Example of HashSet class in java.
In this part of tutorial, we... unique. You can not store duplicate value.
Java hashset example.
How....
Example of Hashset iterator method in java.
Example of Hashset size() method
java
java Sir,I have been assigned a task where i need to insert values in two tables using hibernate and jsf.The first table is staffing table where i need to insert serial No and other details of an employee.At the same time i need
java - Java Beginners
information on Stack or Heap Visit to :
Thanks
http... at any time.
Example of Stack :
import java.io.*;
import java.util.
Java Iterator with Example
hasNext() and next().
Java Iterator Example
import java.util....) {
List list=new ArrayList();
for (int i = 0; i <5 ; i++) {
list.add(new Random().nextInt(10));
}
Iterator i
java program example - Java Beginners
java program example can we create java program without static and main?can u plzz explain with an example
Java Word Occurrence Example
Java Word Occurrence Example
In this example we will discuss about the how... separated by a single white space. In this
example I have used the java.io and java.util packages.
Example
Here I am giving a simple example which
I need an example of sessionfactory
I need an example of sessionfactory Hi,
I need an example of session factory in hibernate. If you can provide me one with, that would be great...Thanks
Java FTP Client Example
Java FTP Client Example How to write Java FTP Client Example code?
Thanks
Hi,
Here is the example code of simple FTP client in Java which downloads image from server FTP Download file example.
Thanks
Java JdbcRowSet Example
Java JdbcRowSet Example
In this section we will see an example of JdbcRowSet... the
ResultSet object.
Example
Here I am going to give a simple example which demonstrates how JdbcRowSet
can be used. In this example I have created a class where I
Java Syntax - Java Beginners
to : Syntax Hi!
I need a bit of help on this...
Can anyone tell me why i get an error [List cannot be resolved to a type] when i try to do
OOPS Concept Abstraction with example - Java Beginners
OOPS Concept Abstraction with example I am new to java. In java...).
For example, the Java Collections Framework defines the
abstraction called... it with one example Hi Friend,
The process of abstraction in Java is used
|
http://www.roseindia.net/tutorialhelp/comment/45517
|
CC-MAIN-2014-52
|
refinedweb
| 2,003
| 58.08
|
Gpy + Pysense - urequests AttributeError: 'module' object has no attribute 'get'
- madeira199 last edited by seb
Hi
I am trying to make an HTTP get request for testing but have getting this message:
urequests.py library downloaded from
Please give me some help, i am started with Pycom...
Network found!
WLAN connection succeeded!
RTC Set from NTP to UTC: (2018, 2, 28, 14, 23, 38, 97276, None)
Traceback (most recent call last):
File "main.py", line 11, in <module>
AttributeError: 'module' object has no attribute 'get'
MicroPython v1.8.6-849-055728a on 2018-02-13; GPy with ESP32
Type "help()" for more information.
# boot.py import machine from network import WLAN wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() for net in nets: if net.ssid == 'REMOVED': print('Network found!') wlan.connect(net.ssid, auth=(net.sec, 'REMOVED.'), timeout=5000) while not wlan.isconnected(): machine.idle() # save power while waiting print('WLAN connection succeeded!')
# main.py import urequests as requests import utime from machine import RTC rtc = machine.RTC() rtc.ntp_sync("pool.ntp.org") utime.sleep_ms(750) print('\nRTC Set from NTP to UTC:', rtc.now()) r = requests.get('') print(r) print(r.content) print(r.text) print(r.content) print(r.json()) r.close()
Ah there seems to have been an issue syncing the library because the output should be:
>>> import urequests as requests >>> print(dir(requests)) ['put', 'post', 'usocket', 'patch', 'request', '__file__', '__name__', 'delete', 'head', 'Response', 'get'] >>> print(type(requests)) <class 'module'>
Can you please run the following to clear your device and sync again:
import os os.mkfs('/flash')
In the REPL console can you please run the following:
import urequests as requests print(dir(requests)) print(type(requests))
@seb Yes i have the latest firmware, updated yesterday, Gpy, and Pysense
i have patch line 53, and the problem remains
- Are you on the latest firmware?
- Are you sure you have correctly downloaded the urequest.py file from the link you provided? When I attempted to run this code I could not replicate your error. I did however have to patch line 53 to be:
ai = usocket.getaddrinfo(host, port)
|
https://forum.pycom.io/topic/2740/gpy-pysense-urequests-attributeerror-module-object-has-no-attribute-get
|
CC-MAIN-2022-33
|
refinedweb
| 353
| 57.87
|
Name | Synopsis | Interface Level | Parameters | Description | Return Values | Context | Examples | See Also
#include <sys/varargs.h> #include <sys/ddi.h> #include <sys/sunddi.h> char *vsprintf(char *buf, const char *fmt, va_list ap);
Solaris DDI specific (Solaris DDI).
Pointer to a character string.
Pointer to a character string.
Pointer to a variable argument list.
vsprintf() builds a string in buf under the control of the format fmt. The format is a character string with either plain characters, which are simply copied into buf, or conversion specifications, each of which converts zero or more arguments, again copied into buf. The results are unpredictable if there are insufficient arguments for the format; excess arguments are simply ignored. It is the user's responsibility to ensure that enough storage is available for buf.
ap contains the list of arguments used by the conversion specifications in fmt. ap is a variable argument list and must be initialized by calling va_start(9F). va_end(9F) is used to clean up and must be called after each traversal of the list. Multiple traversals of the argument list, each bracketed by va_start(9F) and va_end(9F), are possible.
Each conversion specification conversion character is ignored.
A character indicating the type of conversion to be applied:
The integer argument is converted to signed decimal (d, D), unsigned octal (o, O), unsigned hexadecimal (x, X) or unsigned decimal (u), respectively, and copied. The letters abcdef are used for x conversion. The letters ABCDEF are used for X conversion.
The character value of the argument is copied.
This conversion uses two additional arguments. The first is an integer, and is converted according to the base specified in the second argument. The second argument is a character string in the form <base>[<arg> . . . ]. The base supplies the conversion base for the first argument as a binary value; \10 gives octal, \20 gives hexadecimal. Each subsequent <arg> is a sequence of characters, the first of which is the bit number to be tested, and subsequent characters, up to the next bit number or terminating null, supply the name of the bit.
A bit number is a binary-valued character in the range 1-32. For each bit set in the first argument, and named in the second argument, the bit names are copied, separated by commas, and bracketed by < and >. Thus, the following function call would generate reg=3<BitTwo,BitOne>\n in buf.
vsprintf(buf, "reg=%b\n", 3, "\10\2BitTwo\1BitOne")
The argument is taken to be a string (character pointer), and characters from the string are copied until a null character is encountered. If the character pointer is NULL on SPARC, the string <nullstring> is used in its place; on x86, it is undefined.
Copy a %; no argument is converted.
vsprintf() returns its first parameter, buf.
vsprintf() can be called from user, kernel, or interrupt context.
In this example, xxerror() accepts a pointer to a dev_info_t structure dip, an error level level, a format fmt, and a variable number of arguments. The routine uses vsprintf() to format the error message in buf. Note that va_start(9F) and va_end(9F) bracket the call to vsprintf(). instance, level, name, and buf are then passed to cmn_err(9F).
#include <sys/varargs.h> #include <sys/ddi.h> #include <sys/sunddi.h> #define MAX_MSG 256 void xxerror(dev_info_t *dip, int level, const char *fmt, . . . ) { va_list ap; int instance; char buf[MAX_MSG], *name; instance = ddi_get_instance(dip); name = ddi_binding_name(dip); /* format buf using fmt and arguments contained in ap */ va_start(ap, fmt); vsprintf(buf, fmt, ap); va_end(ap); /* pass formatted string to cmn_err(9F) */ cmn_err(level, "%s%d: %s", name, instance, buf); }
cmn_err(9F), ddi_binding_name(9F), ddi_get_instance(9F), va_arg(9F)
Name | Synopsis | Interface Level | Parameters | Description | Return Values | Context | Examples | See Also
|
http://docs.oracle.com/cd/E19082-01/819-2256/vsprintf-9f/index.html
|
CC-MAIN-2015-40
|
refinedweb
| 625
| 57.16
|
I have created a Lable template as attached .
When I do Mail merge from ASPOSE Word , I am sending a data of 21 records , it is printing only 20 records .
That means it is not printing the last record everytime.
Please guide us how to resolve this issue ,.
Check the Label template and Result docs as attached
Regards
Atul
I have created a Lable template as attached .
Alexey, Please take a look at this issue. Seems like Atul is having problems with Aspose.Words
Hi
<?xml:namespace prefix = o
Thanks for your request. The problem is in your template. There is one unnecessary NEXT field after the last record. You can just remove it. I attached the modified template.
Also, I think the example, provided in the following thread, could be useful for you.
Best regards.
|
https://forum.aspose.com/t/merging-one-less-label-in-the-label-template/81320
|
CC-MAIN-2022-27
|
refinedweb
| 136
| 77.94
|
I'm having trouble inserting a loop in this food ordering program to allow the user to keep choosing items until they enter "99" and receive the total cost of their order. Can anyone tell me which loop to use and where I should insert it? Thanks a whole lot!
-Will
The Code:
import java.util.Scanner; class Ticket { public static void main(String args[]) throws Exception { // First declare your constants final double BURGER = 1.99; final double FRIES = 1.69; final double COKE = 1.49; // Display the list of shows and prices to the user System.out.println("Menu:"); System.out.println("1. Burger $1.99"); System.out.println("2. Fries $1.69"); System.out.println("3. Coke $1.49"); System.out.println("99.(to complete order)"); // Prompt for and read in the number of the show System.out.print("Enter desired item: "); Scanner input = new Scanner(System.in); int orderNumber = input.nextInt(); // Prompt for and read in the number of tickets System.out.print("How many would you like?: "); input = new Scanner(System.in); int orderAmount = input.nextInt(); // Use a switch statement to determine what price to use double price = 0; { switch (orderNumber) { case 1: price = BURGER; break; case 2: price = FRIES; break; case 3: price = COKE; } } // Calculate and display the subtotal double subtotal = price * orderAmount; System.out.printf("Subtotal: $%.2f\n", subtotal); // Calculate and display the total double total = subtotal + (subtotal * .05); System.out.printf("Total: $%.2f\n", total); } }
This post has been edited by pbl: 04 March 2010 - 09:16 PM
Reason for edit:: Code tags added for a newbie
|
https://www.dreamincode.net/forums/topic/159685-adding-a-loop-to-a-program/
|
CC-MAIN-2018-26
|
refinedweb
| 264
| 59.19
|
react-native-image-layout
An easy and simple to use React Native component to render a custom masonry layout for remote images and displayed on a custom interactive image viewer. Includes animations and support for both iOS and Android.
Install
Type in the following to the command line to install the dependency.
$ npm install --save react-native-image-layout
or
$ yarn add react-native-image-layout
Usage Example
Add an
import to the top of the file. At minimal, declare the
ImageLayout component in the
render() method providing an array of data for the
images prop.
import ImageLayout from "react-native-image-layout"; //... render() { return ( <ImageLayout images={[ { uri: "" }, { // Version *2.0.0 update (or greater versions): // Does not require an id for each image // object, but is for good practice and // can be better for performance for API. id: "blpccx4cn", uri: "" }, { uri: "" }, { uri: "" }, { uri: "" }, { uri: "" }, ]} /> ); } //...
API
<ImageLayout /> component accepts the following props...
Props
Version *2.0.0 update (or greater versions): Props changes that may not be compatible with lower versions.
Scroll State and Events for Gallery
Built with
react-native-gallery-swiper.
onPageScroll: (event) => {}.
The event object carries the following data:
position: index of first page from the left that is currently visible.
offset: value from range [0,1) describing stage between page transitions.
fraction: means that (1 - x) fraction of the page at "position" index is visible, and x fraction of the next page is visible.
onPageScrollStateChanged: :
- Clone the Repo
- Install and Run
1. Clone the Repo
Clone
react-native-image-layout locally. In a terminal, run:
$ git clone react-native-image-layout
2. Install and Run
$ cd react-native-image-layout/example/
iOS - Mac - Install & Run
1. check out the code 2. npm install 3. npm run ios
Android - Mac - Install & Run
1. check out the code 2. npm install 3. emulator running in separate terminal 4. npm run android
|
https://reactnativeexample.com/a-custom-masonry-layout-for-remote-images-and-displayed/
|
CC-MAIN-2021-17
|
refinedweb
| 313
| 52.36
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.